Grasshopper

algorithmic modeling for Rhino

Hi

My problem is that when i display some lines in the DrawViewportWires method, they disappear when i zoom closer to them.

I tried to use the 

args.Display.Viewport.SetClippingPlanes(boundingBox);

but it does not help.

If i bake this boundingBox i have no problem to see the lines at all time. But obviously I don't want this box to be shown.

What am I doing wrong?

public override void DrawViewportWires(IGH_PreviewArgs args)
{

for (int i = 0; i < lines.Count; i++)
{
if (!this.Attributes.Selected)
{
args.Display.DrawLine(lines[i], args.WireColour);

}
else
{
args.Display.DrawLine(lines[i], args.WireColour_Selected);

}
}
args.Display.Viewport.SetClippingPlanes(boundingBox);

// overwrite the original
base.DrawViewportWires(args);
}

Views: 493

Replies to This Discussion

Hi Jesper,

it's not technically clipping planes but it's the front and back limits of the depth buffer. You need to inform Rhino that you are going to draw objects in a specific location before the real drawing starts, so Rhino can figure out what range the depth buffer needs to handle. To do this override the ClippingBox() property and return a boundingbox that contains all your geometry.

To be absolutely safe, return the union of your own boundingbox and the base class clipping box.

--

David Rutten

david@mcneel.com

Hi David, Thank once again for the help :-)
This piece of code solved the problem:

public override BoundingBox ClippingBox
{
   get
   {
      return this.boundingBox;
   }
}

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service