I have opened up a DWG file in Rhino and ran a Python script that creates some surfaces back to back. The surfaces are based on curves that the user selects. The surfaces end up having small gaps between some of the surfaces. There aren’t supposed to be any gaps. If I copy every single object from the DWG file to a new Rhino file and run the script, no gaps are created. Why? Any ideas would be greatly appreciated in solving this bizarre issue. I have even reset the scripting engine prior to running the script in the DWG file.
I did further testing by creating a new file using 4 different templates, pasting the objects from the original DWG file into the new file and then running the python script on it. I did this 5 times for each template used to make sure there was consistency in the results.
I am taking an educated guess approach here and concluding that when Rhino opens a DWG file it uses a “small” format template some how or similar settings in the “small” templates.
Question 1: What is the difference between the “large” and “small” templates?
Question 2: Why would using one template over another make any difference at all? In my opinion it should not make any difference. Code is code and it’s all relative anyway to the object sizes and should be calculated as such.
Tolerance is the difference. And tolerance does make a difference.
https://wiki.mcneel.com/rhino/faqtolerances
Essentially computers have a limited number of digits they can use for math. Depending if the model is a small piece of jewelry with prongs, or a college campus size project can set which tolerance is best to use.
Also, depending on the structure of edge curves, fitting may be needed with will refine until it is lower then tolerance. The dirty secret of nurbs solids (in all CAD products) is there actually are gaps. CAD products just ignore them below a certain tolerance.
I thought it might be tolerance but the difference unit tolerance between the small and large templates was 0.001 vs 0.001. I thought both tolerances were small enough in a model that they should act pretty similar…obviously not the same.
Thanks for the help!
Do you know when opening a DWG file with Rhino, does Rhino set the tolerance or is the tolerance in the DWG file? If you don’t know, can you please find out?
I realize that I can always create a new Rhino file and set the tolerance but curious about this due to other users I know simply opening a DWG file directly.
Also I just took a file, increased the unit tolerance from 0.001 to 0.01, and ran my code. As expected it did not create any gaps. I changed the tolerance back to 0.001 and there still are not any gaps. Why is this? I expected there would be gaps after changing the tolerance back. I’m trying to get an insight into how Rhino works behind the scenes so I know how it will affect my code. Please explain.
Food for thought…maybe I need to change the unit tolerance to 0.01 in code, run my code, and then change the tolerance back to the original. What are your thoughts on this?
Furthermore after looking into this, RhinoScript has 3 tolerance settings: UnitAbsoluteTolerance, UnitAngleTolerance, and UnitRelativeTolerance. The first two are on the Options/Unit page but the last one is no where in sight. Where is the relative tolerance?
Documentation says:
BlockquoteReturn or set the document’s relative tolerance. Relative tolerance is measured in percent. See Rhino’s DocumentProperties command (Units and Page Units Window) for details
DocumentProperties takes me to Options/Render which I believe is a bug and needs to be reported. It needs to take the user to Options/Units automatically.
Also there is no Page Units window so the documentation needs to be updated. See here
It even gets more complicated then that, many ApI methods can take their own tolerance and calculate to that level. It is one of the flexibilities that the internal functions allow.
But all of this is a bit academic without examples. Is there a place that the gaps are too marge for the intended purpose?
For rendering joining two surfaces will create a closed render mesh for any rendering necessary. So joining surfaces will visually close that gap.
If there are examples to send we can look a them.