DuanJinHui Posted September 7, 2015 Share Posted September 7, 2015 Hello friends. (setq pt1 (cadr (entsel "\nPick the obj:"))) Above code can get point coordinates , is no pick anything will returns "nil" I want , if no pick anything still returns the Pick Points coordinates , like function (getpoint) . Any good idea ? Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 7, 2015 Share Posted September 7, 2015 A more descriptive thread title would help too. Quote Link to comment Share on other sites More sharing options...
DuanJinHui Posted September 7, 2015 Author Share Posted September 7, 2015 A more descriptive thread title would help too. Thanks ReMark , But I don't know how describe it . I'm sorry. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 7, 2015 Share Posted September 7, 2015 Maybe this (if (not (setq pt1 (cadr (entsel "\nPick the obj:")))) (setq pt1 (cadr (grread t 15 0))) ) Quote Link to comment Share on other sites More sharing options...
satishrajdev Posted September 7, 2015 Share Posted September 7, 2015 I want , if no pick anything still returns the Pick Points coordinates , like function (getpoint) . Any good idea ? Then why don't you use GETPOINT function. Quote Link to comment Share on other sites More sharing options...
DuanJinHui Posted September 7, 2015 Author Share Posted September 7, 2015 Maybe this (if (not (setq pt1 (cadr (entsel "\nPick the obj:")))) (setq pt1 (cadr (grread t 15 0))) ) Thank you very much , Tharwat. very good ! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 7, 2015 Share Posted September 7, 2015 Thank you very much , Tharwat. very good ! You are most welcome . Quote Link to comment Share on other sites More sharing options...
DuanJinHui Posted September 7, 2015 Author Share Posted September 7, 2015 You are most welcome . Hi Mr.Tharwat. (setq pt1 (cadr (entsel "\nPick the obj:"))), above code have a small defects. coordinate precision is constraints by ZOOM eg. one horizontal line , x coordinate is "0.0" , I use (setq pt1 (cadr (entsel "\nPick the obj:"))) pick on this line : result: (18.8774 -0.00995981 0.0) Zoom Out... test again ,the result is: (20.8111 0.0871873 0.0) Is there a way to solve ? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 7, 2015 Share Posted September 7, 2015 Use a combination of getpoint/nentselp Quote Link to comment Share on other sites More sharing options...
DuanJinHui Posted September 7, 2015 Author Share Posted September 7, 2015 Use a combination of getpoint/nentselp Thanks Lee, you mean like this : (if (and (setq p (getpoint "\nSelect: ")) (setq e (cadr(nentselp p))) ) e p ) But I fell do it like this , No difference with only (setq p (getpoint "\nSelect: ")) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 7, 2015 Share Posted September 7, 2015 I'm not sure what you are trying to achieve - getpoint will allow the user to accurately specify a point with Object Snaps available; you can then use the selected point to obtain the entity located at point using either nentselp or ssget. If you want an inaccurate point specification, but a point which lies on a selected entity, use the vlax-curve-getclosestpointto function in conjunction with the point & entity returned by entsel. This will return a point on the selected entity which is nearest to the center of the pickbox aperture. Quote Link to comment Share on other sites More sharing options...
DuanJinHui Posted September 7, 2015 Author Share Posted September 7, 2015 If you want an inaccurate point specification, but a point which lies on a selected entity, use the vlax-curve-getclosestpointto function in conjunction with the point & entity returned by entsel. This will return a point on the selected entity which is nearest to the center of the pickbox aperture. Many Thanks ! Lee, can you give an example ? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 7, 2015 Share Posted September 7, 2015 For example: (if (setq sel (entsel)) (list (car sel) (vlax-curve-getclosestpointto (car sel) (trans (cadr sel) 1 0))) ) Or: (if (setq pnt (getpoint "\nPick a point: ")) (if (setq sel (nentselp pnt)) (list (car sel) (vlax-curve-getclosestpointto (car sel) (trans (cadr sel) 1 0))) pnt ) ) Quote Link to comment Share on other sites More sharing options...
DuanJinHui Posted September 8, 2015 Author Share Posted September 8, 2015 For example: (if (setq sel (entsel)) (list (car sel) (vlax-curve-getclosestpointto (car sel) (trans (cadr sel) 1 0))) ) Or: (if (setq pnt (getpoint "\nPick a point: ")) (if (setq sel (nentselp pnt)) (list (car sel) (vlax-curve-getclosestpointto (car sel) (trans (cadr sel) 1 0))) pnt ) ) Thanks Lee, very useful! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 8, 2015 Share Posted September 8, 2015 Thanks Lee, very useful! You're welcome! 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.