Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I want to create an ilogic rule for an idw that is triggered when a iam is used

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
dionm
787 Views, 4 Replies

I want to create an ilogic rule for an idw that is triggered when a iam is used

 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

4 REPLIES 4
Message 2 of 5
Curtis_Waguespack
in reply to: dionm

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

Message 3 of 5
dionm
in reply to: dionm

I'm refering to the "Parts List" in the idw.

Message 4 of 5
Curtis_Waguespack
in reply to: dionm

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):

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Replace-styles-in-Drawing/td-p/3594108...

 

 

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

 

Message 5 of 5

Hi,

 

I think 

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.

Post to forums  

Autodesk Design & Make Report