Is there a way to control whether the results of AddSweep1 outputs freeform or roadlike? It seems to me that freeform is the only output I’m seeing.
Thanks,
Dan
Is there a way to control whether the results of AddSweep1 outputs freeform or roadlike? It seems to me that freeform is the only output I’m seeing.
Thanks,
Dan
Although there is an option for sweep style in RhinoScript’s AddSweep1, RhinoPython rhinoscriptsyntax’s AddSweep1 is using an overload that doesn’t control the sweep style:
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Brep_CreateFromSweep_5.htm
V7 RhinoCommon’s Brep class has an overload with sweep style control:
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Brep_CreateFromSweep_4.htm
Thanks Steve. I’ll check out your link.
Edit:
Steve, would you happen to have a short example of how to use this in Python?
Thanks,
Dan
I haven’t tested this:
import Rhino.Geometry as rg
import rhinoscriptsyntax as rs
import scriptcontext as sc
def main():
gCrv_Rail = rs.GetObject("Select rail curve", filter=rs.filter.curve)
if not gCrv_Rail: return
gCrvs_Shapes = rs.GetObjects("Select shape curves", filter=rs.filter.curve)
if not gCrvs_Shapes: return
rgCrv_Rail = rs.coercecurve(gCrv_Rail)
rgCrvs_Shapes = [rs.coercecurve(g) for g in gCrvs_Shapes]
rgBreps = rg.Brep.CreateFromSweep(
rail=rgCrv_Rail,
shapes=rgCrvs_Shapes,
startPoint=rg.Point3d.Unset,
endPoint=rg.Point3d.Unset,
frameType=rg.SweepFrame.Roadlike,
roadlikeNormal=rg.Vector3d.ZAxis,
closed=False,
blendType=rg.SweepBlend.Local,
miterType=rg.SweepMiter.Trimmed,
tolerance=sc.doc.ModelAbsoluteTolerance,
rebuildType=rg.SweepRebuild.None,
rebuildPointCount=0,
refitTolerance=0.0)
if not rgBreps:
print "Sweep failed."
return
for rgB in rgBreps:
sc.doc.Objects.AddBrep(rgB)
sc.doc.Views.Redraw()
if __name__ == '__main__': main()
Thanks Steve, this was super helpful,
Have a good weekend,
Dan