Inventor General Discussion

Reply
Valued Contributor
lester
Posts: 85
Registered: ‎11-06-2007
Message 1 of 5 (344 Views)

Purchased parts in parts list ??

344 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.

 

*Expert Elite*
mcgyvr
Posts: 6,720
Registered: ‎12-01-2004
Message 2 of 5 (332 Views)

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.

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

Down with IDW/DWG files..... Long live 3D PMI... Hurry it up already..
-------------------------------------------------------------------------------------
2015 Product Design Suite Ultimate
Windows 7 64 bit
Core i7 4820k processor (OC'd to 4.4Ghz), Nvidia GTX 770, 16G RAM


Product Support
pierre.masson
Posts: 227
Registered: ‎05-27-2010
Message 3 of 5 (293 Views)

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.
Product Support
pierre.masson
Posts: 227
Registered: ‎05-27-2010
Message 4 of 5 (292 Views)

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.
Valued Contributor
lester
Posts: 85
Registered: ‎11-06-2007
Message 5 of 5 (282 Views)

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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube