DriveWorks Pro has the ability to replace parts of an assembly with other parts or assemblies. These replacement models take two forms
This topic covers both static and driven replacement models.
After the file name rule of a model is calculated by DriveWorks Pro, the result is checked to see if the model should be replaced with a different model. If the result of the rule indicates that the model should be replaced, then DriveWorks Pro asks SOLIDWORKS to make the replacement in a similar way to if you used the "Replace Components" menu item in SOLIDWORKS.
The benefit of this approach is that if you swap in a model with the same geometry that was used to mate in the original model, then SOLIDWORKS will silently reattach all of the mates to the new component.
Replacement models are required to have identical internal id's as the model they are replacing.
To avoid any mate reference errors avoid mating the model using faces.
When creating the replacement model do not delete any reference geometry used to mate the original component.
There are two methods available for making use of static replacement models:
Using this method means that DriveWorks knows where the model to be inserted is located, so the relative path parameter, of the model to be replaced, is bypassed. It also means that the file name parameter of the model to be replaced just needs to match the name of the model included as a replacement model.
To use static replacement models, in SOLIDWORKS, open the captured model that you want to replace with one or more other models. Switch to the Replacement Models section of the DriveWorks Pro Capture Explorer, and browse for the models you want to be able to use as replacements.
Note, that when the replacement models are added, the name column in the replacement models list shows the file name of the replacement model without its extension, we use this name to control which replacement model to use.
Now that DriveWorks Pro knows about the replacement model(s), the file name rule of the original part needs to be modified to choose which replacement model to use.
So, for example, given three possible types of handle:
If the file rule was calculated as "Shaker Handle" then DriveWorks Pro would replace the original part in its parent assembly with the "Shaker Handle" part file.
The user form has a control, named HandleTypes, that lists the available handle types.
The available types are Shaker, Knob and D Type. The SOLIDWORKS replacement parts are named Shaker Handle, Knob Handle and D Handle respectively.
The following rule is built on the File Name parameter for the part that has these models captured as replacement files.
= IF(HandleTypesReturn="Shaker","Shaker Handle",IF(HandleTypesReturn="Knob","Knob Handle","D Handle"))
With the <ReplaceFile> method a component does not require to be captured.
This method is ideal when models that can replace an existing captured model are constantly being manually created. Files that are created manually do not require to be captured as replacement models each time one is created.
If thought is given to the location and name of the manually created models the rule may not need to change.
In the Model Rules for the component to be replaced build a rule for the File Name parameter using the <ReplaceFile> command as follows:
The full file path along with the name and file extension of the model should be included after the <ReplaceFile> command
If the replacing file does not exist, or the rule does not correctly locate the file, the model generation report for the assembly that is a direct parent of where the replacing takes place will display One of the sub-assemblies in the file '<assembly name> could not be found - the class of the error message in the report will be a Generating Model\Rereferencing.
DriveWorks will swap the file with a reference to the replacing model and suppress the component. Once the replacing file is created the assembly can be opened and modified to display the replacing model.
The user form has a control, named HandleTypes, that lists the available handle types. Another control allows the user to select a color.
The available types are Shaker Handle, Knob Handle and D Type Handle. The SOLIDWORKS replacement parts are named identical to the options available,with the available colors appended to the file name, and are stored in C:\DriveWorks\Models\Handles.
For example the file Shaker Handle Blue.sldprt exists in that location
The following rule is built on the File Name parameter for the part that is to be replaced with these models.
="<ReplaceFile>C:\DriveWorks\Models\Handles\" & HandleTypesReturn & " " & ColorReturn & ".sldprt"
When a new handle type is created the new file needs to be stored in C:\DriveWorks\Models\Handles and the option updated to include the new handle type.
DriveWorks Pro also provides the ability to replace one model with another which is itself a driven model with its own rules.
A replacement model that is to be driven requires capturing in SOLIDWORKS just like the main model driven by your project.
The easiest way to use driven replacement models is to use a "<Replace>" rule which is the method described by this topic.
The steps involved in setting up Driven Replacement Models are:
Capture the driven replacement model by adding it to the required group in the SOLIDWORKS Task Pane. See Captured Models for more information.
Next capture all of the driving parameters and any associated drawings. See the section Capture Parameters from the Model for more information.
Next add the captured driven replacement model to the Model Rules task. See the section To Add a Model to Drive for more information.
Generation order is determined by the order the models appear in the Model Rules list. Ensure the driven replacement models are higher in the Model Rules list than the Main Model they could replace.
To re-order the models:
Top level items in this list will be generated in the order they appear, first in the list will be generated first.
This ensures that any replacement models required to be driven are driven before the main part they will replace.
The File Name rule is now required to consider if a driven replacement file is needed and, if so, the name of the component that will replace the main file.
Using the Model Rules list shown in the image below:
We can see that the component Cupboard RightDoor Shaker Style is the Main Model driven by the project.
Cupboard RightDoor Framed and Cupboard RightDoor are driven replacement models.
The image below is from the user form, this drives the choices for the door types.
This image allows us to match up the choices made on the user form with the components that could be replaced into the model.
So the File Name rule of the Main Model component (Cupboard RightDoor Shaker Style) will be:
=IF(DoorStyleReturn="Flat", "<Replace>Cupboard RightDoor", IF(DoorStyleReturn="Glass", "<Replace>Cupboard RightDoor Framed", DWSpecification))
This rule will:
DriveWorks will know the result of the File Name rule for the driven replacement model and will automatically use that when required.
To make the "<Replace>" syntax even easier, the Rules Builder automatically detects when you are building a file name rule and a browser appears on the right hand side which allows you to just double click on the available components.
|Knowledge Base Article Ref:||KB13103014|