I try to use Python for Autodesk Inventor API. For example, I try to make a new sketch in an Inventor part document that I make with Python.
But I have a problem with adding sketches. All of my tries were wrong. Here's an example of code (one of a lot):
import win32com.client
from win32com.client import constants
invApp = win32com.client.Dispatch("Inventor.Application")
invApp.Visible = True
asd = invApp.Documents.Add(constants.kPartDocumentObject,"",True)
nsk = asd.PartDocuments.ComponentDefinition.Sketches.Add()
There is an error:
AttributeError: '<win32com.gen_py.Autodesk Inventor Object Library.Document instance at 0x284773312>' object has no attribute 'PartDocuments'
I tried to find the right way to call the attributes but I have not had any success.
I'm not expert on Python... but the Documents.Add method return the new document, therefore the asd should contain the PartDocument type