Command Utility Manual

About

A lot of functionality of Cinema 4D is implemented in form of commands. Such commands are plugins based on CommandData. A command is identified by a specific ID that can be used to invoke that command.

Note
The described functions can only be used from the main thread, see Cinema 4D Threads Manual.
The command IDs can easily be obtained from the "Customize Commands" dialog.
These functions wrap around SendCoreMessage().
For modeling commands see SendModelingCommand(), for UV commands see CallUVCommand(), for painter commands see SendPainterCommand().

Functionality

These functions exist to access and utilize existing Cinema 4D commands:

// This example prints the name and help text of the given command.
const Int32 commandID = 12098; // save active project
const maxon::String name = GetCommandName(commandID);
const maxon::String help = GetCommandHelp(commandID);
ApplicationOutput("Command \"@\" (@)"_s, name, help);
Warning
Using CallCommand() is the same as pressing the corresponding button in the GUI. This means the command operates on the active document, adds undo-steps and sends messages. So CallCommand() should only be used in response to some user interaction e.g. when a button in a GeDialog was pressed.
// This example checks if the given command is enabled.
// If so it is executed.
const Int32 commandID = 14047; // subdivide command
// check if the command is enabled (available)
if (IsCommandEnabled(commandID))
{
CallCommand(commandID);
}

Further Reading