gerardo2m Posted August 12, 2017 Share Posted August 12, 2017 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. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 12, 2017 Share Posted August 12, 2017 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) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 12, 2017 Share Posted August 12, 2017 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)))) Quote Link to comment Share on other sites More sharing options...
gerardo2m Posted August 13, 2017 Author Share Posted August 13, 2017 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. Quote Link to comment Share on other sites More sharing options...
SLW210 Posted August 14, 2017 Share Posted August 14, 2017 Please read the Code Posting Guidelines and edit your Code to be included in Code Tags.[NOPARSE] Your Code Here[/NOPARSE] = Your Code Here Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.