Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid Settings #493

Open
tomcass240 opened this issue Oct 10, 2024 · 1 comment
Open

Grid Settings #493

tomcass240 opened this issue Oct 10, 2024 · 1 comment

Comments

@tomcass240
Copy link

Grids and snaps settings on the control bar at the bottom middle of the screen doesn't work. Clicking grid settings opened the window the first time but after I closed it it doesn't open again. None of the checkbox options work either. I need to turn off snap to grid as it's very difficult to use this software with it enabled.

@Zeroji
Copy link

Zeroji commented Jan 29, 2025

Hello, I had the same issue and the workaround I found was to create a script to do the same thing as the button, since the "Utilities > Add-ins" menu works for me.

Here's the code for toggling the grid lines, put together from samples from the docs:

import adsk.core, adsk.fusion, adsk.cam, traceback

def isGridDisplayOn():
    app = adsk.core.Application.get()
    ui  = app.userInterface

    cmdDef = ui.commandDefinitions.itemById('ViewLayoutGridCommand')
    listCntrlDef = adsk.core.ListControlDefinition.cast(cmdDef.controlDefinition)
    layoutGridItem = listCntrlDef.listItems.item(0)
    
    if layoutGridItem.isSelected:
        return True
    else:
        return False
    

def setGridDisplay(turnOn):
    app = adsk.core.Application.get()
    ui  = app.userInterface

    cmdDef = ui.commandDefinitions.itemById('ViewLayoutGridCommand')
    listCntrlDef = adsk.core.ListControlDefinition.cast(cmdDef.controlDefinition)
    layoutGridItem = listCntrlDef.listItems.item(0)
    
    if turnOn:
        layoutGridItem.isSelected = True
    else:
        layoutGridItem.isSelected = False   

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        setGridDisplay(not isGridDisplayOn())

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

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants