Hide Grid? - Shortcut


Hello guys.
I started working recently on Cinema4d. I’m thinking of migrating to it after 18 years working with 3d Studio Max. I’m really enjoying Cinema4d.

But it has a simple functionality that I can not configure in Cinema4d. I would like to create a shortcut key for the command:
Grid - Enables / Disables the grid display.

I already checked the documentation and found that it is not possible to assing a shortcut key for this command. By searching the CGtalk Forum, I discovered a script that would do this …
The problem is that the script is very old and currently in version R17 is not working … Could you tell me why? Maybe someone around understands scripts better.

The script suggested by CGtalk is this:
Var doc = GetActiveDocument ();

Thank you for your attention!

(the original topic is this: http://forums.cgsociety.org/archive/index.php?t-421997.html#)


I have this set up as a script which I’ve mapped to a key command
The script I’m using is as follows


I named my script Toggle Grid and it appears in the Customise Commands manager, which you can then select and map a key to


Try this:

var doc = GetActiveDocument();

I have C4D R.18 and it’s working. (BTW I found this on CGSociety forum as far as I can remember).


Well, as for the “why”: COFFEE is case sensitive. So, first “Var” needs to be “var”. Second, you define “doc” but use “Doc”. If you go with small letters in both cases, it works fine (and actually the original link has it that way…)

For further reference: “doc” is a predefined variable, so you can go without the first line altogether and just use the single command in the second and third line.

If you start with the “main” function, “main(doc,op)” already contains “doc” as a parameter too, so you won’t need to define the variable again, or set it. Note that everyEnd’s code also gets garbled by CGSociety’s formatting: there is a whitespace in “HORIZO N” which should not be there.


Oh, and of course this is COFFEE code, not Python - Python is preselected in the Script Manager so you will need to switch to COFFEE before you use the editor.

And you may want to open the Console that shows errors for the scripts, to get more information when a script just doesn’t work.


Hi, i made these some times ago, to toggle camera, lights and grid filters…if you want to check em out: