A solution for direction of poliline

Discussion in 'AutoCAD' started by fazzini, Apr 14, 2004.

  1. fazzini

    fazzini Guest

    I find a simple solution for determinate the direction of a poliline (CW, CCW).
    Make an offset (1mm or another) positive, get the area of the original poly and the area of the offset poly. If the area of the offset obj is grether than area of original obj the direction is CCW else is CW. Is ok? Thx to Sante di Santo and sorry for my english.


    Public Function DirPolSante(Obj As AcadEntity) As String
    Dim OffsetObj As Variant
    Dim AreaObj As Double
    Dim AreaOffset As Double

    AreaObj = Obj.Area

    OffsetObj = Obj.Offset(1)
    AreaOffset = OffsetObj(0).Area
    OffsetObj(0).Delete

    If AreaOffset < AreaObj Then
    DirPolSante = "CW"
    Else
    DirPolSante = "CCW"
    End If

    End Function
     
    fazzini, Apr 14, 2004
    #1
  2. fazzini

    wivory Guest

    Cool! Thanks for publishing that fazzini (and Sante).

    I had to test it out because interestingly that is *not* the functionality implied in the Help! The Help says that a negative offset will create a "smaller" object that is "Distance less" which is obviously not the case for a clockwise polyline.

    Regards

    Wayne Ivory
    IT Analyst Programmer
    Wespine Industries Pty Ltd
     
    wivory, Apr 15, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.