DisplayConduit and Clipping


#1

Using Python i´m drawing objects (eg. a box) in a display conduit which is runs permanently by using DrawForeground. The box stays visible until i toggle the state of the conduit. So far that works but if i zoom out or especially if i add objects via Rhino’s interface, the dynamically drawn box gets partially clipped. Further if i delete regular rhino objects, the dynamically drawn box disappears if i´ve zoomed far out. Once i zoom way in, or add regular geometry using Rhino’s tools, it gets visible.

How to control this so my object(s) drawn dynamically stay visible (unclipped) at any time ?

I´m not shure its something like the second example class shown here, i guess i need to overide CalculateBoundingBox eventhandlers via python and add the box points ?

thanks,
c.


(Dale Fugier) #2

Yep.


#3

Thanks Dale, but i´m not shure how to overide it, do i have to put it under the same class and use a similar construction like when using DrawForeground ?

class CustomTestConduit(Rhino.Display.DisplayConduit):

    def CalculateBoundingBox(self, e):
        e.BoundingBox.Union(Rhino.Geometry.Point3d( 1000.0, 1000.0, 1000.0))
        e.BoundingBox.Union(Rhino.Geometry.Point3d(-1000.0,-1000.0,-1000.0))

    def DrawForeground(self, e):
        .......

this does not seem to do anything yet :blush:

c.


(Steve Baer) #4

You’re so close. It is

bbox = Rhino.Geometry.BoundingBox(-1000,-1000,-1000,1000,1000,1000)
e.IncludeBoundingBox(bbox)

#5

Thank you both, it works !

c.