Enumerations | |
enum | CellAddType { FromContext = -1, NormalCell = 1, PointCell = 2 } |
Functions | |
int | mdlCell_addLibDescr (MSElementDescrP cellEdP, CellAddType cellType, bool convertNestedCellsToRefs) |
Create a new cell in the currently attached cell library. More... | |
void | mdlCell_getLibraryName (BeFileNameR filename) |
Obtains the name of the cell library attached to the current design file. More... | |
int | mdlCell_attachLibrary (BeFileNameR filename, BeFileNameP inputname, WCharCP defaultDir, int fromkeyin) |
Attaches a new cell library to the current design file. More... | |
int | mdlCell_attachLibraryEx (BeFileNameR filename, BeFileNameP inputname, WCharCP defaultDir, int fromkeyin, int libraryFlag) |
Attach a new cell library to the current design file. More... | |
StatusInt | mdlCell_upgradeLibrary (WCharCP pLibraryFileName, WCharCP pBackupFileName, bool haveUnits, double uorPerStorage, double unitNumerator, double unitDenominator, WCharCP unitLabel, const DgnPlatform::UnitFlags *unitFlags, int libraryFlag, PFFeedbackFunc feedbackFunc) |
Upgrade the specified cell library to the format used by MicroStation V8. More... | |
int | mdlCell_create (MSElementP cellElm, WCharCP cellName, Dpoint3d *origin, bool pointCell) |
Creates a new cell element based on the data provided. More... | |
int | mdlCell_createFromFence (WCharCP cellName, WCharCP descr, Dpoint3d *rOrigin, bool pointCell) |
Create a new cell in the current cell library that contains the elements in the fence. More... | |
int | mdlCell_createFromFenceByType (WCharCP cellName, WCharCP descr, Dpoint3d *rOrigin, UInt16 cellType) |
Create a new cell in the current cell library that contains the elements in the fence. More... | |
int | mdlCell_deleteInLibrary (WCharCP cellName) |
Remove a cell from the current active cell library by name. More... | |
bool | mdlCell_existsInLibrary (WCharCP cellName) |
Indicates whether a cell with the specified name exists in the current cell library. More... | |
int | mdlCell_extract (Dpoint3d *origin, Dpoint3d *shape, RotMatrixP rMatrix, Dpoint3d *scale, WChar *cellName, int bufferSize, MSElementCP cell) |
Extracts the information from a cell header element. More... | |
int | mdlCell_fixLevels (MSElementDescrP elemDscr, int relativeMode, UInt32 baseLevel, DgnFileP library) |
This function is just a direct call to mdlCell_fixLevelsByCode, so that function should be called instead. More... | |
int | mdlCell_fixLevelsByCode (MSElementDescrP elemDscr, DgnModelRefP pModelRef, int relativeMode, UInt32 baseLevelId) |
Adjust element levels in a cell element descriptor, elemDscr. More... | |
StatusInt | mdlCell_getLibraryObject (DgnFileP *ppLibraryObj, WCharCP pLibName, bool unused) |
Returns a pointer to the cell library object of the given name. More... | |
int | mdlCell_getElmDscr (MSElementDescrH cellDscrPP, MSElementDescrH txtNodeDscrPP, DPoint3dCP rOrigin, DPoint3dCP scale, bool trueScale, RotMatrixCP rotMatrix, short const *attributes, UInt32 ggroup, int sharedFlag, bool updateMasterFile, WCharCP cellName, DgnFileP library) |
Read the specified cell from the cell library and returns the cell's element descriptor. More... | |
int | mdlCell_getElmDscrExtended (MSElementDescrH cellDscrPP, MSElementDescrH txtNodeDscrPP, MSElementDescrH tagDscrPP, DPoint3dCP rOrigin, DPoint3dCP scale, bool trueScale, DgnModelRefP destModelRef, RotMatrixCP rotMatrix, short const *attributes, UInt32 ggroup, int sharedFlag, bool keepCellDimensionality, bool updateDestFile, WCharCP cellName, DgnFileP library) |
Read the specified cell element from the cell library, and return the cell's element descriptor. More... | |
int | mdlCell_findCell (DgnFileP *library, DgnFileP preferredLib, WCharCP cellName, int searchAll) |
Search for a cell with the specified cell name. More... | |
StatusInt | mdlCell_findCellEx (DgnFileP *library, DgnFileP preferredLib, WCharCP cellName, int searchAll, UInt32 rights) |
Search for a cell with the specified cell name. More... | |
int | mdlCell_copyCellDefinition (DgnFileP destLibrary, WCharCP cellName, DgnFileP sourceLibrary) |
Duplicate a cell definition from one cell library to another. More... | |
bool | mdlCell_isPointCell (MSElementCP hdr) |
Determine whether the cell cellHeader is a point cell. More... | |
UInt32 | mdlCell_placeCell (DPoint3dCP rOrigin, DPoint3dCP scale, bool trueScale, RotMatrixCP rotMatrix, short *attributes, UInt32 ggroup, bool relativeMode, UInt32 baseLevel, int sharedFlag, WCharCP cellName, DgnFileP library) |
Place a cell in the active model of the current design file. More... | |
int | mdlCell_extractName (WCharP cellNameP, int bufferSize, MSElementCP elmP) |
Retrieve the name string from a non-shared or shared cell element and copy it to the provided buffer. More... | |
int | mdlCell_setName (MSElementP elmP, WCharCP cellNameP) |
Set the name of the specified cell. More... | |
int | mdlCell_extractDescription (WCharP cellDescrP, int bufferSize, MSElementCP elmP) |
Retrieve the description from a cell element and copy it to the provided buffer. More... | |
int | mdlCell_setDescription (MSElementP elmP, WCharCP cellDescrP) |
Set the description of the specified cell element. More... | |
int | mdlCell_rename (WCharCP newName, WCharCP oldName) |
Changes the name of cell in the current cell library. More... | |
void | mdlCell_setRange (MSElementDescrP cellDP, DgnModelRefP modelRef) |
The mdlCell_create and mdlCell_setRange functions are generally used to create library cells in memory for subsequent addition to a cell library using mdlCell_addLibDescr. More... | |
void | mdlCell_setOriginAndRange (MSElementDescrP cellDP) |
Set the cell's range, range diagonal, and origin. More... | |
int | mdlCell_readLibraryElements (MSElementDescrH cellElementsPP, WCharCP cellName, DgnFileP library, bool justHeader) |
Get the component elements of the specified cell from the cell library. More... | |
int | mdlCell_modifyInfo (WCharCP newName, WCharCP newdescr, WCharCP cellName, DgnFileP library) |
Replace the name and description of a cell in a library. More... | |
StatusInt | mdlCell_replaceLibraryHeaderElement (DgnFileP library, MSElementDescrP cellEdP, CellAddType cellType) |
Replace the data for a cell header in a library. More... | |
StatusInt | mdlCellLibAsync_getMessageType (int *pCellLibraryMessageType, CellLibAsyncMsgP cellLibAsyncMsg) |
Get the current message type from the CellAsyncMsgP pointer. More... | |
StatusInt | mdlCellLibAsync_getLibPath (WCharP pCellLibraryPath, int cellLibraryPathLength, CellLibAsyncMsgP cellLibAsyncMsg) |
Get cell library path from the CellAsyncMsgP pointer. More... | |
|
strong |
A cell is defined as a group of elements. When placed in a design file, a cell will consist of a cell header (an element of type CELL_HEADER_ELM) and a collection of geometry elements. Cells can be nested.
Cells are often stored in libraries. A cell library is nothing more than a standard DGN file. Each model in the file can be placed as as seperate cell. When using the mdlCell API functions, all of the elements in the model will be collected up and grouped under a cell header element. Reference models in the cell model will be converted to nested cells in the cell elements. When extracting the geometry for cell models, the only thing that is respected in the display is whether or not a reference model is displayed. All geometry, regardless of level or display property, will be added to the cell element.
Every DGN file, and therefore cell library, contains an index of the models within it. The index is maintained in memory once a file is accessed. Since the index is maintained within the file it is always up to date. However, programs should not change a library through external means, such as mdlFile_copy, while the file is in use in MicroStation. Doing so will cause the index to be invalid.
When working with cell libraries, developers should also remember the mdlWorkDgn api which can be used to edit the elements in a cell directly.
Enumerator | |
---|---|
FromContext | |
NormalCell | |
PointCell |
int mdlCell_addLibDescr | ( | MSElementDescrP | cellEdP, |
CellAddType | cellType, | ||
bool | convertNestedCellsToRefs | ||
) |
Create a new cell in the currently attached cell library.
This function also handles copying styles, dependencies, etc. into the library.
[in] | cellEdP | a cell element descriptor (type 2) to add to the library. |
[in] | cellType | the type of the cell in the library. Use CellAddType::FromContext to choose GRAPHIC or POINT based on the type of the cell. Otherwise, possible values for cellType are CellAddType::NormalCell for a normal graphic cell or CellAddType::PointCell for a point cell. |
[in] | convertNestedCellsToRefs | if true, a nested cell with the same name as a cell (model) in the destination library will be replaced by a reference to that cell, which matches the behavior of the MicroStation cell creation tool. When deciding whether to replace, only the cell names are compared, not the geometry. Pre-V8 behavior of this function was to set this to false. mdlCell_createFromFence calls this function with convertNestedCellsToRefs set to true. |
int mdlCell_attachLibrary | ( | BeFileNameR | filename, |
BeFileNameP | inputname, | ||
WCharCP | defaultDir, | ||
int | fromkeyin | ||
) |
Attaches a new cell library to the current design file.
If a library is successfully attached, filename is set to the cell library's full file specification. If the library is a V7 cell library then this function will fail. It is the equivalent of calling mdlCell_attachLibraryEx with LIBRARY_IgnoreV7Libraries.
[out] | filename | name of cell library opened. This should be a string buffer at least MAXFILELENGTH characters long. |
[in] | inputname | is the name of the cell library. inputName may contain a path specification. However, if it does not, then MS_CELL and defaultDir (if defined) are searched for the file. If this parameter is NULL, then the active library is detached. |
[in] | defaultDir | additional path to search. Can be NULL. |
[in] | fromkeyin | if true, the path information from inputName is used. If it is false, mdlCell_attachLibrary assumes that inputName came from the information stored in the design file header (where the path information is not always correct), and it only uses the path information from inputName if the library cannot be found anywhere else. MDL applications should normally set fromKeyin to true. |
int mdlCell_attachLibraryEx | ( | BeFileNameR | filename, |
BeFileNameP | inputname, | ||
WCharCP | defaultDir, | ||
int | fromkeyin, | ||
int | libraryFlag | ||
) |
Attach a new cell library to the current design file.
If a library is successfully attached, filename is set to the cell library's full file specification.
[out] | filename | name of cell library opened. This should be a string buffer at least MAXFILELENGTH characters long. |
[in] | inputname | is the name of the cell library. inputName may contain a path specification. However, if it does not, then MS_CELL and defaultDir (if defined) are searched for the file. If this parameter is NULL, then the active library is detached. |
[in] | defaultDir | additional path to search. Can be NULL. |
[in] | fromkeyin | if true, the path information from inputName is used. If it is false, mdlCell_attachLibraryEx assumes that inputName came from the information stored in the design file header (where the path information is not always correct), and it only uses the path information from inputName if the library cannot be found anywhere else. MDL applications should normally set fromKeyin to true. |
[in] | libraryFlag | specifies how to handle the cell library if its format is not up to date. If the cell library is a V7 cell library, then it can be upgraded. See for the possible values. |
int mdlCell_copyCellDefinition | ( | DgnFileP | destLibrary, |
WCharCP | cellName, | ||
DgnFileP | sourceLibrary | ||
) |
Duplicate a cell definition from one cell library to another.
[in] | destLibrary | the cell library to copy the cell to. |
[in] | cellName | the name of the cell to copy. |
[in] | sourceLibrary | the cell library to copy the cell from. |
int mdlCell_create | ( | MSElementP | cellElm, |
WCharCP | cellName, | ||
Dpoint3d * | origin, | ||
bool | pointCell | ||
) |
Creates a new cell element based on the data provided.
This can be used as an orphan cell, or later added to a cell library using mdlCell_addLibDescr. Typically this function is used to create a cell header, and mdlElmdscr_appendDscr is then used to add elements.
[out] | cellElm | This is a pointer to a full MSElement union which is filled in. |
[in] | cellName | the name of the cell; may be NULL. |
[in] | origin | the origin of the cell. If NULL is passed for cellOrigin, the (0, 0, 0) point for the current coordinate system is used. |
[in] | pointCell | true if the cell is to be a point cell, otherwise false. |
int mdlCell_createFromFence | ( | WCharCP | cellName, |
WCharCP | descr, | ||
Dpoint3d * | rOrigin, | ||
bool | pointCell | ||
) |
Create a new cell in the current cell library that contains the elements in the fence.
It creates the new cell from the current selection set if no fence is defined.
[in] | cellName | the name of the cell in the library. This must be less than DgnPlatform::MAX_CELLNAME_LENGTH characters, and must be valid as tested by mdlModel_nameIsValid. |
[in] | descr | is the cell description; it may not exceed MAX_CELLDSCR_LENGTH characters. |
[in] | rOrigin | the origin of the cell. If NULL is passed for cellOrigin, tcb->celor is used. |
[in] | pointCell | true if the cell is to be a point cell, otherwise false. |
int mdlCell_createFromFenceByType | ( | WCharCP | cellName, |
WCharCP | descr, | ||
Dpoint3d * | rOrigin, | ||
UInt16 | cellType | ||
) |
Create a new cell in the current cell library that contains the elements in the fence.
It creates the new cell from the current selection set if no fence is defined.
[in] | cellName | the name of the cell in the library. This must be less than DgnPlatform::MAX_CELLNAME_LENGTH characters, and must be valid as tested by mdlModel_nameIsValid. |
[in] | descr | is the cell description; it may not exceed MAX_CELLDSCR_LENGTH characters. |
[in] | rOrigin | the origin of the cell. If NULL is passed for cellOrigin, tcb->celor is used. |
[in] | cellType | the type of cell to create (point, graphic, parametric) |
int mdlCell_deleteInLibrary | ( | WCharCP | cellName | ) |
Remove a cell from the current active cell library by name.
[in] | cellName | name of cell to be deleted. |
bool mdlCell_existsInLibrary | ( | WCharCP | cellName | ) |
Indicates whether a cell with the specified name exists in the current cell library.
[in] | cellName | name of the cell to search for. |
int mdlCell_extract | ( | Dpoint3d * | origin, |
Dpoint3d * | shape, | ||
RotMatrixP | rMatrix, | ||
Dpoint3d * | scale, | ||
WChar * | cellName, | ||
int | bufferSize, | ||
MSElementCP | cell | ||
) |
Extracts the information from a cell header element.
If any parameters are NULL, this function does not attempt to fill them in. All parameters are returned in the current (design file) coordinate system.
[out] | origin | is the cell origin. |
[out] | shape | returns an array of eight Dpoint3d's which represent the minimum bounding box for the cell in the coordinate system of the cell. This idea can be illustrated by using MicroStation's element selection tool to select a cell. MicroStation places handles on the boundary which defines the cell, and these handles correlate to the eight Dpoint3ds returned by mdlCell_extract. Note that this must point to an array large enough to hold the 8 points. |
[out] | rMatrix | the rotation matrix for the cell. |
[out] | scale | the cell's X, Y and Z scale factors. |
[out] | cellName | the cell's name in Unicode. |
[in] | bufferSize | if extracting cell's name, number of widechars name buffer can hold. This is ignored if cellName is NULL. |
[in] | cell | cell element to extract information from. |
int mdlCell_extractDescription | ( | WCharP | cellDescrP, |
int | bufferSize, | ||
MSElementCP | elmP | ||
) |
Retrieve the description from a cell element and copy it to the provided buffer.
Note that graphic cells and shared cell instances as placed by MicroStation do not keep their descriptions. For shared cells, you should use this function on the definition. For graphic cells, you must find the cell in a library and extract its description that way.
[in] | cellDescrP | the buffer where the extracted cell description will be placed. |
[in] | bufferSize | the maximum number of MSWChars to copy to the cellDescrP buffer. |
[in] | elmP | is the cell element from which the description is extracted. |
int mdlCell_extractName | ( | WCharP | cellNameP, |
int | bufferSize, | ||
MSElementCP | elmP | ||
) |
Retrieve the name string from a non-shared or shared cell element and copy it to the provided buffer.
[out] | cellNameP | the buffer where the extracted cell name will be placed. |
[in] | bufferSize | the maximum number of MSWChars to copy to cellNameP. |
[in] | elmP | the cell element from which the name is extracted. |
int mdlCell_findCell | ( | DgnFileP * | library, |
DgnFileP | preferredLib, | ||
WCharCP | cellName, | ||
int | searchAll | ||
) |
Search for a cell with the specified cell name.
The search order is first the library passed in as preferredLib; then the current active cell library; and then sequentially though the files listed in MS_CELLLIST and MS_BLOCKLIST if the searchAll parameter is true. The first cell found with the requested name will stop the search.
[out] | library | is the library where the cell was found, if the search was successful. This argument will be NULL if the cell was not found. |
[in] | preferredLib | the cell library to search first, or NULL. |
[in] | cellName | the name of the cell to search for. |
[in] | searchAll | indicates whether all of the cell libraries in the MS_CELLLIST and MS_BLOCKLIST paths are to be searched. Setting this value to 0 indicates that only the preferredLib library is searched; setting this value to 1 indicates that all cell libraries are to be searched; setting this value to 2 indicates that all cell libraries are to be searched and messages generated as the search progresses. Messages are sent to the error display field in the MicroStation window. |
StatusInt mdlCell_findCellEx | ( | DgnFileP * | library, |
DgnFileP | preferredLib, | ||
WCharCP | cellName, | ||
int | searchAll, | ||
UInt32 | rights | ||
) |
Search for a cell with the specified cell name.
The search order is first the library passed in as preferredLib; then the current active cell library; and then sequentially though the files listed in MS_CELLLIST and MS_BLOCKLIST if the searchAll parameter is true. The first cell found with the requested name will stop the search. This function differs from mdlCell_findCell by the rights parameter which allows the caller to specify the desired permission level.
[out] | library | is the library where the cell was found, if the search was successful. This argument will be NULL if the cell was not found. |
[in] | preferredLib | the cell library to search first, or NULL. |
[in] | cellName | the name of the cell to search for. |
[in] | searchAll | indicates whether all of the cell libraries in the MS_CELLLIST and MS_BLOCKLIST paths are to be searched. Setting this value to 0 indicates that only the preferredLib library is searched; setting this value to 1 indicates that all cell libraries are to be searched; setting this value to 2 indicates that all cell libraries are to be searched and messages generated as the search progresses. Messages are sent to the error display field in the MicroStation window. |
[in] | rights | The level of rights that should be tested. See mdlDgnFileObj_checkRights for a description of the choices. |
int mdlCell_fixLevels | ( | MSElementDescrP | elemDscr, |
int | relativeMode, | ||
UInt32 | baseLevel, | ||
DgnFileP | library | ||
) |
This function is just a direct call to mdlCell_fixLevelsByCode, so that function should be called instead.
It will adjust element levels in a cell element descriptor, elemDscr. This adjustment is based on the cell type and the values of relativeMode and baseLevel. It uses the following logic:
If relative mode is chosen, the all element level ids are adjusted by the difference between the lowest level id in the cell and the base level id provided.
[in] | elemDscr | cell element descriptor |
[in] | relativeMode | true for relative level. |
[in] | baseLevel | used for point cells and relative mode. |
[in] | library | This is no longer used and can be NULL. Instead the model ref from elemDscr->h.dgnModelRef is used. |
int mdlCell_fixLevelsByCode | ( | MSElementDescrP | elemDscr, |
DgnModelRefP | pModelRef, | ||
int | relativeMode, | ||
UInt32 | baseLevelId | ||
) |
Adjust element levels in a cell element descriptor, elemDscr.
This adjustment is based on the cell type and the values of relativeMode and baseLevelId. It uses the following logic:
If relative mode is chosen, the baseLevelId is converted to a level code and all element level codes are adjusted by the difference between the base level code and lowest level code in the cell.
[in] | elemDscr | cell element descriptor |
[in] | pModelRef | model ref of element descriptor |
[in] | relativeMode | relative or absolute |
[in] | baseLevelId | used for point cells and relative mode. This is a level number, not a level code. |
int mdlCell_getElmDscr | ( | MSElementDescrH | cellDscrPP, |
MSElementDescrH | txtNodeDscrPP, | ||
DPoint3dCP | rOrigin, | ||
DPoint3dCP | scale, | ||
bool | trueScale, | ||
RotMatrixCP | rotMatrix, | ||
short const * | attributes, | ||
UInt32 | ggroup, | ||
int | sharedFlag, | ||
bool | updateMasterFile, | ||
WCharCP | cellName, | ||
DgnFileP | library | ||
) |
Read the specified cell from the cell library and returns the cell's element descriptor.
The address of the element descriptor for the cell's graphic elements is returned in cellDscrPP.
[out] | cellDscrPP | cell element descriptor |
[out] | txtNodeDscrPP | element descriptor for empty text nodes. If NULL, these text nodes are lost. |
[in] | rOrigin | the location of the cell's origin. If origin is NULL, the cell is transformed to the (0, 0, 0) point in the current coordinate system. |
[in] | scale | points to a Dpoint3d structure holding the X, Y and (in 3D) Z scale factors to be applied to the cell's elements. If scale is NULL, the cell is not scaled. |
[in] | trueScale | indicates whether the cell definition and DGN file units are used in scaling the cell, resulting in cells that have the same size between models with different units. ACTIVEMODEL is assumed for the destination. |
[in] | rotMatrix | is the rotation matrix that defines the cell's orientation. If rMatrix is NULL, the identity matrix is used. |
[in] | attributes | an array of attribute information to append to the cell header. This parameter has been deprecated; please see the mdlLinkage functions to append attributes to the cell header. |
[in] | ggroup | is the graphic group number for the cell's elements. A value of 0 means that the elements will not be part of a graphic group. |
[in] | sharedFlag | indicates whether the element descriptor is for a shared or unshared cell. If sharedFlag is 0, an unshared cell is returned. If sharedFlag is 1, a shared cell is returned if found, otherwise an unshared cell. If sharedFlag is 2, the state of the user-specified shared flag is used. |
[in] | updateMasterFile | indicates that the cell is to be placed in the active model ref, so all necessary styles, etc. should be copied to the active file. If this parameter is set to false, then the display of the cell elements may not match the original model. |
[in] | cellName | the name of the cell to be returned. |
[in] | library | the library object containing the cell. If this argument is NULL, the cell is searched for. It is usually acquired via mdlCell_findCell or mdlCell_getLibraryObject. |
int mdlCell_getElmDscrExtended | ( | MSElementDescrH | cellDscrPP, |
MSElementDescrH | txtNodeDscrPP, | ||
MSElementDescrH | tagDscrPP, | ||
DPoint3dCP | rOrigin, | ||
DPoint3dCP | scale, | ||
bool | trueScale, | ||
DgnModelRefP | destModelRef, | ||
RotMatrixCP | rotMatrix, | ||
short const * | attributes, | ||
UInt32 | ggroup, | ||
int | sharedFlag, | ||
bool | keepCellDimensionality, | ||
bool | updateDestFile, | ||
WCharCP | cellName, | ||
DgnFileP | library | ||
) |
Read the specified cell element from the cell library, and return the cell's element descriptor.
The address of the element descriptor for the cell's graphic elements is returned in cellDscrPP.
[out] | cellDscrPP | cell element descriptor. |
[out] | txtNodeDscrPP | text node descriptor. If this parameter is not NULL, the returned elmdscr will contain any empty text nodes from the cell. If this parameter is NULL, empty text nodes are ignored. |
[out] | tagDscrPP | tag descriptor. If this is not NULL, updateMasterFile should be set to true to ensure that the tag set is copied into the master file. |
[in] | rOrigin | is the location of the cell's origin. If origin is NULL, the cell is transformed to the (0, 0, 0) point in the current coordinate system. |
[in] | scale | points to a Dpoint3d structure holding the X, Y and (in 3D) Z scale factors to be applied to the cell's elements. If scale is NULL, the cell is not scaled. |
[in] | trueScale | indicates whether the cell definition and DGN file units are used in scaling the cell, resulting in cells that have the same size between models with different units. |
[in] | destModelRef | specifies the design model to use the units from if trueScale is set to true. It also specifies the destination model ref for copying styles, etc. to if updateDestFile is true. This parameter should not be NULL; use ACTIVEMODEL or INVALID_MODELREF instead. |
[in] | rotMatrix | the rotation matrix that defines the cell's orientation. If rMatrix is NULL, the identity matrix is used. |
[in] | attributes | an array of attribute information to append to the cell header. This parameter has been deprecated; please see the mdlLinkage functions to append attributes to the cell header. |
[in] | ggroup | is the graphic group number for the cell's elements. A value of 0 means that the elements will not be part of a graphic group. |
[in] | sharedFlag | indicates whether the element descriptor is for a shared or unshared cell. If sharedFlag is 0, an unshared cell is returned. If sharedFlag is 1, a shared cell is returned if found, otherwise an unshared cell. If sharedFlag is 2, the state of the user-specified shared flag is used. |
[in] | keepCellDimensionality | indicates whether the resulting elmdscr should be converted to the dimensionality (2D or 3D) of the destination model ref. This flag is useful when extracting elements which are then going to be added as a shared cell. In this case, it is likely that the desired behavior is for the shared cell definition to maintain its original dimensionality, but all instances should be of the correct dimensionality to write to the model. For example, a 3D shared cell definition can be referenced by shared cell instances in both 3D and 2D models within the same file. |
[in] | updateDestFile | indicates that the cell is to be placed in the destModelRef, so all necessary styles, etc. should be copied to the active file. If this parameter is set to false, then the display of the cell elements may not match the original model. Setting this parameter to true is similar to calling mdlElmdscr_copy on the cell element descriptor, except that the cell elements themselves are not added to the file. The program can then choose the correct placement of the elements and perform other operations before adding them to the file. |
[in] | cellName | is the name of the cell to be read and returned. |
[in] | library | indicates the cell library to read the cell from, or if NULL, the cell is searched for in all available libraries. It is usually acquired via mdlCell_findCell or mdlCell_getLibraryObject. |
void mdlCell_getLibraryName | ( | BeFileNameR | filename | ) |
Obtains the name of the cell library attached to the current design file.
[out] | filename | name of the attached cell library. |
StatusInt mdlCell_getLibraryObject | ( | DgnFileP * | ppLibraryObj, |
WCharCP | pLibName, | ||
bool | unused | ||
) |
Returns a pointer to the cell library object of the given name.
This is used by mdlCell_getElmDscr, mdlCell_placeCell, and other functions that require a cell library handle.
[out] | ppLibraryObj | pointer to the cell library object. |
[in] | pLibName | name of the cell library to find. |
[in] | unused | Unused; pass false. |
bool mdlCell_isPointCell | ( | MSElementCP | hdr | ) |
Determine whether the cell cellHeader is a point cell.
[in] | hdr | cell header element |
int mdlCell_modifyInfo | ( | WCharCP | newName, |
WCharCP | newdescr, | ||
WCharCP | cellName, | ||
DgnFileP | library | ||
) |
Replace the name and description of a cell in a library.
[in] | newName | is the new cell name. Pass NULL to use the old name. |
[in] | newdescr | is the new cell description. Pass NULL to use the old description. |
[in] | cellName | is the name of the cell to modify. |
[in] | library | is the pointer to the cell library to use. |
UInt32 mdlCell_placeCell | ( | DPoint3dCP | rOrigin, |
DPoint3dCP | scale, | ||
bool | trueScale, | ||
RotMatrixCP | rotMatrix, | ||
short * | attributes, | ||
UInt32 | ggroup, | ||
bool | relativeMode, | ||
UInt32 | baseLevel, | ||
int | sharedFlag, | ||
WCharCP | cellName, | ||
DgnFileP | library | ||
) |
Place a cell in the active model of the current design file.
[in] | rOrigin | the location to place the cell origin. If origin is NULL, the cell is placed at the (0, 0, 0) point in the current coordinate system. |
[in] | scale | points to a Dpoint3d structure holding the X, Y, and (in 3D) Z scale factors to be applied to the cell elements before they are placed. If scale is NULL, the cell is placed at a scale factor of 1.0. |
[in] | trueScale | if true, use cell model and master model units to scale the cell. |
[in] | rotMatrix | the rotation matrix that defines the orientation for cell placement. If rMatrix is NULL, the identity matrix is used. rMatrix does not necessarily need to be orthogonal or normalized. (Cells can be placed skewed). |
[in] | attributes | is an array of attribute information to append to the cell header before it is placed. The first short of this array is the length, in shorts, of the attribute data. Note that attribute linkage lengths must be a multiple of four words. If attributes is NULL, the cell has no attributes attached to the header. |
[in] | ggroup | the graphic group number for the cell's elements. A value of 0 means that the elements will not be part of a graphic group. |
[in] | relativeMode | determines how the levels for the cell's elements are assigned. All elements for a point cell are assigned to baseLevel. If relativeMode is true, the lowest level used in the cell definition is assigned to baseLevel and all other element levels are adjusted accordingly. If relativeMode is false, the levels are taken from the cell library unchanged. |
[in] | baseLevel | determines how the levels for the cell's elements are assigned. All elements for a point cell are assigned to baseLevel. For a graphic cell, this is ignored if relativeMode is false. This is a level ID, gotten through functions such as mdlLevel_getIdFromName. Relative placement internally works by level numbers. |
[in] | sharedFlag | indicates whether the cell should be placed as shared or unshared. If sharedFlag is 0, an unshared cell is placed. If sharedFlag is 1, a shared cell is created. If sharedFlag is 2, the state of the user-specified shared flag is used. mdlCell_placeCell also creates and places the shared cell definition if it does not exist in the file. |
[in] | cellName | is the name of the cell to be placed. |
[in] | library | name of library or NULL. If the library is NULL, the cell will be searched for in the active cell library, then all files found on MS_CELLLIST. If the shared flag is 1, then the active file will be searched for a shared cell definition first. |
int mdlCell_readLibraryElements | ( | MSElementDescrH | cellElementsPP, |
WCharCP | cellName, | ||
DgnFileP | library, | ||
bool | justHeader | ||
) |
Get the component elements of the specified cell from the cell library.
Calling this function with justHeader false is the same as calling mdlCell_getElmDscr with no transformations.
[out] | cellElementsPP | is an element descriptor containing the elements of the cell. |
[in] | cellName | the name of the cell to find and read. |
[in] | library | the cell library to read the cell from, or NULL to search. |
[in] | justHeader | if set true, only the cell header is read and returned. |
int mdlCell_rename | ( | WCharCP | newName, |
WCharCP | oldName | ||
) |
Changes the name of cell in the current cell library.
[in] | newName | is the new name of the cell in the library. This must be less than DgnPlatform::MAX_CELLNAME_LENGTH characters, and must be valid as tested by mdlModel_nameIsValid. |
[in] | oldName | old name for cell in library |
StatusInt mdlCell_replaceLibraryHeaderElement | ( | DgnFileP | library, |
MSElementDescrP | cellEdP, | ||
CellAddType | cellType | ||
) |
Replace the data for a cell header in a library.
Since this will replace all linkages on the element except name and description, care must be taken to avoid removing linkages that should remain. Typically mdlCell_readLibraryElements is used to get the cell header so that the original linkages are in place.
[in] | library | is the pointer to the cell library to use. |
[in] | cellEdP | is the new cell element to use to replace the header. |
[in] | cellType | is the cell type; see mdlCell_addLibDescr for a description of types. |
int mdlCell_setDescription | ( | MSElementP | elmP, |
WCharCP | cellDescrP | ||
) |
Set the description of the specified cell element.
When setting the description of a cell using an element descriptor you need to be careful about changing the length of the cell description as the element descriptor has only been allocated to be large enough for the current description length. The proper way to change the cell descriptor is:
[in] | elmP | the cell element on which the description will be set. |
[in] | cellDescrP | the description to give the cell. |
int mdlCell_setName | ( | MSElementP | elmP, |
WCharCP | cellNameP | ||
) |
Set the name of the specified cell.
When setting the name of a cell using an element descriptor you need to be careful about changing the length of the cell name as the element descriptor has only been allocated to be large enough for the current name length. The proper way to change the cell descriptor is:
[in] | elmP | the cell element on which the name will be set. |
[in] | cellNameP | the name to give to the cell. |
void mdlCell_setOriginAndRange | ( | MSElementDescrP | cellDP | ) |
Set the cell's range, range diagonal, and origin.
The origin is set to the middle of the range. This function only validates the range of the cell against the ACTIVEMODEL. If you are working with a different modelRef, you must use mdlElmdscr_validate and mdlCell_setRange.
[in] | cellDP | the cell's element descriptor. |
void mdlCell_setRange | ( | MSElementDescrP | cellDP, |
DgnModelRefP | modelRef | ||
) |
The mdlCell_create and mdlCell_setRange functions are generally used to create library cells in memory for subsequent addition to a cell library using mdlCell_addLibDescr.
The programmer typically creates a cell element, creates a new element descriptor, adds the component elements to that element descriptor, calls mdlCell_setRange, and then adds the cell to the library using mdlCell_addLibDescr.
[in,out] | cellDP | the element descriptor of the cell. |
[in] | modelRef | indicates the model to validate the cell range against. ACTIVEMODEL is typically used. |
StatusInt mdlCell_upgradeLibrary | ( | WCharCP | pLibraryFileName, |
WCharCP | pBackupFileName, | ||
bool | haveUnits, | ||
double | uorPerStorage, | ||
double | unitNumerator, | ||
double | unitDenominator, | ||
WCharCP | unitLabel, | ||
const DgnPlatform::UnitFlags * | unitFlags, | ||
int | libraryFlag, | ||
PFFeedbackFunc | feedbackFunc | ||
) |
Upgrade the specified cell library to the format used by MicroStation V8.
Since V7 cell libraries were unitless, this functions allows you to pass in units to assign for the cells. Most of the parameters for units are the pieces of a DgnPlatform::UnitInfo structure, so consult mdlUnits_* functions for more explanation.
[in,out] | pLibraryFileName | the name of the library to convert. The full file specification returned in this parameter, so it should be at least MAXFILELENGTH characters. |
[in] | pBackupFileName | the name of a backup file to create before converting. If this parameter is NULL and the libraryFlag indicates that a backup should be made, the backup file will go to MS_BACKUP. |
[in] | haveUnits | specifies whether the unit values given by uorPerStorage, unitNumertor, and unitDenominator, unitLabel, and unitFlags are used. All the parameters except uorPerStorage are the same as what is found in a DgnPlatform::UnitInfo structure. |
[in] | uorPerStorage | uors per master unit for cells; ignored if haveUnits is false. |
[in] | unitNumerator | numerator for converting storage units to meters; ignored if haveUnits is false. |
[in] | unitDenominator | denominator for converting storage units to meters; ignored if haveUnits is false. |
[in] | unitLabel | specifies the name of the storage units; ignored if haveUnits is false. |
[in] | unitFlags | unit flags; ignored if haveUnits is false. |
[in] | libraryFlag | specifies LIBRARY_xxx values which can be used to modify the method of handling V7 cell libraries. Possible values are: |
Value | Description |
---|---|
LIBRARY_IgnoreV7Libraries | Ignore any V7 libraries; function will return MDLERR_INVALIDLIBRARY. |
LIBRARY_AutoConvertToV8 | Automatically convert the library without asking user. A backup will be created. |
LIBRARY_PromptForConvertToV8 | Prompt the user to determine whether to convert. If the user declines, MDLERR_USERABORT is returned. |
LIBRARY_AutoConvertToV8NoBackup | Convert the library to the current version and do not create a backup. Instead, pBackupFileName is the source cell library and pLibraryFileName is the output V8 file. |
[in] | feedbackFunc | is a feedback function called during conversion if the cell library was a V7 file. |
StatusInt mdlCellLibAsync_getLibPath | ( | WCharP | pCellLibraryPath, |
int | cellLibraryPathLength, | ||
CellLibAsyncMsgP | cellLibAsyncMsg | ||
) |
Get cell library path from the CellAsyncMsgP pointer.
[out] | pCellLibraryPath | Returns the full path to the cell library from the CellAsyncMsgP pointer. |
[in] | cellLibraryPathLength | This is the size of the buffer pCellLibraryPath. |
[in] | cellLibAsyncMsg | is the pointer to the object to query cell library information. |
StatusInt mdlCellLibAsync_getMessageType | ( | int * | pCellLibraryMessageType, |
CellLibAsyncMsgP | cellLibAsyncMsg | ||
) |
Get the current message type from the CellAsyncMsgP pointer.
[out] | pCellLibraryMessageType | is the message type extracted from the CellAsyncMsgP pointer. |
[in] | cellLibAsyncMsg | is the pointer to the object to query cell library information. See mdlSystem_cellLibraryChange for callback formatting |