You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
1.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# -*- coding: utf-8 -*-
"""Выполняется внутри FreeCAD GUI через MCP: снимки сборки в out/renders/ (белый фон, 1800×1400)."""
import FreeCAD as App, FreeCADGui as Gui
doc = App.getDocument("Valve")
full = [o for o in doc.getObject("Сборка").Group]
cut = [o for o in doc.getObject("Сборка_разрез").Group]
v = Gui.ActiveDocument.ActiveView
v.setAnimationEnabled(False)
import os
out = os.path.join(globals().get("PROJECT_ROOT") or os.getcwd(), "out", "renders") + "/"
def show(objs_on, objs_off):
for o in objs_off: o.ViewObject.Visibility = False
for o in objs_on: o.ViewObject.Visibility = True
shots = [("iso_full", full, cut, "viewIsometric"), ("iso_cut", cut, full, "viewIsometric"),
("front_cut", cut, full, "viewFront"), ("right_full", full, cut, "viewRight"), ("top_full", full, cut, "viewTop")]
for name, on, off, vw in shots:
show(on, off)
getattr(v, vw)()
v.fitAll()
v.saveImage(out + name + ".png", 1800, 1400, "White")
print("saved", name)
show(cut, full); v.viewIsometric(); v.fitAll()

Powered by TurnKey Linux.