dax Posted June 17, 2016 Share Posted June 17, 2016 Hi Guys, Is there a function that return the pick point from a text entity?? Thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 17, 2016 Share Posted June 17, 2016 (cadr (entsel)) will give the coordinates of the center of the pickbox aperture at the time of selection. Alternatively, you can store a point returned by (getpoint) and then use (nentselp ) or (ssget ) to obtain a selection. Or you can retrieve the selection information from an (ssget) call using the (ssnamex) function. Quote Link to comment Share on other sites More sharing options...
dax Posted June 17, 2016 Author Share Posted June 17, 2016 Hi Lee, Thanks for your response, your correct on (cadr (entsel)) but this function prompt for a user action (select object) , I'm looking for a function that return pick points without user interaction to select an object from this I will add this function to the auto search text function I used. Thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 17, 2016 Share Posted June 17, 2016 I'm looking for a function that return pick points without user interaction What do you mean by 'pick points' if not points picked by the user? Quote Link to comment Share on other sites More sharing options...
dax Posted June 17, 2016 Author Share Posted June 17, 2016 Yes, I have a lisp program that search a text automatically from the drawing then from their I want to get the pick point/coordinates (x, y, z) from the selected text entity. is it possible with lisp or is their a working function on it to retrieve the pick point like what the entsel can do? Thanks Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 17, 2016 Share Posted June 17, 2016 The variable EntityName represents the text entity: (cdr (assoc 10 (entget <EntityName>))) Quote Link to comment Share on other sites More sharing options...
dax Posted June 17, 2016 Author Share Posted June 17, 2016 Hi Tharwat, (cdr (assoc 10 (entget ))) I've used the above code but give me a invalid point error, and also I notice it give me wrong point. See my code below : (defun findString (/ str ss) ; = Find String(s)*by Content **(setq str "DAX") **(if (setq ss (ssget "_X" (list (cons 0 "*TEXT") (cons 1 str) (cons 410* (getvar 'ctab))))) ****(sssetfirst nil ss); select/highlight/grip **); if ); defun This program find and select "DAX" entity. Upon selected. I run below command. Command: (setq a (entlast)) Command: (cdr (assoc 10 (entget a))) (10.0 10.0 10.0) This is different when using the (entsel). Command : (entsel) Select object: ( (619.0 333.0 0.0)) My goal is to get (619.0 333.0 0.0) from the selected text entity. I need the coordinates from the text entity to create a small circle which will be the mid point of the circle, and from their all object inside the circle will be selected for data extraction. Hope you can help me on this one.. Many thanks.. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 17, 2016 Share Posted June 17, 2016 Did you read what Lee described earlier? and the differences between the entsel return list and the ssget function? The second list of the return of the function entsel which represents the cursor position is completely different than the position of the selected object? Which on would like to use? entsel or ssget ? Quote Link to comment Share on other sites More sharing options...
dax Posted June 20, 2016 Author Share Posted June 20, 2016 Hi Tharwat, Thank you for your response, I used the ssget function then ssnamex and got this result ((1 0 (0 (619.0 332.0 0.0)))), however I'm finding it hard to retrieve only the coordinates (619.0 332.0 0.0). Dax Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 20, 2016 Share Posted June 20, 2016 Hi Tharwat, Thank you for your response, I used the ssget function then ssnamex and got this result ((1 0 (0 (619.0 332.0 0.0)))), however I'm finding it hard to retrieve only the coordinates (619.0 332.0 0.0). Dax Hi Dax, Please try the following: (if (setq ss (ssget '((0 . "TEXT")))) ((lambda (i / sn) (while (setq sn (ssnamex ss (setq i (1+ i)))) (setq l (cons (cadr (cadadr sn)) l)) ) ) -1 ) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 20, 2016 Share Posted June 20, 2016 The coordinates would be assigned to variable 'l' so if you running the coding from Vlisp console just type l on the console and hit enter but if you are in AutoCAD command line just type !l and hit enter. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 20, 2016 Share Posted June 20, 2016 Why did you remove your last reply and re-post it again after my reply ? Did you get what I described in my last reply? Quote Link to comment Share on other sites More sharing options...
dax Posted June 20, 2016 Author Share Posted June 20, 2016 Sorry Tharwat I just accidentally delete the other thread. I will try you suggest hope I remember what have you answer on my issue.. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 20, 2016 Share Posted June 20, 2016 Sorry Tharwat I just accidentally delete the other thread. I will try you suggest hope I remember what have you answer on my issue.. You did delete the last two replies accidentally? very odd! Quote Link to comment Share on other sites More sharing options...
dax Posted June 20, 2016 Author Share Posted June 20, 2016 Sorry for my mistake, I will try to what you have suggest.. Quote Link to comment Share on other sites More sharing options...
tombu Posted June 20, 2016 Share Posted June 20, 2016 Yes, I have a lisp program that search a text automatically from the drawing then from their I want to get the pick point/coordinates (x, y, z) from the selected text entity. is it possible with lisp or is their a working function on it to retrieve the pick point like what the entsel can do? Thanks You're definitely not talking about "pick points", maybe insert points? Post the lisp or better yet a link to where you found it then tell us what is it you want the lisp to do differently. The textbox function may be more helpful depending on what you want to do with those points. The clearer you questions the more chance you have of getting the response you're looking for. Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted June 20, 2016 Share Posted June 20, 2016 (edited) @ dax: I hope you are aware that the result of ssget (and therefore of ssnamex) will vary depending on the selection method. Only if the entities are selected with single picks will you get a result in the format you have posted. You should do additional testing with the (Crossing) Window, Fence and All selection methods. Your best bet is to use a point from the entity. You may have to use the trans function to translate from the OCS of the entity to the current UCS or the WCS. Edited June 20, 2016 by Roy_043 Quote Link to comment Share on other sites More sharing options...
dax Posted June 23, 2016 Author Share Posted June 23, 2016 Hi tombu, Roy_043, thank you for your responses, I'm having difficulty on the routine such a newbie of me on LISP, however I already resolved the invalid point error and I noticed that it give me wrong point. Please see below code, I just get this from other forum site. ; search text entity with "DAX" content (setq str "DAX") *(if (setq ss (ssget "_X" (list (cons 0 "*TEXT") (cons 1 str) (cons 410* (getvar 'ctab))))) ****(sssetfirst nil ss); select/highlight/grip **); if ; return "(nil )" (setq ent (entlast)) ; return "" (setq a (entget ent)) ; return "((-1 . ) (0 . "TEXT") (330 . ) (5 . "CDD4") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0-BORDER-0") (62 . 7) (100 . "AcDbText") (10 21.0 12.0 0.0) (40 . 2.0) (1 . "ACAD2014::ical 2014v3b RIVERAD1") (50 . 1.5708) (41 . 1.0) (51 . 0.0) (7 . "romcal") (71 . 0) (72 . 0) (11 20.0 12.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbText") (73 . 2))" but when using (entsel) then select the text entity (with "DAX" content) it return this one ( (615.0 332.0 0.0)), for my code above I did'nt get the (615.0 332.0 0.0) it gives me (10 21.0 12.0 0.0). Thanks, Quote Link to comment Share on other sites More sharing options...
tombu Posted June 23, 2016 Share Posted June 23, 2016 Please follow Code posting guidelines http://www.cadtutor.net/forum/showthread.php?9184-Code-posting-guidelines As you got the code from another site providing that link would let us see the context behind it. Thanks, Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted June 23, 2016 Share Posted June 23, 2016 To translate the coordinate of the text to the current UCS use this: (trans (cdr (assoc 10 (entget ent))) ent 1) 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.