Jump to content

Select one line of a Polyline


guitarguy1685

Recommended Posts

I want to create a lisp for drawing shear wall lines. I was thinking of creating a line based on xy points from one line of a polyline.

 

My problem is I can't figure out how to get the infro from a specific line. when I select a polyline and use getent I see all the points but I don't know which is which. They all have the ASSOC number of 10. how can I get the info of the line my pick box is on?

Link to comment
Share on other sites

The easiest way is to use the vlax-curve-* functions, here is a verbose example:

 

(defun c:test ( / select entity point param )
 (if
   (and
     (setq select (entsel))
     (eq "LWPOLYLINE" (cdr (assoc 0 (entget (setq entity (car select))))))
   )
   (progn
     (setq point  (vlax-curve-getclosestpointto entity (cadr select))
           param  (vlax-curve-getparamatpoint entity point)
           param  (fix param)
     )
     (list
       (vlax-curve-getpointatparam entity param)
       (vlax-curve-getpointatparam entity (1+ param))
     )
   )
 )
)

Link to comment
Share on other sites

Take a look about functions that start with vlax-curve-........ which are much easier than dealing with assoc 10 entity to gather the needed

coordinate points on a polyline in many situations .

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