Where are my coordinates? Please help

Discussion in 'AutoCAD' started by RaghuMN, Aug 7, 2003.

  1. RaghuMN

    RaghuMN Guest

    I am not able to get the coordinates of an object programatically same as that when it is listed.

    For example, I have a LINE and when I list it, the coordinates are shown as follows:

    from point, X= 9.4424 Y=1908.1028 Z= 0.0000
                    to point, X= 63.4249 Y=1916.6033 Z= 0.0000

    When the same details are tried to get as (cdr (assoc 10 (entget (entlast)))), the results are as follows:

    Command: (cdr (assoc 10 (entget (entlast))))
    (6.08731e+006 1.99513e+006 0.0)

    Command: (cdr (assoc 11 (entget (entlast))))
    (6.08736e+006 1.99514e+006 0.0)

    I am not using any UCS nor projection.

    Can any one help me in getting the correct coordinates of the object?
     
    RaghuMN, Aug 7, 2003
    #1
  2. RaghuMN

    Joe Burke Guest

    William,



     



    I don't think so. The X value of the start point, 9.4424, is nowhere near 6.08731e+006.



     



    RaghuMN,



     



    Command: (setq p1 '(9.4424 1908.1028 0.0000))
    (9.4424 1908.1 0.0)



    Command: (setq p2 '(63.4249 1916.6033 0.0000))
    (63.4249 1916.6 0.0)



    Command: line
    Specify first point: !p1
    (9.4424 1908.1 0.0)



    Specify next point or [Undo]: !p2
    (63.4249 1916.6 0.0)



    Command: (cdr (assoc 10 (entget (entlast))))
    (9.4424 1908.1 0.0)



    Command: (cdr (assoc 11 (entget (entlast))))
    (63.4249 1916.6 0.0)



     



    This suggests what you think is entlast may not be. You should try it:



     



    (setq line (car (entsel)))



     



    Then repeat the above substituting (entget line) for (entget (entlast))



     



    HTH



    Joe Burke



     



    "William Salling" <> wrote in message news:...



    Those are the correct coordinates.  they have been truncated because of length of coordinate values.  If you draw a line from (assoc 10 (entget (entlast))) it will go to the correct value.



     



     



    "RaghuMN" <> wrote in message news:...

    I am not able to get the coordinates of an object programatically same as that when it is listed.

    For example, I have a LINE and when I list it, the coordinates are shown as follows:

    from point, X= 9.4424 Y=1908.1028 Z= 0.0000
                    to point, X= 63.4249 Y=1916.6033 Z= 0.0000

    When the same details are tried to get as (cdr (assoc 10 (entget (entlast)))), the results are as follows:

    Command: (cdr (assoc 10 (entget (entlast))))
    (6.08731e+006 1.99513e+006 0.0)

    Command: (cdr (assoc 11 (entget (entlast))))
    (6.08736e+006 1.99514e+006 0.0)

    I am not using any UCS nor projection.

    Can any one help me in getting the correct coordinates of the object?
     
    Joe Burke, Aug 7, 2003
    #2
  3. RaghuMN

    Tom Smith Guest

    Entget returns the World (WCS) coordinates of the point, a listing tells the current user coordinates (UCS). It's generally best programmatically to deal with world coordinates, and translate them back to UCS at the end, if you need to communicate them to the user. 



    RaghuMN <> wrote in message news:...

    I am not able to get the coordinates of an object programatically same as that when it is listed.

    For example, I have a LINE and when I list it, the coordinates are shown as follows:

    from point, X= 9.4424 Y=1908.1028 Z= 0.0000
                    to point, X= 63.4249 Y=1916.6033 Z= 0.0000

    When the same details are tried to get as (cdr (assoc 10 (entget (entlast)))), the results are as follows:

    Command: (cdr (assoc 10 (entget (entlast))))
    (6.08731e+006 1.99513e+006 0.0)

    Command: (cdr (assoc 11 (entget (entlast))))
    (6.08736e+006 1.99514e+006 0.0)

    I am not using any UCS nor projection.

    Can any one help me in getting the correct coordinates of the object?
     
    Tom Smith, Aug 7, 2003
    #3
  4. RaghuMN

    R.K. McSwain Guest

    Are you positive that the entity you LISTed is the same entity returned by (entlast)?
     
    R.K. McSwain, Aug 7, 2003
    #4
  5. RaghuMN

    RaghuMN Guest

    Yes McSwain, Both are of the same entity.
    I got the answer now. As Tom Smith pointed out, UCS was active in this drawing. When I changed the drawing to WCS, it gave me expected results.

    Thanks ALL for your support extended.

    MNRaghu
     
    RaghuMN, Aug 11, 2003
    #5
  6. RaghuMN

    R.K. McSwain Guest

    Ok, but in your intro post, you stated

    but apparently you were.
     
    R.K. McSwain, Aug 11, 2003
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.