如何解决如何在绘图中显示 OCC
我正在尝试在 python 中使用 OCC 显示一个 stp 文件。有用。也就是说,我可以使用 pythonocc 在我的本地机器上显示它。现在,我正在尝试使用 plotly 将它显示在破折号中。我试图在破折号中显示 occ 图像,而不是在我的本地机器中。
代码是:
# -*- coding: utf-8 -*-
# Run this app with `python app.py` and
# visit http://127.0.0.1:8050/ in your web browser.
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import dash_core_components as dcc
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__,external_stylesheets=external_stylesheets)
import sys
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd
from OCC.Core.STEPControl import STEPControl_Reader
from OCC.Core.IFSelect import IFSelect_RetDone,IFSelect_ItemsByEntity
from OCC.display.SimpleGui import init_display
from OCC.Core.ShapeExtend import ShapeExtend_CompositeSurface
from OCC.Core.GProp import GProp_GProps
from OCC.Core.BRepGProp import brepgprop_VolumeProperties
from OCC.Extend.DataExchange import read_step_file
input_file = 'test.stp' # input STEP (AP203/AP214 file)
prop = GProp_GProps()
extend = ShapeExtend_CompositeSurface()
step_reader = STEPControl_Reader()
status = step_reader.ReadFile(input_file)
if status == IFSelect_RetDone: # check status
failsonly = False
step_reader.PrintCheckLoad(failsonly,IFSelect_ItemsByEntity)
step_reader.PrintCheckTransfer(failsonly,IFSelect_ItemsByEntity)
ok = step_reader.TransferRoot(1)
_nbs = step_reader.NbShapes()
aResShape = step_reader.Shape(1)
else:
print("Error: can't read file.")
sys.exit(0)
print(aResShape)
display,start_display,add_menu,add_function_to_menu = init_display()
'''display,add_function_to_menu = init_display()
display.displayShape(aResShape,update=True)
start_display()'''
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),html.Div(children='''
Dash: A web application framework for Python.
'''),display.displayShape(aResShape,update=True)
])
if __name__ == '__main__':
app.run_server(debug=True)
但是,它不起作用。
我只是一个破折号的新手,所以有人可以帮忙吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。