Public Overrides Function RunCommand(ByVal context As IRhinoCommandContext)_
As IRhinoCommand.result
'get a surface
Dim getsurface As New MRhinoGetObject()
getsurface.SetCommandPrompt("Select Surface")
getsurface.SetGeometryFilter(IRhinoGetObject.GEOMETRY_TYPE_FILTER.surface_object_
Or IRhinoGetObject.GEOMETRY_TYPE_FILTER.polysrf_object)
getsurface.GetObjects(1, 1)
If (getsurface.CommandResult() <> IRhinoCommand.result.success) Then
Return getsurface.CommandResult()
End If
'get a curve
Dim getcurve As New MRhinoGetObject()
getcurve.SetCommandPrompt("Select Curve")
getcurve.SetGeometryFilter(IRhinoGetObject.GEOMETRY_TYPE_FILTER.curve_object)
getcurve.GetObjects(1, 1)
If (getcurve.CommandResult() <> IRhinoCommand.result.success) Then
Return getcurve.CommandResult()
End If
Dim brep As IOnBrep = getsurface.Object(0).Brep()
Dim curve As IOnCurve = getcurve.Object(0).Curve()
If (brep Is Nothing Or curve Is Nothing) Then
Return IRhinoCommand.result.failure
End If
Dim tol As Double = context.m_doc.AbsoluteTolerance()
Dim curves(0) As OnCurve
Dim points As New On3dPointArray
Dim rc As Boolean = RhUtil.RhinoCurveBrepIntersect(curve, brep, tol, curves, points)
If (rc = True) Then
For i As Integer = 0 To points.Count() - 1
context.m_doc.AddPointObject(points(i))
Next
context.m_doc.Redraw()
End If
Return IRhinoCommand.result.success
End Function