Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I created Addin in which the two Sub. The first Sub handles the assembly. Second Sub handles the part. Addin starts when you save the file and is written in VB.Net. Constantly I see Addin does not work and I have to restart Inventor. I began to track the progress of the Addin and found the cause of the error. If I start the first assembly is saved and then saved the part, the error occurs in line sbs = m_Doc.ComponentDefinition.SurfaceBodies . If I start the first part is saved and then saved the assembly, an error occurs in line fBom = m_Doc.ComponentDefinition.Bom. Why is this happening? Is there a way to fix this conflict?
... Private Sub m_ApplicationEvents_OnSaveDocument(ByVal DocumentObject As Inventor._Document, _ ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap, _ ByRef HandlingCode As Inventor.HandlingCodeEnum) Handles m_ApplicationEvents.OnSaveDocument If BeforeOrAfter = EventTimingEnum.kBefore Then If DocumentObject.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then If DocumentObject.LevelOfDetailName = "Master" Then ' Or DocumentObject.LevelOfDetailName = "Master1" m_Ass(DocumentObject) End If ElseIf DocumentObject.DocumentType = DocumentTypeEnum.kPartDocumentObject Then Dim m_partDoc As PartDocument = DocumentObject Dim m_compDef As PartComponentDefinition = m_partDoc.ComponentDefinition If m_compDef.BOMStructure = BOMStructureEnum.kNormalBOMStructure Then m_Part(DocumentObject) ... Private Sub m_Ass (ByVal m_Doc As Inventor._Document) Try Dim fBom As BOM fBom = m_Doc.ComponentDefinition.Bom ...
Private Sub m_Part (ByVal m_Doc As Inventor._Document) Try Dim col() As String Dim colv() As String Dim sbs As SurfaceBodies 'Набор тел модели sbs = m_Doc.ComponentDefinition.SurfaceBodies ...
Solved! Go to Solution.