Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automated Sheet Size in BOM list

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
467 Views, 2 Replies

Automated Sheet Size in BOM list

Hello!

Is there any way(ilogic/API ..etc.) to automatically place drawing sheet size into the BOM?

Or any drawing custom property to the BOM list

Example:
After creating drawing for part TT-07-02 with sheet size A3, the column "Sheet Size" after creation would fill up automatically.

MicrosoftTeams-image (1).png

Labels (5)
2 REPLIES 2
Message 2 of 3
jeffsteiger6735
in reply to: Anonymous

Why would one want to show the sheet size in a BOM anyways? Seems like just extra useless information.

Inventor Professional 2017
Message 3 of 3
Anonymous
in reply to: jeffsteiger6735

Sub Main()
    If Not ThisApplication.ActiveDocument.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
        MessageBox.Show("Current document is not drawing docuemnt", "Inventor")
        Exit Sub
    End If
    Dim value_List As List(Of String) = New List(Of String)

    value_List.Add(iProperties.Value("Custom", "Sheet Size"))

    Dim oDoc As Document
    oDoc = ThisDrawing.ModelDocument 

    If oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
        
        Update_Properties(oDoc,  value_List)
        
        Dim oAsyDoc As AssemblyDocument 
        oAsyDoc = oDoc
         
        Dim oReferDoc As Document 
        Dim occ As ComponentOccurrence 
        Dim oDef As AssemblyComponentDefinition 
        oDef = oAsyDoc.ComponentDefinition  

        'For Each occ In oDef.Occurrences             
            'If occ.SubOccurrences.Count = 0 Then
                'oReferDoc = occ.ReferencedDocumentDescriptor.ReferencedDocument
                'Update_Properties(oReferDoc, value_List)
            'Else                
                'oReferDoc = occ.ReferencedDocumentDescriptor.ReferencedDocument
                'Update_Properties(oReferDoc,   value_List)
                'processAllSubOcc(occ,  value_List)
            'End If                
        'Next 
        
    Else If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
        Update_Properties(oDoc, value_List)
    End If 

End Sub 

'Private Sub processAllSubOcc(ByVal oCompOcc As ComponentOccurrence , value_List As List(Of String))
    
    'Dim oSubCompOcc As ComponentOccurrence
    'Dim oReferDoc As Document 
    'For Each oSubCompOcc In oCompOcc.SubOccurrences
        'If oSubCompOcc.SubOccurrences.Count = 0 Then
            'oReferDoc = oSubCompOcc.ReferencedDocumentDescriptor.ReferencedDocument
            'Update_Properties(oReferDoc,value_List)            
        'Else
            'oReferDoc = oSubCompOcc.ReferencedDocumentDescriptor.ReferencedDocument
            'Update_Properties(oReferDoc ,value_List)            
            'Call processAllSubOcc(oSubCompOcc, value_List)
        'End If
    'Next
    
'End Sub

Sub Update_Properties(oDoc As Document,   value_List As List(Of String))
    
    oDoc.PropertySets.Item("Inventor User Defined Properties").Item("Sheet Size").Value = value_List.Item(0)
    oDoc.Save()
    
End Sub

Thank you for attention!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report