Unsurpressing in Batch

Unsurpressing in Batch

a_burggraafUPR9E
Explorer Explorer
123 Views
2 Replies
Message 1 of 3

Unsurpressing in Batch

a_burggraafUPR9E
Explorer
Explorer

is there a way to unsurpress multiple components or a list in one go in ilogic for better processing speed, for example Unsupress(component1,component2, etc..)

0 Likes
124 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @a_burggraafUPR9E.  As far as I know, there is currently no standard method for suppressing or un-suppressing a 'collection' of component occurrences at one time.  There are methods like that for 'features' (AssemblyComponentDefinition.SuppressFeatures & AssemblyComponentDefinition.UnsuppressFeatures), but not for component occurrences.  Currently, I believe the best way to do something like that is by using the ModelStates (or LOD's in 2021 or older versions).  One of the main things the ModelStates are responsible for is recording the suppression status of assembly components, features, and such (among many other uses).

 

If you often need to change suppression status of specific occurrences (or groups of occurrences), then create a custom ModelState for it, then select all the ones you want to set a certain way, then set them how you want them.  That status change will then be recorded by the currently active ModelState.  Now, whenever you want to suppress or un-suppress that group of occurrences, just activate that custom ModelState, or activate a different one.  That change will usually happen much faster than when trying to make a change like that entirely by an iterating code based process.

 

However, if you need to control suppression status of occurrences in multiple levels of an assembly's structure, then that can get pretty complicated to manage by a single code based process started from the top level.  This is because of what I mentioned above...each sub assembly has its own ModelStates, which record and control the suppression statuses of all the occurrences within that sub assembly.  With that in mind, it is best to make sure that each sub assembly has its own custom ModelStates set-up in them, which can be used to control the suppression statuses of the occurrences within it.  Then when you place an instance of that sub assembly within a higher level assembly, you can set the ModelState of that new occurrence (representing that sub assembly) to one of those custom ModelStates, to control that from a higher level, instead of trying to fully control every occurrence's status from the highest level.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

J-Camper
Advisor
Advisor

@a_burggraafUPR9E 

 

If you don't want to loop through the components, but already have them in an ObjectCollection, then you can add them to the SelectSet and run a ControlDefinition to toggle suppression state.  I generally try to avoid relying on ControlDefinitions, but there are somethings that are not possible through the exposed API, but exist as control definitions because there are user commands.

Dim suppressCommand As ControlDefinition = ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyCompSuppressionCtxCmd")

Dim selSet As SelectSet = ThisDoc.Document.SelectSet
'selSet.SelectMultiple(Etities As ObjectCollection)
If selSet.Count > 0 Then suppressCommand.Execute2(True)

 

For testing, if you select the intended components then run the rule they will toggle their suppression state.  This is the same behavior as using the the UI to toggle suppression of multiple components.

 

If you collect the components into an ObjectCollection using iLogic then you can uncomment the "SelectMultiple" line and put you object collection inside the ().