Share

AcDmUtil Namespace

Description

The AcDmUtil namespace is a collection of dimensioning utility functions for managing dimension arrowheads and for dimension style migration from Release 14 to AutoCAD 2000.

Four new dimension variables have been added and two old variables have been removed. The Release 14 variable DIMFIT was separated into the variables DIMATFIT and DIMTMOVE, and the Release 14 variable DIMUNIT was separated into the variables DIMLUNIT and DIMFRAC. Migration functions are provided in this namespace to map from the old variables to the new and from the new to the old.

There are nineteen built-in arrowheads. Each has a globally invariant name and a local name. Arrowheads are stored as blocks in the database, so if an arrowhead is used in a particular drawing it also may be identified by the AcDbObjectId for its AcDbBlockTableRecord. The block table record name is the globally invariant name with a leading underbar, for example “_Dot.”

A subset of the built-in arrowheads are special in that they are treated by dimension layout code as if they have no size.

Arrow functions are provided to return the local or the globally invariant name. Boolean functions are provided to distinguish no size arrowheads, and to return whether a string is the local or the globally invariant name of a built-in arrowhead. A function is provided to return the AcDbObjectId of an arrowhead, and another to create the built-in arrowhead if needed.

Remarks

Dimension arrowhead management:

In Release 14 dimension arrowheads were managed using names, but in this and subsequent releases they will be managed by AcDbObjectId. For example, this Release 14 method:

Acad::ErrorStatus AcDbDatabase::getDimblk1(char*& p)

has been superceded by this method:

AcDbObjectId AcDbDatabase::dimblk1() const

The Release 14 methods will be removed in subsequent releases, so you should migrate your code to use the new methods. Here is an example. This Release 14 code fragment:

char* pBlk1 = 0;
Acad::ErrorStatus es = pDb->getDimblk1(pBlk1);
...
acutDelString(pBlk1);

could be changed to:

const char* pBlk1 = AcDmUtil::arrowName(pDb->dimblk1());

Note that you need not (in fact, must not!) free the memory pBlk1 since it is now const char*.

DIMFIT and DIMUNIT migration:

The Release 14 dimensioning system variables DIMFIT and DIMUNIT were each separated into two separate variables for AutoCAD 2000. The methods dimfit(), dimunit(), setDimfit(), and setDimunit() will be removed in subsequent releases, so you should migrate your code to use the new methods. Here is a Release 14 code fragment:

// Get the current (database) value of dimfit:
int fitVal = pDb->dimfit();
...
// use and possibly change the variable fitVal
...
// Set fitVal as the current (database) value of dimfit:
Acad::ErrorStatus es = pDb->setDimfit(fitVal );

We encourage you to modify your code to actually use the new variables (DIMATFIT and DIMTMOVE in this case), but assuming you wish to continue to use your Release 14 code containing fitVal with minimal changes, here is what you should do:

// Get the Release 14 value from the new variables:
int fitVal = AcDmUtil::dimfit(pDb->dimatfit(), pDb->dimtmove());
...
// use and possibly change the variable fitVal
// (unchanged from your Release 14 code!)
...
//
// Set the current values of the new varabies:
Acad::ErrorStatus es = pDb->setDimatfit(AcDmUtil::dimatfit(fitVal));
es = pDb->setDimtmove(AcDmUtil::dimtmove(fitVal));

Functions

Function Description
arrowName
dimatfit The Release 14 dimension variable DIMFIT has been separated into two new variables DIMATFIT and DIMTMOVE. This function returns the correct DIMATFIT value given a value for DIMFIT. Here is the complete mapping:
dimfit The Release 14 dimension variable DIMFIT has been separated into two new variables DIMATFIT and DIMTMOVE. This function returns the correct DIMFIT value given values for DIMATFIT and DIMTMOVE. Here is the complete mapping:
dimfrac The Release 14 dimension variable DIMUNIT has been separated into two new variables DIMLUNIT and DIMFRAC. This function returns the correct DIMFRAC value given a value for DIMUNIT. Here is the complete mapping:
dimlunit The Release 14 dimension variable DIMUNIT has been separated into two new variables DIMLUNIT and DIMFRAC. This function returns the correct DIMLUNIT value given a value for DIMUNIT. Here is the complete mapping:
dimtmove The Release 14 dimension variable DIMFIT has been separated into two new variables DIMATFIT and DIMTMOVE. This function returns the correct DIMTMOVE value given a value for DIMFIT. Here is the complete mapping:
dimunit The Release 14 dimension variable DIMUNIT has been separated into two new variables DIMLUNIT and DIMFRAC. This function returns the correct DIMUNIT value given values for DIMLUNIT and DIMFRAC. Here is the complete mapping:
findArrowId Given an arrowhead name and a database, this function returns the AcDbObjectId of the arrowhead. If pDb is NULL, it uses the working database.If the function succeeds, Acad::eOk is returned. If pName is NULL, Acad::eInvalidInput is returned. The null string ("") or "." is used to denote the default arrowhead. For these inputs, blockId is set to NULL and Acad::eOk is returned.If pName is not the name of an existing arrowhead (actually the name of an AcDbBlockTableRecord in this database), Acad::eInvalidKey is returned.
getArrowId Given an arrowhead name and a database, this function returns the AcDbObjectId of the arrowhead. If pDb is NULL, it uses the working database.This function can be used to create a built-in arrowhead. If pName is the name of a built-in arrowhead and it does not exist in this database, it will be created and added to the AcDbBlockTable.If the function succeeds, Acad::eOk is returned. If pName is NULL, Acad::eInvalidInput is returned. The null string ("") or "." is used to denote the default arrowhead. For these inputs blockId is set to NULL and Acad::eOk is returned.... more
globalArrowName
isBuiltInArrow Returns true if pName is the local or globally invariant name of a built-in arrowhead. Otherwise returns false.
isZeroLengthArrow Returns true if pName is the local or globally invariant name of an arrowhead that AutoCAD treats as having no length. Otherwise returns false.These are the globally invariant names of the arrowheads that have no length and that will cause this function to return true:
  • None
  • Oblique
  • ArchTick
  • DotSmall
  • Integral
  • Small

Was this information helpful?