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 ! 🙂
you can also use ilogic automation in python
from win32com import client as wc
ThisApplication = wc.Dispatch('Inventor.Application')
iLogicAuto = ThisApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}").Automation
oface = iLogicAuto.GetNamedEntities(ThisApplication.ActiveDocument).FindEntity("myface")
ThisApplication.CommandManager.DoSelect(oface)
Furthermore,you can also use .NET's LINQ methods to search for objects, while also improving performance by pylinq
Can't find what you're looking for? Ask the community or share your knowledge.