Modifying Dimensions
 
Functions Introduced:
The function ProDimensionSymbolSet() allows you to change the symbol (the name) of a dimension. You can use this function only with solid dimensions.
Note:
 
The function will return the error PRO_TK_NO_CHANGE if the specified symbol already exists for another dimension in the model.
The function ProDimensionValueSet() changes the value of a dimension. It does not allow you to change the value of any dimension whose value is driven in some other way, for example, a driven or reference dimension or a dimension that is driven by a relation.
The function ProDimensionOverridevalueSet() assigns the override value for a dimension. This value is restricted to real numbers. The default override value is zero.
Note:
 
You can set the override value only for driven dimensions.
The function ProDimensionValuedisplaySet() sets the type of value to be displayed for a dimension.
The function ProDimensionDecimalsSet() sets the number of decimal places for a decimal dimension.
When you call the function ProDimensionDecimalsSet() for a driving dimension:
If the number of decimal places required to display the stored value of the dimension is greater than the number of decimal places specified in the function ProDimensionDecimalsSet() and the Round Displayed Value attribute of the dimension is ON, the stored value is unchanged. Only the displayed number of decimal places is changed and the displayed value is updated accordingly.
For example, consider a dimension with its stored value as 12.12323 and the Round Displayed Value attribute of the dimension is set to ON. If the function ProDimensionDecimalsSet() sets the number of decimal places to 3, the stored value of the dimension is unchanged, that is, the stored value will be 12.12323. The displayed value of the dimension is rounded to 3 decimal places, that is, 12.123. The Round Displayed Value attribute is not changed.
If the number of decimal places required to display the stored value of the dimension is greater than the number of decimal places specified in the function ProDimensionDecimalsSet() and the Round Displayed Value attribute of the dimension is OFF, the number of decimal places of the dimension is modified and the stored value is rounded to the specified number of decimal places.
For example, consider a dimension with its stored value as 12.12323 and the Round Displayed Value attribute of the dimension is OFF. If the function ProDimensionDecimalsSet() sets the dimension to 3 decimal places, then the stored value of the dimension is rounded to 3 decimal places and is modified to 12.123. The dimension is displayed as 12.123.
If the number of decimal places required to display the stored value of the dimension is less than the number of decimal places specified in the function ProDimensionDecimalsSet(), the number of decimal places is set to the specified value. The status of the Round Displayed Value attribute is not considered, as no change or an increase to the number of decimal places will have no effect on the stored value.
For example, consider a dimension with its stored value as 12.12323. If the function ProDimensionDecimalsSet() sets the dimension to 8 decimal places and if trailing zeros are displayed, then the dimension is displayed as 12.12323000.
For a driven dimension:
If the number of decimal places set by the function is greater than or equal to the number of decimal places required to display the stored value of the dimension, the decimal places value is changed and no change to the Round Displayed Value attribute is made.
If the number of decimal places of the dimension is less than the number required to display the stored value of the dimension, the Round Displayed Value attribute is AUTOMATICALLY set to ON as it is not possible to change the stored value of a driven dimension.
Note:
 
The value given for the input argument decimals of the function ProDimensionDecimalsSet() should be a non-negative number. It should be such that when you apply either the upper or the lower values of the tolerance to the given dimension, the total number of digits before and after the decimal point in the resulting values does not exceed 13.
The function ProDimensionDenominatorSet() sets the denominator for the fractional dimensions. When you call the function ProDimensionDenominatorSet():
The stored value remains unchanged if,
it can be expressed as an exact fraction with the given denominator, regardless of whether the round-off attribute is set or not.
the stored value cannot be expressed as an exact fraction, but the round-off attribute is set. In this case, the fraction is the approximate representation of the stored value.
The stored value changes to the nearest fraction and triggers a regeneration of the model, if it cannot be expressed as an exact fraction with the given denominator and the round-off attribute is not set.
The functions ProDimensionBoundSet() sets the bound status of the dimension.
The function ProDimensionDimensionReset() sets the dimension to the value it had at the end of the last successful regeneration. You can use this function to recover from a failed regeneration.
The function ProDimensionBasicSet() and the function ProDimensionInspectionSet() set the basic and inspection notations of the dimension. These functions are applicable to both driven and driving dimensions.
Note:
 
The basic and inspection notations of the dimension are not available when only the tolerance value for a dimension is displayed.
The function ProDimensionElbowSet() sets the length of the elbow for the specified dimension in a solid. The function can also be used to set the length of the elbow for a dimension in a drawing, where the dimension is created in a solid and is displayed in a drawing. To work with dimensions shown in a drawing, pass the name of the drawing in the input argument drawing.
The function ProDimensionSimpleBreakCreate() creates a simple break on an existing dimension witness line. The input arguments are:
dimension—Specifies a pointer to the dimension whose witness line is to be broken.
drawing—Specifies the drawing in which the dimension is present. You can specify a NULL value.
index—Specifies the index of the witness line. Depending on which side of the dimension the witness line lies, specify the value as 1 or 2. Use the method ProDimlocationWitnesslinesGet to get the location of the witness line end points for a dimension.
Note:
 
This argument is not applicable for ordinate, radius, and diameter dimensions.
break_start—Specifies the start point of the break.
break_end—Specifies the end point of the break.
The function ProDimensionJogCreate() creates a jog on an existing dimension witness line. The input arguments are:
dimension—Specifies a pointer to the dimension where the jog will be created.
drawing—Specifies the drawing in which the dimension is present. You can specify a NULL value.
index—Specifies the index of the witness line. Depending on which side of the dimension the witness line lies, specify the value as 1 or 2. Use the method ProDimlocationWitnesslinesGet to get the location of the witness line end points for a dimension.
Note:
 
This argument is not applicable for ordinate, radius, and diameter dimensions.
jog_points—Specifies an array of points to position the jog. If the specified witness line has no jog added to it, then you must specify minimum two points that is, the start point and end point of the jog.
Note:
 
The functions ProDimensionSimpleBreakCreate() and ProDimensionJogCreate() return the error type PRO_TK_INVALID_TYPE when breaks and jogs are not supported for the specified dimension type, for example, diameter dimension.
The functions return the error type PRO_TK_ABORT when it is not possible to create breaks or jogs for the specified dimension witness line. For example, if you add a jog that is duplicate to an existing jog on the dimension witness line.
The function ProDimensionArrowtypeSet() sets the arrow type for the specified arrow in a dimension. The input arguments are:
dimension—Specifies the dimension.
drawing—Specifies the drawing in which the dimension is displayed. To set the arrow type in the owner model, specify the argument value as NULL.
arrow_index—Specifies the index of the witness line. Depending on which side of the dimension the witness line lies, specify the value as 1 or 2.
Note:
 
The value of arrow_index is ignored for ordinate and radius dimensions.
arrow_type—Specifies the type of arrow and is defined using the enumerated data type ProLeaderType. The valid values are:
PROLEADERTYPE_ARROWHEAD
PROLEADERTYPE_DOT
PROLEADERTYPE_FILLEDDOT
PROLEADERTYPE_NOARROW
PROLEADERTYPE_CROSS
PROLEADERTYPE_SLASH
PROLEADERTYPE_INTEGRAL
PROLEADERTYPE_BOX
PROLEADERTYPE_FILLEDBOX
PROLEADERTYPE_DOUBLEARROW
PROLEADERTYPE_CROSS_N_ARROW
PROLEADERTYPE_TARGET
PROLEADERTYPE_LEFTHALF
PROLEADERTYPE_RIGHTHALF
PROLEADERTYPE_TRIANGLE
PROLEADERTYPE_AUTOMATIC
The function ProDimensionWitnesslineErase() erases a specified witness line from the dimension. The input arguments are:
dimension—Specifies the dimension whose witness line must be erased. This argument cannot be NULL.
drawing—Specifies the drawing in which the dimension is displayed. To erase a witness line from a solid, specify this argument as NULL.
WitnesslineIndex—Specifies the index of the witness line. Specify the value as 1 or 2 depending on which side of the dimension the witness line lies. Use the method ProDimlocationWitnesslinesGet() to get the location of the witness line end points for a dimension.
Use the function ProDimensionWitnesslineShow() to show the erased witness line for the specified dimension.
Note:
 
The functions ProDimensionWitnesslineErase() and ProDimensionWitnesslineShow() erase and show the witness lines of dimensions and reference dimensions, respectively. These functions work with both drawings and solids.
The function ProDimensionDisplayFormatSet() sets the format in which the specified dimension must be displayed.
Use the function ProDimensionOriginSideSet() to set a witness line as the origin or start of measurement for the specified dimension. Specify the index of the witness line in the input argument dim_side. If a witness line is already set as origin, pass dim_side as -1 to remove the origin.
The function ProDimensionEnvelopeGet() returns the envelope of a line in the specified dimension. While retrieving coordinates of the dimension in a specified solid, if the dimension is displayed in the solid as well as in the drawing, the drawing must not be active. The input arguments follow:
dimension—Dimension
drawing—Drawing. The value for this input argument must be passed only if the solid dimension is shown in the drawing. Else, pass it as NULL.
line_number—The line number of the dimension. To get a full dimension envelope, pass this value as PRO_VALUE_UNUSED.
The output argument envelope is the envelope surrounding the text line in the model coordinate system. For drawing, the envelope surrounding the dimension is in the screen coordinates.
The function ProDimensionTangentAttachUpdate() sets the dimension to take the minimum, maximum, or center distance between the tangent lines of the arcs. The input arguments are:
dimension—Handle to input dimension.
tangent
—First or second tangent specified using the enumerated data type ProDimArcTangent. The valid values are:
PRO_DIM_TANGENT_FIRST
PRO_DIM_TANGENT_SECOND
type—Type of tangent specified using the enumerated data type ProDimArcAttachType. The valid values are:
PRO_DIM_TANGENT_MIN—Sets the dimension line at the minimum distance on the arc.
PRO_DIM_TANGENT_MAX—Sets the dimension line at the maximum distance on the arc.
PRO_DIM_TANGENT_CENTER—Sets the dimension line at the center of the arc.
Example 3: Modifying a Dimension
The sample code in the file UgDimsChange.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_dims demonstrates how to modify a dimension. The dimensions belonging to a given feature are displayed. You can choose the dimension you wish to modify.
這是否有幫助?