示例#1
0
 def on_topology_solids(self, event):
     r"""Display another viewer with solid topology"""
     dialog = wx.Dialog(self, title="Topology - Solids")
     panel = Wx3dViewer(dialog,
                        viewer_background_color=self.background_color,
                        show_topology_menu=False)
     for shape in self._shapes:
         solids(panel.viewer_display, shape, transparency=0.5)
     dialog.ShowModal()
from OCC.Display.SimpleGui import init_display

from aocutils.display.topology import solids, edges
from aocutils.display.defaults import backend

from aocxchange.step import StepImporter
from corelib.core.files import path_from_file

logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s :: %(levelname)6s :: %(module)20s :: '
                           '%(lineno)3d :: %(message)s')

backend = backend
display, start_display, add_menu, add_function_to_menu = init_display(backend)

filename = path_from_file(__file__, "./models_in/step/aube_pleine.stp")
step_importer = StepImporter(filename)

# step_importer.read_file() -> automatic read_file !!

print("Nb shapes: %i" % len(step_importer.shapes))
for shape in step_importer.shapes:
    print(shape.ShapeType())  # 2 -> solid
# print("number_of_shapes: %i" % step_importer.number_of_shapes)  # 0 ??
# display.DisplayShape(step_importer.shapes)
solids(display, step_importer.shapes[0], transparency=0.8)
edges(display, step_importer.shapes[0])
display.FitAll()
display.View_Iso()
start_display()
from aocutils.display.topology import solids
from aocutils.display.defaults import backend

from aocxchange.step import StepImporter
from corelib.core.files import path_from_file

logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s :: %(levelname)6s :: %(module)20s :: '
                    '%(lineno)3d :: %(message)s')
backend = backend
display, start_display, add_menu, add_function_to_menu = init_display(backend)

# filename = path_from_file(__file__, "./models_in/step/dm1-id-214.stp")
# filename = path_from_file(__file__,
#                           "./models_in/step/APB_GC.stp")  # big file 50 Mb !
# filename = path_from_file(__file__, "./models_in/step/66m.stp")
filename = path_from_file(__file__, "./models_in/step/ASA.STEP")
# filename = path_from_file(__file__, "./models_in/step/Groupama_VO70.stp")
step_importer = StepImporter(filename)

the_shapes = step_importer.shapes
print("Nb shapes : %i" % len(the_shapes))  # 4
# print("number_of_shapes(): %i" % step_importer.number_of_shapes)  # 0 ??

# display.DisplayColoredShape(the_shapes[0], Quantity_Color(Quantity_NOC_GRAY3))
solids(display, the_shapes[0])
display.FitAll()
display.View_Iso()
start_display()
示例#4
0
from OCC.Display.SimpleGui import init_display

from aocutils.display.topology import solids
from aocutils.display.defaults import backend

from aocxchange.brep import BrepImporter
from corelib.core.files import path_from_file

logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s :: %(levelname)6s :: %(module)20s :: '
                    '%(lineno)3d :: %(message)s')

# open/parse BREP file and get the resulting TopoDS_Shape instance
filename = path_from_file(__file__, "./models_in/brep/carter.brep")
my_brep_importer = BrepImporter(filename)
the_shape = my_brep_importer.shape

# Then display the shape
backend = backend
display, start_display, add_menu, add_function_to_menu = init_display(backend)
# display.DisplayShape(the_shape, color='BLUE', update=True)

# 1 solid to display
solids(display, the_shape)
# faces
# faces(display, the_shape, show_numbers=False)  # super slow !!
display.FitAll()
display.View_Iso()
start_display()