Community
My goal is to get position of the holes of the bearings to automatically insert holes in the rectangle base for these bearings.
I can access the position of the axes by 'axis.geometry.origin.x' according to this (ConstructionAxis.geometry Property).
However, this give position relative to the component itself not in context of the assembly file.
How can I get geometry of the constructionAxis of a component relative to the assembly?
There are 3 solutions:
1. directly use api to get the positions of the axis (the question)
2. calculate using the position of the origin of the bearing in context of assembly which we can get by
rootCompList = rootComp.occurrences.asList
sk: adsk.fusion.Sketch = rootComp.sketches.add(rootComp.xYConstructionPlane)
for i in range(1):
# for i in range(len(rootCompList)):
occ = rootCompList[i]
resultString = resultString + f"{i}: {occ.name}\n"
for j in range(len(occ.component.constructionAxes)):
axis = occ.component.constructionAxes[j]
resultString = (
resultString
+ f"{j}: {axis.name}, {axis.geometry.origin.x}, {axis.geometry.origin.y}, {axis.geometry.origin.z}\n"
+ f"occ.transform2.translation.x: {occ.transform.translation.x}, occ.transform2.translation.y: {occ.transform.translation.y}, occ.transform2.translation.z: {occ.transform.translation.z}\n"
)
Can't find what you're looking for? Ask the community or share your knowledge.