Created
April 30, 2012 15:50
-
-
Save sbaer/2559479 to your computer and use it in GitHub Desktop.
Brep.CreateFromSweep Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Protected Overrides Function RunCommand(ByVal doc As RhinoDoc, ByVal mode As Rhino.Commands.RunMode) As Rhino.Commands.Result | |
Dim command_rc As Rhino.Commands.Result | |
' Sweep the cross section | |
Dim rhobj As Rhino.DocObjects.ObjRef = Nothing | |
command_rc = Rhino.Input.RhinoGet.GetOneObject("Profile shape", False, DocObjects.ObjectType.Curve, rhobj) | |
If command_rc <> Commands.Result.Success Then Return command_rc | |
Dim shape As Rhino.Geometry.Curve = rhobj.Curve() | |
If shape Is Nothing Then Return Commands.Result.Failure | |
doc.Objects.UnselectAll() | |
command_rc = Rhino.Input.RhinoGet.GetOneObject("Sweep curve", False, DocObjects.ObjectType.Curve, rhobj) | |
If command_rc <> Commands.Result.Success Then Return command_rc | |
Dim rail As Rhino.Geometry.Curve = rhobj.Curve() | |
If rail Is Nothing Then Return Commands.Result.Failure | |
Dim breps() As Rhino.Geometry.Brep = Rhino.Geometry.Brep.CreateFromSweep(rail, shape, rail.IsClosed, doc.ModelAbsoluteTolerance) | |
For Each brep As Rhino.Geometry.Brep In breps | |
doc.Objects.AddBrep(brep) | |
Next | |
doc.Views.Redraw() | |
Return Rhino.Commands.Result.Success | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment