• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor

    Reply
    Valued Contributor
    Posts: 64
    Registered: ‎11-06-2007

    Purchased parts in parts list ??

    172 Views, 4 Replies
    04-25-2012 11:18 AM

    Is there a way to have a column in the parts list that shows the purchased parts?

    I want the info from the BOM called BOM Structure to show in the parts list.

     

    Please use plain text.
    *Expert Elite*
    Posts: 5,604
    Registered: ‎12-01-2004

    Re: Purchased parts in parts list ??

    04-25-2012 12:18 PM in reply to: lester

    Pretty sure the answer is no (as it should be).. BUT you can do a parts list filter and have it only show purchased parts.

    Do you not have an ERP system? You should. Purchasing based off a drawing is just silly.

    You can also just export the BOM and get that information.

    Please click "Accept as Solution" if this response answers your question.
    -------------------------------------------------------------------------------------
    2012 Product Design Suite Ultimate
    Windows 7 64 bit
    90G OCZ SATA 3 SSD (My SSD is faster than your HDD)
    Core I7 920 processor, ATI HD6970 graphics card, 12G Corsair RAM


    Please use plain text.
    Product Support
    Posts: 190
    Registered: ‎05-27-2010

    Re: Purchased parts in parts list ??

    04-30-2012 02:48 AM in reply to: mcgyvr

    Hello,

     

    Mcgyvr is right and using a part list filter is a good solution.

     

    We can also scan the assembly and set a custom Iproperty that writes the BOM Structure from structured BOM.

     

    You can copy this piece of code in your ILogic, and use Itrigger tu run this rule each time you save for example.

     

    This rule will scan your assembly and subassemblies, use the structured BOM Value and implement this value in a custom Iproperty in the file. You can display this custom Iprop in your parts list afterwards.

    Pierre Masson Product Support Specialist PS MFG EMEA Autodesk, Inc.
    Please use plain text.
    Product Support
    Posts: 190
    Registered: ‎05-27-2010

    Re: Purchased parts in parts list ??

    04-30-2012 02:49 AM in reply to: pierre.masson

    The code

     

     

    Option Explicit
    Sub Main Correct_G_L_parameter()
            ' Set reference to active document.
            ' This assumes the active document is an assembly
            Dim odoc As Inventor.AssemblyDocument
            odoc = ThisApplication.ActiveDocument

            ' Get assembly component definition
            Dim oCompDef As Inventor.ComponentDefinition
            oCompDef = odoc.ComponentDefinition

            Dim sMsg As String
            Dim iLeafNodes As Long
            Dim iSubAssemblies As Long

            ' Get all occurrences from component definition for Assembly document
            Dim oCompOcc As ComponentOccurrence
            For Each oCompOcc In oCompDef.Occurrences
                ' Check if it's child occurrence (leaf node)
                If oCompOcc.SubOccurrences.Count = 0 Then
                    iLeafNodes = iLeafNodes + 1
                    Call Assign_BOM(oCompOcc)
                Else
                    iSubAssemblies = iSubAssemblies + 1
                    Call processAllSubOcc(oCompOcc, _
                                        sMsg, _
                                        iLeafNodes, _
                                        iSubAssemblies) ' subassembly
                End If
            Next
            odoc.Update
            'Save the assembly
            'odoc.Save
        End Sub

        ' This function is called for processing sub assembly.  It is called recursively
        ' to iterate through the entire assembly tree.
        Private Sub processAllSubOcc(ByVal oCompOcc As ComponentOccurrence, _
                                     ByRef sMsg As String, _
                                     ByRef iLeafNodes As Long, _
                                     ByRef iSubAssemblies As Long)

            Dim oSubCompOcc As ComponentOccurrence
            For Each oSubCompOcc In oCompOcc.SubOccurrences
                ' Check if it's child occurrence (leaf node)
                If oSubCompOcc.SubOccurrences.Count = 0 Then
                    iLeafNodes = iLeafNodes + 1
                    Call Assign_BOM(oSubCompOcc)
                Else
                    sMsg = sMsg + oSubCompOcc.Name + vbCr
                    iSubAssemblies = iSubAssemblies + 1

                    Call processAllSubOcc(oSubCompOcc, _
                                          sMsg, _
                                          iLeafNodes, _
                                          iSubAssemblies)
                End If
            Next
        End Sub

        Private Sub Assign_BOM(ByRef oCompOcc As ComponentOccurrence)
            Dim Bomstructure As String
       Dim odoc As Object
          Dim oPropSets As PropertySets
          Dim opropset As PropertySet
         Dim oUserPropertySet As PropertySet
    Dim i As Integer
                  
            odoc = oCompOcc.Definition
    oPropSets = odoc.Document.PropertySets
          
            Select Case odoc.Document.ComponentDefinition.BOMStructure
      Case 51969
          Bomstructure = "Default"
      Case 51970
          Bomstructure = "Normal"
      Case 51971
          Bomstructure = "Phantom"
      Case 51972
          Bomstructure ="Reference"
      Case 51973
          Bomstructure ="Purchased"
      Case 51974
          Bomstructure ="Inseparable"
      Case 51975
          Bomstructure = "Varies"
      Case Else
          Bomstructure = "Unknown"
      End Select
    MsgBox (Bomstructure)
      
    For Each opropset In oPropSets
        If opropset.Name = "Inventor User Defined Properties" Then oUserPropertySet = opropset
    Next opropset
     
    ' If Property does not exist then add the new Property
    On Error Resume Next
            Call oUserPropertySet.Add(Bomstructure, "BOM")
    ' Try to set the Property value if it already exists
     For i = 1 To oUserPropertySet.Count
       If oUserPropertySet.Item(i).Name = "BOM" Then oUserPropertySet.Item(i).Value = Bomstructure
     Next i

        End Sub

     

    Pierre Masson Product Support Specialist PS MFG EMEA Autodesk, Inc.
    Please use plain text.
    Valued Contributor
    Posts: 64
    Registered: ‎11-06-2007

    Re: Purchased parts in parts list ??

    04-30-2012 05:29 AM in reply to: lester


    Thank you for JD and your reply. This will help me.

    Please use plain text.