I know this code references Autodesk Inventor (CAD) API, but I'm hoping for a generic solution to my problem with the following error. The error is "object reference not set to an instance of an object" and the macro takes an open document (part file drawing) and inserts it into another open document (assembly file).
Code:
Hopefully this is not too specialized to receive help in this forum.
Thx,
Jon
Code:
Code:
' Set a reference to the assembly component definintion. ' This assumes an assembly document is open. Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition ' Set a reference to the transient geometry object. Dim oTG As TransientGeometry oTG = ThisApplication.TransientGeometry ' Create a matrix. A new matrix is initialized with an identity matrix. Dim oMatrix As Matrix oMatrix = oTG.CreateMatrix ' Add the occurrence. Dim oOcc As ComponentOccurrence oOcc = oAsmCompDef.Occurrences.Add(sFileName, oMatrix)
Thx,
Jon
Comment