Results 1 to 4 of 4

Thread: LWPolyline group codes

  1. #1
    Member
    Join Date
    2001-08
    Posts
    2
    Login to Give a bone
    0

    Red face LWPolyline group codes

    I’ve created a monster! I wrote a routine that adds up Arc and Line lengths, and more recently added LWPolyline lengths without the bulges.
    AutoCAD seems to have no problem calculating LWPolyline lengths, but using the DXF Reference group codes, I can’t tell how to calculate and measure the length of the bulge arcs! The actual length isn’t saved as a group code, or is it?
    Attached Files Attached Files

  2. #2
    I could stop if I wanted to
    Join Date
    2003-12
    Location
    Pittsburgh, PA
    Posts
    355
    Login to Give a bone
    0

    Default Re: LWPolyline group codes

    returns the length of a polyline ( or line, arc, spline...) with or without bulges
    Code:
    (vl-load-com)
    (setq obj (vlax-ename->vla-object (car (entsel "Select entity: "))))
    (if (vlax-property-available-p obj 'Length)
      (setq len (vlax-get obj 'Length))
      (princ "Entity has no Length property")
      )

  3. #3
    Member
    Join Date
    2001-08
    Posts
    2
    Login to Give a bone
    0

    Smile Re: LWPolyline group codes

    Thanks!!! Mega-reps!

  4. #4
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: LWPolyline group codes

    vla-get-length is limited, but you can use the vlax-curve* to get the length of any curve.
    Here's a version that will allow you to take it from anything and you don't have to convert it to a vla-object.

    Code:
    (defun _length (ent)
      ((lambda (e)
         (if (not (vl-catch-all-error-p e))
           (vlax-curve-getDistAtParam ent e)
         )
       )
        (vl-catch-all-apply (function vlax-curve-getEndParam) (list ent))
      )
    )
    The error checking isn't required, it's just an example. I would never try an extract a property from something if it wasn't available (like trying to get the length of a block).
    This is really all you need and it works on enames and vla-objects.
    Code:
    (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent))

Similar Threads

  1. Reshape of LWPOLYLINE
    By srinivasarajug in forum AutoLISP
    Replies: 1
    Last Post: 2014-06-26, 06:31 PM
  2. Replies: 4
    Last Post: 2007-09-12, 09:03 PM
  3. lwpolyline bulge
    By pnorman in forum AutoLISP
    Replies: 3
    Last Post: 2005-05-17, 04:59 PM
  4. Replies: 7
    Last Post: 2005-03-16, 01:42 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
  •