Hello @LingZA,
Thank you for reaching out to us. Thank you for posting your solution, much appreciated! I have provided below a variant of your example which without having the C++ Example Pick Object Tool installed.
In case someone is wondering how to find out such a thing, you would have to look into the description of a tool, e.g. the extrude tool ...
toolextrude.res:
CONTAINER xbeveltool
{
NAME xbeveltool;
GROUP MDATA_BEVEL_GROUP_OPTION
{
DEFAULT 1;
LONG MDATA_BEVEL_MASTER_MODE
// ...
}
INCLUDE ToolBase; // Includes the gadgets that are common to all description tools.
}
to find out that they all include all ToolBase which then looks like this:
toolbase.res:
CONTAINER ToolBase
{
NAME ToolBase;
GROUP MDATA_MAINGROUP
{
DEFAULT 1;
}
GROUP MDATA_COMMANDGROUP
{
DEFAULT 1;
GROUP
{
// SEPARATOR { LINE; }
BOOL MDATA_INTERACTIVE { }
SEPARATOR { }
GROUP
{
COLUMNS 2;
DEFAULT 1;
BUTTON MDATA_APPLY { FIT_H; }
BUTTON MDATA_NEWTRANSFORM { FIT_H; }
}
}
}
SUBCONTAINER ID_SNAPSETTINGS
{
}
}
Cheers,
Ferdinand
Code:
"""Actives and runs the extrude tool.
"""
import c4d
ID_EXTRUDE_TOOL: int = 1011183
def main() -> None:
c4d.CallCommand(ID_EXTRUDE_TOOL)
tool = c4d.plugins.FindPlugin(ID_EXTRUDE_TOOL, c4d.PLUGINTYPE_TOOL)
tool[c4d.MDATA_INTERACTIVE] = True
c4d.EventAdd()
if tool is not None:
c4d.CallButton(tool, c4d.MDATA_APPLY)
c4d.CallButton(tool, c4d.MDATA_NEWTRANSFORM)
c4d.EventAdd()
if __name__ == '__main__':
main()