If a user moves a component (not just the bodies) the origin of the component moves with it. However from the Python Scripts if you ask for the geometry of the component's originConstructionPoint, it still reporst (0,0,0) and if you try to get the vector from the rootComponent's origin to the components origin, it is just <0,0,0> which is wrong?
How do you get the "world Geometry" of a component's origin after it has been moved?
Solved! Go to Solution.
Solved by liujac. Go to Solution.
You need to create an object with assembly context. Please try the code below.
import adsk.core, adsk.fusion, adsk.cam, traceback def run(context): ui = None try: app = adsk.core.Application.get() ui = app.userInterface design = adsk.fusion.Design.cast(app.activeProduct) root = design.rootComponent occs = root.occurrences occ = occs[0] comp = occ.component origin = comp.originConstructionPoint originProxy = origin.createForAssemblyContext(occ) point = originProxy.geometry ui.messageBox('X:{}, Y:{}, Z:{}'.format(point.x, point.y, point.z)); except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Jack
Can't find what you're looking for? Ask the community or share your knowledge.