Showing an individual sketch

Showing an individual sketch

cwalsh561
Contributor Contributor
333 Views
2 Replies
Message 1 of 3

Showing an individual sketch

cwalsh561
Contributor
Contributor

There may already be a way of doing this that I don't know about. Please let me know if there is.
My designs have many sketches and often I need to see only the sketch I am working on.  I can hide sketches individually in the browser but it would be great to be able to have single click option to hide all sketches except the one I'm working on.  Perhaps a right click option on each sketch?

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

BrianEkins
Mentor
Mentor

I'm not sure what your exact workflow is, but here's something to get you started. It turns off the display of all sketches except the active sketch.

def HideSketches(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface

        if app.activeEditObject.objectType != adsk.fusion.Sketch.classType():
            ui.messageBox('A sketch must be active.')
            return

        # Get the active sketch.
        activeSketch: adsk.fusion.Sketch = app.activeEditObject

        # If the sketch is in an subassembly, the selection returns a proxy
        # relative to the root component. This gets the native sketch in
        # it's parent component.
        if activeSketch.assemblyContext is not None:
            activeSketch = activeSketch.nativeObject

        product = app.activeProduct
        design = adsk.fusion.Design.cast(product)      

        # Iterate through all of the components in this document
        for comp in design.allComponents:
            # Check to see if this component is owned by this design
            # and is not an externally referenced component.
            if comp.parentDesign == design:
                # Iterate through the sketches in this component.
                for sk in comp.sketches:
                    # Check if this sketch is the active sketch.
                    if sk != activeSketch:
                        sk.isLightBulbOn = False
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 3

cwalsh561
Contributor
Contributor

Thanks for your reply Brian.  Sadly, my knowledge doesn't extend to modifying the software and I was hoping the change might be included in one of the frequent updates Autodesk make to Fusion 360 at sometime in the future.

Kind regards,

Chris

0 Likes