def show_grid(self, step=1., size=10. + 1e-6, color1=(.7, .7, .7), color2=(0, 0, 0)): viewer = self._get_viewer() viewer.ActivateGrid(Aspect_GT_Rectangular, Aspect_GDM_Lines) viewer.SetRectangularGridGraphicValues(size, size, 0) viewer.SetRectangularGridValues(0, 0, step, step, 0) grid = viewer.Grid() grid.SetColors(Quantity_Color(*color1, TOC_RGB), Quantity_Color(*color2, TOC_RGB))
def to_occ_color(color) -> Quantity_Color: if not isinstance(color, QColor): if isinstance(color, tuple): if isinstance(color[0], int): color = QColor(*color) elif isinstance(color[0], float): color = QColor.fromRgbF(*color) else: raise ValueError('Unknown color format') else: color = QColor(color) return Quantity_Color(color.redF(), color.greenF(), color.blueF(), TOC_RGB)
def prepare_display(self): view = self.view params = view.ChangeRenderingParams() params.NbMsaaSamples = 8 params.IsAntialiasingEnabled = True view.TriedronDisplay( Aspect_TypeOfTriedronPosition.Aspect_TOTP_RIGHT_LOWER, Quantity_Color(), 0.1) viewer = self.viewer viewer.SetDefaultLights() viewer.SetLightOn() ctx = self.context ctx.SetDisplayMode(AIS_DisplayMode.AIS_Shaded, True) ctx.DefaultDrawer().SetFaceBoundaryDraw(True)
def get_occ_color(ais : AIS_ColoredShape) -> QColor: color = Quantity_Color() ais.Color(color) return QColor.fromRgbF(color.Red(), color.Green(), color.Blue())