Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

0 REPLIES 0
Reply
Message 1 of 1
6638161521
71 Views, 0 Replies

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

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 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report