Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Missing an 'areProjectedGeometriesShown' property in the Sketch object

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
karl.ri
164 Views, 4 Replies

Missing an 'areProjectedGeometriesShown' property in the Sketch object

Is there a possibility to hide projected geometries?

---------------------------

skt.areConstraintsShown = False
skt.arePointsShown = False
skt.areProfilesShown = False
skt.areDimensionsShown = False

---------------------------

4 REPLIES 4
Message 2 of 5
kandennti
in reply to: karl.ri

Hi @karl.ri -San.

 

Since it does not seem to be provided in the API, we created a sample using a TextCommands.

# 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

        msg: str = "Select Sketch"
        selFilter: str = "Sketches,SketchCurves,SketchLines,SketchCircles,SketchPoints"
        sel: core.Selection = select_ent(msg, selFilter)
        if not sel:
            return

        hide_projected_sketch_geometries(sel.entity)

        ui.messageBox("Done")

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


def hide_projected_sketch_geometries(
        sketchEntity
) -> None:

    skt: fusion.Sketch = None
    if hasattr(sketchEntity, "parentSketch"):
        skt = sketchEntity.parentSketch
    else:
        skt = sketchEntity

    app: core.Application = core.Application.get()
    sels: core.Selections= app.userInterface.activeSelections

    sels.clear()
    sels.add(skt)
    app.executeTextCommand(u"Commands.Start HideProjectedGeometries")
    sels.clear()


def select_ent(
    msg: str,
    filter: str
) -> core.Selection:

    try:
        app: core.Application = core.Application.get()
        ui: core.UserInterface = app.userInterface
        sel = ui.selectEntity(msg, filter)
        return sel
    except:
        return None
Message 3 of 5
karl.ri
in reply to: kandennti

Thanks for your quick response. Your script runs well on its own, but I have to implement it into my script. The script is not finished yet.

Problem 1: The fusionMoveCommand ist started after the script ended.

Problem 2: The sketch offset is sometimes inside, sometimes outside of the projected geometry.

Problem 3: hide_protected_sketch_geometries does not work

I  am a new to scripting and this is my first try to solve my post

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/move-command-modification-showing-an-exten... 

My skript is attached.

 

 

Message 4 of 5
kandennti
in reply to: karl.ri

@karl.ri -San.

 

When calling the hide_projected_sketch_geometries function, do this.

・・・
            hide_projected_sketch_geometries(
                skt.createForAssemblyContext(occ)
            )
・・・

 

Message 5 of 5
karl.ri
in reply to: kandennti

works great,thank you.

👍

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report