Where are my coordinates? Please help

RaghuMN

Usenet Archive
Joined
Jul 14, 2003
Messages
97
Reaction score
0
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?
 
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:

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:

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?
 
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:

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?
 
Are you positive that the entity you LISTed is the same entity returned by (entlast)?
 
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
 

Latest threads

Back
Top