Jump to content

How do you extract the 3rd point coordinates of a polyline?


SIMPLYCRAZY

Recommended Posts

 

 

I have a 5 sided lwpolyline that I would like to extract the 3rd point xy & z coordinates to use with dtr function. I have a list with the 5 sets of coordinates, Im not even sure if the list really is correct. Manly will be using with the world coordinates system but may want the z value later. Im thinking I filter the list but unsure how?

Any help would be much appreciated.

 

(((130.87 75.334) (131.087 76.5975) (161.817 71.3145) (149.922 27.7314) (148.685 28.0689)))

 

(COMMAND "OFFSET" "L" "C" ROS VR99 VR4 "")
(SETQ VR98 (ENTLAST))
(COMMAND "ERASE" VR99 "")
(COMMAND "PEDIT" VR98 "JOIN" VR96 VR97 VR98 "" "")

 
(defun massoc ( key lst / rtn )
   (foreach x lst
       (if (= key (car x))
           (setq rtn (cons (cdr x) rtn))
       )
    )
    (reverse rtn)
)

 (IF (AND
            (setq dxf (entget VR98))
            (= "LWPOLYLINE" (cdr (assoc 0 dxf)))
        )
                    (SETQ 3RD (LIST (massoc 10 dxf)))
    )

 

Edited by SIMPLYCRAZY
Link to comment
Share on other sites

  • SIMPLYCRAZY changed the title to How do you extract the 3rd point coordinates of a polyline?

Your request is confusing, but the answer may be in the fact that whilst an object maybe a "LWPOLYLINE" or "PLOYLINE" it has a secondary property.

 

(setq ss3dpl  (ssget "X" (list (cons 0 "POLYLINE") )

 

You can then look at

(cdr (assoc  100 "AcDb3dPolyline")) 

or

(cdr (assoc  100 "AcDbPolyline"))

 

Using say vl get coordinates can work out has XY or XYZ list of points.

 

Need a dwg to work out what you want.

 

Link to comment
Share on other sites

LWPOLYLINE is a flat polyline, so you won't have a third coordinate for it and will only have a 2d point. What you're after is the elevation of the polyline that can be extracted from DXF code 38 from entget.

Link to comment
Share on other sites

Steven P no (10 188.0 62.0) for a plain pline. (38 . 12.0) which is elevation.

 

A quicky for you in my autoload.lsp, I use these all the time for a quick look at object

(defun c:ent ()(entget (car (entsel "Pick"))))

or use Dumpit.lsp 

 

(100 . "AcDb3dPolyline")  (10 0.0 0.0 0.0) get the vertex points.

Use VL get coordinates. z= 233 etc

Coordinates = (299493.688604032 1222965.59330423 233.721 299493.846604032 1222983.26930423 233.556 299493.916604032 1222989.04330423 233.542 299494.158604032 1222999.75930423 233.394 299494.923604032 1223015.36330423 233.192 299494.923425952 1223016.30612341 233.192 299494.868604032 1223016.74930423 233.191 299494.312604032 1223019.20230423 233.166 299494.396604032 1223024.37930423 233.085 299494.400604032 1223024.88130423 233.055 299495.208062272 1223037.39590885 232.937)

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...