Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Owner2229
in reply to: Anonymous

Hmm, that's strange. When it throws the error again, click on the second error tab. You can read there some more info about the error.

 

Also, you can shorten your code like this (orange is what I've changed):

 

Dim oDrawDoc As Inventor.DrawingDocument = m_inventorApplication.ActiveDocument
Dim oSheet As Inventor.Sheet = oDrawDoc.ActiveSheet
If oSheet.DrawingViews.Count = 0 Then Exit For Dim oDrawingView As Inventor.DrawingView = oSheet.DrawingViews.Item(1) Dim oRefDoc As Inventor.AssemblyDocument = oDrawingView.ReferencedFile.ReferencedDocument Dim oBOM As Inventor.BOM = oRefDoc.ComponentDefinition.BOM oBOM.StructuredViewEnabled = True Dim oBOMView As Inventor.BOMView = oBOM.BOMViews.Item("Structured") Dim oPoint2D As Inventor.Point2d = m_inventorApplication.TransientGeometry.CreatePoint2d(66, 0)
Dim oLevel As Inventor.PartsListLevelEnum = Inventor.PartsListLevelEnum.kStructured
Dim oPartList As Inventor.PartsList = oSheet.PartsLists.Add(oDrawingView, oPoint2D, oLevel, Nothing, 1, False)
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods