Class Hierarchy
AcRxObject AcGiDrawable AcDbObject AcDbEntity AcDbDimension AcDb2LineAngularDimension AcDb3PointAngularDimension AcDbAlignedDimension AcDbArcDimension AcDbDiametricDimension AcDbOrdinateDimension AcDbRadialDimension AcDbRadialDimensionLarge AcDbRotatedDimension
C++
class AcDbDimension : public AcDbEntity;
File
dbdim.h
Description
The AcDbDimension class is the base class for the classes that represent all the dimension entity types within AutoCAD. The appearance of dimensions is controlled by dimension variable settings and dimension styles.
Remarks
Although this class has a constructor, it is intended to be used as a base class -- no objects of this class should be created. An object instantiated directly from AcDbDimension cannot be added to the database. Only objects instantiated from a class derived from AcDbDimension can be added to the database. If a dimension object from a derived class wishes to call AcDbDimension::worldDraw(), it must do so before any calls are made to any of the AcGiWorldGeometry or AcGiViewportGeometry geometry creation methods (including mesh() or shell()). This is because the parent dimensions worldDraw() method makes a call to AcGiSubEntityTraits::setSelectionMarker().
If you do not set the dimension text automatically, the text becomes the measured value of the dimension. Setting the text using the AcDbDimension::setDimensionText method will override the default value. You can revert to the default value by setting the text to "" (an empty string).
Modifying a dimension in a noncurrent database will cause its dimBlockId to be set to NULL. This ensures that the next time the database is loaded as the current drawing, a new dimension block will be created, and the old one will be purged. This is necessary because dimension blocks in noncurrent databases cannot be created or modified. A dimension opened for write in a noncurrent database will have its dimBlockId set to NULL during close.
This may generate problems for applications. For example, once the dimBlockId has been set to NULL, a call to geomExtents on the dimension will fail.
This behavior can be overridden. Calling recordGraphicsModified(Adesk::kFalse) before closing the dimension will prevent the dimBlockId from being set to NULL. Although this will also reset the graphics modified bit, it should cause no other harmful side effects because the operation is on a noncurrent database. The result of overriding this behavior will be as follows:
- Newly created dimensions do not have a dimBlock. Therefore, this workaround will have no effect. You cannot create a dimension in a noncurrent database and give it a dimBlock.
- If the modifications to the AcDbDimension entity do not affect the information in the dimBlock, there will be no noticeable side effects. Doing the workaround is recommended in this case, as it will prevent an unnecessary reconstruction of the dimBlock.
- If the modifications to the AcDbDimension entity do cause a need for the dimBlock to be updated, the update will not occur until after the drawing is loaded and some subsequent action causes the dimBlock to be updated. In other words, the dimension will appear unchanged when the drawing is next loaded. Then, when some subsequent action causes a change to the dimension (this does not include a regen), all the changes will become visible.
- To work around this problem, just before saving the noncurrent database, reopen the dimension for write, call recordGraphicsModified(Adesk::kTrue), and close it. This will set dimBlockId to NULL and the changes will be applied the next time the database is loaded as the current drawing.
This class supports Dimension Style Overrides, which means that it has a dimension style and that it honors certain dimension variables.
This class overrides AcDbEntity::subSetDatabaseDefaults() to set the object's dimension style (dimstyle) to the current style for the database. Typically objects of this class are initialized with a call to setDatabaseDefaults() followed by a call to setDimstyleData() using data obtained by a call to AcDbDatabase::getDimstyleData().
Links
AcDbDimension Enumerations, AcDbDimension Methods
See Also
AcDbObject, AcDbBlockTableRecord