Click or drag to resize

File3dmObjectTableAddClippingPlane Method (Plane, Double, Double, Guid)

Adds a clipping plane object to Rhino.

Namespace:  Rhino.FileIO
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 5.0
public Guid AddClippingPlane(
	Plane plane,
	double uMagnitude,
	double vMagnitude,
	Guid clippedViewportId


Type: Rhino.GeometryPlane
A plane.
Type: SystemDouble
The size in U direction.
Type: SystemDouble
The size in V direction.
Type: SystemGuid
The viewport id that the new clipping plane will clip.

Return Value

Type: Guid
A unique identifier for the object.
using System;

partial class Examples
  public static Rhino.Commands.Result AddClippingPlane(Rhino.RhinoDoc doc)
    // Define the corners of the clipping plane
    Rhino.Geometry.Point3d[] corners;
    Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetRectangle(out corners);
    if (rc != Rhino.Commands.Result.Success)
      return rc;

    // Get the active view
    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];

    // Create a plane from the corner points
    Rhino.Geometry.Plane plane = new Rhino.Geometry.Plane(p0, p1, p3);

    // Add a clipping plane object to the document
    Guid id = doc.Objects.AddClippingPlane(plane, p0.DistanceTo(p1), p0.DistanceTo(p3), view.ActiveViewportID);
    if (id != Guid.Empty)
      return Rhino.Commands.Result.Success;
    return Rhino.Commands.Result.Failure;
import Rhino
import scriptcontext
import System.Guid

def AddClippingPlane():
    # Define the corners of the clipping plane
    rc, corners = Rhino.Input.RhinoGet.GetRectangle()
    if rc!=Rhino.Commands.Result.Success: return rc

    # Get the active view
    view = scriptcontext.doc.Views.ActiveView
    if view is None: return Rhino.Commands.Result.Failure

    p0, p1, p2, p3 = corners
    # Create a plane from the corner points
    plane = Rhino.Geometry.Plane(p0, p1, p3)

    # Add a clipping plane object to the document
    id = scriptcontext.doc.Objects.AddClippingPlane(plane, p0.DistanceTo(p1), p0.DistanceTo(p3), view.ActiveViewportID)
    if id!=System.Guid.Empty:
        return Rhino.Commands.Result.Success
    return Rhino.Commands.Result.Failure

if __name__=="__main__":
See Also