Updating Tool Settings?

  • Hi,

    I'm currently porting a COFFEE script to Python and it seems that accessing/updating tool settings is much more complicated in Python than COFFEE.

    I initially tried something like:

    active_tool = doc.GetActiveToolData()
    active_tool[c4d.MDATA_AXIS_MODE] == 8  # Free Axis Mode

    But it had no effect. I eventually found my way to this post which led me to a solution like this:

    def tool():
        """Retrieves the currently active tool. Doing so allows you to modify tool settings
        unlike GetActiveToolData()"""
        active_tool_id = doc.GetAction()
        if not active_tool_id:
        active_tool = c4d.plugins.FindPlugin(active_tool_id, c4d.PLUGINTYPE_TOOL)
        return active_tool
    def main():
        """Switch from Free Mode to Axis mode and vice/versa.
        active_tool = tool()
        if active_tool is None:
        active_tool[c4d.MDATA_AXIS_MODE] == 8  # Free Axis Mode

    Questions / Requests

    1. QUESTION: Is there a way of knowing when I should change settings with ActiveToolData() vs having to find an instance of the tool/plugin itself?
    2. IDEA: Please add a section to the docs on how to update tool settings.
    3. IDEA: Please add a helper function like tool() to the API for accessing the currently active tool, the present method is a bit convoluted for something people will want to do so frequently.

    Thank you,

    Donovan Keith

  • Hello,

    which tool do you actually want to configure?

    best wishes,