Hi @Anonymous .
I created a sample that changes the grid.
#Fusion360API Python script
import adsk.core, adsk.fusio, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
# grid setting
setGrid(2,10)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
# majerGridSpacing - unit Cm
def setGrid(
majerGridSpacing :float,
minorSubdivisions :float
):
cmds = [
u'NuCommands.DefineGridCmd',
u'Commands.SetDouble GridSpacingInput {}'.format(majerGridSpacing),
u'Commands.SetDouble GridsubdivisionsInput {}'.format(minorSubdivisions),
u'NuCommands.CommitCmd'
]
app = adsk.core.Application.get()
[app.executeTextCommand(cmd) for cmd in cmds]
For more information on how to use TextCommands, see here.
https://forums.autodesk.com/t5/fusion-360-api-and-scripts/use-textcommands2/m-p/9937161