iLogic...Suppress all Components in an assembly

iLogic...Suppress all Components in an assembly

steveh3
Advisor Advisor
1,408 Views
3 Replies
Message 1 of 4

iLogic...Suppress all Components in an assembly

steveh3
Advisor
Advisor

Gang...

Taking a deeper dive into some iLogic.

I'm attempting to suppress all components in an assembly.

Is there a way to do this?

 

Then also saw that you suppress all components in a folder. I attempted this but getting an error?

Tried IV 2019 and IV2022 and get same error in both.

Suppress All.png

Thank you in advance,

 

Steve H.

Steve Hilvers
Inventor Certified User / Vault Professional Influencer
0 Likes
Accepted solutions (1)
1,409 Views
3 Replies
Replies (3)
Message 2 of 4

Ralf_Krieg
Advisor
Advisor

Hello

 

The simpliest way I know is to use the builtin Level of Detail. In an assembly call

ThisDoc.Document.ComponentDefinition.RepresentationsManager.LevelOfDetailRepresentations.Item(2).Activate 

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 3 of 4

steveh3
Advisor
Advisor

Thanks Kreig....

Will keep that in mind....but since LOD has been replaced by Model States in 2022....not sure that will work.

So, still looking for some insight :-).

 

Best,

 

Steve H.

Steve Hilvers
Inventor Certified User / Vault Professional Influencer
0 Likes
Message 4 of 4

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

You can make a version for both. This suppresses only the Occurences in the main assembly. If you open a subassembly in a separate window, all of it's Occurrences will be visible.

 

Dim oAssDoc As AssemblyDocument = ThisDoc.Document
Dim oCompDef As AssemblyComponentDefinition=oAssDoc.ComponentDefinition

If oAssDoc.SoftwareVersionSaved.Major >= 26 Then
	Dim oModelState As ModelState
	Try
		oCompDef.ModelStates.Item("AllSuppressed").Activate 
	Catch
		oModelState = oCompDef.ModelStates.Add("AllSuppressed")		
	End Try
	
	Dim oOcc As ComponentOccurrence
	For Each oOcc In oCompDef.Occurrences
		If oOcc.Suppressed = False Then
			oOcc.Suppress
		End If
	Next
Else
	ThisDoc.Document.ComponentDefinition.RepresentationsManager.LevelOfDetailRepresentations.Item(2).Activate 
End If

 


R. Krieg
RKW Solutions
www.rkw-solutions.com