using System;
partial class Examples
{
public static Rhino.Commands.Result AddClippingPlane(Rhino.RhinoDoc doc)
{
Rhino.Geometry.Point3d[] corners;
Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetRectangle(out corners);
if (rc != Rhino.Commands.Result.Success)
return rc;
Rhino.Display.RhinoView view = doc.Views.ActiveView;
if (view == null)
return Rhino.Commands.Result.Failure;
Rhino.Geometry.Point3d p0 = corners[0];
Rhino.Geometry.Point3d p1 = corners[1];
Rhino.Geometry.Point3d p3 = corners[3];
Rhino.Geometry.Plane plane = new Rhino.Geometry.Plane(p0, p1, p3);
Guid id = doc.Objects.AddClippingPlane(plane, p0.DistanceTo(p1), p0.DistanceTo(p3), view.ActiveViewportID);
if (id != Guid.Empty)
{
doc.Views.Redraw();
return Rhino.Commands.Result.Success;
}
return Rhino.Commands.Result.Failure;
}
}
import Rhino
import scriptcontext
import System.Guid
def AddClippingPlane():
rc, corners = Rhino.Input.RhinoGet.GetRectangle()
if rc!=Rhino.Commands.Result.Success: return rc
view = scriptcontext.doc.Views.ActiveView
if view is None: return Rhino.Commands.Result.Failure
p0, p1, p2, p3 = corners
plane = Rhino.Geometry.Plane(p0, p1, p3)
id = scriptcontext.doc.Objects.AddClippingPlane(plane, p0.DistanceTo(p1), p0.DistanceTo(p3), view.ActiveViewportID)
if id!=System.Guid.Empty:
scriptcontext.doc.Views.Redraw()
return Rhino.Commands.Result.Success
return Rhino.Commands.Result.Failure
if __name__=="__main__":
AddClippingPlane()
Partial Class Examples
Public Shared Function AddClippingPlane(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result
Dim corners As Rhino.Geometry.Point3d() = Nothing
Dim rc As Rhino.Commands.Result = Rhino.Input.RhinoGet.GetRectangle(corners)
If rc <> Rhino.Commands.Result.Success Then
Return rc
End If
Dim view As Rhino.Display.RhinoView = doc.Views.ActiveView
If view Is Nothing Then
Return Rhino.Commands.Result.Failure
End If
Dim p0 As Rhino.Geometry.Point3d = corners(0)
Dim p1 As Rhino.Geometry.Point3d = corners(1)
Dim p3 As Rhino.Geometry.Point3d = corners(3)
Dim plane As New Rhino.Geometry.Plane(p0, p1, p3)
Dim id As Guid = doc.Objects.AddClippingPlane(plane, p0.DistanceTo(p1), p0.DistanceTo(p3), view.ActiveViewportID)
If id <> Guid.Empty Then
doc.Views.Redraw()
Return Rhino.Commands.Result.Success
End If
Return Rhino.Commands.Result.Failure
End Function
End Class