    # Thread: TEST FOR HORIZONTAL OR VERTICAL LINE

1. Login to Give a bone

## TEST FOR HORIZONTAL OR VERTICAL LINE

I am really struggling with this. I am trying to determine if a line is horizontal or vertical. I am simply checking to see what the angle of the line is by checking it angle property line.angle. In the following two screen shots you can see that the line in question has an angle of zero when I look at its properties but is returning a strange angle when I query it using vb.net. Am I missing something here?  Reply With Quote

2. Login to Give a bone

## Re: TEST FOR HORIZONTAL OR VERTICAL LINE

What was wrong with the previous answer I gave you? How are you calculating the angle? Do you realize that AutoCAD api's use radians?  Reply With Quote

3. Login to Give a bone

## Re: TEST FOR HORIZONTAL OR VERTICAL LINE

I am simply looking to see if the start x is equal to end x or start y is equal to end y and if start x is equal to end x the line should be horizontal. If start y is equal to end y the line should be vertical. But as you can see from the screen shots I sent this is not the case. The second screen shot was using the code you gave me.  Reply With Quote

4. Login to Give a bone

## Re: TEST FOR HORIZONTAL OR VERTICAL LINE

Have you calculated how big the angle of 2.67346707152487E-15 (in RAD) is in degree? I did not calculate, but it is something like 0.00000000...xxx degree. Do you think it is not horizontal enough? The reason the angle is not exactly 0.0000 is probably because the 2 Y coordinates are not exactly 90.5177 (i.e. one is like 90.5177000002, the other could be 90.5177000003). To these Double type of numbers, you need to round them up to given precision to make them make sense. In your case, yes, the line is horizontal enough.  Reply With Quote

5. Login to Give a bone

## Re: TEST FOR HORIZONTAL OR VERTICAL LINE

So your telling me that if I draw a line and constrain it to be horizontal it might still not be completely horizontal?  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•