Home Technical Talk

3d max grid question

polycounter lvl 14
Offline / Send Message
fade1 polycounter lvl 14
hey maxusers,
is there a way in max to set custom grid sizes, for example 1,0 and 0,1, and map those to the keyboard?

Replies

  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Not sure what you mean by 1,0 and 0,1...

    The maxscript command for setting a grid size is setGridSpacing, so you could create a custom macroscript, something like:
    if getGridSpacing() == 4.0 then setGridSpacing 8.0
    else setGridSpacing 4.0
    

    The Maxscript help files tell you how to set up a custom macroscript, from there you can bind it to a hotkey. The code I pasted above would set the space between grid lines to 8 if it was currently 4, and if it was any other value it'd get set to 4 (so would become a toggle between 8 and 4 no matter what the starting size was).

    I have one at work which basically just doubles the grid spacing when ] is pressed, and halves the spacing when [ is pressed, and I just keep it all in powers of two.
  • fade1
    Offline / Send Message
    fade1 polycounter lvl 14
    thanks. i just hoped i could get around maxscript. looked through this a little, but i always get an error message. maybe you can help, as i just do some mel stuff and maxscript works a little different. probably just some mistake with the setup of macroscripts.

    error.png
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Oops, the setGridSpacing command is only available in Max 2008 or later, looks like you're on an earlier version, so it won't work.

    Use gridPrefs.spacing instead...
    if gridPrefs.spacing == 1.0 then gridPrefs.spacing = 0.1
    else gridPrefs.spacing = 1.0
    

    There's also the gridPrefs.majorLines value, sets the major line spacing to whatever number you give it. All of this is in the Maxscript Reference document, just type "grid" into the Index, you'll find all the related commands with explanations there.
  • fade1
    Offline / Send Message
    fade1 polycounter lvl 14
    great. that works now. i was actually already digging into the command reference and couldn't find the command, but thought it was some different problem.
    that really helped my workflow. thanks for your fast help.
Sign In or Register to comment.