Inventor Customization

Inventor Customization

Reply
Contributor
11 Posts
1 Kudo
Registered: ‎04-09-2003
Post 1 of 5

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

484 Views, 4 Replies
01-10-2013 08:56 AM

 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

*Expert Elite*
3,002 Posts
1,702 Kudos
Registered: ‎03-08-2006
Post 2 of 5

Re: I want to create an ilogic rule for an idw that is triggered when a iam is u

01-10-2013 09:48 AM 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



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





Contributor
11 Posts
1 Kudo
Registered: ‎04-09-2003
Post 3 of 5

Re: I want to create an ilogic rule for an idw that is triggered when a iam is u

01-10-2013 10:31 AM in reply to: dionm

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

*Expert Elite*
3,002 Posts
1,702 Kudos
Registered: ‎03-08-2006
Post 4 of 5

Re: I want to create an ilogic rule for an idw that is triggered when a iam is u

01-10-2013 02:56 PM 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

 



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





ADN Support Specialist
1,352 Posts
81 Kudos
Registered: ‎06-12-2011
Post 5 of 5

Re: I want to create an ilogic rule for an idw that is triggered when a iam is u

01-17-2013 11:04 PM in reply to: Curtis_Waguespack

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




Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post