propertyValue = sketch_var.isActive

propertyValue = sketch_var.isActive

MichaelT_123
Advisor Advisor
467 Views
2 Replies
Message 1 of 3

propertyValue = sketch_var.isActive

MichaelT_123
Advisor
Advisor

Hi TF360,

 

Could you consider adding isActive property to the SketchObject class?

 

propertyValue = sketch_var.isActive

 

Property Value
This is a read only property whose value is a boolean.

 

Regards

MichaelT

MichaelT
0 Likes
Accepted solutions (2)
468 Views
2 Replies
Replies (2)
Message 2 of 3

kandennti
Mentor
Mentor
Accepted solution

Hi @MichaelT_123 -San.

 

Why not prepare your own functions and use them as extended methods?

# Fusion360API Python script

import traceback
import adsk.core as core
import adsk.fusion as fusion

def run(context):
    ui: core.UserInterface = None
    try:
        app: core.Application = core.Application.get()
        ui = app.userInterface
        des: fusion.Design = app.activeProduct
        root: fusion.Component = des.rootComponent

        fusion.Sketch.isActive = is_active_sketch

        skt: fusion.Sketch = root.sketches[0]
        app.log(f"{skt.isActive()}")

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


def is_active_sketch(self: fusion.Sketch) -> bool:
    des: fusion.Design = self.parentComponent.parentDesign
    return des.activeEditObject == self
Message 3 of 3

MichaelT_123
Advisor
Advisor
Accepted solution

Hi Kandennti-San,

 

It is a good solution that is already at hand. Thank you for pointing it out. I have missed the design.activeEditObject !!!

 

Regards

MichaelT

MichaelT