The physical connection selectors have the option to choose many different parameter rules, and the parameter rules have the option to make many different calculations. The output of the parameter rule is a set of values that are applied to the weld symbol. That collection of parameters is stored in the model, as part of the definition of the physical connection object.
Each parameter rule may set all of the available parameters in the symbol, or a sub-set. The key points for using parameters are as follows:
Every output parameter must be set
Every parameter that is an output of the parameter rule must be set. If a parameter is not needed, or if the default value in the catalog should always be used, the parameter should not be declared as an output.
The parameter names must not be changed
The names must be used exactly as they are defined in the symbol because those are the names expected by manufacturing. The definition of additional, custom parameter names is allowed.
Meters and Radians should be used
When setting a parameter value, any distance value should be expressed in meters. Any angle value should be expressed in radians. Once in the model, the values are adjusted to take on the unit types of the workspace.
Current versus Stored parameter values
When setting a parameter from another parameter in ParameterRuleLogic, it is important to remember that the stored value of the parameter represents the previous stored value, even after calling pIJDParameterLogic.Add to add the new value. To use a value from this execution of the parameter rule, you must save it in a variable. The code that stores the results from rules automatically decides whether each result from this execution has been overridden by the user by clearing the Rule Based check box. If it has been overridden, the computed value is ignored for this field.
For the IJBevel parameters, all of the values are computed and stored in a single operation. If some of the values are overridden, this can cause the overall set of values to be inconsistent, but this is the expected behavior. If you want to override some values within a set, you must override all of the other affected values to keep it consistent. For example, if you increase the nose dimension, you must decrease one or more of the bevel depths so that the total of the nose dimension and all of the bevel depths equal the overall material thickness.
For the IJWeldingSymbol, some of the parameters are based on the values from the IJBevel. Fortunately, this relationship is in one direction only. The IJBevel parameters do not have to respond to values that are overridden in the IJWeldingSymbol. However, this requires an additional step in setting the IJWeldingSymbol parameters. If you are manually overriding values in the IJBevel it cannot be expected to update all of the IJWeldingSymbol parameters affected by the bevel changes. For this reason, the IJWeldingSymbol update must make sure it uses the correct (computed or overridden) parameter values from IJBevel.
For the FT Library, these override values are implemented for each type of joint (Tee, Butt, or Lap) within the code that sets the IJWeldingSymbolValues. For the Smart 3D libraries, there are two methods: SetCalculatedTeeWeldParams and SetCalculatedButtWeldParams. For lap weld, corresponding parameter values(LapWeld1ParameterRule and LapWeld2ParameterRule) sets the values for the parameters(MoldedFillet, AntiMoldedFillet, and EdgeShape). To handle the overridden values, these methods set the valid types for each specific weld, get the IJBevel parameters that are used, check each for whether it is overridden, and then use either the computed or the overridden value. The following methods were implemented in ConnectionServices.cs to define the behavior:
Defines the parameters valid for each weld type and the sequence in which they appear in the parameter array. This is called to determine which values must be read and/or written for each weld type. This method must be updated to handle each type of weld defined in the catalog. The array is sized for each type and each parameter is defined with a name, argument type, and default value. A portion of the method is as follows:
...Define the rest of the parameters and the rest of the types.
Can be called to identify the computed outputs for each type of weld. It calls GetWeldParmInfo to determine the parameters and loops through the returned array to set them. As long as GetWeldParmInfo is properly customized for each type, this method does not need to be changed.
Called after all values have been set to store them to the database. Normally this is used in conjunction with AddWeldParmRuleOutputs, with custom code between the calls to set any values that need to be customized.
Called to get specific values currently stored for the connection. Each caller determines which values need to be checked. This should only include the values from IJBevel that are used to compute the IJWeldingSymbol values. The return values indicate if they are computed or if they were overridden by the user. These values are only used in this execution if they have been overridden by the user. Otherwise, the results of the current execution are used.
Determines which bevel parameters are required for the computation, based on the weld type. The array is sized to hold all values possible for a butt weld and the alignment of the array is constant. Some values may be unused for some butt weld types. The code for this is as follows:
The next section of code retrieves the values stored in the database and checks/overrides each value that has been overridden by the user. If the value is not valid for this type of butt weld or it has not been overridden, the value defined in this execution is used.
The next section sets the correct IJWeldSymbol output values, based on the weld type. This is only partially shown here.
The final section sets all of the IJWeldingSymbol values defined as output for a butt weld. It is important to set all of these values. This is done by getting all of the values that are defined as output with a call to GetWeldParameterInformation, setting the computed ones into the returned array, and then setting the stored values from the array with a call to SetWeldParmeterValues, as shown.
SetCalculatedTeeWeldParams – Similar to SetCalculatedButtWeldParams.
SetCalculatedLapWeldParams – Similar to SetCalculatedButtWeldParams.
The previous methods are called from each weld type parm method in the following way. The example is from ButtCVParameterRule.cs, but all should be similar.