I am trying to do a sweep 2 rails with python, and understand it
This is what I got so far cobbling together bits from various searches here and the RhinoCommon SDK docs. Code:
import Rhino import Rhino.Geometry as rg import scriptcontext as sc import rhinoscriptsyntax as rs def Sweep2(): rail1 = rs.GetObject("Select first rail curve", rs.filter.curve) rail_crv1 = rs.coercecurve(rail1) if not rail_crv1: return rail2 = rs.GetObject("Select second rail curve", rs.filter.curve) rail_crv2 = rs.coercecurve(rail2) if not rail_crv2: return cross_sections = rs.GetObjects("Select cross sections", rs.filter.curve) if not cross_sections: return cross_sections = [rs.coercecurve(crv) for crv in cross_sections] sweep = rg.SweepTwoRail() sweep.AngleToleranceRadians = sc.doc.ModelAngleToleranceRadians sweep.ClosedSweep = False sweep.SweepTolerance = sc.doc.ModelAbsoluteTolerance surface1 = sweep.PerformSweep(rail_crv1, rail_crv2, cross_sections) sc.doc.Objects.AddBrep(surface1) #sc.doc.Views.Redraw() if __name__ == "__main__": Sweep2()
The last error I was getting …
Can someone guide me a bit? looking here & here … still confused.