What's new

Issue with GetArea()

stepalibre

Alibre Super User
You can write logic that gets the session name and/or type and if Assembly then proceed.

root = alibre.Root
session = root.TopmostSession
session.SessionType
type(session)
CurrentAssembly() - Satisfy the type/object required by AlibreX when using types/objects from Alibre Script

If you have multiple assemblies open you'll need logic to pick the one you want.
 

kyleborot

Member
You can write logic that gets the session name and/or type and if Assembly then proceed.

root = alibre.Root
session = root.TopmostSession
session.SessionType
type(session)
CurrentAssembly() - Satisfy the type/object required by AlibreX when using types/objects from Alibre Script

If you have multiple assemblies open you'll need logic to pick the one you want.
Can't I also put a window dialog where you choose that assembly directory? And make that directory = CurrentAssembly()?
 

stepalibre

Alibre Super User
Can't I also put a window dialog where you choose that assembly directory? And make that directory = CurrentAssembly()?
Is this better?
Python:
root = alibre.Root
for i in range(root.Sessions.Count):
    a = root.Sessions.Item(i).Name
    b = root.Sessions.Item(i).SessionType
    if b == AlibreX.ADObjectSubType.AD_PART:
        print(a)
        print("this is an part")
    if b == AlibreX.ADObjectSubType.AD_ASSEMBLY:
        print(a)
        print("this is an assembly")
 

stepalibre

Alibre Super User
Can't I also put a window dialog where you choose that assembly directory? And make that directory = CurrentAssembly()?
Yes, but not exactly with CurrentAssembly(). You'll need to create your own function/code that returns the assembly you want.
 

NateLiquidGravity

Alibre Super User
If using AlibreScript you can use some unsupported and undocumented shortcuts. For example you can get to the assembly session from the CurrentAssembly() by switching from the AlibreScript Assembly to the API IADAssemblySession like this:
Code:
Assem = CurrentAssembly()
AD_Assem = Assem._Assembly
 
Top