• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD 2010/2011/2012 DWG Format

    Reply
    Active Contributor
    M_Mogharabi
    Posts: 26
    Registered: ‎12-12-2011
    Accepted Solution

    inaccurate coordinates

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

    Please use plain text.
    *Expert Elite*
    Posts: 6,398
    Registered: ‎06-29-2007

    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
    -------------------------------------------------------------------------
    Please use plain text.
    Active Contributor
    M_Mogharabi
    Posts: 26
    Registered: ‎12-12-2011

    Re: inaccurate coordinates

    02-18-2012 12:58 AM in reply to: alfred.neswadba

    thank you very much.

    disabling objectsnap resolved the issue.

    Please use plain text.