Skip to content

Latest commit

 

History

History
140 lines (85 loc) · 12.9 KB

File metadata and controls

140 lines (85 loc) · 12.9 KB
icon list-check

Row Component Rules

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.

Overview

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

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 %}

Where to configure

To configure these rules:

  • Navigate to Data Sources > Your Primary Cad Data Source
  • Click the Configure button
  • Navigate to the Configuration tab
  • There is a selection option for Generate sub-items using rules
  • Change this from No RulesSpecify Rules
  • A new button will become visible, click it: Configure Server Rules

Supported row types

Supported Row TypesSupported
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]

How does it work?

  • 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:

ArgumentDescription
OrderThe order in which a rule is executed. Drag and drop the handle to re-order rules.
DescriptionA 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.
ActionsThe 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]

Technical Details

[1] Searching

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 value
  • Match condition . Single value
  • Search Text . Can be a list of values
Search Rule ParametersDescription
1st Param

Property accessor: The name of the Property Mapping (accessor) or rowData.xxxx to search for.

This includes values like rowData.isAssemblyRow, rowData.componentName, etc.

If the property is not prefixed with rowData. then the assumption is your searching in the row cells.

If you want to find a cell where the value of X is "Y", you would put 'X' as the first param, 'equals' as the second and 'Y' as the last

If you want to find a cell where the value of material is "Steel", you would put 'material' 'equals', 'Steel'. So the first argument would be 'material'

If you want to find a component where the name of part is 'PRT-1', you would put 'rowData.componentName' 'equals' 'PRT-1', so the first argument would be 'rowData.componentName'

2nd ParamMatch Condition : This is the condition that must be matched.

See the list of conditions below for all possible options
3rd ParamSearch 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 TextExplanation
containsThe 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.
endsWithThe value your looking to match ends with the text specified
endsWithExactThe 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
equalsThe value your looking to match is equal to the value specified, ignoring the casing of the value specified. so 'Text' is equal to 'text'
equalsExactThe 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'
isInListThe value your looking to match is in the list of values. If looking for Alu, you may search in the list [ "alu", "aluminium", "aluminum" ]
notContainsExactThe 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.
regexThe value your looking to match may be found with the specified regular expression
startsWithThe value your looking to match starts with the specified text, ignoring the casing.
startsWithExactThe 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]

[2] Row Actions

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 TextExplanation
createMaterialRowCreates 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.

SettingValue
Order1
DescriptionAdd 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:

AccessorArg1Arg2
rowData.componentNameequalsSM-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:

SettingValue
Order2
DescriptionChange 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:

AccessorArg1Arg2
materialsequalsAluminium

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 %}