Adding a Pre-Condition to Task 2
Add a pre-condition to Task 2.
The following code adds a pre-condition to Task 2 to check whether a part exists in the Geometry > Parts manager node. If no part exists, the task is disabled (greyed out). If a part exists, the condition is satisfied and the task is enabled. Pre-conditions only affect the task that they are placed in.
- Return to the Task02CreateRegionFromPart class.
- Locate the public Task02CreateRegionFromPart() constructor.
-
Add the following code to this constructor:
// Makes sure that a geometry exists before enabling this task. setPreconditions(Collections.singleton(InternalFlowConditions.createPartCondition()));
where:
- setPreconditions() sets the pre-condition for the task.
- Collections.singleton(InternalFlowConditions.createPartCondition()) is the condition that checks for a geometry part.
- Add the missing import.
- Save and build your project.