Jump to content

To List multipolygon vertices


gisanalyst

Recommended Posts

Hi ,

 

is there any command to list the vertex of a multipolygon?

Cause, when I have a polygon I can use (entget (car (entsel))) and recover its vertex. But how could I do this in a multipolygon?

 

Thanks. :)

 

#Autocad Civil 3D 2015.

Edited by gisanalyst
Link to comment
Share on other sites

The vertex of the mpolygon (dxf code 10) appear to deltas relating to the origin (dxf code 11).

You can use the entget as you had stated to get the entity data. Then use assoc to retrieve the vertex deltas (dxf code 10) and the origin (dxf code 11).

 

I hope that this helps.

Link to comment
Share on other sites

The vertex of the mpolygon (dxf code 10) appear to deltas relating to the origin (dxf code 11).

You can use the entget as you had stated to get the entity data. Then use assoc to retrieve the vertex deltas (dxf code 10) and the origin (dxf code 11).

 

I hope that this helps.

 

yeah, I gotcha...

 

Tks 4 help.

Link to comment
Share on other sites

The quick search suggests multpolygons are in fact plines so can get at vertices pretty easy using VL which supports the property 'Coordinates so you retrieve all in one step. There is a few variations on this around. Lee-mac has a real nice one.

 

; pline co-ords example
; By Alan H
(defun getcoords (ent)
 (vlax-safearray->list
   (vlax-variant-value
     (vlax-get-property
   (vlax-ename->vla-object ent)
   "Coordinates"
     )
   )
 )
)

(defun co-ords2xy ()
; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
(setq len (length co-ords))
(setq numb (/ len 2)) ; even and odd check required
(setq I 0)
(repeat numb
(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) ))
(setq co-ordsxy (cons xy co-ordsxy)) ; this is a list of the vertices
(setq I (+ I 2))
)
)
; program starts here
(setq co-ords (getcoords (car (entsel "\nplease pick pline"))))
(co-ords2xy) ; list of 2d points making pline

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...