@fernandomaytorena,
i think scripting will give you the similar problems, since python uses the same RhinoCommon based code from the sdk as the new gh Sweep2 component uses. To check this, paste below script into the python editor (_EditPythonScript
):
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def Sweep2Rails(r1, r2, s, maintain_height=False, closed=False):
sweep = Rhino.Geometry.SweepTwoRail()
sweep.AngleToleranceRadians = scriptcontext.doc.ModelAngleToleranceRadians
sweep.SweepTolerance = scriptcontext.doc.ModelAbsoluteTolerance
sweep.MaintainHeight = maintain_height
sweep.ClosedSweep = closed
return sweep.PerformSweep(r1, r2, s)
def DoSomething():
id_r1 = rs.GetObject("Select first rail", 4, True, False)
if not id_r1: return
id_r2 = rs.GetObject("Select second rail", 4, False, False)
if not id_r2: return
id_s = rs.GetObjects("Select cross section curves", 4, False, False, False)
if not id_s: return
r1 = rs.coercecurve(id_r1, -1, True)
r2 = rs.coercecurve(id_r2, -1, True)
s = [rs.coercecurve(id, -1, True) for id in id_s]
rc = Sweep2Rails(r1, r2, s, maintain_height=True, closed=False)
if rc:
breps = [scriptcontext.doc.Objects.AddBrep(brep) for brep in rc]
scriptcontext.doc.Views.Redraw()
return breps
DoSomething()
At the moment, the function call (line 25 in the script above) creates the sweep2 with
Sweep2Rails(r1, r2, s, maintain_height=True, closed=False)
If you try the script using 2 closed rails, it will create a brep and maintain height works. If you set closed=True
, there often is no output. Try the example file below with the script.
@dale, i think this is a bug in RhinoCommon which affects python and gh.
Sweep2Rail.3dm (72.3 KB)
c.