How To: Create Multiple Component Sets From A Single Specification
A typical implementation will create a single set of components per Specification.
However, it is possible to create multiple sets of components from a single Specification.
A Component Set is a part or assembly which has been added to the
Model Rules screen and is not contained in a parent assembly.
This is useful when:
- A Specification requires more than one variation of the same Component to be created.
- A library of standard components is to be created en masse.
This topic explains how to add the ability to create multiple Component variations from a single Specification.
How it works
This example uses a Specification Macro that executes the Run Macro In A Loop
Task to read a Simple Table.
For each row in the Table another Macro will Release a set of Models and queue
all the required iterations to be generated.
The User Form allows each iteration to be specified and the selections stored in a Data Table control.
The results of this control are then exported to a Simple Table (read by the
Run Macro In A Loop Task described above).
The File Name property for each model in the component set includes the Loop Index to allow DriveWorks to
Generate each iteration.
This could be a more intelligent naming convention or a combination of the concepts discussed in the topic File Naming.
Just keep in mind the name given to the parent Component, or any child of an assembly, needs to be unique (has
not been used before) in order for it to be generated.
Steps
Once a Project has been created that includes all the correct Captured Information and the required Specification
Inputs follow the steps below.
Create a Simple Table
- Create an ID column, this will be associated with the Part Number.
- Include all Specification input names required, this is where the Models will get their data.
Create an Export to a Simple Table Data Document.
- Link this to the table that you have just created.
- The ID column will be the Control Field.
- Ensure all required fields are captured.
- Ensure that the ID column always has a unique ID.
- Link all remaining columns to the Return Value of their corresponding form Controls or Variables.
A unique ID can be created by using the number of rows in the Table +1.
Example: TableMaxValue(TableName,1)+1
Create Data Table Control.
- Link this to your Simple Table
- This will display the Specification Data for each Component once added.
Create a Release Documents Macro
- Ensure that you are releasing the Export to Simple Table Data Document.
- Link this Macro to a Macro Button on your Form.
Create a Macro to Release the Models
- Link this to the Model or Component captured.
Create a Macro that loops through the Simple Table, Running the Macro to Release Models for each line
in the
table.
- Add a Run Macro in a Loop Task.
- Set the Macro Name to be the Release Models Macro that was just created.
- The Start Value will be 1.
- The Limit Value will be the number of rows in your Simple Table at point of Running.
- Create a Loop Counter Constant, this will be linked to the Counter Constant.
Link Model Rules to the Simple Table
- Using DriveWorks functions such as TableGetValue link Model Rules to the Table.
- Use the Loop Counter Constant to ensure that the Component's Model Rules are correct at the point of
Generation.
Example: TableGetValue(DwLookupTableName,ColumnNumber,DWConstantLoopCounter)
Modify the File Name Property for each Model to include the Loop Index.
- This will ensure that your Models are unique.
Example: DWSpecificationId &" - "& DWConstantLoopCounter.
Further considerations
Delete incorrect Model Data from the Table
If you would like the ability to delete a row from the Simple Table you can use the Delete Simple Table Rows Macro Task.
You can link this to another Macro Button on your form.
Data Table
The Data Table is not a requirement, if you do not want the Specification Data to be displayed on the form
this can be hidden from the user.
Model Folder Structure
If every iteration of the model needs to be in a separate folder, you can use the same logic applied to the
File Name Property in the Relative Path Property.