Files
wheel/scripts/render_open_encoder_option.py

18 lines
727 B
Python

from pathlib import Path
import time, traceback
import FreeCAD as A, FreeCADGui as G
from pivy import coin
R=Path(__file__).resolve().parent.parent
O=R/'models'/'profile_mount_check'
try:
doc=A.openDocument(str(O/'OpenSlot50.FCStd'))
for o in doc.Objects:
if hasattr(o,'Shape'): o.ViewObject.Visibility=(o.Name=='OpenBracket')
view=G.activeDocument().activeView()
view.viewTop();G.updateGui();time.sleep(.5);view.fitAll();G.updateGui();time.sleep(.5)
view.saveImage(str(O/'OpenSlot50_支架开口.png'),1600,1200,'White')
(O/'OPEN_RENDER_DONE.txt').write_text('ok\n',encoding='utf8')
except Exception:
(O/'OPEN_RENDER_ERROR.txt').write_text(traceback.format_exc(),encoding='utf8')
raise