Extract Definition and Usage
Over time, your model may grow to contain usage elements with repetitive features, thus the use of typing by definition elements would be useful. The Extract Definition command allows you to extract a definition element with the features of the usage element. This improves feature reusability, allowing you to easily generate definition elements that can be used for typing other usage elements.
On the left: the same attributes diameter and width are each created for the parts leftFrontWheel and rightFrontWheel, resulting in duplicated elements that serve the same purpose.
On the right: once the Extract Definition command is executed on the rightFrontWheel element, the definition is extracted with the part's attributes.
The rightFrontWheel element is then defined by the extracted definition, inheriting its attributes. The leftFrontWheel part can then be defined by the definition as well.
Extracting a definition element from a usage element
Once you execute the Extract Definition command, all owned features, except for the redefined ones, are moved to the definition, which is then set as the type for the usage. All features that have been moved are then inherited instead of being owned by the usage.
To extract a definition element from a usage element
- Right-click a usage element(s) or its symbol(s) and in the shortcut menu select Refactor, then Extract Definition.
The appropriate definition element is created.
Extracting a usage element
You can also use the Extract Usage command to extract a usage element. This is especially useful when reusing and adapting actions, use cases, and states to different contexts.
Once you execute the Extract Usage command:
- The extracted usage is owned by the same package and named after the element from which it was extracted;
- The extracting usage reference subsets the extracted usage;
- All owned features of the extracting usage are moved to the extracted usage, except for the redefined ones;
- All features that have been moved are then inherited instead of owned by the extracting usage.
Extract Usage command is only available for perform action, include use case, and exhibit state usage, unless they reference other elements.
To extract a usage element from a perform action usage, include use case usage, or exhibit state usage element
- Right-click a perform action usage, include use case usage, or exhibit state usage element(s) or its symbol(s), and in the shortcut menu select Refactor, then Extract Usage.
The appropriate action, use case, or state usage element is created.