Our code for a RhinoCommon plugin command does not give the desired sweep 2 rails behavior in Rhino 6 (Version 6 SR26 (6.26.20126.12201, 5/5/2020).
Errant sweep using RhinoCommon:
Correct sweep using GUI (manual rail/shape selection):
Code:
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
Curve curve1 = null;
Curve curve2 = null;
Curve line1 = null;
var curveObjs = doc.Objects.GetObjectList(Rhino.DocObjects.ObjectType.Curve);
foreach (Rhino.DocObjects.RhinoObject crvObj in curveObjs)
{
Rhino.DocObjects.ObjRef objref = new Rhino.DocObjects.ObjRef(crvObj.Id);
Curve crv = objref.Curve();
switch (crvObj.Attributes.Name)
{
case "trimCL":
curve1 = crv;
break;
case "intCrv":
curve2 = crv;
break;
case "line1":
line1 = crv;
break;
}
}
double tolerance = doc.ModelAbsoluteTolerance;
if (curve1 !=null && curve2 != null && line1 != null)
{
Brep[] botmSweep = Brep.CreateFromSweep(curve1, curve2, line1, false, tolerance);
doc.Objects.AddBrep(botmSweep[0]);
}
return Result.Success;
}
We’ve also tried the CreateFromSweep overrides and the SweepTwoRail class. Any additional suggestions would be appreciated.