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

这里返回总目录>>返回总目录
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()

© 版权声明
THE END
喜欢就支持一下吧
点赞238 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容