pythonOCC例子搬運:1.顯示三維輪廓
阿新 • • 發佈:2019-01-04
這裡返回總目錄>>返回總目錄
core_display_customize_prs3d.py
本例從 https://github.com/tpaviot/pythonocc-demos 搬運而來
執行版本:0.18.1 在其餘版本執行不保證正確
先上結果圖
程式碼部分
from OCC.BRepPrimAPI import BRepPrimAPI_MakeCylinder from OCC.Display.SimpleGui import init_display display, start_display, add_menu, add_function_to_menu = init_display() display.SetModeHLR() # # Get Context # ais_context = display.GetContext().GetObject() # # Get Prs3d_drawer from previous context # drawer_handle = ais_context.DefaultDrawer() drawer = drawer_handle.GetObject() drawer.SetIsoOnPlane(True) la = drawer.LineAspect().GetObject() la.SetWidth(4) # increase line width in the current viewer # This is only viewed in the HLR mode (hit 'e' key for instance) line_aspect = drawer.SeenLineAspect().GetObject() drawer.EnableDrawHiddenLine() line_aspect.SetWidth(4) # drawer.SetWireAspect(line_aspect.GetHandle()) # # Displays a cylinder # s = BRepPrimAPI_MakeCylinder(50., 50.).Shape() display.DisplayShape(s) # # Display settings and display loop # display.View_Iso() display.FitAll() start_display()