f.kato
(F Kato)
September 3, 2020, 1:16pm
1
Hi all,
I am working on custom clipping box plug-in with DisplayPipeline.AddClippingPlane method that attach clipping plane of each faces of Box object.
It works fine but the plane clips objects on all viewports, if I moved the plane.
I need to turn on and off the clipping view of each viewport like “Top” = on, "Front = off, “Rhight”= on.
Is there any DisplayConduit method for that?
I went through Rhinocommon API and sample programs, but did not find solution yet.
Rhino.DisplayDisplayConduit.txt (2.1 KB)
Thank you
Kato
f.kato
(F Kato)
September 3, 2020, 1:20pm
2
My program for clipping plane is this
class DrawClippingPlanesConduit : Rhino.Display.DisplayConduit
{
private readonly ClipGumballBox d_box;
private readonly Point3d[] d_corners;
private readonly Point3d d_center;
private readonly Point3d XplusCenter;
private readonly Vector3d XplusVec;
private readonly Point3d XminusCenter;
private readonly Vector3d XminusVec;
private readonly BoundingBox m_bbox;
public DrawClippingPlanesConduit(ClipGumballBox box)
{
d_box = box;
//edge_lines = d_box.BoundingBox.GetEdges();
m_bbox = d_box.box.BoundingBox;
d_corners = d_box.box.GetCorners();
d_center = d_box.Center;
Plane planeXplus = new Plane(d_corners[2], d_corners[1], d_corners[6]);
XplusCenter = planeXplus.ClosestPoint(d_center);
XplusVec = new Vector3d(d_center - XplusCenter);
Plane planeXminus = new Plane(d_corners[0], d_corners[3], d_corners[4]);
XminusCenter = planeXminus.ClosestPoint(d_center);
XminusVec = new Vector3d(d_center - XminusCenter);
}
protected override void CalculateBoundingBox(CalculateBoundingBoxEventArgs e)
{
base.CalculateBoundingBox(e);
e.IncludeBoundingBox(m_bbox);
}
protected override void PreDrawObjects(DrawEventArgs e)
{
base.PreDrawObjects(e);
e.Display.AddClippingPlane(XplusCenter, XplusVec);
e.Display.AddClippingPlane(XminusCenter, XminusVec);
}
public class ClippingBox : Rhino.Commands.TransformCommand
{
public Box basebox;
static DrawClippingPlanesConduit m_draw_clipping_planes;
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
///
to do program here
///
m_draw_clipping_planes = new DrawClippingPlanesConduit(base_box);
m_draw_clipping_planes.Enabled = true;