Creating a New Custom Dynamo
The following procedures demonstrate examples of how to create and use custom Dynamo objects in iFIX.
To build a Dynamo object:
- Open a new picture.
- Insert an Oval.
- In the Properties window, change the Name property of the Oval to dynOval.
- For the dynOval object, animate the VerticalFillPercentage property to any tag in the process database.
- Insert a second Oval.
- In the Properties window, change the Name property of the Oval to dynOval2.
- Select both ovals.
- Right-click the selected ovals, and select Dynamo. The Build Dynamo Wizard appears.
NOTE: You can also click the Build Dynamo button, the first button on the Dynamo toolbar to open this dialog box.
- In the Dynamo Name field, enter a name, if you do not want to use the default name.
- Optionally, in the Object Description field, enter a description for the object.
- In the User Prompt field, enter a prompt such as FillColor.
NOTES:
- Ensure you enter a value here. If you do not enter a value, the user will not be shown the value in a user prompt, and as a result not have the option of changing it later. However, you can access this value manually from the Property window.
- If you added multiple animations in this Dynamo object and you wanted them to all use the same value, enter the same name in all User Prompt fields. This results in one user prompt that changes all animations.
- Click OK.
To build a Dynamo form:
- Right-click the Dynamo object and select Edit Script from the pop-up menu.
- In the Microsoft Visual Basic Editor, on the Insert menu, select UserForm.
- If the Properties window is not already displayed, on the View menu, select Property Window.
- In the Properties window, change the Name property of the form to frmDyn1.
- On the Tools menu, click Additional Controls.
- Select the iFIX Expression Editor Control and click OK.
- Select the Expression Editor control on the toolbox and add it to the form.
- Add a Command button on the form.
- Right-click the Command button and select View Code from the pop-up menu.
- Enter the following script:
frmDyn1.hide
- Select "General" from the Object Drop Down List (in the upper left of the Code Window).
- Enter the following script:
'FormVersion: 1.0
- Select the script window for dynOval.
- Choose Edit from the Procedure drop-down list.
- Enter the following script:
Private Sub DynamoObjectName_Edit()
Dim FillObj As Object
frmDyn1.Show
'FindLocalObject (below) is a subroutine in
'FactoryGlobals Global Subroutines. In this case, it
'finds the animation object that you created off of the
'oval in step 4 of Building the Dynamo Object.
Set FillObj = FindLocalObject(DynamoObjectName, _
"AnimatedVerticalFillPercentage")
FillObj.Source = frmDyn1.ExpressionEditor1.EditText
End Sub
- Save your project and close the Microsoft Visual Basic Editor.
To create a Master Dynamo and place
it in a Dynamo set:
- In the iFIX WorkSpace, in Ribbon view, on the Home tab, in the New group, click Dynamo Set.
- Or -
In Classic view, on the File Menu, select New Dynamo Set.
An empty Dynamo set appears.
- Drag the Dynamo that you created earlier in this section into the new Dynamo set. The Add Objects to Dynamo Set dialog box appears.
- In the Add Objects to Dynamo Set dialog box, select Create a new Master Dynamo and then click OK. The object becomes a new Master Dynamo in the Dynamo set.
- Select Save from the File menu and name your Dynamo set.
For more information on Dynamos, refer to the Creating Pictures manual.