How do I assign a material based on a property?
When a part has no material but a property has nevertheless been entered manually, the material corresponding to that property should be assigned to the part. This may be the case when the project comes from a subcontractor or when, for the sake of simplicity, no effort was made to assign the correct material to the various parts at the time of their creation...
This process isn't very complicated, but if the project involves a lot of parts, it may take a long time to complete. Generally, the same materials are often used, and the process can easily be automated.
To make these changes, we'll use the "Integration" tool. Here are the steps to follow:
Step 1:
Select the folder or files to process.
Step 2:
Create an initial action corresponding to a material (e.g., AISI 1020).
We need to define two conditions:
- Process only documents of the "invoice" type.
- Check whether a property exists (e.g., MATIERE).
Step 3:
Create an operation that meets both conditions in order to change the part's material. The listed materials correspond to the "material databases" defined in the SOLIDWORKS options.
Step 4:
Repeat the process of creating an action as many times as necessary for all materials.
After the processing begins, the material assigned to the various selected parts is correctly displayed.
You can find this example of creating "Mat to Mat SOLIDWORKS.mcact" actions in the myCADtools installation directory:
(..\Program Files\Visiativ\myCADtools\Integration\Samples\fr)
This directory contains many other practical examples of how to use the "Integration" tool.
For more details on this tool, see Integration