Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Label XY Coordinates with a Leader

25 REPLIES 25
Reply
Message 1 of 26
mwyant2
20032 Views, 25 Replies

Label XY Coordinates with a Leader

I am interested in labeling points on my drawing with reference to the UCS. I would like the finished label to be a leader line with x and y on two separate lines. I have found other posts of similar ideas, but I couldn't seem to get them to work. It would be an added bonus to label each line automatically as well. I assume this will have to be a script that I write. I am working on reading up on how to write them but any help would be appreciated.
25 REPLIES 25
Message 2 of 26
hmsilva
in reply to: mwyant2

HI mwyant2

try this...



(defun C:cxy ()
(setvar "cmdecho" 0)

(setq pt1 (getpoint "\nPique o ponto a coordenar: "))
(if pt1
(progn
(setq pt2 (getpoint pt1 "\nPique ponto de inicio do texto: "))
(if pt2
(progn
(setq txtx (strcat "M=" (rtos (car pt1) 2 4) "\n"))
(setq txty (strcat "P=" (rtos (cadr pt1) 2 4) "\n"))
(princ "\n")
(command "leader" pt1 pt2 "Annotation" txtx txty "")
)
)
)
)
(setvar "cmdecho" 1)
(princ)
)

Cheers


Henrique

EESignature

Message 3 of 26
mwyant2
in reply to: mwyant2

I ran the script and it never asks for the point that I want to label. Am I using it wrong?
Message 4 of 26
hmsilva
in reply to: mwyant2

Hi mwyant2

Save the cxy.lsp file in yor computer

Load the application in Autocad

Then type

C:cxy

Cheers

Henrique

EESignature

Message 5 of 26
mwyant2
in reply to: mwyant2

Thanks for the reply. The code is great. One quesiton though how can I change it into feet and inches? It does exactly what I want it to do.
Message 6 of 26
Anonymous
in reply to: mwyant2

Change these two lines

(setq txtx (strcat "M=" (rtos (car pt1) 2 4) "\n"))
(setq txty (strcat "P=" (rtos (cadr pt1) 2 4) "\n"))

to these

(setq txtx (strcat "M=" (rtos (car pt1) 4 4) "\n"))
(setq txty (strcat "P=" (rtos (cadr pt1) 4 4) "\n"))

The first 4 is the unit, in this case Architectural.

1 Scientific
2 Decimal
3 Engineering (feet and decimal inches)
4 Architectural (feet and fractional inches)
5 Fractional

The second 4 is the precision. The lower the number, the lower the
precision.

--
Matt W
"Children are like TV sets. When they start acting weird, whack them across
the head with a big rubber basketball shoe."
Message 7 of 26
mwyant2
in reply to: mwyant2

Thank you so much for all the help. This command now does exactly what we want it to. I figured out how to change a few other things and now hopefully I am on my way to write others to help me work quicker.

Thanks
Message 8 of 26
hmsilva
in reply to: mwyant2

You're welcome, mwyant2

Cheers

Henrique

EESignature

Message 9 of 26
Anonymous
in reply to: mwyant2

what's wrong with using DIMORDINATE?
format two coincident dimordinate object, horizontal and vertical, the way
they need to look then insert that where you need it

wrote in message news:4996483@discussion.autodesk.com...
I am interested in labeling points on my drawing with reference to the UCS.
I would like the finished label to be a leader line with x and y on two
separate lines. I have found other posts of similar ideas, but I couldn't
seem to get them to work. It would be an added bonus to label each line
automatically as well. I assume this will have to be a script that I write.
I am working on reading up on how to write them but any help would be
appreciated.
Message 10 of 26
mwyant2
in reply to: mwyant2

That is originally how I was finding the points then retyping it in to a leader box. I wanted both of the dimensions horizontal and labeled CL and PL for center line and plaster line. It is for theatre. It looks very clean and neat on the plan. It is also how everyone here is used to seeing the dimensions of a point. The script way is just much faster.
Message 11 of 26
ctpgamage
in reply to: hmsilva

i have attached current status of this lisp please help me some one to make my requirement (i have attached what i want to make)

 

please help me

 

Message 12 of 26
hmsilva
in reply to: ctpgamage


@ctpgamage wrote:

i have attached current status of this lisp please help me some one to make my requirement (i have attached what i want to make)

please help me


Hi ctpgamage,

try the attached code.

 

Hope that helps

Henrique

 

EESignature

Message 13 of 26
ctpgamage
in reply to: hmsilva

thank you very much hmsilva..you are a great person salute for you.....

Message 14 of 26
hmsilva
in reply to: ctpgamage

You're welcome, ctpgamage
Glad I could help

Henrique

EESignature

Message 15 of 26
stevesfr
in reply to: hmsilva

what controls the size of the arrowhead in the xyz.lsp program ?
Message 16 of 26
hmsilva
in reply to: stevesfr


@stevesfr wrote:
what controls the size of the arrowhead in the xyz.lsp program ?

In XYZ.lsp, the arrowhead size is defined in current dimension style (DIMASZ System Variable), and the code will add a leader with all default values, if you need to change some value, you'll need to set the property you want with the desired value.
To set a new arrowhead size try

 

(vla-put-verticaltextposition lead acvertcentered)
(vla-put-ArrowheadSize lead 3.0);; <<<<<
(vla-update lead)

 

Hope that helps

Henrique

EESignature

Message 17 of 26
stevesfr
in reply to: hmsilva

thanks Henrique

Message 18 of 26
hmsilva
in reply to: stevesfr

You're welcome, stevesfr

Henrique

EESignature

Message 19 of 26
joedints
in reply to: hmsilva

Your XYZ.lsp is wrong, it is showing the x value as north and the y value as east, they should be reversed.  

It is a very handy tool, although I do not know how to correct it. 

Message 20 of 26
Kent1Cooper
in reply to: joedints


@joedints wrote:

Your XYZ.lsp is wrong, it is showing the x value as north and the y value as east, they should be reversed.  

.... 


I was going to ask whether you were in the World Coordinate System, but I downloaded it and tried it, and you're correct.  Change these lines:

 

....

    tstr (strcat (strcat "N=" (rtos (car pt1) 2 4))
         (strcat "\\PE=" (rtos (cadr pt1) 2 4))

....

 

to reverse the X (car) and Y (cadr) coordinates:

 

....

    tstr (strcat (strcat "N=" (rtos (cadr pt1) 2 4))
         (strcat "\\PE=" (rtos (car pt1) 2 4))

....

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost