Remove Duplicate Curves

Searching the forum for a solution to my dilemma yielded a couple of suggestions, both of which I tried. Please see below.

I called the General Manager of a local machine shop to ask what he needed for a request for a quote. He requested that I send him DXF files for the parts.

I thought I had deleted by inspection some extra geometry. I then “selected all” in one of the viewports for each of these two separate parts in separate files and chose File>Export Selected and emailed the DXFs. The GM then forwarded the files to the CAM specialist to see what they looked like.

The specialist reported to the General Manager the following:

“These .DXFs have multiple lines stacked on top of each other that is going to make them very hard to program. Can he take some of the excess geometry out of them?”

Evidently, my inspection was not thorough enough. So, hanging my head in shame, I searched the forums and found discussion suggesting the use of SelDup. I tried that on both 3dm files and it returned: No duplicates found. Nothing added to the selection.

I then tried the suggestion to use RemoveDuplicateLines in Kangaroo. I was successful in installing kangaroo099 and kangaroo202 in Grasshopper but am clueless about how to implement that.

Any guidance in how to remove excess geometry would be greatly appreciated. Thanks.

Pinion_Gear_01_05_16.dxf (2.1 MB)
Pinion_Gear_01_05_16.3dm (2.2 MB)
main_gear_01_05_16_w_slots.3dm (4.6 MB)
main_gear_01_05_16_w_slots.dxf (6.2 MB)

Hi David,

Saving the gears as .Dxf has created geometry from the surface isocurves so when the machinist picks a curve in plan view, he finds a stack - see image. If it’s a 3D they request, perhaps an .iges or .stp or whatever 3D file they can read would be better.

Otherwise you could extract the geometry from the model that you wish to send - see image, or create a sketch, or along these lines…

Thank you, Brian.
They specifically requested DXFs. Perhaps extracting the geometry might be the best approach. I’ll look it up and see if I can figure it out.

David, try using the ‘2004 Solids’ export scheme, (I’ve just realised), I think you may have used ‘2004 Lines’…

1 Like

Brian, actually, I used the default (I didn’t pick any particular scheme). I’ve tried ‘2004 Solids’ export scheme and will run that by the machine shop. Fingers crossed!

Thanks again!

Hi David,

As its name says, Kangaroo’s “RemoveDuplicateLines” component will remove only lines (1st degree curves).

For curves of any degree use the following python script: (9.7 KB)
Unlike Rhino’s SelDup command, it can also select duplicates curves, regardless if their direction is reversed, or if they are scattered around the space.


Djordje -

This is awesome. Can’t wait to try it out.

Thank you.


Hi djordje,
Thank you! That is awesome! I think. :confused:
I ran it on both files and it did not find any curves to remove. I was unable to select any curves. I tried exploding the solid (Pinion_Gear_01_05_16.3dm) but that made no difference. I also tried changing command line options to no avail. Any clue as to what I’m missing?
I copied and pasted the output of the Python Script Editor into the attached txt file.

selectDuplicateCurves.py_output.txt (332 Bytes)

Hi David

First I’d try to know exactly what your supplier wants.
The pinion dxf has no duplicated curves
The main dxf has duplicated curves on the naked edges of the polysurface only.
I think the supplier may expect a 2D drawing and projects your 3D curves onto the XY plane.
That way, obviously several duplicated curves appear.
If, on the other hand, the supplier really wants 3D data, but there are too many curves, you can DupEdge the solids and then remove any undesired curve before exporting to DXF.
You can also hide the isocurves before running DupEdge, that would only keep the curves at the border of the surfaces.

HTH, cheers

P.S. Oh … a bit late, but … Happy new year !

Hi David,

I opened the Pinion_Gear_01_05_16.3dm file and there are no curves present. You can check this by running Rhino: SelCrv command.
The error you get is a consequence of that, it’s not that something is wrong with the python script. Although I can add something like: “You did not select any curves”, which is what the version below does: (9.8 KB)

Your main_gear_01_05_16_w_slots.3dm file does contain some curves, but no duplicate ones.

You folks are awesome. Evidently BrianM’s suggestion to export with the ‘2004 Solids’ export scheme did the trick, as the vendor replied to the revised DXFs and asked about material thickness and replied later with a quote.
I am blown away by the level of help I’ve gotten here. I am so glad I chose Rhino. Happy belated New Year everyone!

Thanks a lot djordje!