Get currently active component

Get currently active component

jeremiahrose
Enthusiast Enthusiast
828 Views
1 Reply
Message 1 of 2

Get currently active component

jeremiahrose
Enthusiast
Enthusiast

I have a script that creates some geometry, and I want that to happen within the component that is currently active in the UI. I couldn't find any info about this in the reference manual or forums, so - what code should I use to get a reference to the active component?

Accepted solutions (1)
829 Views
1 Reply
Reply (1)
Message 2 of 2

jeremiahrose
Enthusiast
Enthusiast
Accepted solution

Found it:

app = adsk.core.Application.get()
design = app.activeProduct
comp = design.activeComponent 

Link to reference manual