Get the tolerance related to Curve/Surface Evaluator


That must be a typo. Of course Rhino geometry calculations are unit-based

Yes I understand now. The tolerance setting when opening SWX files is not correct. I do not know if that is a Rhino bug or a SWX bug. I have seen this bug myself many times recently (the bug has only been around for about 6 months). This bug makes it more difficult to open SWX Step files reliably.

The workaround for this bug s to use “Import” command to bring in SWX geometry,
So you would start with a template file with tolerance set to .01 and units mm and then import the SWX data. Importing geometry won’t change the tolerance to something ridiculous.

To answer your original question, the tolerance your plug-in should use for its numerical algorithms is the Rhino absolute tolerance. Keep in mind that your users will not likely be working on a SWX STEP file that they opened. The vast majority of mm files will have a tolerance of .01-.001. But if the user is making something really large like a building or a ship they may set the tolerance to 1.0-0.1 mm or if they are modeling something very tiny (say smaller than a mm) they may set the tolerance to smaller than .001 mm.

It is important that your plugin use the same tolerance that the user sets for absolute tolerance . The reason is that if you use a tolerance that is looser than the user’s tolerance then your geometry will likely not join to the user’s geometry and if your tolerance is smaller than the user tolerance it will produce curves and surfaces that are much denser than they need to be.

If your numerical algorithms only work within a narrow range of tolerance you should give the user a pop-up message box that explains this fact. The user can then adjust the tolerance, units or even scale the model size so that the can work within the plugins tolerance range. One of the things Rhino users must learn very early is to set the units and tolerance so as to achieve the best results for their own particular modeling needs,



“It is important that your plugin use the same tolerance that the user sets for absolute tolerance.”
This is what we try to do. However, when opening STEP files etc., Rhino sets a wrong tolerance (I guess they mistakenly use meters for the document tolerance and use mm for other calculations.)

“Keep in mind that your users will not likely be working on a SWX STEP file that they opened. The vast majority of mm files will have a tolerance of .01-.001.”
Our plugin should work for all files. As @robin_l suggested, ‘looking at the document tolerances is probably not the best approach’.

Thank you guys.

(Dale Fugier) #19

@chuck, the user is reporting a tolerance issue when opening STEP files created with SolidWorks. Can you work with @XNurbs to resolve this?

– Dale

(Chuck Welsh) #20

A STEP file has a tolerance entity that is used to determine the Rhino document tolerance. Whether or not the data in the STEP file is accurate to within this tolerance is up to the exporting software. In many cases it is not.


Then the bug is Rhino 6 reads this entity incorrectly.

What tolerance does Rhino6 use to join edges when it reads in a STEP file. Does it ignore the tolerance all together and just join anything where there are edges that have overlapping intervals?

Here is a file that my Rhino6 says the tolerance is 0.000001

corep.stp (60.1 KB)

(Chuck Welsh) #22

The STEP file claims the tolerance is 0.000001. Since the edge curve entities are shared by adjacent faces, the edges are identical. When everything goes as planned, there is no need to use a tolerance for the joining. The resulting edge tolerances, that are as large as 2.2531090370642774e-05 in your model, come from how far off the surfaces the edge curves are.

What do you think Rhino should do in this case, beyond reading in the data in the STEP file? One possibility would be to set the file tolerance to 2.2531090370642774e-05. This would not make sense when you import the file into an existing 3dm document but it might otherwise.


Previous versions of Rhino open this file with the tolerance as .0001

(Chuck Welsh) #24

In previous versions we used 0.0001 as the minimum tolerance. This caused problems.


I can’t even begin to imagine what that bizarre statement means

The 0.000001 tolerance will cause problems for 99% of users who try to do any further modeling with this file. I doubt that a .0001 tolerance would cause even 10% of users problems.

As the Xnurbs guy said the very tight tolerances make sense if it means 0.000001 meters. In other words, the tolerance may not be using the same unit system as the geometry

(Chuck Welsh) #26

Your STEP file says the tolerance is 0.000001. We have always used the tolerance stated in the STEP file unless it was smaller than a chosen minimum value. In the past that was 0.0001. Now it’s not. Moving it back to 0.0001 would make you happy for this particular file. It would cause problems in other files. I have no idea why the software that wrote your file used an incorrect tolerance.


This is not unique to one file. XNurbs posted another example and the other STEP files that I have downloaded from this Forum also have ridiculously tight tolerance. All the proprietary STEP file that I have received in the last few months also have opened with incorrect tolerance.

XNurbs releases a ground-breaking NURBS software

I am afraid it is a Rhino bug. The tolerance 0.000001 or 0.00001 is based on meters! Also the geometries in STEP are based on meters. When Rhino loads STEP, Rhino “converts” the geometries into mm, but forgets converting the tolerance.

From Rhino’c comments, it appears that Rhino may use a STEP translation from a third party, and may not know what is going on. Rhino should send a bug report to the developer of the STEP translation.

(Chuck Welsh) #29

From your STEP file:


I thought maybe the 0.000001 really goes with the mm unit, rather than inches from which the file units are derived, but that would be even worse. I think some export packages just always stick 0.000001 in the STEP file no matter how noisy the joins are.

Maybe the right thing to do is give you the option of setting the document tolerance to the tolerance in the STEP file or using the maximum edge tolerance if it’s bigger. I have seen some files where the STEP file tolerance is a typical value of, say, 0.001, but the actual distance from edge curves to the surfaces they should be trimming is huge, like 0.5. One problem with this approach is that therre could be surfaces or edges that are smaller than that tolerance.

Most of the work in our STEP import code is trying to interpret incorrect information in the STEP file. This is just another example, I guess.



I just want to remark that we also use step import/export. On most projects we need to actually build with a precision of +/- 0,1mm on objects of 90 to 150m. Rhino documentations says that we then should set the tolerance to 0,01mm. Some Projects use meters as units. Therefore we need to use 0,00001 as standard. If something needs to be build with tighter tolerances we need to go to 0,000001. I think that it must be possible to import/export and of course model with these settings, that also counts for plugins as xnurbs.


The right thing for a Rhino user to do is (as I advised Xnurbs) use the “import” command instead of the “Open” command. The tolerance setting that you get when you use “open” is completely unreliable when bringing in data from other CAD systems

And there is no point in users complaining about the unreliability of the tolerance when opening STEP files because past complaints have just made the problem worse.

1 Like


As @JoergH mentioned, some projects use meters as units, so could you show us how to get the document unit setting? If users use meters as units, would Curve/Surface Evaluator returns results based on meters?


I did not check the STEP file. Based on your description, I think it may be a Rhino bug:
Simply speaking, UNCERTAINTY_MEASURE_WITH_UNIT 1.0E-006 may mean precise geometries, e.g., an arc or a straight line. NURBS needs to use a tolerance for non-precise geometries. Rhino document tolerance is for NURBS, and you cannot use the tolerance setting for precise geometries.


Yes that is correct. The Rhino absolute tolerance is what is used for non-precise calculations. This includes the joining of surfaces to create a Brep. If 2 surface edges are within tolerance then the edges can be joined and a new common edge definition is created for both surfaces. The original edge definition is forever lost (unless an undo is used)

Setting the Rhino tolerance to 1.0E-006when opening mm unit document is either a bug or a kick in the teeth to the user.

(Dale Fugier) #35
const ON_3dmUnitsAndTolerances& units = pDoc->Properties().UnitsAndTolerances();

Yes, of course.


The few STEP files created by KeyCreator that I found online all have 1e-6 assigned to UNCERTAINTY_MEASURE_WITH_UNIT no matter the units. This matches the ACIS-based “coincident distance” as explained under Modeling Range on .