A single multi-line style in the dictionary can be the current active style. The current active
multi-line style is the object that is associated by default with a new multi-line entity; it is added in the database if the setDatabaseDefaults() function is called. The multi-line entity
has the style() and setStyle() methods for associating it with a multi-line style object,
which defines its appearance. When the program creates a new multi-line entity and adds it in the
database, it gets the current active multi-line style as a default object to set the association.
The CMLSTYLE system variable stores the object ID of the current active multi-line style. This
variable is set to the "Standard" predefined multi-line style in the database by default. The
database object provides the ability to access the system variables using get#() and set#() methods,
where # is the variable name. In the following examples, the pMLStyle variable stores a pointer to the multi-line
style object, the pMLine variable stores a pointer to the multi-line entity, and the pDb variable stores a
pointer to the database object. For example:
// Get the database object from the multi-line style object
OdDbDatabasePtr pDb = pMLStyle->database();
// Get the database object from the multi-line entity
OdDbDatabasePtr pDb = pMLine->database();
To get the current active multi-line style, use the getCMLSTYLE() method of the database object
that does not have arguments and returns the OdDbObjectId instance associated with the current active
multi-line style object. For example:
// Get the ID of the current active multi-line style
OdDbObjectId idActive = pDb->getCMLSTYLE();
To get the smart pointer to it, declare a variable of the OdDbMlineStylePtr type and use the
safeOpenObject() method of the obtained OdDbObjectId object in the corresponding open mode (kForRead,
kForWrite, or kForNotify). For example:
// Open the current active multi-line style in the read mode
OdDbMlineStylePtr pMLSActive = idActive.safeOpenObject(OdDb::kForRead);
// Open the current active multi-line style in the write mode
OdDbMlineStylePtr pMLSActive = idActive.safeOpenObject(OdDb::kForWrite);
To make a multi-line style active, use the setCMLSTYLE() method of the database object that requires
the object ID of the multi-line style object to be set active as an argument of the OdDbObjectId type
and does not return a value. For example:
If another multi-line style becomes the current active multi-line style, multi-line entities associated with the
previous active multi-line style save their own associations. Changing of the current active multi-line
style influences only new multi-line entities.
Additionally, the database has the CMLJUST system variable that stores the default justification and
the CMLSCALE system variable that stores the default scale factor for a new multi-line entity. These
variables have the same interface. For example: