DrawObject with applied Transform object clipping


#1

So I’m trying to display an object whose Transform gets updated every 10ms or so. To do this, I’m using a custom Display Conduit and the DrawObject method:

var o = e.RhinoDoc.Objects.Find(rpo.Guid);
e.Display.DrawObject(o, newX);    

So far, so good. However, once these objects transform themselves far enough away from their parent objects, they start to get clipped. I’ve tried to override the CalculateBoundingBox function, but they still get clipped:

base.CalculateBoundingBox(e);
e.BoundingBox.Transform(Transform.Scale(Point3d.Origin, 100.0));

Screenshot:

Also, how would I change the display material of the transformed object? It seems that I can only use DrawMesh(Mesh, Material) on the parent object (i.e. object before Display transformation)…


(Steve Baer) #2

Inside of your CalculateBoundingBox function, call
e.IncludeBoundingBox(box);

where box is the bounding box of your geometry.


#3

Hi Steve,
Doesn’t seem to work:

protected override void CalculateBoundingBox(CalculateBoundingBoxEventArgs e)
{
base.CalculateBoundingBox(e);
var box = new BoundingBox(new Point3d(1000.0, 1000.0, 1000.0), new Point3d(-1000.0, -1000.0, -1000.0));
e.IncludeBoundingBox(box);
}

(Steve Baer) #4

I haven’t tested, but that BoundingBox constructor looks bad. Try switching min and max


#5

That fixed it - thanks!