How to Add a Command

Theoretical considerations are one thing, but they cannot beat a practical example. In this short tutorial you will be guided through the process of adding a Python command to RealFlow. The command will be equipped with an icon and a shortcut, and hooked to one of RealFlow's shelves.

The first thing you need is a Python script that should be defined as an embedded command. Please click on this link to download the program:


Please download the "SceneSummary" script and its icon here: SceneSummary.zip

 

The script creates a summary with some of the current scene's important settings: FPS rate, number of threads, simulation range, scale, and many more. When the command is executed, the script will print the output to the “Messages” window.

 Adding the Script to the “Commands Manager”

  • Open Tools > Commands Manager

  • Click on the “Add” button and choose “Add new script from file”.

  • Select the script.

 

 

Here is what you can see in the “Add Command” window:

 

 

Currently, the command uses a reference (or link) to the script on your hard disk, but in this example, the script should be embedded into RealFlow directly:

  • Press “Embed command in RealFlow”.
  • Confirm the appearing dialogue and check "Reuse current Class ID".



Completing the Command's Properties

The most important part has been done already and the remaining input fields are completed within a few minutes:

  • The “Class Id” entry does not have to be changed unless you really have a reason for creating a new number. The Id's leading 4, by the way, indicates that the Id is assigned to a Python script.
  • By default, the script's file name is used for the “Name” field. Feel free to change it to something different.
  • Under “Copyright” enter “Next Limit Technologies” (or leave it blank)
  • To define a shortcut, please click on “Edit”.
  • In the appearing window, click on “+” and press the keys you want to use as a shortcut, e.g. Shift + S.
  • Confirm with “OK” and the shortcut appears in the appropriate field. If your shortcut is already used by RealFlow (e.g. Ctrl/Cmd + N) you will get a conflict warning.
  • Add description like “Python command, which prints a scene's most important specifications to RealFlow's "Messages" window.”
  • The icon should be stored in a save place. It is a good idea to use a common folder for all of your icons. Click on “Edit Icon” and load the SVG file in the "From File" tab with the "…" button. If you cannot see the icon change the file type to "Scalable Vector Graphics files (*.svg)".
  • Leave "As file reference" checked ad adjust the icon's resolution if necessary.
  • Click on “Apply”.



Adding a Command to a Shelf

The script appears in the “Commands Manager's” list and now it can be attached to a shelf.

  • Click on the “Shelves Manager” button.

  • Look for your script in the list, or use the “Python” option under “Filters...” to show all scripts.

  • Click on the “Add new shelf” on the left

  • Shelf Name > System Commands

  • Shelf Visibility > Visible

  • OK

  • Drag the “Scene Summary” command from the right window onto the “System Commands” entry in the left window. This action will attach the command to the newly created shelf.

  • Close

 

Now, the new command appears in RealFlow's user interface. Open the “System Commands” shelf and click on the script's icon. In the “Messages” window you will see the output.