I see everywhere that there is a Suppress Features Rule, but cannot find any suppress parts rules?
This is my dilemma here:
I want to be able to create a rule that when a .iam is opened; I can select in a list box
ex.
part1
part2
part3
When i select one of those, the rule will suppress everything else.
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
What is the purpose of this functionality? I only as becase there might be a better way to accomplish your goal..
Maybe LOD..maybe design view rep..maybe iassemblies
Hi m.teleguz1,
You didn't mention iLogic, but from your use of the words "Rule" and "List Box" I'm assuming you were looking for an iLogic solution.
You can use Component.IsActive(Name:1) = False to suppress in iLogic. Here's a quick example that requires the user to select a component, and then it creates a LOD named after the selected component, and then it suppresses everything else.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
'get currently selected component
Dim oOccurrence as ComponentOccurrence
Try
oOccurrence = ThisDoc.Document.SelectSet.Item(1)
Catch
MessageBox.Show("Please select a component to replace before running this rule.", "iLogic")
Return
End Try
'- - - - - - - - - - - - - - - - - - - - - - - - -
'Format selected occurence name for LOD name
'remove the colon from the occurence and replaces with underscore
Dim fixedText As String = Replace(oOccurrence.Name, ":", "_")
'- - - - - - - - - - - - - - - - - - - - - - - - -
'setup LOD
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = oAsmDoc.ComponentDefinition
'activate the Master LOD so we can read in the names of all the components
oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations("Master").Activate
InventorVb.DocumentUpdate(False)
'define an arraylist to hold the list of LOD rep names
Dim NameList As New ArrayList()
'define LOD rep
Dim oLODRep As LevelOfDetailRepresentation
'Look at the LOD reps in the assembly
For Each oLODRep In oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations
'set the list of names to the array list
NameList.add(oLODRep.Name)
Next
'check for an iLogic LOD rep and create it if not found
If Not NameList.Contains(fixedText & " LOD") Then
'create iLogic LOD
oLODRep = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add(fixedText & " LOD")
oLODRep.Activate
Else
oLODRep.Activate
End If
'- - - - - - - - - - - - - - - - - - - - - - - - -
'suppress components
For Each oOcc In oAsmCompDef.Occurrences
'check for and skip virtual components
'(in case a virtual component trips things up)
If Not TypeOf oOcc.Definition Is VirtualComponentDefinition Then
'Suppress all other components except the one that was selected
If oOcc.Name <> oOccurrence.Name Then
Component.IsActive(oOcc.Name) = False
Else
End If
Else
End If
Next
'zoom all
ThisApplication.ActiveView.Fit
I have a lot of these Parker Fittings that i need to put into Content Center.
Instead of publishing these fittings up individiually I am putting them all in one assembly. Making a little mini Content Center 🙂
Based on the information picked it will activate one fitting and supress all the rest and then shoot the .ipt properties to the assembly so we can still use it in the BOM.
I havent figured out how to pass that info yet 😕
Thanks Curtis!
this right here would be enough in my world. But is it possible for list box?
why wouldnt this work?
oOccurrence = ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("DetailOFRepresentation").Activate
Hi m.teleguz1,
Here is a version with a list box.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Imports System.Diagnostics Imports System.Collections.Generic Sub Main StartRule: Dim partsList As Dictionary(Of String, Document) = AllPartsList() For Each name As String In partsList.Keys Next If (partsList.Count = 0) Then Return Dim partNames as New List(Of String)(partsList.Keys) 'present list box Dim partNameSelected As String = InputListBox("Select a component.", partNames, partNames(0), "Select Component", "Components") If String.IsNullOrEmpty(partNameSelected) Then Return 'get document from selected name Dim partSelected As Document = partsList(partNameSelected) Dim oPartDoc As Inventor.PartDocument = partSelected '- - - - - - - - - - - - - - - - - - - - - - - - - 'Format selected component name for LOD name 'remove the colon from the name and replace with underscore Dim fixedText As String = Replace(partNameSelected, ":", "_") '- - - - - - - - - - - - - - - - - - - - - - - - - 'setup LOD Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = oAsmDoc.ComponentDefinition 'activate the Master LOD so we can read in the names of all the components oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations("Master").Activate InventorVb.DocumentUpdate(False) 'define an arraylist to hold the list of LOD rep names Dim NameList As New ArrayList() 'define LOD rep Dim oLODRep As LevelOfDetailRepresentation 'Look at the LOD reps in the assembly For Each oLODRep In oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations 'set the list of names to the array list NameList.add(oLODRep.Name) Next 'check for an iLogic LOD rep and create it if not found If Not NameList.Contains(fixedText & " LOD") Then 'create iLogic LOD oLODRep = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add(fixedText & " LOD") oLODRep.Activate Else oLODRep.Activate End If '- - - - - - - - - - - - - - - - - - - - - - - - - 'suppress components For Each oOcc In oAsmCompDef.Occurrences 'check for and skip virtual components '(in case a virtual component trips things up) If Not TypeOf oOcc.Definition Is VirtualComponentDefinition Then 'Suppress all other components except the one that was selected If oOcc.Name <> partNameSelected Then Component.IsActive(oOcc.Name) = False Else End If Else End If Next 'zoom all ThisApplication.ActiveView.Fit End Sub '- - - - - - - - - - - - - - - - - - - - - - - - - 'set up component list Function AllPartsList() As Dictionary(Of String, Document) Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = oAsmDoc.ComponentDefinition Dim partsList As New Dictionary(Of String, Document) For Each oOcc In oAsmCompDef.Occurrences 'check for and skip virtual components '(in case a virtual component trips things up) If Not TypeOf oOcc.Definition Is VirtualComponentDefinition Then Dim partName As String = oOcc.Name partsList(partName) = doc Else End If Next Return partsList End Function
This works great, but it does take forever to do it. The one from before was a lot faster. This code goes through and it looks like it runs for each part in the list. But thank you!
Can't find what you're looking for? Ask the community or share your knowledge.