Using variables to make your automated processes more generic


Process automation in BuildIT is a powerful tool that can save you a lot of time if you need to repeat the same action multiple times or whenever you perform an inspection. You can simply record your process the first time and then play it back to get the same result the next time.

While this can be great, in practice it is quite rare that we need to do the exact same thing over again. We may want to perform the same operation, but on different elements, or on all elements of a set.

BuildIT’s automation module allows you to do this using variables. Variables can be used to store all kinds of information that varies between executions of your process. In its simplest form, using variables, your process no longer references a specific object. You define which object to use when running your process and this execution of the process will be applied to the object you selected.

Below, we see a simple process which caps both ends of a cylinder using planes that are then trimmed. We recorded the process by performing the commands interactively once on “Cylinder1”.

BuildIT Cap Cyclinder 0

I have cheated a bit here and already edited the command names so that the tree at the left of the editor shows a more meaningful description of what each command is doing. By default, this will simply show the command id.
From this simple process, which would only work on a 10mm cylinder named Cylinder1, we want to get a generic process that will work on any user-specified cylinder.

The first step is to create a prompt for the user when starting the process to specify the cylinder name and store it in a variable.

BuildIT Variables Automation

Next, we replace the references to Cylinder1 in the process by $(CYLINDER). The dollar sign and parenthesis signal to BuildIT that we are using a variable and the variable name is given within.

BuildIT Cap Cylinder 1

With these changes, we can run the process and select the cylinder to be capped. This will work fine, as long as the cylinder is 100mm in diameter. If the diameter is different, the cap will still be 10mm wide and not seal the cylinder.

We need to modify the process so that it will work with cylinders of different diameters. For this, we will be using the PROPERTY function to get the diameter of the selected cylinder and use it when creating the planes instead of a hard-coded value of 10mm. For creating the circles, we will need to use the Radius property instead of the 5mm hard-coded value.

BuildIT info tab

The PROPERTY function can be used to get any property of an object that is shown in the information tab and use it as a value within a process. Here we will be getting the Diameter property of the selected cylinder. Check the online help for more information on using the PROPERTY function.

BuildIT Cap Cylinder 2

With all these changes in place, if we now run this process, we will get a window that allows us to select which cylinder should be modified by the process.

BuildIT Process Play Window

This is just a start of what can be done with variables. In a future post, we will see how we can execute a process or part of a process on a set of elements, either user-specified or matching some criteria. These advanced capabilities build upon the usage of variables we presented here.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply