Hello. I’m trying to take GIS output & create a cutting path. I was hoping that Rhino would be the right tool to do this, but many problems have arisen.
There are hundreds, if not thousands of lines to process, so any intervention or tweaking on a per contour level would be bad, and drawing the curves manually won’t happen. A GIS contour often has hundreds of thousands of points, so even Rebuild’s 5000 point limit is an issue.
Each contour visually looks continuous until you get in close. A typical line is composed of hundreds of curves. There are over lapping pieces, broken lines, lines which double back on themselves, there are loops, and cantor dust. There are long parallel sections which technically shouldn’t be bridged. The lines are garbage. I’m trying to turn them into a continuous curve.
So far every combination of SelDup Join Explode SelSmall & messing with Tolerances has triggered as many problems as they have solved.
I’m not terribly well versed in Rhino so I’m hoping there is a solution I haven’t found yet. Something like the Shrinkwrap tool, but for curves instead of volumes?
I dont know what you mean by continuous - your file containes 1356 polylines.
of 430927 points in total.
I can reduce it to 1351 polylines from 298120 points. without visible changes
-so what do you need?
do you need to change the shape? make it continuous? simplify further?
Yes, this is typical bad data, extracted from an overly detailed (for your purposes) DEM file.
What I suggest is this:
Use SelShortCrv and start with a value of something like 0.5 or 1.0. this will select all the very short curves in the document - they are basically noise. Put them on another layer (you can make several) and turn the layers off. For example if I use 1.0, I am left with 209 curves instead of 1351. If I go up to 5.0, I have only 75 curves left.
You can then use ReducePolyline with a certain value to remove superfluous points with a tolerance. For example using 0.01 can reduce the total point count from 400K+ to around 75K. A larger tolerance will reduce the point count further, but things can move within the tolerance you give it. This will however not smooth out the jaggedness of the data.
To make this stuff nicer, you need several different algorithms. I use the following script which includes the point count reduction plus some smoothing options:
One can also use Grasshopper to do something similar, with the advantage of a live preview. In the upcoming V9, Rebuild (Elmo) may also be intelligent enough to fix these types of curves as well - I have not yet tried that. Note that none of this will fix the gaps in the curves preventing them from joining. You will first need to process the curves as above to get them managable, then fix the remaining gaps yourself.
Below is a quick attempt using the values FittingTolerance=0.05 SmoothFactor=0.2 SmoothIterations=50 OutputSplines=No
Point count has been reduced by 95% and curves have been smoothed. The smoothing may be too much, that will depend on the ultimate goal. One can play with the values to get the desired result.
before you get a heart attack trying to process the crap data, maybe there is a different way to get more accurate usable files from different sources. specifically if its a landscape model for cnc there are often quite a few sources with mesh in place already which you could contour yourself in a much much faster time span.
what might help beyond the given suggestions and scripts would still be SelClosedCrv gets rits of a bunch of “islands” that dont add much to the wannabe continuous curve. after that SelSmalla few open islands you might have to visually get rid off or fix. its a few minutes work per slide if you have a bunch that might still be a bit work but maybe manageable. if the exact crazy edges are not needed you can use the Convert to reduce that.
what really might help
if you want to be just plain brutal, increase your tolerance settings in your Rhino Units settings to 0.1 or higher then use Join that will bench them together like butter and also simplify the curves very radically, all in one step which works really well if you dont need the extra details.
or leave the tolerance but use the command Join without preselecting which lets you join bigger gaps. and as far as i can tell will only move the end points closer to each other. so call Join then select the ends close to each other, it will prompt by how much it will deviate to join then hit enter and end the command you will end up with quickly joined lines either, just note that some gaps might then still be too big, you can use the command a few times, the stubborn ones will join but some may still need a different tolerance settings. so for this exact file its a foot work of about 3-4 minutes so not extreme.