Jump to content

Recommended Posts

Posted (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 by SLW210
Added Code Tags!!
Posted

In the future please use code tags for your code. (<> in the editor toolbar)

Posted

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

 

Posted

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. 

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

Posted
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

Posted

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.

Posted

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

Posted (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 by SLW210
Added Code Tags!!
Posted
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.

Posted

@Gerper I'm sorry.

I didn't see your previous posts. Maybe the moderators didn't post them until a few minutes ago.

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

Posted

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"

Posted (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 by BIGAL
Posted

The best way is to upload an example drawing, as @BIGAL mentioned. Also, there is a plenty ways to accomplish that what you want.

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

Posted
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

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

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

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