AutoCAD 2010/2011/2012

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

inaccurate coordinates

129 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}\")));

ActiveDocument.SendCommand("writeText");

{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*
Alfred.NESWADBA
Posts: 8,490
Registered: ‎06-29-2007
Message 2 of 3 (128 Views)

Re: inaccurate coordinates

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

Hi,

 

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 -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
M_Mogharabi
Posts: 26
Registered: ‎12-12-2011
Message 3 of 3 (121 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

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

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

Ask the Community




Connect with AutoCAD

Twitter

Facebook

Blogs

Pinterest

Youtube