Jump to content

Recommended Posts

Posted

Is it possible to extract the coordinate point where the selection was made from this code?''

 

(setq obj
        (vlax-ename->vla-object
          (car (entsel "\nSelect object: "))
        )
)

 

Posted (edited)

The selection point (specifically, the centre of the pickbox aperture) is the second element (cadr) of the list returned by entsel, therefore, you will need to change the code to something like this (obviously with additional testing to account for null input):

(setq sel (entsel)
      pnt (cadr sel)
      obj (vlax-ename->vla-object (car sel))
)

Note that since the point returned is the centre of the pickbox aperture, such point may not necessarily lie on the selected object; to solve this, you can use the vlax-curve-getclosestpointto function in conjunction with the entity & point returned in the entsel list in order to obtain a point on the selected object closest to the centre of the selection aperture, but this will only work for curve objects; for others, you can use the osnap function with the "_nea" mode.

Edited by Lee Mac
Posted

Thank you Lee!!

 

I found a routine very similar to your Double Offset command

 

http://www.lee-mac.com/doubleoffset.html

 

But the other routine caps the ends of the newly offset entities
creating a closed boundary which is what I needed.


Unfortunately some of their code is really hard for me to follow.
Not that I can follow many of yours either...

Autolisp? So-so. VLisp? Not really.

 

I was originally going to ask you if adding that functionality
to your routine would be too much to ask..

I need to hatch the interior of that new boundary which represents
a "line" that is being removed.That is why I was asking how
to locate that "interior" point. To use with my hatch command.

 

Thank you so much for your help.


I hope I can get my modification to work.


If not, I'll be back with more questions...

Posted
4 minutes ago, ILoveMadoka said:

But the other routine caps the ends of the newly offset entities
creating a closed boundary which is what I needed.

 

I was originally going to ask you if adding that functionality
to your routine would be too much to ask..

 

I need to hatch the interior of that new boundary which represents
a "line" that is being removed.That is why I was asking how
to locate that "interior" point. To use with my hatch command.

 

Something like this?

Posted

I'm sitting here laughing...

You are so friggin' AWESOME!!

 

Once again, MY HERO!!

 

 

Thank you Sir!

Posted

FWIW, another way:

 

(if (mapcar 'set '(ent pnt) (entsel)) 
  (setq obj (vlax-ename->vla-object ent))
)

 

  • Like 1
Posted
10 hours ago, ILoveMadoka said:

I'm sitting here laughing...

You are so friggin' AWESOME!!

 

Once again, MY HERO!!

 

 

Thank you Sir!

 

Thank you for your kind words - you're most welcome! :)

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