My company has a standard that when the drawing is detailing an assembly it uses one style of BOM, and when we use a weldment it uses a different BOM. Is there a way to have an ilogic rule work when an assembly file is used it can trigger the specific BOM to use. I would like this so that a user doesn't really have to think as to which BOM to use.
Any help would be great.
Using Inventor 2013
Solved! Go to Solution.
Solved by xiaodong_liang. Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi dionm,
Do you mean BOM style as in the XML file used in the Assembly, or are you referring to a Parts List style in the Drawing?
I'm not sure I have a solution in either case, but it might help to clarify this for someone else who reads this.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi dionm,
You can try this example, but I'm not getting it to work completely. I can't recall if we can set the parts list style with the API or not (I'm thinking we can not.) I've run out of time to look at this, but thought I'd post what I had in case it helps.
This link is related and provides another possiblity (switching the object default):
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument 'Set a reference to the active sheet. Dim oSheet As Sheet oSheet = oDrawDoc.ActiveSheet ' Set a reference to the first drawing view on the sheet. Assumes it’s not a draft view. Dim oDrawingView As DrawingView oDrawingView = oSheet.DrawingViews(1) ‘define the insert point Dim oPlacementPoint As Point2d oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d (27.8130#, 21.463#) ' Create the parts list. oPartsList = oSheet.PartsLists.Add(oDrawingView, oPlacementPoint) 'check to see if the referenced file is a weldment oModelDoc = ThisDoc.ModelDocument If oModelDoc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'set parts list to a specific style for weldments oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Weldment Parts List") Else 'set parts list to a specific style for standard assemblies oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Standard Parts List") End if
Hi,
I think Curtis_Waguespack provided a correct solution. The only issue is PartsListStyles collection does not support get item by name. So I made a little bit and got a worked code:
Sub Main() ' This assumes a drawing document is active.Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument 'Set a reference to the active sheet.Dim oSheet As Sheet oSheet = oDrawDoc.ActiveSheet ' Set a reference to the first drawing view on the sheet. Assumes it's not a draft view.Dim oDrawingView As DrawingView oDrawingView = oSheet.DrawingViews(1) 'define the insert pointDim oPlacementPoint As Point2d oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d (27.8130#, 21.463#) ' Create the parts list.oPartsList = oSheet.PartsLists.Add(oDrawingView, oPlacementPoint) 'check to see if the referenced file is a weldmentDim oStyle As PartsListStyle oModelDoc = ThisDoc.ModelDocument If oModelDoc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'set parts list to a specific style for weldments 'oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Weldment Parts List") oStyle = PartsListStyle(oDrawDoc, "Weldment Parts List") If Not oStyle Is Nothing Then oPartsList.Style = oStyle End If Else 'set parts list to a specific style for standard assemblies 'oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Parts List (Ansi)") oStyle = PartsListStyle(oDrawDoc, "Parts List (Ansi)") If Not oStyle Is Nothing Then oPartsList.Style = oStyle End If End If End Sub Function PartsListStyle(oDoc As DrawingDocument, stylename As String ) As PartsList PartsListStyle =Nothing Dim oEachStyle As PartsListStyle For Each oEachStyle In oDoc.StylesManager.PartsListStyles If oEachStyle.Name = stylename Then PartsListStyle = oEachStyle Exit Function End If Next End Function
Can't find what you're looking for? Ask the community or share your knowledge.