Message 1 of 2
Get component's face with python
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I'm currently working on a Python code to automate a mechanical assembly in Inventor, and I'm facing an issue getting a component's face in my code.
To get the necessary planes, I'm using this method:
# def planes
masAPi_wp_YZ = comp.Definition.WorkPlanes.Item(1)
masAPi_Face_impl = comp.SurfaceBodies.Item(1).Faces.Item(2) # Problème ici
masAPi_wp_XY = comp.Definition.WorkPlanes.Item(3)
# proxys
masAPiYZ = comp.CreateGeometryProxy(masAPi_wp_YZ)
masAPiImpl = comp.CreateGeometryProxy(masAPi_Face_impl)
masAPiXY = comp.CreateGeometryProxy(masAPi_wp_XY)
This method works well with work planes, but the issue is that I get the face I need with the entity number (2) and not its name ('Face_impl').
I haven't found a solution, I tried writing it like this: 'comp.SurfaceBodies.Item(1).Faces.Item("Face_impl")', but it doesn't find the face.
I also attempted to create a construction plane, but that doesn't work either
If you have any ideas, feel free to answer.
thanks ! 🙂