Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to get geometry of the constructionAxis of a component relative to the assembly?

6638161521
Explorer

How to get geometry of the constructionAxis of a component relative to the assembly?

6638161521
Explorer
Explorer

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 

occ.transform.translation.x according to this Occurrence.transform2 Property.
3. create sketches of hole by projecting the circle edges.
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"
                )



6638161521_0-1718671612995.png

 

0 Likes
Reply
137 Views
0 Replies
Replies (0)