What's new

Read unsuppressed parts and assemblies only

kyleborot

Member
Hello,

I am running a program using AlibreX that uses the root occurrence of an assembly session to read all of the design sessions and occurrences. However, there are suppressed parts in some assemblies that I do not want to read and iterate through. Does anybody know a way to read the design sessions and occurrences of only the parts and assemblies that are unsuppressed?

Alternatively, is there a way to ignore a design session altogether given a condition when looping through the occurrences? I was thinking of a hashmap but I'm not so sure...

Here's an example of my code that prints the names of all the design sessions. Assume all imports.

Code:
alibre = Marshal.GetActiveObject("AlibreX.AutomationHook")
root = alibre.Root
session = root.TopmostSession
assembly_session = session
root_ocurrence = assembly_session.RootOccurrence
occurrences = root_occurrence.Occurrences
for i in range(occurrences.Count):
    print(occurrences.Item(i).DesignSession.Name) #prints the name of all design sessions in the assembly
 

stepalibre

Alibre Super User
Does anybody know a way to read the design sessions and occurrences of only the parts and assemblies that are unsuppressed?

You can check IADOccurrence.IsSuppressed and decide what to do for each case.

Alternatively, is there a way to ignore a design session altogether given a condition when looping through the occurrences?

Ignore the design session? What do you want to do and what's the condition? What problem is the design session causing for you to want to ignore it? You don't have to use the design session if you don't need to. I guess I'm confused as to why you'd ignore the design session, couldn't you just not call properties and methods from the design session. Otherwise you'd need to use the design session in order to access those objects on an occurrence. The design session is always available. More info would help me understand your question.
 
Top