Dimension Controller
-
interface ICwAPI3DDimensionController
Public Functions
-
virtual ICwAPI3DString *getLastError(int32_t *aErrorCode) = 0
Retrieves the last error message.
- Parameters:
aErrorCode – [out] [int32_t*] A pointer to an integer where the error code will be stored.
- Returns:
[ICwAPI3DString*] A string containing the last error message.
-
virtual elementID createDimension(vector3D aXl, vector3D aPlaneNormal, vector3D aDistance, ICwAPI3DVertexList *aDimensionPoints) = 0
Creates a dimension element to measure distances on 3D parts.
Creates a dimension annotation in 3D space. The dimension is drawn on a plane defined by its normal and offset distance. Points added to the dimension are projected onto this plane, and dimension segments are automatically created between consecutive points.
- Example:
// Create a list of dimension points ICwAPI3DVertexList lListPoints; lListPoints.append(vector3D{0, 0, 0}); lListPoints.append(vector3D{1000, 0, 0}); lListPoints.append(vector3D{2000, 500, 0}); lListPoints.append(vector3D{3000, 200, 0}); lListPoints.append(vector3D{4000, 360, 0}); lListPoints.append(vector3D{6000, 451, 0}); // Create the dimension element elementID lIdDimension = aFactory.getDimensionController()->createDimension( vector3D{1, 0, 0}, // xl - dimension arrow direction vector3D{0, 1, 0}, // plane_normal vector3D{0, 0, 500}, // distance - offset from geometry &lListPoints); // dimension_points
- Parameters:
aXl – [in] [vector3D] The direction vector defining the dimension line axis (the direction of the measurement arrow). Can be aligned with X, Y, Z axes or any 3D direction.
aPlaneNormal – [in] [vector3D] The normal vector defining the orientation of the dimension plane.
aDistance – [in] [vector3D] The offset vector from the dimensioned geometry to where the dimension line is drawn. Can offset in any direction.
aDimensionPoints – [in] [ICwAPI3DVertexList*] A list of dimension points to measure. At least 2 points are needed for a valid dimension measurement, but the points can be added later using addSegment(). Points are projected onto the dimension plane.
- Returns:
[elementID] The element ID of the created dimension element.
-
virtual void setOrientation(ICwAPI3DElementIDList *aElementIdList, vector3D aViewDir, vector3D aViewDirUp) = 0
Sets the orientation of a dimension element.
- Parameters:
aElementIdList – [in] [ICwAPI3DElementIDList*] The dimension element id list.
aViewDir – [in] [vector3D] The view direction vector.
aViewDirUp – [in] [vector3D] The view direction up vector.
-
virtual void addSegment(elementID aElementId, vector3D aSegment) = 0
Adds a point to an existing dimension element.
Adds a new point to the dimension’s point list. A dimension segment is automatically created between this point and the previous point. This method can be called multiple times to progressively add more measurement points to the dimension.
-
virtual void setPrecision(ICwAPI3DElementIDList *aElementIdList, uint32_t aPrecision) = 0
Sets the precision/decimal places of a dimension element.
- Parameters:
aElementIdList – [in] [ICwAPI3DElementIDList*] The dimension element id list.
aPrecision – [in] [uint32_t] The precision/decimal places to set.
-
virtual void setTextSize(ICwAPI3DElementIDList *aElementIdList, double aTextSize) = 0
Sets the text size a dimension element.
- Parameters:
aElementIdList – [in] [ICwAPI3DElementIDList*] The dimension element id list.
aTextSize – [in] [double] The text size to set.
-
virtual void setLineThickness(ICwAPI3DElementIDList *aElementIdList, double aThickness) = 0
Sets the line thickness a dimension element.
- Parameters:
aElementIdList – [in] [ICwAPI3DElementIDList*] The dimension element id list.
aThickness – [in] [double] The line thickness to set.
-
virtual void setTotalDimension(ICwAPI3DElementIDList *aElementIdList, bool aTotal) = 0
Sets if the total dimension is shown in a dimension element.
- Parameters:
aElementIdList – [in] [ICwAPI3DElementIDList*] The dimension element id list.
aTotal – [in] [bool] True if the total dimension should be shown, false otherwise.
-
virtual void setTextColor(ICwAPI3DElementIDList *aElementIdList, colorID aColorID) = 0
Sets the text color a dimension element.
- Parameters:
aElementIdList – [in] [ICwAPI3DElementIDList*] The dimension element id list.
aColorID – [in] [colorID] The color ID to set for the text.
-
virtual void setLineColor(ICwAPI3DElementIDList *aElementIdList, colorID aColorID) = 0
Sets the line color a dimension element.
- Parameters:
aElementIdList – [in] [ICwAPI3DElementIDList*] The dimension element id list.
aColorID – [in] [colorID] The color ID to set for the line.
-
virtual void setDefaultAnchorLength(ICwAPI3DElementIDList *aElementIdList, double aLength) = 0
Sets the default anchor length a dimension element.
- Parameters:
aElementIdList – [in] [ICwAPI3DElementIDList*] The dimension element id list.
aLength – [in] [double] The default anchor length to set.
-
virtual void setDistance(ICwAPI3DElementIDList *aElementIdList, vector3D aDistance) = 0
Sets the distance vector between the points and the line.
- Parameters:
aElementIdList – [in] [ICwAPI3DElementIDList*] The dimension element id list.
aDistance – [in] [vector3D] The distance vector to set.
-
virtual void shiftDistanceAndTexts(ICwAPI3DElementIDList *aElementIdList, bool aShifted) = 0
Sets if distance and texts are shifted.
- Parameters:
aElementIdList – [in] [ICwAPI3DElementIDList*] The dimension element id list.
aShifted – [in] [bool] True if the distance and texts should be shifted, false otherwise.
-
virtual ICwAPI3DVertexList *getDimensionPoints(elementID aElementId) = 0
Gets all dimension points ordered by dimension direction.
- Parameters:
aElementId – [in] [elementID] The dimension element id.
- Returns:
[ICwAPI3DVertexList*] A list of dimension points.
-
virtual double getDefaultAnchorLength(elementID aElementId) = 0
Gets the default anchor length.
- Parameters:
aElementId – [in] [elementID] The dimension element id.
- Returns:
[double] The default anchor length.
-
virtual vector3D getDistance(elementID aElementId) = 0
Get the distance to the dimension reference point. The point is in the plane of the dimensioning.
-
virtual int getSegmentCount(elementID aElementId) = 0
Get count of segments.
- Parameters:
aElementId – [in] [elementID] The dimension element id.
- Returns:
[int] The number of segments in the dimension element.
-
virtual double getSegmentDistance(elementID aElementId, int aSegmentIndex) = 0
Get the distance from the anchor point to the dimension segment.
- Parameters:
aElementId – [in] [elementID] The dimension element id.
aSegmentIndex – [int] The index of the segment.
- Returns:
[double] The distance from the anchor point to the dimension segment.
-
virtual vector3D getSegmentDirection(elementID aElementId, int aSegmentIndex) = 0
Get the normalized direction from the anchor point to the point on the dimension.
-
virtual bool getTotalDimension(elementID aElementId) = 0
Query whether the visualisation of the overall dimension is set for a dimension element.
- Parameters:
aElementId – [in] [elementID] The dimension element id.
- Returns:
[bool] True if the visualisation is set, false otherwise. For elements that are not of type dimension, the return value is per default false.
-
virtual CwAPI3D::DimensionBaseFormat getDimensionBaseFormat(const CwAPI3D::elementID aElementId) = 0
Gets the base format of a Dimension Element.
- Parameters:
aElementId – [in] [elementID] The dimension element id.
- Returns:
[DimensionBaseFormat] the format used for the dimension. Enum value
Nonemay indicate that something went during while retrieving the value due to e.g. the element not being a valid dimension.
-
virtual ICwAPI3DString *getLastError(int32_t *aErrorCode) = 0