CW or CCW

CW or CCW

Anonymous
Not applicable
1,405 Views
2 Replies
Message 1 of 3

CW or CCW

Anonymous
Not applicable
Can i get the orientation (CW or CCW) of a polyline.
My polyline don't have any radius? I cannot use the
get bulge method. THX to all.
0 Likes
1,406 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Here is a sub that I wrote that uses determinants of a matrix to get the direction by setting up columns of the x and y coordinates. It uses a collection of points but you should be able to modify it to work for you. Public Sub ccw() 'dimension locals Dim PolyPoints As New Collection Dim PolyCounter As Integer Dim numPoints As Long Dim Pnt() As Variant Dim Pnt1() As Variant Dim PointCounter As Long Dim top As Single Dim bottom As Single Dim Result As Single Dim SectionPolyCol As New Collection 'get a polygon point collection from a global collection of polygons Set SectionPolyCol = gSectionCol.Item(1) PolyCounter = 1 For Each PolyPoints In SectionPolyCol numPoints = PolyPoints.Count top = 0 bottom = 0 Result = 0 For PointCounter = 1 To numPoints - 1 Pnt = PolyPoints.Item(PointCounter) Pnt1 = PolyPoints.Item(PointCounter + 1) top = top - (Pnt(1) * Pnt1(0)) bottom = bottom + (Pnt(0) * Pnt1(1)) Next PointCounter Result = top + bottom If Result > 0 Then MsgBox "CounterClockwise" Else MsgBox "Clockwise" End If PolyCounter = PolyCounter + 1 Next PolyPoints End Sub Good Luck, Bill -- fazzini wrote: > Can i get the orientation (CW or CCW) of a polyline. > My polyline don't have any radius? I cannot use the > get bulge method. THX to all.
0 Likes
Message 3 of 3

Anonymous
Not applicable
See my previous post on clockwiseness of three points. You could supply 3 points from your polyline for this purpose.

http://discussion.autodesk.com/thread.jspa?messageID=377745

Regards

Wayne Ivory
IT Analyst Programmer
Wespine Industries Pty Ltd
0 Likes