예제 #1
0
    def Display(self, context, material=Graphic3d_NOM_ALUMINIUM, color=None):
        """Displays all components of this instance to input context

        Parameters
        ----------
        context : OCC.Display.OCCViewer.Viewer3d or WebRenderer
            The display context - should have a Display or DisplayShape method

        meterial : OCC.Graphic3d_NOM_* type (default=ALUMINIUM)
            The material for display: note some renderers do not allow this

        color : string
            The color for all components in this shape
        """
        for name, component in self.items():
            ais = AIS_Shape(component)
            ais.SetMaterial(material)
            if color:
                try:
                    from OCC.Display.OCCViewer import get_color_from_name
                    color = get_color_from_name(color)
                except:
                    pass
                ais.SetColor(color)
            try:
                context.Context.Display(ais.GetHandle())
            except:
                context.DisplayShape(component)
예제 #2
0
 def Display(self, context, material=Graphic3d_NOM_ALUMINIUM, color=None):
     print("display-Part")
     for name, component in self.items():
         ais = AIS_Shape(component)
         ais.SetMaterial(material)
         if color:
             try:
                 from OCC.Display.OCCViewer import get_color_from_name
                 color = get_color_from_name(color)
             except:
                 pass
             ais.SetColor(color)
         try:
             context.Context.Display(ais.GetHandle())
             #context.register_select_callback(print_xy_click)
         except:
             context.DisplayShape(component)