Obj export and tolerances

Hi, I needed to export the control points, the knots and the polynomial degree of a geometry in order to read them in excel, therefore I exported my geometry using the*obj file.
What I would like to do now is to export the geometry applying a tolerance in order that some points close to each other can be recognized as the same point.
I mean, I have for example two points with coordinates:
0.245693 and 0.245690. What I would like to do is to set the precision to 0.24569 or to merge them in only one point since the two points arise due to a bad modelling. How can I do it?
Thanks a lot in advance.

Hello - you’ll need some scripting for this -

-Pascal

Hi, thank you for your reply.
Do you know if there’s something already existing for doing this using Rhino.Python? I am a beginner on Rhino.Python and unfortunately I have a very tight schedule to export this tricky geometry…

Hello - rereading your comments, are you looking to eliminate duplicate control points in the surface, or only in the exported information? Keep in mind that a surface cannot be recreated from this information by simply leaving out control points, if that is the goal.

-Pascal

I am trying to eliminate duplicate control points only in the exported information without doing it manually.
My geometry is made up of four patches i.e. 4 different surfaces each with its own control points.
These surfaces have in common the edges and even if I made my best to be accurate, some of the control points along the edges of two surfaces are slightly different and when I export them I can see they have different decimals.
What I would like to do is to export each single surface with the *obj function having for the edges the same control points instead of correcting them manually.

Hello - I see - if we can ‘fix’ the surfaces automatically in Rhino, then you use what ever export workflow you are currently using, would that do it?

-Pascal

Yes of course.
If the surfaces in Rhino would perfectly match, then I assume the export through *obj will have no “errors”.

Hello - if you use MatchSrf > Position, with match by closest points un-checked, does that get things close enough? And can’t you do this in excel? Round the numbers?

@robertoruggeri - see if this gets things close enough -

SrfTuneup.py (2.9 KB)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

-Pascal

Hi @pascal thank you for your reply.
Unfortunately both of the ways you’re proposing are not working.
In particular the Python script gives me this error after I select my surfaces:
image

Thank you in advance for your help.

Hello - please post, or send me the surfaces.

-Pascal

Here’s the file
Surface.3dm (84.3 KB)

Hello - is this the level of discrepancy you are looking at cleaning up?

ON_Point: (-12.037037037037038, 9.9585608853592115e-11, 2.370370370370372)

ON_Point: (-12.037037037037042, 9.9585545408330765e-11, 2.3703703703703729)

My script did have a mistake in it, but nevertheless, removing that noise at the end is probably much easier and more reliable in Excel.

SrfTuneup.py (2.9 KB)

-Pascal