| icon | list-check |
|---|
When using SharpSync to send Bill of material data to your ERP, it may be desirable to show material consumption rows. You may want materials to automatically be listed as children of part components. The Row Component Rules are meant to assist with this.
Row Component Rules are rules that run before the BOM is shown on screen the first time. It affects not only the data of the BOM, but also (optionally) the structure.
These rules are (different from Property Mapping rules) pre-BOM-load generation rules, or Row Component rules. These rules run:
- After the BOM is generated using the Primary Data Source, but
- Before the BOM is displayed on-screen. This is different to the client-side rules (Property Mapping Rules), which only run per-source, after the BOM is displayed on-screen.
Row Component Rules Order
{% hint style="success" %}
You may think of row component rules as rules that affect the structure of a BOM. The structure of the BOM is affected by renaming components or adding new components.
Compare this to Property Mapping rules that only affect the cell values, not the structure or component names.
{% endhint %}
To configure these rules:
- Navigate to
Data Sources> Your Primary Cad Data Source - Click the
Configurebutton - Navigate to the
Configurationtab - There is a selection option for
Generate sub-items using rules - Change this from
No Rules⇒Specify Rules - A new button will become visible, click it:
Configure Server Rules
| Supported Row Types | Supported |
|---|---|
| Generate Single Child Row | ✅ |
| Generate Multiple Child Rows at same level | ✅ |
| Generate Multiple Child Rows at different levels | ❌ |
| Generated Material Children | ✅ |
| Drawings | [future release] |
| Derivatives | ❌ |
| Primary Source | Supported |
|---|---|
| Autodesk Inventor | [future release] |
| Autodesk Fusion | [future release] |
| CSV | [future release] |
| Onshape | ✅ |
| SolidWorks | [future release] |
| SolidWorks PDM | [future release] |
- Each rule is run in the order specified
- Rules are additive only
- A rule has 1 or more search conditions
- A rule has 1 or more actions
Structure of a rule
Where the following key concepts should be noted:
| Argument | Description |
|---|---|
Order | The order in which a rule is executed. Drag and drop the handle to re-order rules. |
Description | A user-friendly description of what the rule does. You may enter anything here. (optional) |
Search Rules | What to search for. This can be a single or multiple criteria. See [1]. If a row is found, an action may be taken. If a row is not found, nothing happens. |
Actions | The actions to perform when the Search Rule(s) are matched. If searching for say, PRT-123, and you find a match, the specified action will be performed. See [2] |
When searching for a row, the row will be found based on the conditions specified.
The way the Search Rule works is that it takes 3 parameters. These are
Property accessor. Single valueMatch condition. Single valueSearch Text. Can be a list of values
| Search Rule Parameters | Description |
|---|---|
| 1st Param |
This includes values like If the property is not prefixed with |
| 2nd Param | Match Condition : This is the condition that must be matched. See the list of conditions below for all possible options |
| 3rd Param | Search Text. The text used to identify a row. If the text is matched (or not matched based on the condition), an action is taken. |
Search Conditions available in a rule (not case sensitive. Casing is applied below for ease of reading).
Some options have more than 1 way of being specified and is listed on different rows. They evaluate to the same result.
| Condition Text | Explanation |
|---|---|
| contains | The value your looking to match contains the text specified |
| doesNotContain | The value your looking to match does not contains the specified text, not taking into account the casing. Use this sparingly as this will match most rows. |
| endsWith | The value your looking to match ends with the text specified |
| endsWithExact | The value your looking to match ends with the text specified, including the casing of the text. So 'A' is not the same as 'a' |
| is containsExact | The value your looking to match is exactly the text specified |
| equals | The value your looking to match is equal to the value specified, ignoring the casing of the value specified. so 'Text' is equal to 'text' |
| equalsExact | The value your looking to match is equal to the value specified, considering the casing of the value specified. so 'Text' is not equal to 'text' |
| isInList | The value your looking to match is in the list of values. If looking for Alu, you may search in the list [ "alu", "aluminium", "aluminum" ] |
| notContainsExact | The value your looking to match does not contains the specified text, taking into account the casing. Use this sparingly as this will match most rows. |
| notExact | The value your looking to match does not equal the full specified text, taking into account the casing. Use this sparingly as this will match most rows. |
| regex | The value your looking to match may be found with the specified regular expression |
| startsWith | The value your looking to match starts with the specified text, ignoring the casing. |
| startsWithExact | The value your looking to match starts with the specified text, taking into account the casing. |
| != | Does not equal. Does not consider text casing. |
| !== | Does not equal. Considers text casing. |
| > | [future operator] |
| >= | [future operator] |
| < | [future operator] |
| <= | [future operator] |
Row actions are actions that are performed on existing rows or new rows. There are 2 types of actions: RowCellAction and RowCreationAction
A RowCellAction performs an action on the cell specified for the row.
| Condition Text | Explanation |
|---|---|
createMaterialRow | Creates a new row. Does not do anything else. Takes no parameters |
setCellValue | Sets the specified cell value or rowData.xxx value to the user specified value.SharpSync considers this value as a source value from the CAD source. Has no noticeable effect on Property Mapping Rules. Should not be used on the same row as createMaterialRow |
copyCellValue | Only applicable to new rows. Sets the specified cell value or rowData.xxx value to the user specified value from the source row. This is the parent row values copied to the child row values. SharpSync considers this value as a source value from the CAD source. Has no noticeable effect on Property Mapping Rules. Should not be used on the same row as createMaterialRow |
Example: Add a new material row if the component material equals "SM-PUR"
The following example, we check if a row's material equals SM-PUR. If it matches, a new sheet metal row will be added below the component for a flat pattern, setting the value of qty to 1 and naming the component the same as the original, but appending -FLATPATTERN at the end.
| Setting | Value |
|---|---|
| Order | 1 |
| Description | Add material row for SM-PUR |
Next we'll setup the search rule condition. This will tell SharpSync how to identify the row. We'll use only a single condition:
| Accessor | Arg1 | Arg2 |
|---|---|---|
| rowData.componentName | equals | SM-PUR |
Now that the search rule condition has been setup, let's setup the actions:
| Accessor | Arg1 | Arg2 |
|---|---|---|
| createMaterialRow | [blank] | [blank] |
| setCellValue | rowData.componentName | {rowData.componentName}-FLATPATTERN |
| setCellValue | quantity | 1 |
| setCellValue | canBePurchased | true |
Example: Substitute material name
In the example below, we'll search for any material call Aluminium. We'll change the value to AS-2005 because we want to use the material code, not the name assigned in the CAD system. We also make sure that the unitOfMeasure is in meters, not each:
| Setting | Value |
|---|---|
| Order | 2 |
| Description | Change material name |
Next we'll setup the search rule condition. This will tell SharpSync how to identify the row. We'll use only a single condition:
| Accessor | Arg1 | Arg2 |
|---|---|---|
| materials | equals | Aluminium |
Now that the search rule condition has been setup, let's setup the actions. There will be no createMaterialRow action since we just want to change the value of the material:
| Accessor | Arg1 | Arg2 |
|---|---|---|
| setCellValue | material | AS-2005 |
| setCellValue | unitOfMeasure | m |
{% hint style="danger" %} Take note: To make troubleshooting easier, try not to run value substitutions for existing rows. In the examples above, this will work, but you might run into difficulty trying to establish why the value in SharpSync is different to that of the value in your CAD system because there is no indication that the value has changed. Ideally you should use row component rules to create new rows only. But you know, we all have different needs, so if you find this is a requirement, go for it! ;)
The reason you might want to change values is because you have a legacy CAD library that has old values, and you want to still keep those in place, while updating the values displayed in SharpSync. This can still be achieved with rules and you can see that it was edited with a rule. With Row Component Rules, you will not see that it was edited with a rule. {% endhint %}
