Jump to content

SSNAMEX does not return the point on the selected object.


gerardo2m

Recommended Posts

Using the SSNAMEX instruction I get the name of the selected entity and a point, which according to the literature is the point at which the object was selected.

 

I would think that point (in my program is a line) should be collinear to the start and end point of the line, but it is not.

 

Capturing that point and using the same VIEWPOINT, the point appears collinear, but if you rotate the viewpoint while maintaining the same coordinate system, the point is outside the LINE object.

 

I appreciate any comments on the development of the solution.

SSNAMEX_01_Eng.jpg

SSNAMEX_02_Eng.jpg

Link to comment
Share on other sites

Using entsel and a osnap setting you will get a point on the line.

 

(entsel)
Select object: _mid of (<Entity name: 7ff75825c9b0> (484.727 273.7 0.0))

(cadr (entsel))
(484.727 273.7 0.0)

Link to comment
Share on other sites

Assuming you are referring to Pick selections only (i.e. Selection Method ID = 1)

 

  • If a single point is returned by ssnamex, e.g.:
    ((1 <Entity name: 7ffff706880> 0 (0 (20.961 16.4791 0.0))))

    This point corresponds to the center of the pickbox aperture, which will not necessary lie on the selected object. The distance of this point from the object will depend upon the size of the pickbox and the position of the selection relative to the center of the pickbox.

 

  • However, for Pick selections in which the view direction is not perpendicular to the WCS plane, the ssnamex function will return two points: a basepoint, and a vector defining an infinite line or ray whose direction is dependent on the view direction at the time of selection, e.g.:
    ((1 <Entity name: 7ffff706880> 0 (0 (24.4408 18.6307 -0.362457) (-0.497648 0.647014 -0.577684))))


Link to comment
Share on other sites

Thank you.

 

The situation was resolved by applying:

(Vlax-curve-getClosestPointToProjection curve-obj givenPnt normal [extend])

 

(setq selEnts (ssget "_+.:E" '((0 . "LINE"))))

 

(setq linea01Ger (ssname selEnts 0))

 

(setq ptoSeleccion01Ger

(vlax-curve-getClosestPointToProjection

linea01Ger

(nth 1 (nth 3 (nth 0 (ssnamex selEnts 0))))

'(0.0 0.0 1.0))

)

 

 

Sorry for the nth's, I'm still polishing it.

 

I will have to study a little more what Lee explains about the second point he describes.

 

Greetings.

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