Thanks @TheMarkster.
... and here is the macro.
Context:
A2plus with a Wheel and its Cutout-Cube referenced individual and Cutout-Cube tracks the wheel.
Note:
If it is applied to A2plus-objects the Transform-tool modifies the tree after the movement.
It seems both become a fusion with the 1st object the parent and the 2nd object the child.
Regular Solids of the Part-WB do not show this tree behavior AFAICT.
Code: Select all
# -*- coding: utf-8 -*-
#........1.........2.........3.........4.........5.........6.........7.........8
# copyright (c) 2021 lutz_dd
#
# Copy all Placement parameters from 1st selected object to the second selected
# object to get 2nd object tracks 1st object (eg. wheel and cutout-cube)
import traceback
import FreeCAD, FreeCADGui
def make_dependency():
try:
selset=Gui.Selection.getSelection()
src=selset[0]
dest=selset[1]
dest.setExpression("Placement.Rotation.Angle",
src.Name+".Placement.Rotation.Angle")
for hdr in ["Placement.Base", "Placement.Rotation.Axis"]:
for item in ["x","y","z"]:
dest.setExpression(hdr+"."+item, src.Label+"."+hdr+"."+item)
# set recompute flag on the object
dest.recompute()
# recompute the document
App.ActiveDocument.recompute()
except:
App.Console.PrintError("ERROR: make_dependency() has failed."+os.linesep)
traceback.print_exc()
make_dependency()