9 Replies Latest reply on Sep 23, 2015 7:47 PM by Sudha K

# Height of graphic line

Hi,

How to get height of Graphic Line when it is rotated??.. Usually we will find the height and width of the object using bounds...

When the object is rotated, how to get the height...

Sudha K

• ###### 1. Re: Height of graphic line

Hi Sudha,

This is involves getting the y values of the path points and subtracting the top position from the bottom position. Like so.

```myLine = app.activeDocument.graphicLines.add();
myPoint1 = myLine.paths.item(0).pathPoints.item(0).anchor;
myPoint2 = myLine.paths.item(0).pathPoints.item(1).anchor;
myLineHeight = myPoint2[1] - myPoint1[1];
\$.writeln(myLineHeight);

```

Just remember there are 2 values (x,y) in each path point so you must point to the one you want, we want the y value (vertical or height) so it is myPoint1[1]. For the x value (horizontal or width) it would be myPoint1[0].

Regards,

Brett

• ###### 2. Re: Height of graphic line

Hi,

When the Lines are straight line, it will return correct value.  When the lines are rotated will it return the correct value??

What I am thinking is,

1. Bring that Rotation angle to 0.

2. Find the length/height of the line.

Is it right? or  anyother way??

- Sudha K

• ###### 3. Re: Height of graphic line

Hi Sudha,

I think we need to define what height is. Can you please look at the image and let me know which one you are referring to?

My thinking was number 1 in the answer. Number 2 I would define as the length, while number 3 I would define as the thickness/weight.

Brett

• ###### 4. Re: Height of graphic line

Maybe I'm not understanding your question, but stroke weight returns the vertical dimension of a line irrespective of its rotation angle.

• ###### 5. Re: Height of graphic line

I need to get the length of the graphic line, when it is rotated.

I have placed the images in my question.  I understood wrongly, actually i need to get length of the graphic line.

• ###### 6. Re: Height of graphic line

Hi Sudha,

Try this.

```var myLine = app.activeDocument.graphicLines.item(0).paths.item(0).entirePath;
var a = myLine[0][0] - myLine[1][0];
var b = myLine[1][1] - myLine[0][1];
var c = Math.sqrt(a * a + b * b);
\$.writeln(c);
```

Brett

• ###### 8. Re: Height of graphic line

Thanks Vamitul, I didn't know about INNER_COORDINATES and how they work.

• ###### 9. Re: Height of graphic line

Thanks vamitul, i will check...  thank you....