Here is a small macro that goes over the imported step assembly and saves an image of each "part" (well it is actually just a solid geometry but lets not now go in to that debate
).
Attached is also a zip with all the images of this model with size "320x240" on "White" background (and two additional images out of this zip, just to show an example).
Together with the Mark7_report.txt (attached in one of the previous posts) one could put together a part list (BOM) with images in an LibreOffice spreadsheet for example... Does someone have an idea how to do it automatically!?
This macro should work on all similar imported step assemblies. When using it make sure to SET THE PATH where to save the images. There are also a few additional lines commented out as an example how to play a bit with different options to get different results... I am not the best coder so I am sure our developers can make something much better out of it
Code: Select all
# -*- coding: utf-8 -*-
import FreeCAD as App
import FreeCADGui as Gui
prtList = App.ActiveDocument.findObjects("Part::Feature")
for prt in prtList:
Gui.Selection.addSelection(App.ActiveDocument.Name, prt.Name)
Gui.runCommand('Std_ToggleVisibility',0)
Gui.Selection.clearSelection()
for prt in prtList:
Gui.Selection.addSelection(App.ActiveDocument.Name, prt.Name)
Gui.runCommand('Std_ToggleVisibility',0)
#Gui.activeDocument().activeView().viewFront()
#Gui.activeDocument().activeView().viewTop()
Gui.activeDocument().activeView().viewIsometric()
Gui.SendMsgToActiveView("ViewSelection")
Gui.Selection.clearSelection()
#Gui.activeDocument().activeView().saveImage('C:/### SET THE PATH ###/temp/' + prt.Label + "_" + prt.Name + '.png',640,480,'Transparent')
#Gui.activeDocument().activeView().saveImage('C:/### SET THE PATH ###/temp/' + prt.Label + "_" + prt.Name + '.png',320,240,'White')
Gui.Selection.addSelection(App.ActiveDocument.Name, prt.Name)
Gui.runCommand('Std_ToggleVisibility',0)
Gui.Selection.clearSelection()
- X1_Manifold v1_Part__Feature064.png (12.54 KiB) Viewed 963 times
- VentNutSteelBody_Part__Feature123.png (8.38 KiB) Viewed 963 times