Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to make alert for circle shape

Explorer ,
Jan 02, 2020 Jan 02, 2020

 i know how to get  kind of solid layer  

 

if(_layers[i].kind == LayerKind.SOLIDFILL){
  alert("rectangle");
}

 

but what`s the kind of ellipse (circle shape) i need to make it in alert and thanks for you

TOPICS
Actions and scripting
622
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 02, 2020 Jan 02, 2020

This script will test to see if the first anchor point is a corner or rounded, so it will tell if the shapes are possibly a rectangle or an ellipse.

#target photoshop
var doc = activeDocument;
var layPath = doc.pathItems[0].subPathItems[0];
$.writeln(layPath.pathPoints[0].anchor+'===='+layPath.pathPoints[0].leftDirection)

if((layPath.pathPoints[0].anchor[0]===layPath.pathPoints[0].leftDirection[0])&&(layPath.pathPoints[0].anchor[1]===layPath.pathPoints[0].leftDirection[1])){
    alert('Shape co
...
Translate
Adobe
Community Expert ,
Jan 02, 2020 Jan 02, 2020

Unless I am missing something, whether you are adding a solid fill layer or a shape via one of the shape tools, the layer kind is still a LayerKind.SOLIDFILL layer kind.

 

Perhaps there is a way to get live shape properties or to do complicated math based on vector path co-ordinates...

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2020 Jan 02, 2020

This script will test to see if the first anchor point is a corner or rounded, so it will tell if the shapes are possibly a rectangle or an ellipse.

#target photoshop
var doc = activeDocument;
var layPath = doc.pathItems[0].subPathItems[0];
$.writeln(layPath.pathPoints[0].anchor+'===='+layPath.pathPoints[0].leftDirection)

if((layPath.pathPoints[0].anchor[0]===layPath.pathPoints[0].leftDirection[0])&&(layPath.pathPoints[0].anchor[1]===layPath.pathPoints[0].leftDirection[1])){
    alert('Shape could be rectangle')
    }
else{alert('Shape could be an ellipse')}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2020 Jan 02, 2020

Also  if the layer bounds does not have a 1:1 Aspect ratio the layers is not a square or a circle.

 

 

I also do not know if all solid fill layers are Shape Layers or that all Shape layers are solid fill layers for shapes can have no fill, a gradient fill and a pattern fill as well.

 

I also do not know Action manager code and when you get layer descriptions using Action manager code the code seems to have a different  layerKind  list than DOM LayerKind.  Its list seem to be like the Layers Palette Kind Filter (Pixel, Adjustment, Text, Shape and Smart Object)  + three fill type (Colorfill, Patternfill and Gradientfill) I had map Action Manager layerKind integers different the DOM LayerKind integers.

Capture.jpg

 

 

JJMack
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 02, 2020 Jan 02, 2020
LATEST

working done.. you are great man

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines