Dimensions and Parameters
This section describes the Web.Link methods and classes that affect dimensions and parameters.
Overview
Dimensions and parameters in Creo Parametric have similar characteristics but also have significant differences. In Web.Link, the similarities between dimensions and parameters are contained in the pfcBaseParameter class. This class allows access to the parameter or dimension value and to information regarding a parameter's designation and modification. The differences between parameters and dimensions are recognizable because pfcDimension inherits from the class pfcModelItem, and can be assigned tolerances, whereas parameters are not pfcModelItems and cannot have tolerances.
The ParamValue Object
Both parameters and dimension objects contain an object of type pfcParamValue. This object contains the integer, real, string, or Boolean value of the parameter or dimension. Because of the different possible value types that can be associated with a pfcParamValue object there are different methods used to access each value type and some methods will not be applicable for some pfcParamValue objects. If you try to use an incorrect method an exception will be thrown.
Accessing a ParamValue Object
Methods and Property Introduced:
  • MpfcModelItem.CreateIntParamValue()
  • MpfcModelItem.CreateDoubleParamValue()
  • MpfcModelItem.CreateStringParamValue()
  • MpfcModelItem.CreateBoolParamValue()
  • MpfcModelItem.CreateNoteParamValue()
  • pfcBaseParameter.Value
  • The pfcModelItem utility class contains methods for creating each type of pfcParamValue object. Once you have established the value type in the object, you can change it. The property pfcBaseParameter.Value returns the pfcParamValue associated with a particular parameter or dimension.
    A NotepfcParamValue is an integer value that refers to the ID of a specified note. To create a parameter of this type the identified note must already exist in the model.
    Accessing the ParamValue Value
    Properties Introduced:
  • pfcParamValue.discr
  • pfcParamValue.IntValue
  • pfcParamValue.DoubleValue
  • pfcParamValue.StringValue
  • pfcParamValue.BoolValue
  • pfcParamValue.NoteId
  • The property pfcParamValue.discr returns a enumeration object that identifies the type of value contained in the pfcParamValue object. Use this information with the specified properties to access the value. If you use an incorrect property an exception of type pfcXBadGetParamValue will be thrown.
    Parameter Objects
    The following sections describe the Web.Link methods that access parameters. The topics are as follows:
    Creating and Accessing Parameters
    Methods and Property Introduced:
  • pfcParameterOwner.CreateParam()
  • pfcParameterOwner.CreateParamWithUnits()
  • pfcParameterOwner.GetParam()
  • pfcParameterOwner.ListParams()
  • pfcParameterOwner.SelectParam()
  • pfcFamColParam.RefParam
  • In Web.Link, models, features, surfaces, and edges inherit from the pfcParameterOwner class, because each of the objects can be assigned parameters in Creo Parametric.
    The method pfcParameterOwner.GetParam() gets a parameter given its name.
    The method pfcParameterOwner.ListParams() returns a sequence of all parameters assigned to the object.
    To create a new parameter with a name and a specific value, call the method pfcParameterOwner.CreateParam().
    To create a new parameter with a name, a specific value, and units, call the method pfcParameterOwner.CreateParamWithUnits().
    The method pfcParameterOwner.SelectParam() allows you to select a parameter from the Creo Parametric user interface. The top model from which the parameters are selected must be displayed in the current window.
    The method pfcParameterOwner.SelectParameters() allows you to interactively select parameters from the Creo Parametric Parameter dialog box based on the parameter selection options specified by the pfcParameterSelectionOptions object. The top model from which the parameters are selected must be displayed in the current window. Refer to the section Parameter Selection Options for more information.
    The property pfcFamColParam.RefParam returns the reference parameter from the parameter column in a family table.
    Parameter Selection Options
    Parameter selection options in Web.Link are represented by the pfcParameterSelectionOptions class.
    Methods and Properties Introduced:
  • pfcParameterSelectionOptions.Create()
  • pfcParameterSelectionOptions.AllowContextSelection
  • pfcParameterSelectionOptions.Contexts
  • pfcParameterSelectionOptions.AllowMultipleSelections
  • pfcParameterSelectionOptions.SelectButtonLabel
  • The method pfcParameterSelectionOptions.Create() creates a new instance of the pfcParameterSelectionOptions object that is used by the method pfcParameterOwner.SelectParameters().
    The parameter selection options are as follows:
    •  AllowContextSelection—This boolean attribute indicates whether to allow parameter selection from multiple contexts, or from the invoking parameter owner. By default, it is false and allows selection only from the invoking parameter owner. If it is true and if specific selection contexts are not yet assigned, then you can select the parameters from any context.
    Use the property pfcParameterSelectionOptions.AllowContextSelection to modify the value of this attribute.
    •  Contexts—The permitted parameter selection contexts in the form of the pfcParameterSelectionContexts object. Use the property pfcParameterSelectionOptions.Contexts to assign the parameter selection context. By default, you can select parameters from any context.
    •  The types of parameter selection contexts are as follows:
      PARAMSELECT_MODEL—Specifies that the top level model parameters can be selected.
      PARAMSELECT_PART—Specifies that any part’s parameters (at any level of the top model) can be selected.
      PARAMSELECT_ASM—Specifies that any assembly’s parameters (at any level of the top model) can be selected.
      PARAMSELECT_FEATURE—Specifies that any feature’s parameters can be selected.
      PARAMSELECT_EDGE—Specifies that any edge’s parameters can be selected.
      PARAMSELECT_SURFACE—Specifies that any surface’s parameters can be selected.
      PARAMSELECT_QUILT—Specifies that any quilt’s parameters can be selected.
      PARAMSELECT_CURVE—Specifies that any curve’s parameters can be selected.
      PARAMSELECT_COMPOSITE_CURVE—Specifies that any composite curve’s parameters can be selected.
      PARAMSELECT_INHERITED—Specifies that any inheritance feature’s parameters can be selected.
      PARAMSELECT_SKELETON—Specifies that any skeleton’s parameters can be selected.
      PARAMSELECT_COMPONENT—Specifies that any component’s parameters can be selected.
    •  AllowMultipleSelections—This boolean attribute indicates whether or not to allow multiple parameters to be selected from the dialog box, or only a single parameter. By default, it is true and allows selection of multiple parameters.
    Use the property pfcParameterSelectionOptions.AllowMultipleSelections to modify this attribute.
    •  SelectButtonLabel—The visible label for the select button in the dialog box.
    Use the pfcParameterSelectionOptions.SelectButtonLabel to set the label. If not set, the default label in the language of the active Creo Parametric session is displayed.
    Parameter Information
    Methods and Properties Introduced:
  • pfcBaseParameter.Value
  • pfcParameter.GetScaledValue()
  • pfcParameter.SetScaledValue()
  • pfcParameter.Units
  • pfcBaseParameter.IsDesignated
  • pfcBaseParameter.IsModified
  • pfcBaseParameter.ResetFromBackup()
  • pfcParameter.Description
  • pfcParameter.GetRestriction()
  • pfcParameter.GetDriverType()
  • pfcParameter.Reorder()
  • pfcParameter.Delete()
  • pfcNamedModelItem.Name
  • Parameters inherit methods from the pfcBaseParameter, pfcParameter and pfcNamedModelItem classes.
    The property pfcBaseParameter.Value returns the value of the parameter or dimension.
    The method pfcParameter.GetScaledValue() returns the parameter value in the units of the parameter, instead of the units of the owner model as returned by pfcBaseParameter.Value.
    The method pfcParameter.SetScaledValue() assigns the parameter value in the units provided, instead of using the units of the owner model as assumed by pfcBaseParameter.Value.
    The method pfcParameter.Units returns the units assigned to the parameter.
    You can access the designation status of the parameter using the property pfcBaseParameter.IsDesignated .
    The property pfcBaseParameter.IsModified and pfcBaseParameter.ResetFromBackup() enable you to identify a modified parameter or dimension, and reset it to the last stored value. A parameter is said to be "modified" when the value has been changed but the parameter's owner has not yet been regenerated.
    The property pfcParameter.Description returns the parameter description, or null, if no description is assigned.
    The property pfcParameter.GetRestriction identifies if the parameter’s value is restricted to a certain range or enumeration. It returns the pfcParameterRestriction object. Refer to the section Parameter Restrictions for more information.
    The property pfcParameter.GetDriverType() returns the driver type for a material parameter. The driver types are as follows:
    •  PARAMDRIVER_PARAM—Specifies that the parameter value is driven by another parameter.
    •  PARAMDRIVER_FUNCTION—Specifies that the parameter value is driven by a function.
    •  PARAMDRIVER_RELATION—Specifies that the parameter value is driven by a relation. This is equivalent to the value obtained using pfcBaseParameter.IsRelationDriven for a parameter object type.
    The method pfcParameter.Reorder() reorders the given parameter to come immediately after the indicated parameter in the Parameter dialog box and information files generated by Creo Parametric.
    The method pfcParameter.Reorder() permanently removes a specified parameter.
    The property pfcNamedModelItem.Name accesses the name of the specified parameter.
    Parameter Restrictions
    Creo Parametric allows users to assign specified limitations to the value allowed for a given parameter (wherever the parameter appears in the model). You can only read the details of the permitted restrictions from Web.Link , but not modify the permitted values or range of values. Parameter restrictions in Web.Link are represented by the class pfcParameterRestriction.
    Method Introduced:
  • pfcParameterRestriction.Type
  • The method pfcParameterRestriction.Type returns the pfcRestrictionType object containing the types of parameter restrictions. The parameter restrictions are of the following types:
    •  PARAMSELECT_ENUMERATION—Specifies that the parameter is restricted to a list of permitted values.
    •  PARAMSELECT_RANGE—Specifies that the parameter is limited to a specified range of numeric values.
    Enumeration Restriction
    The PARAMSELECT_ENUMERATION type of parameter restriction is represented by the classpfcParameterEnumeration. It is a child of the pfcParameterRestriction class.
    Property Introduced:
  • pfcParameterEnumeration.PermittedValues
  • The property pfcParameterEnumeration.PermittedValues returns a list of permitted parameter values allowed by this restriction in the form of a sequence of the pfcParamValue objects.
    Range Restriction
    The PARAMSELECT_RANGE type of parameter restriction is represented by the interface pfcParameterRange. It is a child of the pfcParameterRestriction interface.
    Properties Introduced:
  • pfcParameterRange.Maximum
  • pfcParameterRange.Minimum
  • pfcParameterLimit.Type
  • pfcParameterLimit.Value
  • The property pfcParameterRange.Maximum returns the maximum value limit for the parameter in the form of the pfcParameterLimit object.
    The property pfcParameterRange.Minimum returns the minimum value limit for the parameter in the form of the pfcParameterLimit object.
    The property pfcParameterLimit.Type returns the pfcParameterLimitType containing the types of parameter limits. The parameter limits are of the following types:
    •  PARAMLIMIT_LESS_THAN—Specifies that the parameter must be less than the indicated value.
    •  PARAMLIMIT_LESS_THAN_OR_EQUAL—Specifies that the parameter must be less than or equal to the indicated value.
    •  PARAMLIMIT_GREATER_THAN—Specifies that the parameter must be greater than the indicated value.
    •  PARAMLIMIT_GREATER_THAN_OR_EQUAL—Specifies that the parameter must be greater than or equal to the indicated value.
    The property pfcParameterLimit.Value returns the boundary value of the parameter limit in the form of the pfcParamValue object.
    Example Code: Updating Model Parameters
    The sample code in the file pfcParameterExamples.js located at <creo_weblink_loadpoint>/weblinkexamples/jscript contains a single static utility method. This method creates or updates model parameters based on the name-value pairs in the URL page. A utility method parses the String returned via the URL into int, double, or boolean values if possible.
    Dimension Objects
    Dimension objects include standard Creo Parametric dimensions as well as reference dimensions. Dimension objects enable you to access dimension tolerances and enable you to set the value for the dimension. Reference dimensions allow neither of these actions.
    Getting Dimensions
    Dimensions and reference dimensions are Creo Parametric model items. See the section Getting ModelItem Objects for methods that can return pfcDimension and pfcRefDimension objects.
    Dimension Information
    Methods and Properties Introduced:
  • pfcBaseParameter.Value
  • pfcBaseDimension.DimValue
  • pfcBaseParameter.IsDesignated
  • pfcBaseParameter.IsModified
  • pfcBaseParameter.ResetFromBackup()
  • pfcBaseParameter.IsRelationDriven
  • pfcBaseDimension.DimType
  • pfcBaseDimension.Symbol
  • pfcBaseDimension.Texts
  • All the pfcBaseParameter methods are accessible to Dimensions as well as Parameters. See the section Parameter Objects for brief descriptions.
    Note
    You cannot set the value or designation status of reference dimension objects.
    The property pfcBaseDimension.DimValue accesses the dimension value as a double. This property provides a shortcut for accessing the dimensions' values without using a ParamValue object.
    The property pfcBaseParameter.IsRelationDriven identifies whether the part or assembly relations control a dimension.
    The property pfcBaseDimension.DimType returns an enumeration object that identifies whether a dimension is linear, radial, angular, or diametrical.
    The property pfcBaseDimension.Symbol returns the dimension or reference dimension symbol (that is, “d#” or “rd#”).
    The property pfcBaseDimension.Texts and pfcBaseDimension.Texts methods allows access to the text strings that precede or follow the dimension value.
    Dimension Tolerances
    Methods and Properties Introduced:
  • pfcDimension.Tolerance
  • pfcDimTolPlusMinus.Create()
  • pfcDimTolSymmetric.Create()
  • pfcDimTolLimits.Create()
  • pfcDimTolSymSuperscript.Create()
  • pfcDimTolISODIN.Create()
  • Only true dimension objects can have geometric tolerances.
    The property pfcDimension.Tolerance enables you to access the dimension tolerance. The object types for the dimension tolerance are:
    •  pfcDimTolLimits—Displays dimension tolerances as upper and lower limits.
    Note
    This format is not available when only the tolerance value for a dimension is displayed.
    •  pfcDimTolPlusMinus—Displays dimensions as nominal with plus-minus tolerances. The positive and negative values are independent.
    •  pfcDimTolSymmetric—Displays dimensions as nominal with a single value for both the positive and the negative tolerance.
    •  pfcDimTolSymSuperscript—Displays dimensions as nominal with a single value for positive and negative tolerance. The text of the tolerance is displayed in a superscript format with respect to the dimension text.
    •  pfcDimTolISODIN—Displays the tolerance table type, table column, and table name, if the dimension tolerance is set to a hole or shaft table (DIN/ISO standard).
    A null value is similar to the nominal option in Creo Parametric.
    To determine whether a given tolerance is plus/minus, symmetric, limits, or superscript use TBD.
    Example Code: Setting Tolerances to a Specified Range
    The sample code in the file pfcDimensionExamples.js located at <creo_weblink_loadpoint>/weblinkexamples/jscript shows a utility method that sets angular tolerances to a specified range.
    The example code shows a utility method that sets angular tolerances to a specified range. First, the program determines whether the dimension passed to it is angular. If it is, the method gets the dimension value and adds or subtracts the range to it to get the upper and lower limits.