Issue with coords

Issue with coords

Anonymous
Not applicable
1,152 Views
10 Replies
Message 1 of 11

Issue with coords

Anonymous
Not applicable

Good morning, im having a little problem here, maybe its dumb but i cant pass through it. I have a simple bit of code that returns a list with vertexs from a given polyline. Thing is, both that code and (getpoint) some points are returning the coords in a strange format. As example, for a polyline with vertex ((0.0 -105.0) (0.0 0.0) (-86.0 0.0) (-86.0 -199.44)) it returns ((-1.92882e-014 -105.0) (0.0 0.0) (-86.0 1.0532e-014) (-86.0 -109.44) (-1.92882e-014 -105.0)).

A getpoint in some of the points also return that format so its not the code (i think), maybe im missing some config setting. Its happening this first time after i pasted some polylines that was created on ArcGIS, maybe is something about it.  Any ideas?

 

Thanks, and sorry for my english, im new at it

0 Likes
1,153 Views
10 Replies
Replies (10)
Message 2 of 11

dgorsman
Consultant
Consultant

That's exponential format.  Read "1.92882e-014" as 1.92882 x 10 (raised to the power of) -14; also written as "...x10 ^-14".  AutoCAD uses that for displaying very, very large and small numbers.  *Anything* to x10^-14 is way freaking small, just as anything x10^14 is astronomically big.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 3 of 11

Anonymous
Not applicable

I supposed something like that. Thing is, im not using any amount of units that big or small. I entmaked that polylines  (starting on '(0.0 0.0) and manually writing more points) so i know that the points was introduced in the normal format, but then used chamfer with a set distance of exactly 4 in a 90 degree corner and extracted the new vertexs... Even using (getpoint) on a non-modified vertex still gives me that exponential form of the point. Maybe some variable or similar is telling autocad to give the exponential format if the point is far than X units of the SCP.

 

Anyways, it fixed when i moved all to a new drawing. Guess i will have to work near to the 0 and move all to the correct coordinate when im done (moving the SCP doesnt fix the issue)

0 Likes
Message 4 of 11

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... im not using any amount of units that big or small. ....


Maybe not that big, but certainly you are using amounts that small.  10 to the minus 14 is essentially zero -- almost as close to zero as AutoCAD can handle.  A point coordinate will sometimes come out that way [scientific notation] as the result of the calculations involved.

 

You should be able to use the resulting points, even if they look kind of funny in list-of-coordinates display.

Kent Cooper, AIA
0 Likes
Message 5 of 11

Anonymous
Not applicable

The code hasnt (is that the word, "hasnt"?) that problem in any drawing but that one... Problem appears when i draw something too far away from the 0 (exact point was '(2588319.8 5976989.7)) o move something to somewhere that far. I have "fixed" it by not moving anything, but i will have to do it later or sooner. And yes, code should work anywhere on the drawing but its not. I will post it here tonight or tomorrow, maybe im doing something wrong or not doing something basic (im new at this)

0 Likes
Message 6 of 11

dgorsman
Consultant
Consultant

opazojonatan wrote:

The code hasnt (is that the word, "hasnt"?) that problem in any drawing but that one... Problem appears when i draw something too far away from the 0 (exact point was '(2588319.8 5976989.7)) o move something to somewhere that far. I have "fixed" it by not moving anything, but i will have to do it later or sooner. And yes, code should work anywhere on the drawing but its not. I will post it here tonight or tomorrow, maybe im doing something wrong or not doing something basic (im new at this)


 

There are limits to what can be represented as a number in a program - this is common with almost all computer systems dealing with numbers.  The coordinates are stored as double-precision floating point numbers in the WCS.  As those numbers get large (and I'm talking REALLY big numbers here), precision gets sacrificed in order to physically store the number.  You'll find this more often a problem when working with 3D solids, such as extruding and revolving.

 

You should always strive for keeping the majority of work close to the WCS origin; if you require a different set of coordinates establish a named UCS at the appropriate location.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 7 of 11

_gile
Consultant
Consultant

Hi,

 

Even close to the WCS origin you may have this kind of accuracy issue due to the double-precision floating numbers.

(polar '(0. 0. 0.) pi 1.) returns (-1.0 1.22465e-16 0.0) instead of (-1.0 0.0 0.0)

This is why we should always use a tolerance when comparing numbers points and so on.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 8 of 11

Anonymous
Not applicable

I tryed something like this today at work

 

(osoff)                                  ->sets osmode to 0 and a few other things

(command "_line" '(0.0 10.0) '(20.0 30.0) "")

(entget (entlast))

 

And the retrieved list for that line still had the (10 0.0 ...........) with that last number in cientific notation. Im not at work right now so i cant copy paste the result or post an image

 

0 Likes
Message 9 of 11

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... (10 0.0 ...........) with that last number in cientific notation. ....


In that case, since it's the Z coordinate and you didn't include a Z coordinate in your Line command point designations, could it be that your ELEVATION System Variable setting is not zero?

Kent Cooper, AIA
0 Likes
Message 10 of 11

Anonymous
Not applicable

no, that 10 was the prefix of the point when you extract it with (ASSOC 10 (ENTGET ())... Today i gave up on it and continued working just to find another challenge involving UCS and entmake... But i guess i should ask in another post. Im going to check elevation but i think i was zero

 

Guess i will continue to finding problems while my actual work keeps being this boring and slow (not that slow as two months ago but still can be speeded up) Smiley Frustrated

0 Likes
Message 11 of 11

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

no, that 10 was the prefix of the point when you extract it with (ASSOC 10 (ENTGET ())... ....


Then are there two numbers [not just one "last number"] in scientific notation?  For a Line as in your code sample, there should be X, Y and Z coordinates in addition to the 10 [or the 11 for the other end].

Kent Cooper, AIA
0 Likes