pythonOCC例子搬运:1.显示三维轮廓

这里返回总目录>>返回总目录
core_display_customize_prs3d.py
本例从 https://github.com/tpaviot/pythonocc-demos 搬运而来
运行版本:0.18.1 在其余版本运行不保证正确
先上结果图
pythonOCC例子搬运:1.显示三维轮廓_第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()

你可能感兴趣的:(pythonocc)