Dimensions and Parameters
This section describes the Creo.JS methods and classes that affect dimensions and parameters.
Overview
Dimensions and parameters in Creo Parametric have similar characteristics but also have significant differences. In Creo.JS, the similarities between dimensions and parameters are contained in the pfcBaseParameter class. This class provides access to the parameter or dimension value and to information regarding designation and modification for a parameter. The differences between parameters and dimensions are recognizable because pfcDimension inherits from the class pfcModelItem, and can be assigned tolerances, whereas parameters are not pfcModelItem 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 are not applicable for some pfcParamValue objects. If you try to use an incorrect method an exception will be thrown.
Accessing a ParamValue Object
Methods and Properties Introduced:
  • pfcCreateIntParamValue()
  • pfcCreateDoubleParamValue()
  • pfcCreateStringParamValue()
  • pfcCreateBoolParamValue()
  • pfcCreateNoteParamValue()
  • pfcBaseParameter.Value
  • The pfcModelItem utility class contains methods for creating each type of pfcParamValue object. After you establish 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 pfcNoteParamValue 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.
    Use the method pfcCreateIntParamValue() to create a pfcParamValue object with the specified integer value.
    Use the method pfcCreateDoubleParamValue() to create a pfcParamValue object with the specified real value.
    Use the method pfcCreateStringParamValue() to create a pfcParamValue object with the specified string value.
    Use the method pfcCreateBoolParamValue() to create a pfcParamValue object with the specified Boolean value.
    Use the method pfcCreateNoteParamValue() to create a note parameter.
    Accessing the ParamValue Value
    Properties Introduced:
  • pfcParamValue.discr
  • pfcParamValue.IntValue()
  • pfcParamValue.DoubleValue()
  • pfcParamValue.StringValue()
  • pfcParamValue.BoolValue()
  • pfcParamValue.NoteId()
  • The property pfcParamValue.discr returns an enumeration object that identifies the type of value contained in the pfcParamValue object using the enumerated data type pfcParamValueType. The valid values and what each value specifies that the parameter has, follows:
    •  PARAM_STRING— Specifies the parameter has a string value.
    •  PARAM_INTEGER— Specifies the parameter has a integer value.
    •  PARAM_BOOLEAN— Specifies the parameter has a boolean value.
    •  PARAM_DOUBLE— Specifies the parameter has a real value.
    •  PARAM_NOTE— Specifies the parameter has a note identifier as its value.
    •  PARAM_VOID
    •  PARAM_NOT_SET
    If you use an incorrect property an exception of type pfcXBadGetParamValue is thrown.
    Parameter Objects
    The following sections describe the Creo.JS 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()
  • pfcParameterOwner.SelectParameters()
  • pfcFamColParam.RefParam
  • In Creo.JS 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 specified by its name.
    The method pfcParameterOwner.ListParams() returns an array 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 Creo.JS 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 pfcParameterSelection.Context to assign the parameter selection context. By default, you can select parameters from any context. This property can be set using the enumerated data type pfcParameterSelectionContext. The values for pfcParameterSelectionContext and a description of what each value specifies for selection, follow:
      PARAMSELECT_MODEL—Specifies that the top level model parameters can be selected.
      PARAMSELECT_PART—Specifies that parameters of any part(at any level of the top model) can be selected.
      PARAMSELECT_ASM—Specifies that parameters of any assembly (at any level of the top model) can be selected.
      PARAMSELECT_FEATURE—Specifies that parameters of any feature can be selected.
      PARAMSELECT_EDGE—Specifies that parameters of any edge can be selected.
      PARAMSELECT_SURFACE—Specifies that parameters of any surface can be selected.
      PARAMSELECT_QUILT—Specifies that parameters of any quilt can be selected.
      PARAMSELECT_CURVE—Specifies that parameters of any curve can be selected.
      PARAMSELECT_COMPOSITE_CURVE—Specifies that parameters of any composite curve can be selected.
      PARAMSELECT_INHERITED—Specifies that parameters of any inheritance feature can be selected.
      PARAMSELECT_SKELETON—Specifies that parameters of any skeleton can be selected.
      PARAMSELECT_COMPONENT—Specifies that parameters of any component can be selected.
      PARAMSELECT_ALLOW_SUBITEM_SELECTION
    •  AllowMultipleSelections—This Boolean attribute indicates whether or not to allow the selection of multiple parameters from the dialog box, or only a single parameter. By default, it is true and allows for the 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 property 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
  • pfcBaseParameter.IsDesignated
  • pfcBaseParameter.IsModified
  • pfcBaseParameter.ResetFromBackup()
  • pfcBaseParameter.IsRelationDriven
  • pfcParameter.GetScaledValue()
  • pfcParameter.SetScaledValue()
  • pfcParameter.Units()
  • pfcParameter.Description
  • pfcParameter.GetRestriction
  • pfcParameter.GetDriverType
  • pfcParameter.Reorder()
  • pfcParameter.Delete()
  • pfcNamedModelItem.Name()
  • Parameters inherit methods from the pfcBaseParameter, pfcParameter and pfcNamedModelItem classes.
    You can access the designation status of the parameter using the property pfcBaseParameter.IsDesignated.
    The property pfcBaseParameter.IsModified enables 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 changes but the owner of the parameter has not yet been regenerated.
    The method pfcBaseParameter.ResetFromBackup() resets the parameter to the value it had before it was last set in the current Creo Parametric.
    The property pfcBaseParameter.IsRelationDriven identifies whether the part or assembly relations control a dimension.
    The method pfcParameter.GetScaledValue() returns the parameter value in the units of the parameter, instead of the units of the owner model.
    The method pfcParameter.SetScaledValue() assigns the parameter value in the units provided, instead of using the units of the owner model.
    The method pfcParameter.Units() returns the units assigned to the parameter.
    The property pfcParameter.Description returns the parameter description, or null, if no description is assigned.
    The property pfcParameter.GetRestriction identifies if the value of the parameter 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 using the enumerated data type pfcParameterDriverType. A list of driver types including a description of each parameter value ,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.Delete() permanently removes a specified parameter.
    The property pfcNamedModelItem.Name accesses the name of the specified parameter.
    Parameter Restrictions
    In Creo Parametric users can assign specified limitations to the value for a given parameter wherever the parameter appears in the model. You can only read the details of the permitted restrictions from Creo.JS, but not modify the permitted values or range of values. Parameter restrictions in Creo.JS are represented by the class pfcParameterRestriction.
    Method Introduced:
  • pfcParameterRestriction.Type()
  • The method pfcParameterRestriction.Type() returns the the types of parameter restrictions using the enumerated data type pfcRestrictionType. 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 for this restriction in the form of a sequence of the pfcParamValues object.
    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 the types of parameter limits using the enumerated data type pfcParameterLimitType . 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.
    Dimension Objects
    Dimension objects include standard Creo Parametric dimensions and reference dimensions. With dimension objects you can access dimension tolerances to set the value for the dimension. You cannot do either of these actions with reference dimensions.
    Getting Dimensions
    Dimensions and reference dimensions are Creo Parametric model items. See the section Getting ModelItem Objects for properties that can return pfcDimension object.
    Dimension Information
    Properties Introduced:
  • pfcBaseParameter.Value
  • pfcBaseDimension.DimValue
  • pfcBaseDimension.DimType
  • pfcBaseDimension.Symbol
  • pfcBaseDimension.Texts
  • All the pfcBaseParameter methods are accessible to Dimensions and Parameters. See the section Parameter Objects for brief descriptions.
    Note
    You cannot set the value or designation status of reference dimension objects.
    The property pfcBaseParameter.Value returns the value of the parameter or dimension.
    The property pfcBaseDimension.DimValue accesses the dimension value as a double. This property provides a shortcut for accessing the values for the dimensions without using a pfcParamValue object.
    The property pfcBaseDimension.DimType returns the type of the dimension such as linear, radial, angular, or diametrical, using the enumerated data type pfcDimensionType. The valid values and a description of the dimension that each value specifies follow:::
    •  DIM_LINEAR—Specifies if the dimension is linear.
    •  DIM_RADIAL—Specifies if the dimension is radial.
    •  DIM_DIAMETER—Specifies if the dimension is diametrical.
    •  DIM_ANGULAR—Specifies if the dimension is angular.
    The property pfcBaseDimension.Symbol returns the dimension or reference dimension symbol (that is, “d#” or “rd#”).
    The property pfcBaseDimension.Texts 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 using the enumerated data type pfcDimToleranceType and the valid values are:
    •  DIMTOL_LIMITS—Displays dimension tolerances as upper and lower limits.
    Note
    This format is not available when only the tolerance value for a dimension is displayed.
    •  DIMTOL_PLUS_MINUS—Displays dimensions as nominal with plus-minus tolerances. The positive and negative values are independent.
    •  DIMTOL_SYMMETRIC—Displays dimensions as nominal with a single value for both the positive and the negative tolerance.
    •  DIMTOL_SYMMETRIC_SUPERSCRIPT—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.
    •  DIMTOL_ISODIN-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.
    Use the method pfcDimTolPlusMinus.Create() a new DimTolPlusMinus object. The input parameters are as follows:
    •  inPlus—Specifies the tolerance amount above the nominal value
    •  inMinus—Specifies the tolerance amount below the nominal value
    Use the method pfcDimTolSymmetric.Create() to create a symmetric tolerance. The input parameter inValue specifies the tolerance value.
    Use the method pfcDimTolLimits.Create() to create an object containing a limits-type tolerance for a dimension. The input parameters are as follows:
    •  inUpperLimit—Specifies the upper limit for the tolerance.
    •  inLowerLimit—Specifies the lower limit for the tolerance.
    Use the method pfcDimTolSymSuperscript.Create() creates a symmetric tolerance in superscript format. The input parameter inValue is the tolerance value.
    Use the method pfcDimTolISODIN.Create() creates a pfcDimTolISODIN object. The input parameters are as follows:
    •  inTolTableType—Specifies the tolerance table type using the enumerated data type pfcToleranceTableType and the valid values are:
      TOLTABLE_GENERAL—Specifies the dimension tolerance type as General.
      TOLTABLE_BROKEN_EDGE—Specifies the dimension tolerance type as Broken Edge
      TOLTABLE_SHAFTS—Specifies the dimension tolerance type as Shafts
      TOLTABLE_HOLES—Specifies the dimension tolerance type as Holes
    •  inTableName—Specifies the tolerance table name.
    •  inTableColumn—Specifies the tolerance table column.