|
| 1 | +#!/usr/bin/env python |
| 2 | +## |
| 3 | +##This file is part of pythonOCC. |
| 4 | +## |
| 5 | +##pythonOCC is free software: you can redistribute it and/or modify |
| 6 | +##it under the terms of the GNU Lesser General Public License as published by |
| 7 | +##the Free Software Foundation, either version 3 of the License, or |
| 8 | +##(at your option) any later version. |
| 9 | +## |
| 10 | +##pythonOCC is distributed in the hope that it will be useful, |
| 11 | +##but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | +##GNU Lesser General Public License for more details. |
| 14 | +## |
| 15 | +##You should have received a copy of the GNU Lesser General Public License |
| 16 | +##along with pythonOCC. If not, see <http://www.gnu.org/licenses/>. |
| 17 | + |
| 18 | +from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox |
| 19 | +from OCC.AIS import AIS_Shape |
| 20 | +from OCC.Quantity import Quantity_NOC_BLACK |
| 21 | +from OCC.Display.SimpleGui import init_display |
| 22 | + |
| 23 | +display, start_display, add_menu, add_function_to_menu = init_display() |
| 24 | + |
| 25 | +myBox = BRepPrimAPI_MakeBox(60,60,50).Shape() |
| 26 | +context = display.Context |
| 27 | +context.SetAutoActivateSelection(False) |
| 28 | + |
| 29 | +aisShape = AIS_Shape(myBox) |
| 30 | +h_aisShape = aisShape.GetHandle() |
| 31 | +context.Display(h_aisShape) |
| 32 | + |
| 33 | +# Set shape transparency, a float number from 0.0 to 1.0 |
| 34 | +context.SetTransparency(h_aisShape, 0.6) |
| 35 | +context.HilightWithColor(h_aisShape, Quantity_NOC_BLACK) |
| 36 | + |
| 37 | +display.View_Iso() |
| 38 | +display.FitAll() |
| 39 | +start_display() |
0 commit comments