2 Attachment(s)

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?

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?

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.

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.

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?