I have a idw file which has two sheets. On sheet 2 I'm trying to make a line item in a BOM table visible only when a layer is turned on. We also need this too function in a dwf file after we publish our sheets so we can toggle it on and off using layers.
Say I have a table that has items 1 thru 5. When I turn off a layer called layerblue, I would like item number 4 to not be visible. Is this possible using the iLogic function?
Is this something that can be done or do I need to use the VB side to make this a reality.
Solved! Go to Solution.
Solved by sgwilliams. Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi sgwilliams,
Here is a simple iLogic rule that checks to see if the layer is turned off and then hides the 4th row of the parts list. You could tie this rule to an event trigger such as the save event, so that the rule is run everytime the drawing is saved.
' Set a reference to the drawing document. Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument ' Set a reference to the first parts list on the active sheet. ' This assumes that a parts list is on the active sheet. Dim oPartList As PartsList oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1) ' Set a reference to the 4th row Dim oRow As PartsListRow oRow = oPartList.PartsListRows.Item(4) 'check layer and turn parts list row on/off
If oDrawDoc.StylesManager.Layers("layerblue").Visible = False Then
'turn off row
oRow.Visible = False
Else
'turn on row
oRow.Visible = True
End If
alternate rule that just toggles them both on / off at the same time
' Set a reference to the drawing document.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
' Set a reference to the first parts list on the active sheet.
' This assumes that a parts list is on the active sheet.
Dim oPartList As PartsList
oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
' Set a reference to the 4th row
Dim oRow As PartsListRow
oRow = oPartList.PartsListRows.Item(4)
'toggle on / off layer and parts list row
If oDrawDoc.StylesManager.Layers("layerblue").Visible = False Then
oDrawDoc.StylesManager.Layers("layerblue").Visible = True
oRow.Visible = True
Else
oDrawDoc.StylesManager.Layers("layerblue").Visible = False
oRow.Visible = False
End If
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Curtis this does half of what I'm looking to accomplish but it doesn't follow thru when I publish the dwf file. it will not remove the line item when I turn the layer off in the dwf viewer.
I have found a way to accomplish what I'm after but the iLogic doesn't do it. My work around is to:
After the file is published to dwf file it can be turned on and off as it is required.
Curtis Thanks for your help. I will use your answer as a solution because it helped point me in the right direction & it did half of what I was looking to accomplish, even tho I did not use it in the final fix.