代码拉取完成,页面将自动刷新
同步操作将从 loujiand/occ_example 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
from OCC.Display.SimpleGui import init_display
from OCC.Core.TopoDS import topods_Edge
from OCC.Extend.DataExchange import read_step_file
display, start_display, add_menu, add_function_to_menu = init_display()
# loads and displays a step file
the_shape = read_step_file('SFU01610-4.step')
from OCC.Core.GProp import GProp_GProps
from OCC.Core.BRepGProp import brepgprop_LinearProperties,BRepGProp_EdgeTool,BRepGProp_EdgeTool_Value
def line_clicked(shp, *kwargs):
""" This function is called whenever a line is selected
"""
for shape in shp: # this should be a TopoDS_Edge
print("Edge selected: ", shape)
e = topods_Edge(shape)
props = GProp_GProps()
brepgprop_LinearProperties(e, props)
length = props.Mass()
print("此边的长度为: %f" % length)
centerMass = props.CentreOfMass()
print("此边的中心点为", centerMass.X(), centerMass.Y(), centerMass.Z())
display.DisplayShape(the_shape, update=True)
display.SetSelectionModeEdge() # switch to edge selection mode
display.register_select_callback(line_clicked)
start_display()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。