this is my first post. I do develop software with VB and Rhinocommon and never found problems.
This is my first one.
Please look at the attached 3dm. I have to generate a sweep one rail where the closed curve is the rail and the triangle is the section moving along. Triangle is placed on curve’s start point.
If I try to create the sweep through Rhino interface, sweep is created and looks fine.
If I try to create the sweep using this VB code sweep fails and gets nothing back.
Could you please help me figuring where my mistake is? Here’s the basic 3dm.
Thank you so much
no_sweep.3dm (22.6 KB)
See if this doesn’t work any better.
Protected Overrides Function RunCommand(ByVal doc As RhinoDoc, ByVal mode As RunMode) As Result Dim gr = New GetObject() gr.SetCommandPrompt("Select rail") gr.GeometryFilter = ObjectType.Curve gr.SubObjectSelect = False gr.Get() If gr.CommandResult() <> Result.Success Then Return gr.CommandResult() End If Dim railCurve As Curve = gr.Object(0).Curve() If railCurve Is Nothing Then Return Result.Failure End If Dim gs = New GetObject() gs.SetCommandPrompt("Select cross section curve") gs.GeometryFilter = ObjectType.Curve gs.SubObjectSelect = False gs.EnablePreSelect(False, True) gs.DeselectAllBeforePostSelect = False gs.Get() If gs.CommandResult() <> Result.Success Then Return gs.CommandResult() End If Dim shapeCurve As Curve = gs.Object(0).Curve() If shapeCurve Is Nothing Then Return Result.Failure End If Dim breps = Brep.CreateFromSweep(railCurve, shapeCurve, False, doc.ModelAbsoluteTolerance) For i As Integer = 0 To breps.Length - 1 doc.Objects.AddBrep(breps(i)) Next doc.Views.Redraw() Return Result.Success End Function
thank you very much, your solution sorted it out