# Script to fix imported 2D geometry...?

I’m importing the file from Adobe Illustrator to Rhino.

Illustrator UI has precision of 0.001mm. But AI stores data in points. Because of all the calculation and rounding - actual measures are off by 0.0001mm (if you import file into Rhino you can see actual tolerance and actual numbers that AI has created in 0.0000001 precision).

I don’t work in such a high precision, but if I would zoom things really close for inspection I can see misalignment, and it makes me crazy. As well, if I would need to scale things like 1000 times I would face real issue.

For example object that has to be exactly 455 x 4 mm I’m getting values like: 454.9999719 x 3.9997591

I know I could set Absolute Tolerance to 0.001 and move on, but it’s just not right.

Is it doable to create a Python script so it would automatically go through the objects and round actual values / save them?

I’m experienced in C++, so Python wouldn’t be that much hard to learn.

but I’m new to Rhino, so I don’t know its capabilities.
Could someone bring me on the right track?

MacOS - Rhino 7

Cheers

FWIW, 454.9999719 is well within 0.001mm tolerance. This is more likely a function of floating point representation than bugs. This forum has already a multitude of topics lamenting and surprising people on floating points, arithmetic and precision.

For fun in Python do: `print(0.1 + 0.1 + 0.1 == 0.3)`.

For all intents and purposes in the computer world 454.9999719 is exactly 455.

1 Like

Thank you.
I completely agree.
Why Rhino do not represent this in the UI view, like Illustrator or other software does? Is there a specific reason?

I would venture a guess that in this case there is no formatting of the numbers done. One reason for that could be that such a formatting also could introduce unwanted errors or misconceptions for the user of the state of the model. But I do not know the correct answer to this particular issue. Maybe @stevebaer or @dale know more about that?

Not sure I understand this. But if you want to see more precision, just click `Tools > Options > Units` and adjust the `Display precision`.

– Dale

Hello Dale,
What I mean is, if I set Display Precision to 0.001 It rounds only values in the text fields, but if I zoom to extreme in the view window, I see that lines do not match in my model.

For example if I have to two points one being 0.00007mm and other being 0.00005 placed on X axis. No matter what I set as Display Precision, on close inspection visually they are apart from one another.

Andrius has a point. Precise modelling is often not so much because the real world objects produced from it actually needs that kind of precision, but because it helps when points are at a precisely ‘defined’ location, and other points that are supposed to be at the same location should share the exact same coordinates.
This ‘jittering’ of points around a location is irritating, and invites for buildup errors that in the end can become relevant in production.