yes search by Name ... for the moment not possible many work to change
the command is:
Code: Select all
sel = FreeCAD.ActiveDocument.getObject("NameObject")
Code: Select all
#Macro_D_Un_Jour_Rotate_And_Save_Image_Without_Selection
#https://forum.freecadweb.org/viewtopic.php?f=3&t=58340
#Make a GIF
#20/05/2021
#Mario52
#
import FreeCAD, FreeCADGui
import time
#### begin Config ########
##
SaveNamefile = "/home/mint/Documents/Tyty" # complete path and Name (without extension) the .png extenstion is in the loop
nameObject = FreeCAD.ActiveDocument.getObject("Box") #name of object
##
beginRotation = 0 # angle begin rotation
endRotation = 360 # angle end rotation
angleStep = 40 # angle step by step
##
Length = 640 # format image length
Heigth = 480 # format image heigth
##
backGroundColor = "Current" # # availlable: Current, Transparent or html color ex: #FFFFFF
##
#### end Config ########
BBCenter = nameObject.Shape.BoundBox.Center # rotation on boundBox center of object
for i in range(beginRotation, endRotation + angleStep, angleStep):
print(i)
nameObject.Placement = FreeCAD.Placement(FreeCAD.Vector(0,0,0), FreeCAD.Rotation(0,0,i), FreeCAD.Vector(BBCenter))
Gui.activeDocument().activeView().saveImage(SaveNamefile +"_"+str(i)+".png" , Length, Heigth, backGroundColor)
FreeCADGui.updateGui()
time.sleep(0.01)