Jump to content

Recommended Posts

Posted

hi guys,

 

How do I:

 

1) Select a mline and explode it.

2) "setq ent" the line which was picked to explode the mline.

3) "setq pt" using vlax-curve-getclosestpointto

4) All in one click of the mouse.

 

Sorry guys, I'm having trouble expressing myself in english (and also in lisp) so I just enumerated.

Thank you.

Posted
(defun c:test (/ TheLine Ent Npt)
 (vl-load-com)
 (setq theLine (entsel "\nSelect Mline: "))
 (command "_explode" theLine)
 (setq Npt (vlax-curve-getClosestPointTo
      (setq Ent
      (vlax-ename->vla-object (car (nentselp (cadr TheLine))))
      )
      (cadr TheLine)
    )
 )
 (vla-highlight Ent :vlax-true)
 (print Npt)
 (princ)
)

Posted
(vlax-ename->vla-object (car (nentselp (cadr TheLine))))

 

Be careful if other objects surround the MLine, it would be difficult to guarantee the correct entity will be selected using nentselp ;)

 

Maybe this old code will offer some ideas :)

Posted

 
(mapcar '(lambda ( x ) (ssadd x ss)) [color=blue][b](_Entnext el)[/b][/color])

 

 
(defun _Entnext ( e )
   (if (setq e (entnext e)) (cons e (_Entnext e)))
 )

 

Very nice, it works for blocks as well, it gave me an idea for a routine i'm working on regarding block layers

 

Cool Beans.

 

Thanks Lee.

Posted

Hope you dont mind if i "borrow" your _Entnext routine for a while till i write my own version

 

Again, Thank you my friend

 

:beer:

Posted
Hope you dont mind if i "borrow" your _Entnext routine for a while till i write my own version

 

Again, Thank you my friend

 

:beer:

 

Its only two lines of code... go ahead :)

 

I appreciate the courtesy of asking before taking.

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