I wanted to improve this (recommendations are welcome), so I thought I could try some of the methods in RhinoCommon as I think there are some more options to try. However, the different methods output a bit of a weird result (Brep.CreateFromSweep shown), especially as the shape does not follow the rail!!
I just want to understand what is happening here with the CreateFromSweep method, and why such different results out of the methods. Also, any recommendations to produce a output that does not self intersect.
You have a Sweep1 with only one section curve (triangle) placed at the end of the rail curve instead of its start. Flipping the rail curve is part of a solution. Using aligned pFrames helps to overcome the effect of torsion. There are still some issues at tight turns that are common to both methods, but otherwise they look the same.
In this case, there is only a slight difference in volume (in the fourth decimal place) of the capped sweep between many aligned sections vs. only one section. No visual difference in shape.
Ok, I got something with good quality by using an offset from the rail curve and making sure it does not have a sharp corner where the offset âcollapsesâ (using fillet curve). The offset is set so it aligns with the shape section. Then using sweep2 with both rails:
I would still be interested to see if there is something that can handle a sweep and avoid self-intersections in a more âgeneralâ way and not specific to this problem.
There is a way. You need to provide railing curves which are composed out of simple and clean curves which share the same properties as their counterpart (=âoffsetâ). Direction, Amount of control-points, relative spacing etc.. everything should only differ minimal. These curves should be continuous, at least G1, better G2..
This purple group goes to extremes to create a filleted polyline rail. That rail could have been created differently (better) in the first place!
It also implements Sweep2. You can examine and compare them, including one section vs. many. Note that âCountâ (PFrames âNâ input) makes a difference too It is what it is.
Thanks for the proposed modifications to the original curve.
However, I would say the modification will not work on what I am trying to do. The rail curve is part of a brep, which will be combined with the output of the sweep (BooleanUnion) to make a single body. The output needs to be whithin tolerance of the original rail curve to work:
Thanks Already seeing that the union brep will tend to fail if I am not including some overlapping, so actually might be able to use a curve that deviates from the original.