Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Find Polygon Diagonals

  1. #11
    Active Member
    Join Date
    2007-06
    Posts
    97
    Login to Give a bone
    0

    Default Re: Find Polygon Diagonals

    Quote Originally Posted by MikeJarosz
    You might be able to guess from my posting that I don't quite get the translate coordinates method.

    I admit to also finding the complete understanding of that method quite elusive. In fact, the routine above contains an unneccessary step:

    varStPt = dblStPt
    varStPt = .Utility.TranslateCoordinates(varStPt, acOCS, acWorld, 0, varNormal)

    could be just:

    varStPt = .Utility.TranslateCoordinates(dblStPt, acOCS, acWorld, 0, varNormal)

    Likewise for the End Point.

    I could have sworn that step was required when I first wrote it. Oh well.

    For an even more complete understanding of the LWPoly and its properties, do a search for Arbitrary Axis Algorithm. Caution, it is some head banging stuff.

  2. #12
    AUGI Addict MikeJarosz's Avatar
    Join Date
    2015-10
    Location
    New York NY
    Posts
    1,497
    Login to Give a bone
    0

    Default Re: Find Polygon Diagonals

    I didn't want to knock Autodesk, but the way they have chosen to represent polylines does seem to be unneccessarily complex. In the past, I used another CAD system that had xyz coordinates as simple points in space. Period.

    I wonder if this is an example of maintaining backward compatibility to a data structure that never anticipated full 3D modeling.

    This poly diagonal task is an attempt to demonstrate to one of my colleagues that VBA (or VB.NET) is a better language for certain computational problems than lisp. The overall program is an energy analysis for high rise buildings. The lisp program my colleague wrote takes 3 hours to run. I ran your code on 31,000 polys and it took 14 seconds.

  3. #13
    Active Member
    Join Date
    2007-06
    Posts
    97
    Login to Give a bone
    0

    Smile Re: Find Polygon Diagonals

    Wow, that's quite surprising.

    I've heard that VBA was faster than Lisp but had never seen any proof. It would make sence in that all variable in Lisp seam to be a "Variant" type, thus requiring more processing than the more explicit variable in VBA. That issue alone wouldn't account for that time desparity, however.

    At the risk of angering your colleague, I have to assume his code could use a fair bit of optimization. If his routine employs (command "****") style of programming, it may be incurring a large time penalty with screen redraws and such. I'm sure the crew in the AutoLISP forum could provide more informed advice.

    With regard to the complexity of AutoCAD polylines: I think it was situations such as yours(31000 polylines) that prompted Autodesk to search for a method of storing information as efficiently as possible. I also suspect the hardship imposed on us VBAers while wrangling with such densely pack info was not one of their major concerns.

  4. #14
    AUGI Addict MikeJarosz's Avatar
    Join Date
    2015-10
    Location
    New York NY
    Posts
    1,497
    Login to Give a bone
    0

    Default Re: Find Polygon Diagonals

    Sean:

    I'm back from vacation and spending some time on your code.

    Quote Originally Posted by seant61
    intCode(0) = 0: varData(0) = "LWPOLYLINE"
    intCode(1) = -4: varData(1) = "&="
    intCode(2) = 70: varData(2) = 1
    intCode(3) = -4: varData(3) = "&"
    intCode(4) = 70: varData(4) = 129
    intCode(5) = 90: varData(5) = 4
    intCode(6) = -4: varData(6) = "<Not"
    intCode(7) = 67: varData(7) = 1
    intCode( = -4: varData( = "Not>"
    [/CODE]
    I'm trying to decipher this filter sequence. flag70=1 means closed polyline, flag 90=4 means four vertices and code 67 <> 1 means modelspace. I haven't been able to find any documentation on polyline flag code 70=129. This could mean 1+128, which would indicate bits 1 and 8 are set. But you've already tested bit 1. So I changed the 129 to 128 and the selection failed. The 129 seems to be necessary, but I can't figure out why!

    Anyone out there able to explain?

  5. #15
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Exclamation Re: Find Polygon Diagonals

    Quote Originally Posted by MikeJarosz
    I'm trying to decipher this filter sequence.The 129 seems to be necessary, but I can't figure out why!

    Anyone out there able to explain?
    129 means bits 1 and 128 are true. These are the only bitcodes in group 70 of an LWPOLYLINE.
    R.K. McSwain | CAD Panacea |

  6. #16
    AUGI Addict MikeJarosz's Avatar
    Join Date
    2015-10
    Location
    New York NY
    Posts
    1,497
    Login to Give a bone
    0

    Default Re: Find Polygon Diagonals

    So, my hunch was correct. Bit code 1 indicates open/closed but what does bit 8 indicate?

  7. #17
    Active Member
    Join Date
    2007-06
    Posts
    97
    Login to Give a bone
    0

    Default Re: Find Polygon Diagonals

    As Mr. McSwain said, it is to control how bitcodes 1 and 128 are processed.

    When you say 1 and 8, I presume you mean the bit indicator in the first and eighth position.

    The purpose of the settings such as they are is to select LWPolylines only if they are closed, but allow for poly's with Linetype generation (how linetypes behave at corners) either enabled or diabled.

    The "&" and "&=" bitwise operators for selection sets are quite useful, yet another thing difficult to wrap one's head around.

  8. #18
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Exclamation Re: Find Polygon Diagonals

    What seant61 said...

    Also, this is all documented in the Developers Help (acad_dev.chm)
    R.K. McSwain | CAD Panacea |

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Polygon center
    By Wish List System in forum ACA Wish List
    Replies: 2
    Last Post: 2014-07-02, 03:48 AM
  2. Truss diagonals keep moving
    By jeffcook21 in forum Revit Structure - General
    Replies: 0
    Last Post: 2008-10-23, 10:02 PM
  3. Stretch a Polygon/Maintain the Original Area of Polygon
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2007-08-02, 04:39 PM
  4. Parametric Polygon?
    By sbrown in forum Revit Architecture - General
    Replies: 5
    Last Post: 2005-11-16, 02:48 PM
  5. Polygon Callout
    By thalim in forum Revit Architecture - General
    Replies: 1
    Last Post: 2004-10-12, 05:59 PM

Posting Permissions

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