Trouble with TEXT coordinates

Trouble with TEXT coordinates

shannongreen_17
Contributor Contributor
1,253 Views
7 Replies
Message 1 of 8

Trouble with TEXT coordinates

shannongreen_17
Contributor
Contributor

Hi,

 

In my lisp routine I'm trying to place my text at an exact coordinate but it doesn't work. Can anyone help?

 

The y coordinate is always off, see below

 

I wrote this

(command "text" "j" "mc" "16.0077,8.07996,0.0" "0" "hi")

 

but the result keeps giving me "16.0077,7.9728,0.0".

0 Likes
Accepted solutions (1)
1,254 Views
7 Replies
Replies (7)
Message 2 of 8

dlanorh
Advisor
Advisor
What result i.e. what are you checking and how?

I am not one of the robots you're looking for

0 Likes
Message 3 of 8

mgorecki
Collaborator
Collaborator
Accepted solution

I don't know if this will help, but give it a try.

 

(CreateText "mc" 2.0 (list 16.0077 8.07996) "hi")
(defun CreateText (txtJust txtHeight insertPt txtString) (if (= txtJust "tc") (setq horJust 1 verJust 3)) (if (= txtJust "mc") (setq horJust 1 verJust 2)) (if (= txtJust "bc") (setq horJust 1 verJust 1)) (if (= txtJust "ml") (setq horJust 0 verJust 2)) (if (= txtJust "mr") (setq horJust 2 verJust 2)) (entmake (list (cons 0 "TEXT") (cons 72 horJust) ;Horizontal text justification,0=Left,1=Center,2=Right,4=Center,5=Fit (cons 73 verJust) ;Vertical text justification, 0=Baseline,1=Bottom,2=Middle,3=Top (cons 7 "RomanS") (cons 10 insertPt) (cons 11 insertPt) (cons 40 txtHeight) (cons 1 txtString) ) ) )

Best regards,

Mark

0 Likes
Message 4 of 8

shannongreen_17
Contributor
Contributor

This did the trick THANK YOU SO MUCH :). For future reference, I know there could be a myriad of reasons why the "text" command didn't work but could you explain why your code possibly did the trick?

0 Likes
Message 5 of 8

Kent1Cooper
Consultant
Consultant

Did you have any running Object Snap mode(s) on?  Your (command)-function version will be affected by those, but not the (entmake) approach.

Kent Cooper, AIA
0 Likes
Message 6 of 8

shannongreen_17
Contributor
Contributor

Yes, they were on. I'll keep that in mind for next time. That's a strange thing to affect the command though =S. Thank you

0 Likes
Message 7 of 8

ВeekeeCZ
Consultant
Consultant

This default setting is the reason why it's affected. You might want to change the option to the one above to avoid the issue entirely.

image.png

 

Or/and... another very simple fix is to put "_non" prior to each point set. The Non is temp osnap override mode.

(command "text" "j" "mc" "non" "16.0077,8.07996,0.0" "0" "hi")

 

Message 8 of 8

cadffm
Consultant
Consultant

What BeekeeCZ wrote is the smart&clean way.

This setting is OSNAPCOORD (= 1) and you can easily set it first in your Macro, Program, Script where you using AutoCAD commands.

Because of it is saved in the profile it can be different and changed by the user, so it is the best place to set value 1 in you automation first.

Sebastian