GERPER Posted March 10 Posted March 10 (edited) some one who can help me out fixing this, please (defun c:dsam (/ pt1 x1 y1 ed pt1x pt2x) (setq pt1 (getpoint "\nSelect First Point: ")) (setq pt2 (getpoint "\nSelect Second Point: " pt1)) (setq pt1x (car pt1) pt1y (cadr pt1) pt2x (car pt2) pt2y (cadr pt2) X1 (- pt1x pt2x) Y1 (- pt1y pt2y) ) (setq Ed (entget (car (entsel "\nCoordenada X to change: ")))) (entmod (setq Old (dxf 1 Ed) Ed (subst (cons 1 X1) (cons 1 Old) Ed) ) ) (princ) (setq Ed (entget (car (entsel "\nCoordenada Y to change: ")))) (entmod (setq Old (dxf 1 Ed) Ed (subst (cons 1 Y1) (cons 1 Old) Ed) ) ) (princ) ) Edited March 11 by SLW210 Added Code Tags!! Quote
SLW210 Posted March 11 Posted March 11 In the future please use code tags for your code. (<> in the editor toolbar) Quote
Isaac26a Posted March 11 Posted March 11 Hi GERPER, welcome to Cadtutor Is this what you are trying to achieve? (defun c:dsam (/ pt1 x1 y1 ed pt1x pt2x) (setq pt1 (getpoint "\nSelect First Point: ") pt2 (getpoint "\nSelect Second Point: " pt1) pt1x (car pt1) pt1y (cadr pt1) pt2x (car pt2) pt2y (cadr pt2) X1 (- pt1x pt2x) Y1 (- pt1y pt2y) ) (setq Ed (entget (car (entsel "\nCoordenada X to change: "))) Old (assoc 1 Ed) ) (entmod (subst (cons 1 (rtos X1 2 3)) Old Ed)) (setq Ed (entget (car (entsel "\nCoordenada Y to change: "))) Old (assoc 1 Ed) ) (entmod (subst (cons 1 (rtos Y1 2 3)) Old Ed)) (princ) ) Quote
Saxlle Posted March 11 Posted March 11 Hi @GERPER, With what type of entity are you working with (TEXT, MTEXT, etc.). Because, you're using twice (another for Y) (setq Ed (entget (car (entsel "\nCoordenada X to change: "))) Old (assoc 1 Ed) ) maybe it is insufficient to repeat twice. Quote
GERPER Posted March 11 Author Posted March 11 35 minutes ago, Saxlle said: Hi @GERPER, With what type of entity are you working with (TEXT, MTEXT, etc.). Because, you're using twice (another for Y) (setq Ed (entget (car (entsel "\nCoordenada X to change: "))) Old (assoc 1 Ed) ) maybe it is insufficient to repeat twice. hi, I m working with text, one for each delta (x-y).... Quote
GERPER Posted March 11 Author Posted March 11 8 hours ago, SLW210 said: In the future please use code tags for your code. (<> in the editor toolbar) HI.. sorry, I don't know what do you mean with code tags, LISP is new for me , self learning..., but please, let me know and I'll doit next time Cheers Quote
BIGAL Posted March 11 Posted March 11 If you use Mtext you can have say 2 lines in one text. X=123.456 Y=789.012 Last suggestion maybe use VL code. Quote
GLAVCVS Posted March 11 Posted March 11 @Gerper, with all due respect: I think you should at least respond to the kindness of those who are trying to help you. It's the necessary incentive to do it again next time. Quote
GERPER Posted March 11 Author Posted March 11 (edited) Hi and thanks everyone.., I may no explain my self, please excuse me. There is a coordinate table that I need to to do in order to get an approved topographic plan, they want me to show deltaX and deltaY plus the actual x,y value. in order to do that, I got a block with a x,y field, so far no problem, but in order to get delta value, I was trying to do a lisp routing but, I've no idea how to put X1 and Y1 in to a text, here is the first part where I get delta (defun c:dsam (/ pt1 x1 y1 ed pt1x pt2x) (setq pt1 (getpoint "\nSelect First Point: ")) (setq pt2 (getpoint "\nSelect Second Point: " pt1)) (setq pt1x (car pt1) pt1y (cadr pt1) pt2x (car pt2) pt2y (cadr pt2) X1 (- pt2x pt1x) Y1 (- pt2y pt1y) ) Please, help me, how to put X1 and Y1 in to selected tex..!! Edited March 12 by SLW210 Added Code Tags!! Quote
GERPER Posted March 12 Author Posted March 12 1 minute ago, GLAVCVS said: @Gerper, with all due respect: I think you should at least respond to the kindness of those who are trying to help you. It's the necessary incentive to do it again next time. sure thing, I'm working on that, just give me a little time please, English is my second language and I doing this while I work. Quote
GLAVCVS Posted March 12 Posted March 12 @Gerper I'm sorry. I didn't see your previous posts. Maybe the moderators didn't post them until a few minutes ago. Quote
Isaac26a Posted March 12 Posted March 12 1 hour ago, GERPER said: Please, help me, how to put X1 and Y1 in to selected tex..!! The code above does exactly that, please try it. Quote
Isaac26a Posted March 12 Posted March 12 And the CODE TAGS is the blue box where you put the code when you are writing you can activate it by hitting the <> Simbol (next to the happy face) and then click the button "Insert into post" Quote
BIGAL Posted March 12 Posted March 12 (edited) You may be best using a Block with attributes, it have X1 X2 Y1 Y2 deltax deltay etc. You can also use a Mleader pointing to one of the points with that block. You can make a dim that points to the two points with label in middle. X1 X2 Y1 Y2 deltax deltay I wont go into it now but you can have fields in a block or mtext so move a point the values update, Complex field equation is required. What is best at moment is for you to post a sample dwg with before and after, then people here can help you with solutions. Edited March 12 by BIGAL Quote
Saxlle Posted March 12 Posted March 12 The best way is to upload an example drawing, as @BIGAL mentioned. Also, there is a plenty ways to accomplish that what you want. Quote
GERPER Posted March 12 Author Posted March 12 On 3/11/2025 at 8:08 AM, Isaac26a said: Hi GERPER, welcome to Cadtutor Is this what you are trying to achieve? (defun c:dsam (/ pt1 x1 y1 ed pt1x pt2x) (setq pt1 (getpoint "\nSelect First Point: ") pt2 (getpoint "\nSelect Second Point: " pt1) pt1x (car pt1) pt1y (cadr pt1) pt2x (car pt2) pt2y (cadr pt2) X1 (- pt1x pt2x) Y1 (- pt1y pt2y) ) (setq Ed (entget (car (entsel "\nCoordenada X to change: "))) Old (assoc 1 Ed) ) (entmod (subst (cons 1 (rtos X1 2 3)) Old Ed)) (setq Ed (entget (car (entsel "\nCoordenada Y to change: "))) Old (assoc 1 Ed) ) (entmod (subst (cons 1 (rtos Y1 2 3)) Old Ed)) (princ) ) hey, thank you, but is not working yet... Quote
GERPER Posted March 12 Author Posted March 12 15 hours ago, Isaac26a said: The code above does exactly that, please try it. hi..! ok, I guess I miss something and that is why it wasn't working, I'll try again latter on my lunch time, thank you in advance Quote
GERPER Posted March 12 Author Posted March 12 19 hours ago, Isaac26a said: The code above does exactly that, please try it. you are the man..!! it works perfectly, thank you so much, really appreciated. Quote
GERPER Posted March 12 Author Posted March 12 On 3/11/2025 at 8:33 AM, Saxlle said: Hi @GERPER, With what type of entity are you working with (TEXT, MTEXT, etc.). Because, you're using twice (another for Y) (setq Ed (entget (car (entsel "\nCoordenada X to change: "))) Old (assoc 1 Ed) ) maybe it is insufficient to repeat twice. Thank you for the input, is solved . Quote
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.