Is there a RhinoCommon method that will create a fully-defined simple sweep as such?
- The rail is a border isocurve.
- The shapes are all the isocurves intersecting the rail at its Greville points.
- _Sweep1 and _Sweep2 (with default options) produce the same result.
Below is a script with both the CreateFromSweep method and SweepOneRail class. Neither produce the same result as _Sweep1 for the example geometry below.
Python script
import Rhino.Geometry as rg
import rhinoscriptsyntax as rs
import scriptcontext as sc
def addBreps(rgBreps):
if not rgBreps:
print "Sweep failed."
return
else:
for rgB in rgBreps:
gB_Out = sc.doc.Objects.AddBrep(rgB)
def main():
gRail = rs.GetObject("Select rail", filter=rs.filter.curve)
if not gRail: return
gShapes = rs.GetObjects("Select sweep shapes", filter=rs.filter.curve)
if not gShapes: return
rail = rs.coercecurve(gRail)
shapes = [rs.coercecurve(g) for g in gShapes]
addBreps(rg.Brep.CreateFromSweep(
rail,
shapes,
closed=rail.IsClosed,
tolerance=sc.doc.ModelAbsoluteTolerance))
# addBreps(rg.Brep.CreateFromSweep(
# rail,
# shapes,
# startPoint=rg.Point3d.Unset,
# endPoint=rg.Point3d.Unset,
# frameType=rg.SweepFrame.Freeform,
# roadlikeNormal=rg.Vector3d.ZAxis,
# closed=rail.IsClosed,
# blendType=rg.SweepBlend.Local,
# miterType=rg.SweepMiter.None,
# tolerance=sc.doc.ModelAbsoluteTolerance,
# rebuildType=rg.SweepRebuild.None,
# rebuildPointCount=0,
# refitTolerance=0.0))
# addBreps(rg.Brep.CreateFromSweepSegmented(
# rail,
# shapes,
# closed=rail.IsClosed,
# tolerance=sc.doc.ModelAbsoluteTolerance))
rgSweep1 = rg.SweepOneRail()
rgSweep1.ClosedSweep = rail.IsClosed
rgSweep1.SweepTolerance = sc.doc.ModelAbsoluteTolerance
addBreps(rgSweep1.PerformSweep(
rail=rail,
crossSections=shapes))
sc.doc.Views.Redraw()
if __name__ == '__main__': main()
ForSimpleSweep.3dm (51.0 KB)