For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Visibility of edges & vertexes through shells

Eric Pawtowski's picture
Forums: 

I'm making an app that's primarily for visualization, not manipulation.  That is, I just want to show the user how things relate to each other, they don't have to be able to change much.  My app is based off of 'wxDisplay.py' and 'OCCViewer.py'.

What I've got is a bunch of solid objects, lines, and points.  Everything is passed into DisplayShape (in class Viewer3d from OCCViewer.py).  The solids are passed in as OCCTopoDS.TopoDS_Shell, the lines are OCCTopoDS.TopDS_Edge, the points are OCCTopoDS.TopoDS_Vertex.  All are made into objects of type AIS_Shape, which are displayed.  Note that the lines/points are *NOT* edges or vertices of the shells: they could be anywhere, inside a shell, next to it, whatever.

My problem:  I want to be able to see the lines & points through the solids. I tried making the solids partially transparent, but that isn't really what I want, because the solids still obscure the view of the other geometry unless I make them so transparent you can hardly see the solids anymore.  What I want is for the lines & points to be completely visible to the viewer, even if they are on the other side of a non-transparent solid, i.e. their visualization needs to be 'on top' of the solids. I tried using Deactivate on the solids and Activate on the lines/points, which lets me select them through the solids but I still can't see them.  Anyone have an idea of what path I should try next?

Kirill's picture

You should take a look onto ZLayer property of Presentable Object, see also Graphic3d_ZLayerId enumeration values.

Eric Pawtowski's picture

That worked!

In case someone else has this issue, the solution was to set up the layers as follows:

        obj_viewer = self.display.Viewer
        
        self.int_ZlayerID_solids = obj_viewer.AddZLayer()[1]
        self.int_ZlayerID_geom = obj_viewer.AddZLayer()[1]
        
        obj_Zsettings_1 = obj_viewer.ZLayerSettings(self.int_ZlayerID_solids)
        obj_Zsettings_2 = obj_viewer.ZLayerSettings(self.int_ZlayerID_geom)
        
        obj_Zsettings_1.SetDepthOffsetNegative()
        obj_Zsettings_2.SetDepthOffsetPositive()
        
        obj_viewer.SetZLayerSettings(1, obj_Zsettings_1)
        obj_viewer.SetZLayerSettings(2, obj_Zsettings_2)

And then anytime any AIS_Shape is created or recolored, use

         self.Context.SetZLayer(obj_displayhandle, self.int_ZlayerID_solids)

or

          self.Context.SetZLayer(obj_displayhandle, self.int_ZlayerID_geom)

as appropriate.