AutoCAD 2010/2011/2012

Active Contributor
Posts: 26
Registered: ‎12-12-2011
Message 1 of 3 (138 Views)
Accepted Solution

inaccurate coordinates

138 Views, 2 Replies
02-17-2012 11:31 PM

hi all.

I'm developing an application in c# and I use sendcommand to draw shapes and write text in autocad.

I use lisp  to write text in autocad. here's an example :

ActiveDocument.SendCommand("(defun c:writeText() (Command \"text\" \"{0},{1}\" \"{2}\")));


{0} and {1} are coordinates of the start of text and {2} is the text itself.

the problem is when text is drawn its start position is not what I passed to sendcommand SOMETIMES!

sometimes it is exactly written in the coordinate I specified, but sometimes it gets changed a little.

I checked autocad commandline and it recieves the parameters correctly everytime.

does anyone have any idea?

thanks in advance.

*Expert Elite*
Posts: 8,893
Registered: ‎06-29-2007
Message 2 of 3 (137 Views)

Re: inaccurate coordinates

02-17-2012 11:40 PM in reply to: M_Mogharabi



depending on country settings it may me the decimal-separator that makes troubles. E.g. for us we have a comma as sep and if you send now the coords with your syntax the result for X=10.1 and Y=20.2 would be

10,1,20,2     instead of   10.1,20.2

for the definition for one point. So we would have first to replace the comma to a point before we send a double-value (converted to string) to the command-line.


The second reason (always critical when using points-coords in SendCommands) is the objectsnap. E.g. if you have a line from 0,0 to 10,10 and you try to set a text at point 1,1 the object-snap "ENDPOINT" will result in ==> the text is positioned at 0,0 (and not at 1,1). So deactivate osnap first.


- alfred -

Ingenieur Studio HOLLAUS ...
Active Contributor
Posts: 26
Registered: ‎12-12-2011
Message 3 of 3 (130 Views)

Re: inaccurate coordinates

02-18-2012 12:58 AM in reply to: Alfred.NESWADBA

thank you very much.

disabling objectsnap resolved the issue.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community

Connect with AutoCAD