Python tools: best practices
 
 
 

Frequently-used tools can be started from the Startup directory; but if rarely used, start them by dragging into the scene.

Do not create a tool twice

If all tools in the startup directory are created like SafeToolCreationExample.py, you have the best of both worlds: a tool is executed once and can be dragged and dropped in the viewer when needed.

Rather than using FBTool, you should use pyfbsdk_additions::CreateUniqueTool or pyfbsdk_additions::CreateTool which ensure that the tools are added to the tool list and that the Python ToolManager knows about them.

Unlike FBTool, CreateUniqueTool and CreateTool use the Python ToolManager.

pyfbsdk_additions::CreateUniqueTool

Recommended: checks whether a tool with a similar name exists, and if so, it destroys that tool. It then creates a new tool with the same name. So each time you re-execute your script during testing, there is only one tool instantiated.

pyfbsdk_additions::CreateTool

Recommended: creates a tool without destroying the previous tool.

pyfbsdk::FBTool

Not recommended, as it does not register your tool with the Python ToolManager.