Classes | Functions
Element Descriptors

An MSElementDescr holds a copy of a (potentially complex) MicroStation element. More...

Classes

struct  MSElementDescr
 

Functions

static DGNPLATFORM_EXPORT
MSElementDescrP 
Allocate (MSElementCR element, DgnModelRefP modelRef=0, MSElementDescrP myHeader=0)
 Allocate a new MSElementDescr holding a copy of the supplied MSElement. More...
 
static DGNPLATFORM_EXPORT
MSElementDescrP 
Allocate (ElementRefP elemRef, DgnModelRefP modelRef=0, MSElementDescrP myHeader=0)
 Allocate a new MSElementDescr holding a copy of the element data from the supplied ElementRef. More...
 
DGNPLATFORM_EXPORT UInt32 AddRef ()
 Add a reference to this MSElementDescr. More...
 
DGNPLATFORM_EXPORT void Release ()
 Decrement the use count for this MSElementDescr. The last reference frees the MSElementDescr. More...
 
DGNPLATFORM_EXPORT StatusInt Duplicate (MSElementDescrH newDscr, bool copyScheduledXaChanges=true, bool loadPersistentXasAsChanges=false) const
 Allocates and returns a copy of this MSElementDescr. More...
 
DGNPLATFORM_EXPORT StatusInt DuplicateSingle (MSElementDescrH newDscr, bool copyScheduledXaChanges=true, bool loadPersistentXasAsChanges=false) const
 Allocates and returns a copy of this MSElementDescr without copying h.next. More...
 
DGNPLATFORM_EXPORT MSElementDescrP ReplaceElement (MSElementCR element)
 Replace the element held by this MSElementDescr with a new element. More...
 
DGNPLATFORM_EXPORT MSElementDescrP ReplaceDescr (MSElementDescrR newDscr)
 Replace this MSElementDescr, and all of its children, with a new MSElementDescr. More...
 
DGNPLATFORM_EXPORT MSElementDescrP AppendElement (MSElementCR element)
 Allocates a new element descriptor from an existing element and append to the end of an existing element descriptor. More...
 
DGNPLATFORM_EXPORT StatusInt AppendDescr (MSElementDescrP newDscr)
 Adds newDscr to the end of this msElementDescr. More...
 
DGNPLATFORM_EXPORT MSElementDescrP RemoveElement ()
 Removes this element from an element descriptor chain. More...
 
DGNPLATFORM_EXPORT void Validate (DgnModelRefP modelRef, bool ignoreIsValid=false)
 Updates complex header element information based on current components. More...
 
DGNPLATFORM_EXPORT void ClearElementIds ()
 Set the ElementIDs of this MSElementDescr, and all of its children, to zero. More...
 
DGNPLATFORM_EXPORT void SetModelRef (DgnModelRefP modelRef)
 
DGNPLATFORM_EXPORT BentleyStatus CopyXAttributesTo (MSElementDescrR sink, bool copyChildXAttributes) const
 
DGNPLATFORM_EXPORT
XAttributeChangeSetP 
GetXAttributeChangeSet () const
 
DGNPLATFORM_EXPORT
XAttributeChangeSetP 
QueryXAttributeChangeSet () const
 
DGNPLATFORM_EXPORT void AddToChain (MSElementDescrP newElem)
 Add newElem to the end of this msElementDescr. More...
 
static DGNPLATFORM_EXPORT void InitOrAddToChainWithTail (MSElementDescrH ppChainHeadDescr, MSElementDescrH ppChainTailDescr, MSElementDescrP pNewDescr)
 Append a descriptor to a growing chain, maintaining both head and tail pointers within the chain so that subsequent calls can access the tail directly without walking the chain. More...
 
int mdlElement_maxLineStringPoints ()
 Gets the maximum number of points allowed in a line string. More...
 
UInt32 mdlElmdscr_add (MSElementDescrP elemDescr)
 
Adds the new element(s) contained in

the element descriptor pointed to by elemDescr to the design file. More...

 
int mdlElmdscr_addFill (MSElementDescrH edPP)
 
Adds an attribute linkage to a

closed element that causes the element to be displayed filled. More...

 
void mdlElmdscr_initOrAddToChainWithTail (MSElementDescrH ppHeadDescr, MSElementDescrH ppTailDescr, MSElementDescrP pDescr)
 Append a descriptor to a growing chain, maintaining both head and tail pointers within the chain so that subsequent calls can access the tail directly without walking the chain. More...
 
int mdlElmdscr_assembleChains (MSElementDescrH edPP, double closureTolerance, DgnModelRefP modelRef)
 
Takes an unconnected, unordered chain of open elements

(line, arc, * linestring, curve etc.) and combines them into complex chains or shapes if their endpoints are within closureTolerance of each other. More...

 
UInt32 mdlElmdscr_append (MSElementDescrP elemDescrP)
 
Adds the modified element(s)

contained in the element descriptor pointed to by elemDscr to the design file. More...

 
StatusInt mdlElmdscr_appendByModelRef (MSElementDescrP elemDescr, DgnModelRefP modelRef)
 
This function is identical to @ref mdlElmdscr_append

except for the addition of a modelRef argument that allows elements to be appended to models other than the active model. More...

 
void mdlElmdscr_appendAttributes (MSElementDescrH elDscrPP, int length, UInt16 *attributes)
 
Appends the attribute

information contained in the attributes buffer to the end of any existing attributes attached to the elements in the descriptor elDscr. More...

 
int mdlElmdscr_convertTo2D (MSElementDescrH newDscrPP, MSElementDescrP oldDscrP, int view, TransformP transP, DgnModelRefP sourceModelRef, DgnModelRefP destModelRef, bool preserveZRange)
 Converts the 3D element descriptor pointed to by oldDscrP to a 2D element descriptor. More...
 
int mdlElmdscr_convertTo3D (MSElementDescrH newDscrPP, MSElementDescrP oldDscrP, int eType, double elevation, TransformP transP, DgnModelRefP sourceModelRef, DgnModelRefP destModelRef)
 Converts the 2D element descriptor pointed to by oldDscrP to a 3D element descriptor. More...
 
int mdlElmdscr_copyParallel (MSElementDescrH outDscrPP, MSElementDescrP inDscr, Dpoint3d *point, double distance, Dpoint3d *normal)
 
Creates a copy of the element descriptor

outDscr specified by inDscr that is offset parallel from the original element. More...

 
int mdlElmdscr_signedOffset (MSElementDescrH outDscrPP, MSElementDescrCP curveDescrP, double distance, DVec3dP normal)
 Creates an offset of a curve element. More...
 
void mdlElmdscr_display (MSElementDescrCP elemDescr, DgnModelRefP modelRef, int drawMode)
 
Displays the element descriptor

pointed to by elemDscrP in all active views. More...

 
void mdlElmdscr_displayAllReferences (MSElementDescrP elemDescr, int drawMode, DgnModelRefP activeModel, int viewMask)
 
Displays the element descriptor

pointed to by elemDscrP in the views specified by viewMask if the descriptors modelRef can be reached from the root modelRef of the view. More...

 
void mdlElmdscr_displayInView (MSElementDescrP edP, DgnModelRefP modelRef, DgnPlatform::DgnDrawMode drawMode, MSWindow *gwP)
 
Used to display the

contents of the specified element descriptor in the specified view window using the given drawing mode. More...

 
void mdlElmdscr_displaySingle (MSElementDescrP elemDescr, DgnModelRefP modelRef, int drawMode)
 
This function is identical to

mdlElmdscr_display except that it displays a single element descriptor and will not display the elements pointed to by elemDescr->next. More...

 
int mdlElmdscr_displayFromFile (UInt32 filePos, DgnModelRefP modelRef, MSElementP el, int drawMode)
 
This function is similar to

mdlElmDscr_display, but operates on elements in the design file rather than from an element descriptor supplied by the application. More...

 
int mdlElmdscr_displayToWindow (MSWindow *windowP, BSIRect const *rectP, DgnPlatform::ViewFlags const *viewFlags, MSElementDescrCP elmDP, RotMatrixCP rotMatrixP, Dpoint3d const *originP, Dpoint3d const *rangeP, int threeD, int menuColor)
 
Used to display the graphics element

designated by edP in the window designated by windowP. More...

 
int mdlElmdscr_extendedDisplayToWindow (MSWindow *windowP, BSIRect const *rectP, DgnPlatform::ViewFlags const *viewFlags, MSElementDescrCP elmDP, RotMatrixCP rotMatrixP, Dpoint3d const *originP, Dpoint3d const *rangeP, int threeD, int menuColor, void const *colormap, bool clearFirst, byte const *backgroundImageP)
 
  Provides some

extensions to the mdlElmdscr_displayToWindow function that allow the display of rendered images within a window. More...

 
int mdlElmdscr_distanceAtPoint (double *distance, Dpoint3d *position, Dpoint3d *tangent, MSElementDescrP edP, Dpoint3d *inputPoint, double inputTolerance)
 
Returns the distance along

an element from the beginning of the element to the projection of inputPoint on the element. More...

 
void mdlElmdscr_extractAttributes (int *length, UInt16 *attributes, MSElementDescrP elDscr)
 
Extracts the attribute

information from the first element contained in the element descriptor elmdscrP. More...

 
int mdlElmdscr_extractNormal (Dpoint3d *normal, Dpoint3d *point, MSElementDescrCP edP, Dpoint3d *inputDefaultNormal)
 Used to find the normal vector of an element, using the incredibly coarse classic IGDS/Microstation tolerance of 100 UORS. More...
 
int mdlElmdscr_extractNormalTight (Dpoint3d *normal, Dpoint3d *point, MSElementDescrCP edP, Dpoint3d *inputDefaultNormal)
 Used to find the normal vector of an element, with tight tolerance for planarity test. More...
 
int mdlElmdscr_extractNormalWithTolerance (Dpoint3d *normal, Dpoint3d *point, MSElementDescrCP edP, Dpoint3d *inputDefaultNormal, double absTol, double localRelTol, double globalRelTol)
 Used to find the normal vector of an element, with user-defined tolerance for planarity test. More...
 
StatusInt mdlElmdscr_evaluateCurveSpace (MSElementDescrCP pDescr, DPoint3dP pOrigin, RotMatrixP pMatrix, int *pTangentDimensions)
 Determine the dimensionality of a curve – line, plane, or space. More...
 
StatusInt mdlElmdscr_orientationExt (TransformP pTransform, MSElementDescrCP pSourceDescr, DgnModelRefP modelRef)
 return a natural coordinate frame for the element. More...
 
int mdlElmdscr_operation (MSElementDescrP elemDescr, PFElemOperation elemFunc, CallbackArgP params, int opFlags)
 
Sets a user call-back function to recursively iterate through all

component elements in a complex element descriptor. More...

 
int mdlElmdscr_partialDelete (MSElementDescrH outEdPP1, MSElementDescrH outEdPP2, MSElementDescrP inEdP, Dpoint3d *point1, Dpoint3d *point2, Dpoint3d *point3, int view)
 Returns the portions of inEdP that are not between the projection of point1 and point3 on the element. More...
 
int mdlElmdscr_pointAtDistance (Dpoint3d *position, Dpoint3d *tangent, double inputDistance, MSElementDescrP edP, double inputTolerance)
 Returns the point and tangent vector at distance along the element. More...
 
UInt32 mdlElmdscr_read (MSElementDescrH elemDescrPP, UInt32 filePos, DgnModelRefP modelRef, int expandSharedCells, UInt32 *readFilePos)
 
Reads the element at the position filePos from

the element cache for model modelRef and creates a new element descriptor. More...

 
UInt32 mdlElmdscr_getByElemRef (MSElementDescrH elemDescrPP, ElementRefP elemRef, DgnModelRefP modelRef, int expandSharedCells, UInt32 *readFilePos)
 Get an element descriptor given an ElementRefP. More...
 
MSElementDescrP mdlElmdscr_getThicknessEdP (MSElementDescrP edP, DgnModelRefP modelRef)
 Get a surface or solid element that represents a planar element with thickness. More...
 
UInt32 mdlElmdscr_readToMaster (MSElementDescrH elemDescrPP, UInt32 filePos, DgnModelRefP modelRef, int expandSharedCells, UInt32 *startFilePos)
 
Reads the element at the position filePos from the element cache for model

modelRef and creates a new element descriptor. More...

 
UInt32 mdlElmdscr_readComponentToMaster (MSElementDescrH edPP, DisplayPathCP pathP, int elementNumber, int expandSharedCells, bool returnNonCellHeader, bool allowGroupHoles, UInt32 *startFilePosP)
 Used to read an element from the specified design file and add it to the master design file. More...
 
UInt32 mdlElmdscr_rewrite (MSElementDescrP newElemDscr, MSElementDescrP oldElemDscr, UInt32 filePos)
 
Overwrites the existing MicroStation

element(s) pointed to by oldElemDscrP with the new element(s) pointed to by newElemDscrP at file position filePos. More...

 
void mdlElmdscr_stripAttributes (MSElementDescrH elDscrPP)
 
Removes all of the attribute

data on the elements contained in descriptor elmdscrPP. More...

 
int mdlElmdscr_stripFill (MSElementDescrH edPP)
 
Removes the fill attribute linkage

from an element. More...

 
int mdlElmdscr_stroke (Dpoint3d **points, int *nPoints, MSElementDescrP edP, double tol)
 
Strokes the element descriptor pointed

to by elmDscrP into vectors in an array pointed to by points. More...

 
int mdlElmdscr_transform (MSElementDescrH edPP, TransformCP userTrans)
 Transforms the element descriptor by the supplied transformation matrix. More...
 
void mdlElmdscr_transformAllowModification (MSElementDescrH edPP, TransformCP userTrans, DgnModelRefP sourceModelRef, DgnModelRefP destModelRef, const UInt32 options)
 Transforms the element descriptor by the supplied transformation matrix. More...
 
int mdlElmdscr_undoableDelete (MSElementDescrP elemDescrP, UInt32 filePos, bool display)
 
Deletes the element(s)

pointed to by elemDscrP at file position filePos. More...

 
int mdlElmdscr_deleteByModelRef (MSElementDescrP elemDescr, UInt32 filePos, DgnModelRefP modelRef, bool display)
 
Deletes the element(s)

pointed to by elemDscrP at file position filePos in the model specified by modelRef. More...

 
int mdlElmdscr_displayFromFileViews (UInt32 filePos, DgnModelRefP modelRef, MSElementP elP, int drawMode, int viewMask)
 
This function is identical to

mdlElmdscr_displayFromFile, except that the viewMask argument determines the views in which element descriptor is displayed (see mdlElement_displayInSelectedViews for a discussion of viewMask). More...

 
void mdlElmdscr_displayInSelectedViews (MSElementDescrCP elemDescr, DgnModelRefP modelRef, int drawMode, int viewMask)
 
This function is identical to

mdlElmdscr_display, except that the viewMask argument determines the views in which element descriptor is displayed (see mdlElement_displayInSelectedViews for a discussion of viewMask). More...

 
int mdlElmdscr_generatePartial (MSElementDescrH outEdPP, MSElementDescrCP elmDescrP, double t1, double t2, bool splineParameters)
 
Generates the portion

of the element descriptor elmDescr that is between t1 and t2 and returns this portion in outEdPP. More...

 
int mdlElmdscr_reverse (MSElementDescrH outEdPP, MSElementDescrCP inEdP, DgnModelRefP modelRef)
 
Reverses the direction of inEdP

and returns the reversed element in outEdPP. More...

 
int mdlElmdscr_reverseNormal (MSElementDescrH outEdPP, MSElementDescrCP inEdP, DgnModelRefP modelRef)
 
Reverses the normal

direction for a surface, solid or closed element. More...

 
int mdlElmdscr_extractEndPoints (DPoint3dP startP, DPoint3dP startTangentP, DPoint3dP endP, DPoint3dP endTangentP, MSElementDescrCP edP, DgnModelRefP modelRef)
 
Returns the start and end points

(in start and end) for the open element, edP. More...

 
int mdlElmdscr_fromCompoundElement (MSElementDescrH edPP, MSElementP elemP, DgnModelRefP modelRef, UInt32 graphicGroup, bool transformToWorld, bool expandNested)
 
Converts a compound element

(multi-line, dimension, shared cell) to a set of simple (pre-MicroStation 4.0 compatible) elements. More...

 
bool mdlElmdscr_isClosed (MSElementDescrCP edP)
 Queries if an element descriptor is a closed element; i.e., a shape, complex shape, ellipse or closed B-spline curve. More...
 
bool mdlElmdscr_isOpen (MSElementDescrCP edP)
 
Queries if an element descriptor is an open

element; i.e., a line, line string, curve, open B-Spline curve or complex chain. More...

 
bool mdlElmdscr_isGroupedHole (MSElementDescrCP groupEdP)
 
Queries if an element descriptor is

a grouped hole element; i.e., an element that has a hole punched in it (such as can be created with mdlElmdscr_createShapeWithHoles). More...

 
bool mdlElmdscr_hasLineStyle (MSElementDescrCP lineStyleEdP)
 Queries if an element descriptor has line style. More...
 
int mdlElmdscr_createShapeWithHoles (MSElementDescrH outEdPP, MSElementDescrP solidEdP, MSElementDescrP holeEdP)
 
Creates an orphan

cell entity, outEdPP, that associates the solid element, solidEdP with the hole entity(s) in holeEdP. More...

 
int mdlElmdscr_close (MSElementDescrH outEdPP, MSElementDescrP inEdP, DgnModelRefP modelRef)
 Converts the open element inEdP to a closed element, outEdPP. More...
 
int mdlElmdscr_open (MSElementDescrH outEdPP, MSElementDescrP inEdP, DgnModelRefP modelRef)
 
Converts the closed element inEdP

to an open element, outEdPP. More...

 
int mdlElmdscr_show (MSElementDescrP edP, WCharCP currentIndent)
 
Used to print information from the

element descriptor header in a formatted fashion. More...

 
int mdlElmdscr_fromSelectionSet (MSElementDescrH edPP)
 
Used to create an

element descriptor chain from the set of elements that are currently in the selection set. More...

 
int mdlElmdscr_fillet (MSElementP fillet, MSElementP pTemplate, MSElementDescrP in0EdP, MSElementDescrP in1EdP, double inputRadius, Dpoint3d *inputPoint, RotMatrixP inputRotMatrix)
 
Used to create a two dimensional

circular fillet between the specified elements. More...

 
int mdlElmdscr_spaceFillet (MSElementDescrH ppFilletChain, MSElementP pTemplate, MSElementDescrCP pCurveA, MSElementDescrCP pCurveB, double radius, DPoint3dP pCenterSelect)
 Compute circular arc fillets between two elements. More...
 
void mdlElmdscr_setProperties (MSElementDescrH edPP, DgnPlatform::LevelId const *level, UInt32 const *ggNum, DgnPlatform::DgnElementClass const *elementClass, bool const *locked, bool const *newElm, bool const *modified, bool const *viewIndepend, bool const *solidHole)
 Changes the level, element class, graphic group, and other properties in the element desciptor pointed to by edPP to the values specified. More...
 
void mdlElmdscr_setSymbology (MSElementDescrH edPP, UInt32 *color, Int32 *style, UInt32 *weight, UInt32 *fillColor)
 Changes the color, weight, and style in the element desciptor pointed to by edPP to the values specified. More...
 
int mdlElmdscr_createFromVertices (MSElementDescrH edPP, MSElementP templateElmP, Dpoint3d *pointP, size_t numPoints, bool closed, int fillMode)
 
Creates a line string

or complex chain if closed is zero and a shape or complex shape if closed is non-zero. More...

 
MSElementDescrP mdlElmdscr_findElementId (MSElementDescrP edP, DgnPlatform::ElementId reqId)
 Get a pointer to the component element descriptor having the specified ElementId in the supplied complex element descriptor. More...
 
MSElementDescrP mdlElmdscr_atOffset (MSElementDescrP edP, int offset, DgnModelRefP modelRef)
 
Used to get the element

descriptor at the specified offset from the start of an element descriptor chain. More...

 
UInt32 mdlElmdscr_componentOffset (MSElementDescrP headerEdP, MSElementDescrP componentEdP, DgnModelRefP modelRef)
 Used to get the offset value of a component element in the specified element descriptor chain. More...
 
int mdlElmdscr_fromCone (MSElementDescrH edPP, MSElementP coneP, TransformP transP)
 Used to create an element descriptor chain from the specified cone element. More...
 
int mdlElmdscr_close2 (MSElementDescrH outEdPP, MSElementDescrP inEdP, DgnModelRefP modelRef)
 
Used to create a closed element

from an element that is not closed. More...

 
int mdlElmdscr_extractNormal2 (Dpoint3d *normalP, Dpoint3d *pointP, MSElementDescrP edP, Dpoint3d *inputDefaultNormal, bool applyCurrTrans, bool cleanupNormal)
 Used to find the normal vector of an element. More...
 
int mdlElmdscr_isSphere (double *radiusP, Dpoint3d *centerP, RotMatrixP rotMatrixP, MSElementDescrP edP)
 
Used to determine whether the

specified element is spherical. More...

 
int mdlElmdscr_extractCellTMatrix (TransformP forwardP, TransformP inverseP, MSElementP cellP, DgnModelRefP modelRef)
 Used to get a transformation matrix from a cell element. More...
 
StatusInt mdlElmdscr_simplifyComplexChainOrShape (MSElementDescrH edPP, DgnModelRefP modelRef)
 
Used to simplify a complex element, if possible, by concatenating consecutive linear

segments into linestrings. More...

 
bool mdlElmdscr_isRule (MSElementDescrCP edP)
 
Used to determine whether the specified element descriptor contains an

element of either the DgnElementClass::PrimaryRule or the DgnElementClass::ConstructionRule. More...

 
UInt32 mdlElmdscr_rewriteByModelRef (MSElementDescrP newEdP, MSElementDescrP oldEdP, UInt32 filePosition, DgnModelRefP modelRef)
 Replaces the specified element descriptor in the given file position, with a new element descriptor from the given modelRef. More...
 
UInt32 mdlElmdscr_addByModelRef (MSElementDescrP edP, DgnModelRefP modelRef)
 This function is identical to mdlElmdscr_add except for the addition of a modelRef argument that allows elements to be added to models other than the active model. More...
 
int mdlElmdscr_numElementsSingle (MSElementDescrCP edP)
 Used to find the number of child elements within an element descriptor chain. More...
 
void mdlElmdscr_setVisible (MSElementDescrP edP, bool visible)
 Used to set the visibility flag of the contents of the specified element descriptor. More...
 
bool mdlElmdscr_isAssociativeRegionChild (MSElementDescrH regionEdPP, MSElementDescrP edP)
 
Used to determine whether the element contained by the specified element descriptor is a

child element of an associative region. More...

 
bool mdlElmdscr_isAssociativeRegion (MSElementDescrCP edP)
 Used to determine whether the specified element descriptor contains an element that is an associative region. More...
 
StatusInt mdlElmdscr_addClip (MSElementDescrH ppElementDescr, RotMatrixP pRMatrix, DPoint3dP pOrigin, bool frontClipOn, double zFront, bool backClipOn, double zBack, UInt32 nPoints, DPoint2d *pPoints)
 Used to add a clip boundary linkage to the specified element. More...
 
StatusInt mdlElmdscr_deleteClip (MSElementDescrH ppElementDescr)
 Used to remove any clip boundary linkage from the specified element. More...
 
void mdlElmdscr_computeRange (Dpoint3d *minP, Dpoint3d *maxP, MSElementDescrCP edP, RotMatrixCP rotMatrixP)
 Computes the range of the element(s) in the specified element descriptor. More...
 
int mdlElmdscr_getUsedLevels (BitMaskP pBitMaskOut, MSElementDescrP pElemDscrIn)
 Get a bit-mask which represents the set of the levels used by an element. More...
 
bool mdlElmdscr_areTwoIdentical (MSElementDescrP edP1, MSElementDescrP edP2)
 Returns whether two element descriptors are exactly identical. More...
 
bool mdlElmdscr_areIdenticalToTolerance (MSElementDescrCP edP1, MSElementDescrCP edP2, UInt32 comparisonFlags, double distanceTolerance, double directionTolerance)
 Returns whether two element descriptors are identical to a given tolerance and optionally ignoring certain characteristics. More...
 
int mdlElmdscr_copy (MSElementDescrH elDscrPP, DgnModelRefP sourceModelRef, DgnModelRefP destModelRef, ElementCopyContextP copyContextP)
 Copies an element descriptor and adds it to the destination. More...
 
void mdlCopyContext_setView (ElementCopyContextP ccP, int view)
 Sets the view that will be used to flatten the elements if the source model is 3D and the destination model is 2D. More...
 
ElementCopyContextP mdlCopyContext_create (void)
 
Used to allocate memory for and create a

copy context structure. More...

 
void mdlCopyContext_free (ElementCopyContextP *ccP)
 
Used to dispose of a copy context

structure and all of its related data after it has been used. More...

 
void mdlCopyContext_setViewport (ElementCopyContextP ccP, ViewportP vp)
 Sets the view that will be used to flatten the elements if the source model is 3D and the destination model is 2D. More...
 
void mdlCopyContext_setNewGGs (ElementCopyContextP ccP, bool assignNewGGs)
 
Defines whether copied elements should

maintain their current graphic group or should be assigned to a new group. More...

 
void mdlCopyContext_setNewNodes (ElementCopyContextP ccP, bool assignNewNodes)
 
Defines whether copied elements should

maintain their current text node numbers or should be assigned a new number. More...

 
void mdlCopyContext_setScaleToDestination (ElementCopyContextP ccP, bool transformToDestination)
 
Defines whether copied elements should

be scaled to match the units in the destination model. More...

 
void mdlCopyContext_setModelFromElmdscr (ElementCopyContextP ccP, bool useElmdscr)
 Set the copy context so that the model ref from the element descriptor is used as the source model ref for the copy, unless it is NULL in which case the source model ref is used. More...
 
void mdlCopyContext_setMatchDimToDestination (ElementCopyContextP ccP, bool changeDimension)
 Setting this option to false in the copy context will cause the element descriptor passed in not to take on the dimensionality (2D/3D) of the destination model ref. More...
 
void mdlCopyContext_setWriteElements (ElementCopyContextP ccP, bool writeAllElements)
 Set the copy context value that determines whether the element descriptor passed to mdlElmdscr_copy will get written to the destination model ref. More...
 
void mdlCopyContext_setLevelHandling (ElementCopyContextP ccP, DgnPlatform::CopyContextLevelOption levelOption)
 Determine the way in which levels are brought from the source model ref to the destination model ref. More...
 
void mdlCopyContext_setRedirectInternalRefs (ElementCopyContextP ccP, bool redirectRefs)
 Set the copy context value that determines how to handle internal reference attachments. More...
 
void mdlCopyContext_setRedirectExternalRefs (ElementCopyContextP ccP, bool redirectRefs)
 Set the copy context value that determines how to handle external reference attachments. More...
 
int mdlProject_perpendicular (DPoint3dP position, DPoint3dP tangent, DPoint3dP perpendicular, MSElementDescrP edP, DgnModelRefP modelRef, DPoint3dP inputPoint, RotMatrixP inputRotMatrix, double inputTolerance)
 Projects a point to an element on a perpendicular from the element. More...
 
int mdlProject_tangent (DPoint3dP position, DPoint3dP tangent, DPoint3dP perpendicular, MSElementDescrP edP, DgnModelRefP modelRef, DPoint3dP point, RotMatrixP rotMatrix, DPoint3dP closestPoint, double tolerance)
 Projects a point to an element along a tangent from the element. More...
 

Detailed Description

An MSElementDescr holds a copy of a (potentially complex) MicroStation element.

MSElementDescr's are necessary and intended for creating new elements and making changes to existing elements. MSElementDescr's can also hold an XAttributeChangeSet.

Note
For readonly access to existing elements, see the ElementHandle class.
Remarks
Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib

Function Documentation

Add a reference to this MSElementDescr.

Returns
The new reference count for this MSElementDescr
Note
The reference count for new MSElementDescr's returned by Allocate is 1, so you should not call this method unless you hold more than 1 reference to this MSElementDescr.
DGNPLATFORM_EXPORT void AddToChain ( MSElementDescrP  newElem)

Add newElem to the end of this msElementDescr.

This method can create a chain of non-complex elements in chainElem, but that technique is strongly discouraged. Instead, use an ElementAgenda.

Parameters
[in]newElemThe MSElementDescr to add.
Note
The difference between AppendDescr and AddToChain is that AppendDescr requires the MSElementDescr to hold a single complex element and AddToChain does not.
Remarks
These methods essentially merge the two MSElementDescrs passed to them. Therefore, newElem should not be referenced after either of these functions is called. (Thus, it should not be freed).
static DGNPLATFORM_EXPORT MSElementDescrP Allocate ( MSElementCR  element,
DgnModelRefP  modelRef = 0,
MSElementDescrP  myHeader = 0 
)
static

Allocate a new MSElementDescr holding a copy of the supplied MSElement.

Parameters
[in]elementThe existing element.
[in]modelRefThe value for the dgnModelRef member of the new MSElementDescr.
[in]myHeaderThe parent MSElementDescr to which the new MSElementDescr is attached. This method sets the myHeader field in the new MSElementDescr to this value. Generally this should be NULL unless AppendDescr cannot be used.
Returns
A pointer to the new MSElementDescr, or NULL if element is not a valid MicroStation element.
static DGNPLATFORM_EXPORT MSElementDescrP Allocate ( ElementRefP  elemRef,
DgnModelRefP  modelRef = 0,
MSElementDescrP  myHeader = 0 
)
static

Allocate a new MSElementDescr holding a copy of the element data from the supplied ElementRef.

Parameters
[in]elemRefThe value for the elementRef member of the new MSElementDescr as well as the source of the element data.
[in]modelRefThe value for the dgnModelRef member of the new MSElementDescr.
[in]myHeaderThe parent MSElementDescr to which the new MSElementDescr is attached. This method sets the myHeader field in the new MSElementDescr to this value. Generally this should be NULL unless AppendDescr cannot be used.
Returns
A pointer to the new MSElementDescr, or NULL if element is not a valid MicroStation element.
DGNPLATFORM_EXPORT StatusInt AppendDescr ( MSElementDescrP  newDscr)

Adds newDscr to the end of this msElementDescr.

Parameters
[in]newDscrThe MSElementDescr to add.
Returns
SUCCESS if newDscr is appended to this msElementDescr, DGNELEMENT_STATUS_NotCmplxHdr if this msElementDescr does not hold a complex header.
See also
AddToChain
DGNPLATFORM_EXPORT MSElementDescrP AppendElement ( MSElementCR  element)

Allocates a new element descriptor from an existing element and append to the end of an existing element descriptor.

Parameters
[in]elementElement to append.
Returns
A pointer to the new descriptor if the element is successfully inserted and NULL otherwise.
DGNPLATFORM_EXPORT void ClearElementIds ( )

Set the ElementIDs of this MSElementDescr, and all of its children, to zero.

DGNPLATFORM_EXPORT BentleyStatus CopyXAttributesTo ( MSElementDescrR  sink,
bool  copyChildXAttributes 
) const
DGNPLATFORM_EXPORT StatusInt Duplicate ( MSElementDescrH  newDscr,
bool  copyScheduledXaChanges = true,
bool  loadPersistentXasAsChanges = false 
) const

Allocates and returns a copy of this MSElementDescr.

DGNPLATFORM_EXPORT StatusInt DuplicateSingle ( MSElementDescrH  newDscr,
bool  copyScheduledXaChanges = true,
bool  loadPersistentXasAsChanges = false 
) const

Allocates and returns a copy of this MSElementDescr without copying h.next.

DGNPLATFORM_EXPORT XAttributeChangeSetP GetXAttributeChangeSet ( ) const
static DGNPLATFORM_EXPORT void InitOrAddToChainWithTail ( MSElementDescrH  ppChainHeadDescr,
MSElementDescrH  ppChainTailDescr,
MSElementDescrP  pNewDescr 
)
static

Append a descriptor to a growing chain, maintaining both head and tail pointers within the chain so that subsequent calls can access the tail directly without walking the chain.

Before starting the chain construction, caller initializes both the head and tail pointers to NULL.

Parameters
ppChainHeadDescrIN OUT pointer to head of chain.
ppChainTailDescrIN OUT pointer to tail of chain.
pNewDescrIN descriptor to add at tail.
See also
usmthAddToChainC usmthAppendDescrC
ElementCopyContextP mdlCopyContext_create ( void  )

Used to allocate memory for and create a

copy context structure.

The caller is responsible for freeing the copy context after use by calling mdlCopyContext_free. The copy context is initialized to set new graphic groups and set new text nodes but not to scale the elements.

Returns
A pointer to the copy context structure.
See also
mdlCopyContext_free mdlElmdscr_copy
void mdlCopyContext_free ( ElementCopyContextP *  ccP)

Used to dispose of a copy context

structure and all of its related data after it has been used.

Parameters
[in]ccPthe copy context which is to be disposed of.
See also
mdlCopyContext_create
void mdlCopyContext_setLevelHandling ( ElementCopyContextP  ccP,
DgnPlatform::CopyContextLevelOption  levelOption 
)

Determine the way in which levels are brought from the source model ref to the destination model ref.

Remarks
This is defaulted to CopyContextLevelOption::ByUserPreference in mdlCopyContext_create.
Parameters
[in]ccPis the copy context to modify.
[in]levelOptiondetermines how the levels are handled during a copy. See ~!tCopyContextLevelOption.
See also
mdlCopyContext_create mdlCopyContext_free mdlElmdscr_copy
void mdlCopyContext_setMatchDimToDestination ( ElementCopyContextP  ccP,
bool  changeDimension 
)

Setting this option to false in the copy context will cause the element descriptor passed in not to take on the dimensionality (2D/3D) of the destination model ref.

The value will always be treated as true if the elements are being written to the file (see mdlCopyContext_setWriteElements).

Remarks
This is defaulted to true in mdlCopyContext_create.
Parameters
[in]ccPis the copy context to modify.
[in]changeDimensiontrue to allow elements to be converted to the same dimensionality as the destination model ref; false to keep the elements as they are.
See also
mdlCopyContext_create mdlCopyContext_free mdlElmdscr_copy
void mdlCopyContext_setModelFromElmdscr ( ElementCopyContextP  ccP,
bool  useElmdscr 
)

Set the copy context so that the model ref from the element descriptor is used as the source model ref for the copy, unless it is NULL in which case the source model ref is used.

The primary reason to use this option is for cells that may be from multiple model refs.

Remarks
This is defaulted to false in mdlCopyContext_create.
Parameters
[in]ccPis the copy context to modify.
[in]useElmdscrtrue to use the model refs on the element descriptors; false to use the source model ref passed to mdlElmdscr_copy.
See also
mdlCopyContext_create mdlCopyContext_free mdlElmdscr_copy
void mdlCopyContext_setNewGGs ( ElementCopyContextP  ccP,
bool  assignNewGGs 
)

Defines whether copied elements should

maintain their current graphic group or should be assigned to a new group.

Note that all elements with the same graphic group number will be remapped to the same new number as long as the same context is used.

Remarks
This is defaulted to true in mdlCopyContext_create.
Parameters
[in]ccPthe copy context to modify.
[in]assignNewGGsdefines whether to assign new graphic groups or maintain the current values.
See also
mdlCopyContext_create mdlCopyContext_free mdlElmdscr_copy
void mdlCopyContext_setNewNodes ( ElementCopyContextP  ccP,
bool  assignNewNodes 
)

Defines whether copied elements should

maintain their current text node numbers or should be assigned a new number.

Remarks
This is defaulted to true in mdlCopyContext_create.
If the destination file is the masterfile, then new text node numbers are allocated from the tcb.
Parameters
[in]ccPthe copy context to modify.
[in]assignNewNodesdefines whether to assign new text node numbers or maintain the current values.
See also
mdlCopyContext_create mdlCopyContext_free mdlElmdscr_copy
void mdlCopyContext_setRedirectExternalRefs ( ElementCopyContextP  ccP,
bool  redirectRefs 
)

Set the copy context value that determines how to handle external reference attachments.

An external reference is an attachment that targets a model that is not within the same file as its parent model. If this value is set to "true", when an external reference is copied into the same file as its target, then the attacement will be "internalized" so that it continues to target the same model. Note that it will now be an internal reference.

Remarks
This is defaulted to false in mdlCopyContext_create.
If this value is set to false, it is likely that special processing will be required to maintain external references that are copied into the same file as their target model. Thus most applications should set this to true.
Parameters
[in]ccPis the copy context to modify.
[in]redirectRefstrue to redirect external refs; false to leave external refs unchanged.
See also
mdlCopyContext_create mdlCopyContext_free mdlElmdscr_copy
void mdlCopyContext_setRedirectInternalRefs ( ElementCopyContextP  ccP,
bool  redirectRefs 
)

Set the copy context value that determines how to handle internal reference attachments.

An internal reference is an attachment that targets a model within the same file as its parent model. If this value is set to "true", when an internal reference is copied to into a new file that does not contain its target, then the attachment will be "externalized" so that it will continue to reference the same model in the original file. Note that it will no longer be an internal reference.

Remarks
This is defaulted to false in mdlCopyContext_create.
If this value is set to false, it is likely that special processing will be required to maintain internal references that are copied into a different file from their target model. Thus most applications should set this to true.
Parameters
[in]ccPis the copy context to modify.
[in]redirectRefstrue to redirect internal refs; false to leave internal refs unchanged.
See also
mdlCopyContext_create mdlCopyContext_free mdlElmdscr_copy
void mdlCopyContext_setScaleToDestination ( ElementCopyContextP  ccP,
bool  transformToDestination 
)

Defines whether copied elements should

be scaled to match the units in the destination model.

Remarks
This is defaulted to false in mdlCopyContext_create.
Parameters
[in]ccPthe copy context to modify.
[in]transformToDestinationdefines whether to scale the elements by the difference in units between the models.
See also
mdlCopyContext_create mdlCopyContext_free mdlElmdscr_copy
void mdlCopyContext_setView ( ElementCopyContextP  ccP,
int  view 
)

Sets the view that will be used to flatten the elements if the source model is 3D and the destination model is 2D.

Remarks
This is defaulted to top in mdlCopyContext_create.
Parameters
[in]ccPis the copy context to modify.
[in]viewdefines the view to use for flattening if necessary.
See also
mdlCopyContext_create mdlCopyContext_free mdlElmdscr_copy
void mdlCopyContext_setViewport ( ElementCopyContextP  ccP,
ViewportP  vp 
)

Sets the view that will be used to flatten the elements if the source model is 3D and the destination model is 2D.

Remarks
This is defaulted to top in mdlCopyContext_create.
Parameters
[in]ccPis the copy context to modify.
[in]vpdefines the view to use for flattening if necessary.
void mdlCopyContext_setWriteElements ( ElementCopyContextP  ccP,
bool  writeAllElements 
)

Set the copy context value that determines whether the element descriptor passed to mdlElmdscr_copy will get written to the destination model ref.

Regardless of the value passed in, the additional necessary information (styles, levels, etc.) will be copied to the destination model ref.

Remarks
This is defaulted to true in mdlCopyContext_create.
Parameters
[in]ccPis the copy context to modify.
[in]writeAllElementstrue to copy all elements to the destination model ref; false to just copy necessary additional elements.
See also
mdlCopyContext_create mdlCopyContext_free mdlElmdscr_copy
int mdlElement_maxLineStringPoints ( )

Gets the maximum number of points allowed in a line string.

Returns
the maximum number of points allowed in a line string.
Remarks
Required Library: mdllib.dll
UInt32 mdlElmdscr_add ( MSElementDescrP  elemDescr)

Adds the new element(s) contained in

the element descriptor pointed to by elemDescr to the design file.

You should use mdlElmdscr_add when creating new elements. Before writing the element to the file, mdlElmdscr_add sets the properties bits in the element header to not locked, new element, and not modified.

Remarks
The mdlElmdscr_add and mdlElmdscr_append functions validate the element descriptor before adding it to the file.
MicroStation remembers the mdlElmdscr_add and mdlElmdscr_append functions, so the user can undo them.
Parameters
[in]elemDescradded to file
Returns
Returns the file position of the first element added to the design file. If an error occurs, the file position is set to zero and the global variable mdlErrno is set to the specific error cause. Possible values for mdlErrno are MDLERR_READONLY, MDLERR_DISKFULL, MDLERR_WRITEINHIBIT, MDLERR_BADELEMENT and MDLERR_WRITEFAILED.
See also
mdlElmdscr_rewrite mdlElement_add mdlElement_append
UInt32 mdlElmdscr_addByModelRef ( MSElementDescrP  edP,
DgnModelRefP  modelRef 
)

This function is identical to mdlElmdscr_add except for the addition of a modelRef argument that allows elements to be added to models other than the active model.

If the model specified is the active model then the two functions are identical. If the element is from the active design file the various asynch hooks are called and the element is recorded in the undo buffer. The supplied modelRef must be open for write access.

Parameters
[in]edPelement to be added to file.
[in]modelRefthe model to add to.
Returns
Returns the file position of the first element added to the design file. If an error occurs, the file position is set to zero and the global variable mdlErrno is set to the specific error cause. Possible values for mdlErrno are MDLERR_READONLY, MDLERR_DISKFULL, MDLERR_WRITEINHIBIT, MDLERR_BADELEMENT and MDLERR_WRITEFAILED.
Remarks
Required Library: mdlbltin.lib
StatusInt mdlElmdscr_addClip ( MSElementDescrH  ppElementDescr,
RotMatrixP  pRMatrix,
DPoint3dP  pOrigin,
bool  frontClipOn,
double  zFront,
bool  backClipOn,
double  zBack,
UInt32  nPoints,
DPoint2d *  pPoints 
)

Used to add a clip boundary linkage to the specified element.

Parameters
[in,out]ppElementDescris the element descriptor to receive the clip boundary linkage.
[in]pRMatrixis the rotation matrix of the clipping boundary.
[in]pOriginis the origin point of the clipping boundary.
[in]frontClipOnindicates whether the front clipping plane is turned on or off.
[in]zFrontis the distance along the z-axis from the element to the front clipping plane.
[in]backClipOnindicates whether the back clipping plane is turned on or off.
[in]zBackis the distance along the z-axis from the element to the back clipping plane.
[in]nPointsis the number of points in the clipping boundary.
[in]pPointsis the array of points that comprises the clipping boundary.
Returns
SUCCESS if the operation completed successfully; MDLERR_BADELEMENT if the element descriptor is not valid.
See also
mdlElmdscr_deleteClip
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_addFill ( MSElementDescrH  edPP)

Adds an attribute linkage to a

closed element that causes the element to be displayed filled.

The fill color is set to the same color as the elements color, but can be changed with the mdlElement_setFillColor function.

Remarks
The mdlElmdscr_stripFill function removes the fill attribute linkage from an element.
Parameters
[in,out]edPPpoints to the address of the element descriptor to be modified. This must be a closed element (shape, complex shape, ellipse, grouped hole orphan cell or closed B-spline curve).
Returns
Returns SUCCESS if the element is modified successfully and an appropriate error code otherwise.
See also
mdlElement_setFillColor
Remarks
Required Library: mdlbltin.lib
UInt32 mdlElmdscr_append ( MSElementDescrP  elemDescrP)

Adds the modified element(s)

contained in the element descriptor pointed to by elemDscr to the design file.

You should use mdlElmdscr_append if you are modifying an element and changing its size. The mdlElmdscr_rewrite function is also useful for this purpose, but requires that the old file position be known.

Remarks
The mdlElmdscr_add and mdlElmdscr_append functions validate the element descriptor before adding it to the file.
MicroStation remembers the mdlElmdscr_add and mdlElmdscr_append functions, so the user can undo them.
Parameters
[in]elemDescrPappended to file
Returns
Returns the file position of the first element added to the design file. If an error occurs, the file position is set to zero and the global variable mdlErrno is set to the specific error cause. Possible values for mdlErrno are MDLERR_READONLY, MDLERR_DISKFULL, MDLERR_WRITEINHIBIT, MDLERR_BADELEMENT and MDLERR_WRITEFAILED.
See also
mdlElmdscr_rewrite mdlElement_add mdlElement_append mdlElmdscr_add mdlElmdscr_appendByModelRef
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_appendAttributes ( MSElementDescrH  elDscrPP,
int  length,
UInt16 attributes 
)

Appends the attribute

information contained in the attributes buffer to the end of any existing attributes attached to the elements in the descriptor elDscr.

Parameters
[in,out]elDscrPPelement descriptor to receive attributes.
[in]lengthspecifies the size of the attribute data in words. If complex elements are present in the element descriptor elDscr, only the header of the complex element receives the attributes.
[in]attributesattribute data to be appended.
Remarks
No validity checking is performed on the content of the attribute information in attributes. Care should be exercised to make sure that you adhere to all of the rules for attributes.
See also
mdlElement_extractAttributes mdlElmdscr_stripAttributes mdlElement_appendAttributes mdlElmdscr_extractAttributes mdlElmdscr_appendAttributes
Remarks
Required Library: mdlbltin.lib
StatusInt mdlElmdscr_appendByModelRef ( MSElementDescrP  elemDescr,
DgnModelRefP  modelRef 
)

This function is identical to @ref mdlElmdscr_append

except for the addition of a modelRef argument that allows elements to be appended to models other than the active model.

If the model specified is the active model then the two functions are identical. If the element is from the active design file the various asynch hooks are called and the element is recorded in the undo buffer. The supplied modelRef must be open for write access.

Parameters
[in]elemDescrappended to file
[in]modelRefthe model to append to.
Returns
Returns SUCCESS if the element is appended successfully and ERROR otherwise. If an error occurs, the file position is set to zero and the global variable mdlErrno is set to the specific error cause. Possible values for mdlErrno are MDLERR_READONLY, MDLERR_DISKFULL, MDLERR_WRITEINHIBIT, MDLERR_BADELEMENT and MDLERR_WRITEFAILED.
See also
mdlElmdscr_append
Remarks
Required Library: mdlbltin.lib
bool mdlElmdscr_areIdenticalToTolerance ( MSElementDescrCP  edP1,
MSElementDescrCP  edP2,
UInt32  comparisonFlags,
double  distanceTolerance,
double  directionTolerance 
)

Returns whether two element descriptors are identical to a given tolerance and optionally ignoring certain characteristics.

Parameters
[in]edP1the first element to test
[in]edP2the second element to test.
[in]comparisonFlagsflags controlling parameter to ignore during the comparison. See COMPAREOPT_ definitions above.
[in]distanceTolerancetolerance in UORs for comparing distance values
[in]directionTolerancetolerance in radians for comparing angular values. A value of 1.0E-8 is appropriate for this comparison.
Returns
true if elements are identical or false otherwise.
Remarks
The comparison includes scheduled XAttribute changes. Also see mdlElmdscr_copyXAttributes.
Required Library: mdlbltin.lib
bool mdlElmdscr_areTwoIdentical ( MSElementDescrP  edP1,
MSElementDescrP  edP2 
)

Returns whether two element descriptors are exactly identical.

Parameters
[in]edP1the first element to test
[in]edP2the second element to test.
Returns
true if elements are identical or false otherwise.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_assembleChains ( MSElementDescrH  edPP,
double  closureTolerance,
DgnModelRefP  modelRef 
)

Takes an unconnected, unordered chain of open elements

(line, arc, * linestring, curve etc.) and combines them into complex chains or shapes if their endpoints are within closureTolerance of each other.

Parameters
[in,out]edPPthe element descriptor chain
[in]closureTolerancethe tolerance for testing closure
[in]modelRefthe model containing the elements
Returns
Always returns SUCCESS.
Remarks
Required Library: mdlbltin.lib
MSElementDescrP mdlElmdscr_atOffset ( MSElementDescrP  edP,
int  offset,
DgnModelRefP  modelRef 
)

Used to get the element

descriptor at the specified offset from the start of an element descriptor chain.

Parameters
[in]edPis a pointer to the first element descriptor in the chain.
[in]offsetindicates the offset of the target element within the chain.
[in]modelRefindicates the design model containing the element descriptor chain.
Returns
A pointer to the element descriptor at the specified offset in the chain.
See also
mdlElmdscr_componentOffset
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_close ( MSElementDescrH  outEdPP,
MSElementDescrP  inEdP,
DgnModelRefP  modelRef 
)

Converts the open element inEdP to a closed element, outEdPP.

If the beginning and endpoints of the element are not identical, a segment connecting them is inserted. This function will convert a complex chain into a complex shape, a linestring into a shape, etc.

Parameters
[out]outEdPPclosed element descriptor
[in]inEdPelement descriptor to close
[in]modelRefis used only to resolve associative points, in most cases MASTERFILE can be passed for this parameter.
Returns
Returns SUCCESS if the element is closed successfully and an appropriate error code otherwise.
See also
mdlElmdscr_isOpen mdlElmdscr_isClosed mdlElmdscr_open
int mdlElmdscr_close2 ( MSElementDescrH  outEdPP,
MSElementDescrP  inEdP,
DgnModelRefP  modelRef 
)

Used to create a closed element

from an element that is not closed.

The method used to close the element is determined by the type of the initial open element.

Remarks
If the inEdP element is a linestring, the closed element will be a shape. If inEdP is an arc element, the closed element will be an ellipse (a circle if the arc has a constant radius). If inEdP is a bSpline curve element, the closed element will also be a bSpline curve. If inEdP is a complex string element, the closed element will be a complex shape element.
Parameters
[out]outEdPPis the closed element created from the open element.
[in]inEdPis the initial open element.
[in]modelRefindicates the design model containing the open element, and where the new closed element will be stored.
Returns
SUCCESS if the closed element is created, otherwise ERROR.
Remarks
Required Library: mdlbltin.lib
UInt32 mdlElmdscr_componentOffset ( MSElementDescrP  headerEdP,
MSElementDescrP  componentEdP,
DgnModelRefP  modelRef 
)

Used to get the offset value of a component element in the specified element descriptor chain.

Parameters
[in]headerEdPis a pointer to the start of the element descriptor chain.
[in]componentEdPis a pointer to the component element descriptor.
[in]modelRefindicates the design model containing the element descriptor chain.
Returns
The offset of the component element within the chain, or zero if the component element was not found within the chain.
See also
mdlElmdscr_atOffset
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_computeRange ( Dpoint3d minP,
Dpoint3d maxP,
MSElementDescrCP  edP,
RotMatrixCP  rotMatrixP 
)

Computes the range of the element(s) in the specified element descriptor.

Parameters
[out]minPcontains the minimum X Y and Z range values
[out]maxPcontains the maximum X Y and Z range values
[in]edPthe element descriptor containing the element(s) to compute the range of.
[in]rotMatrixPthe rotation matrix to apply to the range values, or NULL if no rotation is needed.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_convertTo2D ( MSElementDescrH  newDscrPP,
MSElementDescrP  oldDscrP,
int  view,
TransformP  transP,
DgnModelRefP  sourceModelRef,
DgnModelRefP  destModelRef,
bool  preserveZRange 
)

Converts the 3D element descriptor pointed to by oldDscrP to a 2D element descriptor.

A pointer to the new 2D element descriptor is returned in newDscrPP.

Remarks
The element's orientation in the resulting 2D design plane is defined by view and transform.
Parameters
[out]newDscrPPnew element description.
[in]oldDscrPoriginal element description.
[in]viewdefines which view (0 to 7, where 0 = view 1, and 1 = view 2) establishes the final orientation of the converted elements. A value of -1 indicates that the top view is used.
[in]transPallows an additional transformation to be applied to the element descriptor before the transformation defined by the chosen view parameter is applied. If NULL, no additional transformation is applied. chosen view parameter is applied. A value of INVALID_MODELREF means to use the model refs from the element descriptors.
[in]sourceModelRefSource model ref.
[in]destModelRefDestination model ref - can be the same as the source.
[in]preserveZRangeif true, copy the Z range from oldDscrP to newDscrPP
Remarks
Applications must free memory pointed to by newDscrPP using mdlElmdscr_freeAll when they are finished with it.
The following list of element types are not converted to 2D elements and are removed from the output element list:
  • B-spline surface element headers
  • Surface element headers
  • Solid element headers
  • Cone elements
  • Reference file attachment definitions
Returns
Returns SUCCESS when the elements convert successfully. If an error occurs, ERROR is returned and mdlErrno contains the reason for failure.
See also
mdlElmdscr_convertTo3D mdlElmdscr_freeAll mdlElmdscr_new
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_convertTo3D ( MSElementDescrH  newDscrPP,
MSElementDescrP  oldDscrP,
int  eType,
double  elevation,
TransformP  transP,
DgnModelRefP  sourceModelRef,
DgnModelRefP  destModelRef 
)

Converts the 2D element descriptor pointed to by oldDscrP to a 3D element descriptor.

A pointer to the new 3D element descriptor is returned in newDscrPP.

Parameters
[out]newDscrPPnew element descriptor
[in]oldDscrPoriginal element descriptor
[in]eTypeThe element depth (Z value) in the resulting 3D design plane is defined by the eType and elevation parameters.
[in]elevationElevation value if eType is FIXEDDEPTH.
[in]transPA transformation to be applied to the element descriptor before each element is converted from 2D to 3D. If NULL, no transformation is applied.
[in]sourceModelRefSource model ref - can be the same as the destination. A value of INVALID_MODELREF means to use the model refs from the element descriptors.
[in]destModelRefDestination model ref - can be the same as the source.
Remarks
The eType parameter defines the type of value to be used in defining each element's Z depth. The following values are allowed:
Value Description
FIXEDDEPTH All elements have the fixed Z depth specified by the elevation parameter.
ELEMHIGH Each element has the Z depth defined by the high value of the Z range in the element definition.
ELEMLOW Each element has the Z depth defined by the low value of the Z range in the element definition.
Applications must free the memory pointed to by newDscrPP using mdlElmdscr_freeAll when they are finished with it.
Reference file attachment definitions are not converted to 3D elements and are removed from the output element list.
Returns
Returns SUCCESS when elements are converted successfully. If an error occurs, ERROR is returned and mdlErrno contains the reason for failure.
See also
mdlElmdscr_convertTo2D mdlElmdscr_freeAll mdlElmdscr_new
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_copy ( MSElementDescrH  elDscrPP,
DgnModelRefP  sourceModelRef,
DgnModelRefP  destModelRef,
ElementCopyContextP  copyContextP 
)

Copies an element descriptor and adds it to the destination.

It is important to use this function when copying between two models because it copies all necessary additional data, such as text styles,levels, etc. along with the elements. It is also useful to call this function within a single model because it tries to maintain dependencies between elements.

Styles and levels are resolved by name, so if a style with the same name exists in both the source and destination models, the element will be remapped to the style in the destination.

If you need to make multiple calls to this function for a related group of elements, you should create a ElementCopyContextP using mdlCopyContext_create to pass into each of the calls and then free the context after the calls are completed. For example,

while (haveMoreElements)
mdlElmdscr_copy (&elementDscrP, sourceModelRef, destModelRef, ccP);
Remarks
This function will work on elmdscr chains. If the source model is 3D and the destination model is 2D, then the top view (z direction) will be used for flattening. Dependency remapping works as a 3 part process. When an element is copied by this function, the dependencies in the element are invalidated and replaced with a 64 bit key describing the source modelRef and elementRef for each elementID that is a root of the dependency linkage. This information is used to populate one side of a remap table. When elements are added to the destination file (which will happen automatically unless mdlCopyContext_setWriteElements has set this differently) and get assigned their new elementIDs they can now populate the other half of the remap table using the destination modelRef and new elementRef. Finally, when it seems that all elements in a copy operation have been copied, all the invalid dependency roots are checked, the corresponding entry in the remap table is found and used to set the new elementID. The last step occurs when an undo mark is set, a cache is closed (i.e. mdlWorkDgn_close) or if the application explicitly calls mdlDependency_processAffected.
Parameters
[in,out]elDscrPPElement descriptor to copy to the destModelRef. It may be modified by this function. The returned value will be the element descriptor as written to the destination.
[in]sourceModelRefThe model ref that the element was read from.
[in]destModelRefThe model ref that the element should be written to. NULL means to use the sourceModelRef.
[in]copyContextPThe copy context derived from a call to mdlCopyContext_create. This parameter can be NULL; if so, a default copy context is created, which means that graphic groups and text nodes will be renumbered but no units scaling will occur.
Returns
SUCCESS if elements were successfully added to the file.
See also
mdlCopyContext_create mdlCopyContext_free mdlElmdscr_add
int mdlElmdscr_copyParallel ( MSElementDescrH  outDscrPP,
MSElementDescrP  inDscr,
Dpoint3d point,
double  distance,
Dpoint3d normal 
)

Creates a copy of the element descriptor

outDscr specified by inDscr that is offset parallel from the original element.

This is the same result as obtained by the MicroStation COPY PARALLEL... key-ins. If distance is zero, the offset distance and direction is obtained from point. If distance is non-zero, it specifies the offset distance and the direction only is obtained from point.

Parameters
[out]outDscrPPoutput geometry
[in]inDscrinput geometry
[in]pointdirection/distance point
[in]distancedistance to offset
[in]normaldefines the plane in which the geometry will be offset. If it is set to NULL the unit vector in the z direction will be used. To obtain an offset in a particular view, supply the third row of the view rotation matrix.
Remarks
This function will not function properly if used in versions of MicroStation prior to version 4.4.
Returns
Returns SUCCESS if the element is successfully copied and an appropriate non-zero error code otherwise.
Remarks
Required Library: mdlbltin.lib
Required Library: mdlbltin.lib
int mdlElmdscr_createFromVertices ( MSElementDescrH  edPP,
MSElementP  templateElmP,
Dpoint3d pointP,
size_t  numPoints,
bool  closed,
int  fillMode 
)

Creates a line string

or complex chain if closed is zero and a shape or complex shape if closed is non-zero.

A linestring or shape is created if numPoints is less than 5000, otherwise the appropriate complex element is created.

Parameters
[out]edPPpoints to the address of an element descriptor containing the created element.
[in]templateElmPIf in is NULL, the display parameters for the created element are taken from the active MicroStation parameters when the function is called. Otherwise the display parameter from in are used. All attribute information from in is retained in out.
[in]pointPpoints to an array of numPoints vertices.
[in]closedIf closed is non-zero, fillMode determines whether the created shape is filled. See mdlShape_create for possible values for fillMode.
[in]numPointsnumber of vertices
[in]fillModefill mode (if closed)
Returns
Returns SUCCESS if the element is created successfully and an appropriate error code otherwise.
See also
mdlLineString_create mdlShape_create
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_createShapeWithHoles ( MSElementDescrH  outEdPP,
MSElementDescrP  solidEdP,
MSElementDescrP  holeEdP 
)

Creates an orphan

cell entity, outEdPP, that associates the solid element, solidEdP with the hole entity(s) in holeEdP.

Remarks
The hole elements should be planar with and contained within the solid. The solid and hole descriptors become a part of the output element descriptor, they are not copied.
The holes will be recognized as being associated with the solid by MicroStation's rendering, hidden line removal, filled element display and translators.
Parameters
[out]outEdPPshapes with holes
[in]solidEdPouter shape (included in outEdPP)
[in]holeEdPhole element descriptor (chain)
Returns
Returns SUCCESS if a grouped hole is created and an appropriate error code otherwise.
See also
mdlElmdscr_isGroupedHole
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_deleteByModelRef ( MSElementDescrP  elemDescr,
UInt32  filePos,
DgnModelRefP  modelRef,
bool  display 
)

Deletes the element(s)

pointed to by elemDscrP at file position filePos in the model specified by modelRef.

The deletion will be undoable if the model is in the current master file. If it is, MicroStation needs the element(s) to save in the undo buffer. If the element descriptor does not exist, pass NULL for elemDscrP and MicroStation will re-read the elements from the cache. Doing so adds some overhead, so always pass the element descriptor if it exists.

Parameters
[in]elemDescrelement descr to delete
[in]filePosfile position
[in]modelRefthe model containing the element(s)
[in]displayIf display is true, MicroStation erases the elements from the screen as it deletes them. Otherwise, it does not erase them.
Remarks
MicroStation remembers the mdlElmdscr_undoableDelete function, so the user can undo it.
Returns
If the element is deleted, returns SUCCESS. If it fails, it sets mdlErrno and returns one of the following: MDLERR_READONLY, MDLERR_WRITEINHIBIT, MDLERR_BADELEMENT or MDLERR_MODIFYCOMPLEX.
See also
mdlElmdscr_undoableDelete
Remarks
Required Library: mdlbltin.lib
StatusInt mdlElmdscr_deleteClip ( MSElementDescrH  ppElementDescr)

Used to remove any clip boundary linkage from the specified element.

Parameters
[in,out]ppElementDescris the element descriptor representing the element with the clip boundary to be removed.
Returns
SUCCESS if a clip boundary linkage was found and removed.
See also
mdlElmdscr_addClip
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_display ( MSElementDescrCP  elemDescr,
DgnModelRefP  modelRef,
int  drawMode 
)

Displays the element descriptor

pointed to by elemDscrP in all active views.

Parameters
[in]elemDescrelements to display
[in]modelRefdetermines the display transformation and clipping to be applied to the element(s) as they are drawn.
[in]drawModedetermines how MicroStation displays the element(s).
Remarks
Possible values for drawMode are as follows:
drawMode drawMode field meaning
DRAW_MODE_Normal Draw the element(s) in its normal color.
ERASE Erase the element(s).
HILITE Draw the element(s) in the current highlight color.
See also
mdlElmdscr_displaySingle mdlElement_display mdlElmdscr_displayInSelectedViews mdlElmdscr_displayFromFileViews mdlElmdscr_displayFromFile
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_displayAllReferences ( MSElementDescrP  elemDescr,
int  drawMode,
DgnModelRefP  activeModel,
int  viewMask 
)

Displays the element descriptor

pointed to by elemDscrP in the views specified by viewMask if the descriptors modelRef can be reached from the root modelRef of the view.

Useful for displaying changes in dependency callbacks.

Parameters
[in]elemDescrelements to display
[in]drawModedetermines how MicroStation displays the element(s).
[in]activeModeldetermines the display transformation and clipping to be applied to the element(s) as they are drawn.
[in]viewMaskwhich views to display in
Remarks
Possible values for drawMode are as follows:
drawMode drawMode field meaning
DRAW_MODE_Normal Draw the element(s) in its normal color.
ERASE Erase the element(s).
HILITE Draw the element(s) in the current highlight color.
See also
mdlElmdscr_displaySingle mdlElement_display mdlElmdscr_displayInSelectedViews mdlElmdscr_displayFromFileViews mdlElmdscr_displayFromFile
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_displayFromFile ( UInt32  filePos,
DgnModelRefP  modelRef,
MSElementP  el,
int  drawMode 
)

This function is similar to

mdlElmDscr_display, but operates on elements in the design file rather than from an element descriptor supplied by the application.

el is an optional parameter that points to the element at position filePos from modelRef. If the element does not exist, pass NULL.

mdlElmdscr_displayFromFile uses the following logic internally:
if (el is non-NULL and points to a simple element)
{
}
else
{
mdlElmdscr_read(..., filePos, modelRef, ..)
}
Parameters
[in]filePosfile position
[in]modelRefelement source
[in]elelement (or NULL)
[in]drawModedetermines how MicroStation displays the element(s).
Remarks
Possible values for drawMode are as follows:
drawMode drawMode field meaning
DRAW_MODE_Normal Draw the element(s) in its normal color.
ERASE Erase the element(s).
HILITE Draw the element(s) in the current highlight color.
Returns
Returns SUCCESS if the element is read and displayed and ERROR if filePos is invalid.
See also
mdlElmdscr_displaySingle mdlElement_display mdlElmdscr_displayInSelectedViews mdlElmdscr_displayFromFileViews
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_displayFromFileViews ( UInt32  filePos,
DgnModelRefP  modelRef,
MSElementP  elP,
int  drawMode,
int  viewMask 
)

This function is identical to

mdlElmdscr_displayFromFile, except that the viewMask argument determines the views in which element descriptor is displayed (see mdlElement_displayInSelectedViews for a discussion of viewMask).

Parameters
[in]filePosfile position of element
[in]modelRefelement source
[in]elPoptional
[in]drawModedrawing mode
[in]viewMaskone bit per view
Returns
Returns SUCCESS if the element is displayed and ERROR if filePos is invalid.
See also
mdlElmdscr_display mdlElmdscr_displayFromFile mdlElmdscr_displayInSelectedViews
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_displayInSelectedViews ( MSElementDescrCP  elemDescr,
DgnModelRefP  modelRef,
int  drawMode,
int  viewMask 
)

This function is identical to

mdlElmdscr_display, except that the viewMask argument determines the views in which element descriptor is displayed (see mdlElement_displayInSelectedViews for a discussion of viewMask).

Parameters
[in]elemDescrpointer to elemDscr displayed
[in]modelRefelement source
[in]drawModedrawing mode
[in]viewMaskone bit per view
See also
mdlElmdscr_display mdlElmdscr_displayFromFile mdlElmdscr_displayFromFileViews
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_displayInView ( MSElementDescrP  edP,
DgnModelRefP  modelRef,
DgnPlatform::DgnDrawMode  drawMode,
MSWindow gwP 
)

Used to display the

contents of the specified element descriptor in the specified view window using the given drawing mode.

Parameters
[in]edPis the element descriptor indicating the element to draw in the given view.
[in]modelRefindicates the model containing the element.
[in]drawModeis one of the drawing mode values.
Remarks
Possible values for drawMode are as follows:
drawMode drawMode field meaning
DRAW_MODE_Normal Draw the element(s) in its normal color.
ERASE Erase the element(s).
HILITE Draw the element(s) in the current highlight color.
Parameters
[in]gwPwindow to display element in
See also
mdlElmdscr_show
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_displaySingle ( MSElementDescrP  elemDescr,
DgnModelRefP  modelRef,
int  drawMode 
)

This function is identical to

mdlElmdscr_display except that it displays a single element descriptor and will not display the elements pointed to by elemDescr->next.

Parameters
[in]elemDescrelement to display
[in]modelRefelement source
[in]drawModedisplay mode
Remarks
Possible values for drawMode are as follows:
drawMode drawMode field meaning
DRAW_MODE_Normal Draw the element(s) in its normal color.
ERASE Erase the element(s).
HILITE Draw the element(s) in the current highlight color.
See also
mdlElmdscr_display
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_displayToWindow ( MSWindow windowP,
BSIRect const *  rectP,
DgnPlatform::ViewFlags const *  viewFlags,
MSElementDescrCP  elmDP,
RotMatrixCP  rotMatrixP,
Dpoint3d const *  originP,
Dpoint3d const *  rangeP,
int  threeD,
int  menuColor 
)

Used to display the graphics element

designated by edP in the window designated by windowP.

Parameters
[in]windowPwindow
[in]rectPrectangle in window (local coordinates)
[in]viewFlagsis used to determine the element display mode. The typedef for the viewFlags structure is included in mstypes.h. The display of line weights, fast curve display etc., are controlled by the bitfields within this structure. If NULL is passed, edP is displayed with slow curves and text, and line weight, pattern, text node and, enter data field display is enabled.
[in]elmDPelement descriptor
[in]rotMatrixProtation matrix
[in]originPorigin in element coordinates
[in]rangePrange in element coordinates
[in]threeDtrue if it's a 3D transform/element
Remarks
If threeD is set to zero, both elmDP and rotMatrixP should be two dimensional, otherwise they must be three dimensional.
rectP, originP, rotMatrixP and rangeP determine the location of the element within the window. These parameters are exactly analogous to the way that MicroStation views are specified in the TCB. originP designates the coordinate (in UORs) that will be mapped to the lower left corner of rectP. rangeP designates the dimensions of the display rectangle (volume in 3D) in UORs. rotMatrixP designates the rotation from world to view coordinates. A point in design file coordinates is, therefore, mapped to window coordinates in the following manner:
  1. Subtract originP
  2. Rotate by rotMatrixP
  3. Scale to screen coordinates

    scale.x = (rectP->corner.x - rectP->origin.x)/rangeP->x <br>
    scale.y = (rectP->corner.y - rectP->origin.y)/rangeP->y

  4. Add lower left corner of rectP
The ratio between rangeP->x and rangeP->y should match the aspect ratio of rectP. If it doesn't, the display of edP will be stretched to reflect the difference.
Parameters
[in]menuColorIf menuColor is non-negative, it designates the menu color index for all of the elements. For example, if BLACK_INDEX is used, all elements are displayed in black. If a negative menuColor is used, the elements are displayed in their normal MicroStation colors.
Returns
Returns SUCCESS if the element is displayed successfully and an appropriate non-zero error code otherwise.
See also
mdlElmdscr_extendedDisplayToWindow
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_distanceAtPoint ( double *  distance,
Dpoint3d position,
Dpoint3d tangent,
MSElementDescrP  edP,
Dpoint3d inputPoint,
double  inputTolerance 
)

Returns the distance along

an element from the beginning of the element to the projection of inputPoint on the element.

The position and tangent vector are also returned. The mdlElmdscr_pointAtDistance function returns the point and tangent vector at distance along the element. All input parameters are specified in the current coordinate system.

Parameters
[out]distancedistance along elm
[out]positionpoint on element
[out]tangenttangent direction
[in]edPelement descriptor
[in]inputPointinput point
[in]inputTolerancestroking tolerance
Returns
Returns SUCCESS or a non-zero error status otherwise if an error occurs.
See also
mdlElmdscr_pointAtDistance
Remarks
Required Library: mdlbltin.lib
StatusInt mdlElmdscr_evaluateCurveSpace ( MSElementDescrCP  pDescr,
DPoint3dP  pOrigin,
RotMatrixP  pMatrix,
int *  pTangentDimensions 
)

Determine the dimensionality of a curve – line, plane, or space.

Parameters
[in]pDescrelement to inspect.
[out]pOriginorigin of curve.
[out]pMatrixorientation matrix. For planar curves, the xy columns are inplane. For lines, the x column is the line tangent.
[out]pTangentDimensions1 if the geometry is a line, either explicitly or as a bspline that is only a line; 2 if this is a plane curve; 3 if this is a space curve.
Returns
SUCCESS if the element is a curve.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_extendedDisplayToWindow ( MSWindow windowP,
BSIRect const *  rectP,
DgnPlatform::ViewFlags const *  viewFlags,
MSElementDescrCP  elmDP,
RotMatrixCP  rotMatrixP,
Dpoint3d const *  originP,
Dpoint3d const *  rangeP,
int  threeD,
int  menuColor,
void const *  colormap,
bool  clearFirst,
byte const *  backgroundImageP 
)

  Provides some

extensions to the mdlElmdscr_displayToWindow function that allow the display of rendered images within a window.

See the mdlElmdscr_displayToWindow function for information on the first nine common arguments.

Parameters
[in]windowPwindow
[in]rectPrectangle in window (local coordinates)
[in]viewFlagsview flags to use
[in]elmDPelement descriptor
[in]rotMatrixProtation matrix
[in]originPorigin in element coordinates
[in]rangePrange in element coordinates
[in]threeDtrue if it's a 3D transform/element
[in]menuColorMenu Index or -1 for element colors
[in]colormapcolormap is a pointer to an array of 256 bytes that contain the mapping from element colors to display indices. If NULL is passed, the master design file color map is used.
[in]clearFirstclear window/zBuffer first. If clearFirst is non-zero, the background is cleared before displaying the element.byte
[in]backgroundImagePis a pointer to an RGB image buffer (IMAGEFORMAT_RGB). If NULL is passed, no background image is displayed. The size of the image must match rectP.
Returns
Returns SUCCESS if the element is displayed successfully and an appropriate error code otherwise.
See also
mdlElmdscr_displayToWindow
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_extractAttributes ( int *  length,
UInt16 attributes,
MSElementDescrP  elDscr 
)

Extracts the attribute

information from the first element contained in the element descriptor elmdscrP.

The attributes are copied into the attributes buffer and length is set to the size of the attribute data in words.

Parameters
[out]lengthlength (words) of attribute data
[out]attributesattribute data extracted
[in]elDscrelement descriptor to process
Remarks
If more than one element is contained in the element descriptor, only the first element is processed. If the first element is a complex element, attributes are extracted from the header only.
The attributes array should be large enough to hold MAX_ATTRIBSIZE words.
See also
mdlElement_extractAttributes mdlElement_stripAttributes mdlElement_appendAttributes mdlElmdscr_stripAttributes mdlElmdscr_appendAttributes
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_extractCellTMatrix ( TransformP  forwardP,
TransformP  inverseP,
MSElementP  cellP,
DgnModelRefP  modelRef 
)

Used to get a transformation matrix from a cell element.

Parameters
[out]forwardPis the forward transform extracted from the cell element.
[out]inversePis the inverse transform extracted from the cell element.
[in]cellPis the cell element from which the transformation matrix is extracted.
[in]modelRefindicates the model containing the cell element.
Returns
SUCCESS if the operation completed successfully, otherwise ERROR.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_extractEndPoints ( DPoint3dP  startP,
DPoint3dP  startTangentP,
DPoint3dP  endP,
DPoint3dP  endTangentP,
MSElementDescrCP  edP,
DgnModelRefP  modelRef 
)

Returns the start and end points

(in start and end) for the open element, edP.

Valid element types include lines, linestrings, arcs, curves, B-spline curves, multilines, complex chains and complex shapes.

Parameters
[out]startPthe starting point for the curve; pass NULL for argument if you do not need or want this value.
[out]startTangentPstart tangent
[out]endPthe ending point for the curve; pass NULL for argument if you do not need or want this value.
[out]endTangentPend tangent
[in]edPelement descriptor
[in]modelRefis used only if the input element is a multiline.
Remarks
This function is included in the object library mdllib.ml. This library must be linked into any application calling this function.
Returns
Returns SUCCESS if the element is successfully reversed and MDLERR_BADTYPE if the element type is invalid.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_extractNormal ( Dpoint3d normal,
Dpoint3d point,
MSElementDescrCP  edP,
Dpoint3d inputDefaultNormal 
)

Used to find the normal vector of an element, using the incredibly coarse classic IGDS/Microstation tolerance of 100 UORS.

Use mdlElmdscr_extractNormalTight to get a tighter tolerance.

Parameters
[out]normalis a vector normal to the element.
[out]pointis a point on the element.
[in]edPis the element to which the normal will be found.
[in]inputDefaultNormalis a reference vector used only if the element normal is ambiguous, as is the case for a line element. In this case, inputDefaultNormal is a default vector in the plane of the line and the returned normal.
Returns
SUCCESS if the normal vector is returned, MDLERR_NONPLANARELEMENT if an average normal vector is returned.
Remarks
Required Library: mdlbltin.lib
See also
mdlElmdscr_extractNormal2 mdlElmdscr_extractNormalTight2
int mdlElmdscr_extractNormal2 ( Dpoint3d normalP,
Dpoint3d pointP,
MSElementDescrP  edP,
Dpoint3d inputDefaultNormal,
bool  applyCurrTrans,
bool  cleanupNormal 
)

Used to find the normal vector of an element.

Remarks
If both applyCurrTrans and cleanupNormal are false, then this function behaves exactly like mdlElmdscr_extractNormal.
Parameters
[out]normalPis a vector normal to the element.
[out]pointPis a point on the element.
[in]edPis the element to which the normal will be found.
[in]inputDefaultNormalis a reference vector used only if the element normal is ambiguous, as is the case for a line element. In this case, inputDefaultNormal is a default vector in the plane of the line and the returned normal.
[in]applyCurrTransdetermines whether the inverse current transform is applied to pointP before it is returned.
[in]cleanupNormalindicates whether the normal vector is cleaned up before it is returned so that coordinates near -1, 0 or 1 are set to those exact values.
Returns
SUCCESS if the normal vector is returned, MDLERR_NONPLANARELEMENT if an average normal vector is returned.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_extractNormalTight ( Dpoint3d normal,
Dpoint3d point,
MSElementDescrCP  edP,
Dpoint3d inputDefaultNormal 
)

Used to find the normal vector of an element, with tight tolerance for planarity test.

Parameters
[out]normalis a vector normal to the element.
[out]pointis a point on the element.
[in]edPis the element to which the normal will be found.
[in]inputDefaultNormalis a reference vector used only if the element normal is ambiguous, as is the case for a line element. In this case, inputDefaultNormal is a default vector in the plane of the line and the returned normal.
Returns
SUCCESS if the normal vector is returned, MDLERR_NONPLANARELEMENT if an average normal vector is returned.
Remarks
Required Library: mdlbltin.lib
See also
mdlElmdscr_extractNormal2 mdlElmdscr_extractNormal
int mdlElmdscr_extractNormalWithTolerance ( Dpoint3d normal,
Dpoint3d point,
MSElementDescrCP  edP,
Dpoint3d inputDefaultNormal,
double  absTol,
double  localRelTol,
double  globalRelTol 
)

Used to find the normal vector of an element, with user-defined tolerance for planarity test.

Parameters
[out]normalis a vector normal to the element.
[out]pointis a point on the element.
[in]edPis the element to which the normal will be found.
[in]inputDefaultNormalis a reference vector used only if the element normal is ambiguous, as is the case for a line element. In this case, inputDefaultNormal is a default vector in the plane of the line and the returned normal.
[in]absTolis a user-defined absTol tolerance.
[in]localRelTolis a user-defined local tolerance.
[in]globalRelTolis a user-defined global tolerance.
Returns
SUCCESS if the normal vector is returned, MDLERR_NONPLANARELEMENT if an average normal vector is returned.
Remarks
Required Library: mdlbltin.lib
See also
mdlElmdscr_extractNormal2 mdlElmdscr_extractNormal
int mdlElmdscr_fillet ( MSElementP  fillet,
MSElementP  pTemplate,
MSElementDescrP  in0EdP,
MSElementDescrP  in1EdP,
double  inputRadius,
Dpoint3d inputPoint,
RotMatrixP  inputRotMatrix 
)

Used to create a two dimensional

circular fillet between the specified elements.

Optionally, a template element can be specified from which the symbology settings are copied.

Parameters
[out]filletis the element descriptor for the fillet arc element after it is created.
[in]pTemplateis an element from which the symbology settings are copied to the fillet arc.
[in]in0EdPis the first element to fillet.
[in]in1EdPis the second element to fillet.
[in]inputRadiusis the desired fillet arc radius.
[in]inputPointindicates which fillet is desired by proximity. For example, if the elements to fillet include two intersecting lines, there are four possible fillets that could be created (assuming the radius value does not preclude any of the four). The fillet closest to the given point is the fillet that is selected and created.
[in]inputRotMatrixis the rotation matrix to apply to the fillet. This may be NULL.
Returns
SUCCESS if the fillet can be created, otherwise ERROR.
Remarks
Required Library: mdlbltin.lib
MSElementDescrP mdlElmdscr_findElementId ( MSElementDescrP  edP,
DgnPlatform::ElementId  reqId 
)

Get a pointer to the component element descriptor having the specified ElementId in the supplied complex element descriptor.

Parameters
[in]edPis a pointer to the header element descriptor of a complex element.
[in]reqIdindicates the ElementId of the target element within the complex element.
Returns
A pointer to the element descriptor with the specified ElementId or NULL if not present.
int mdlElmdscr_fromCompoundElement ( MSElementDescrH  edPP,
MSElementP  elemP,
DgnModelRefP  modelRef,
UInt32  graphicGroup,
bool  transformToWorld,
bool  expandNested 
)

Converts a compound element

(multi-line, dimension, shared cell) to a set of simple (pre-MicroStation 4.0 compatible) elements.

Parameters
[out]edPPpoints to the address of an element descriptor that contains the simple elements representing the compound element, elemP.
[in]elemPinput compound element
[in]modelRefis the model reference for elemP. It is used to resolve associative points.
[in]graphicGroupis a graphic group number for the output elements. If this is nonzero, the elements will all receive this graphic group number and therefore will be a part of the same graphic group.
[in]transformToWorldfor shared cell instances
[in]expandNestedexpand nested shared cells
Remarks
If the element is a shared cell and transformToWorld is true, shared cell definitions are transformed to world coordinates. In most cases, this variable should be true.
If the element is a shared cell instance and expandNested is true, shared cell instances are replace with their definitions.
Returns
Returns SUCCESS if the compound element is expanded successfully and MDLERR_BADELEMENT if the input element is not a compound element.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_fromCone ( MSElementDescrH  edPP,
MSElementP  coneP,
TransformP  transP 
)

Used to create an element descriptor chain from the specified cone element.

Parameters
[out]edPPis a pointer to the start of the element descriptor chain created from the cone.
[in]conePis a pointer to the cone element.
[in]transPis a transform to be applied to the element descriptor chain. This transform is not applied to the cone element.
Returns
SUCCESS if the operation completed normally, MDL_INSFMEMORY if there was not sufficient memory to create the chain.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_fromSelectionSet ( MSElementDescrH  edPP)

Used to create an

element descriptor chain from the set of elements that are currently in the selection set.

Parameters
[out]edPPis the element descriptor chain that includes all of the elements in the selection set.
Returns
SUCCESS if the descriptor chain was created successfully, otherwise MDLERR_NOSELECTIONSET if no elements were selected.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_generatePartial ( MSElementDescrH  outEdPP,
MSElementDescrCP  elmDescrP,
double  t1,
double  t2,
bool  splineParameters 
)

Generates the portion

of the element descriptor elmDescr that is between t1 and t2 and returns this portion in outEdPP.

The parameters correspond to the parameterization of the element after conversion to a B-spline curve entity with the mdlBspline_convertToCurve function. The splineParameters argument should always be set to true.

Parameters
[out]outEdPPoutput (partial) element
[in]elmDescrPinput element
[in]t1start parameter
[in]t2end parameter
[in]splineParameterst1 and t2 are b-spline params
Returns
Returns SUCCESS if the partial element is generated successfully and an appropriate error status otherwise.
See also
mdlBspline_convertToCurve
Remarks
Required Library: mdlbltin.lib
UInt32 mdlElmdscr_getByElemRef ( MSElementDescrH  elemDescrPP,
ElementRefP  elemRef,
DgnModelRefP  modelRef,
int  expandSharedCells,
UInt32 readFilePos 
)

Get an element descriptor given an ElementRefP.

Parameters
[out]elemDescrPPThe element descriptor created from elemRef
[in]elemRefThe ElementRefP for which the element descriptor is created
[in]modelRefPoints to the model containing the element. This parameter is only used to fill in the el->h.dgnModelRef field in the descriptor. It can be NULL.
[in]expandSharedCellsUnsupported option, must be 0 or read fails.
[in]readFilePosThe actual file position.
Returns
The file position of the next element.
Remarks
Required Library: mdlbltin.lib
MSElementDescrP mdlElmdscr_getThicknessEdP ( MSElementDescrP  edP,
DgnModelRefP  modelRef 
)

Get a surface or solid element that represents a planar element with thickness.

Element thickness is a new concept introduced in V8. The presence of a thickness linkage on a planar element implies that the element is extruded by the thickness distance. The mdlElmdscr_getThicknessEdP function will return a solid or surface element that represents an element with thickness

Parameters
[in]edPa planar element with a non-zero thickness.
[in]modelRefthe modelRef for the element.
Returns
If the element has a non-zero thickness then a surface or solid element representing the extrusion, else NULL is returned.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_getUsedLevels ( BitMaskP  pBitMaskOut,
MSElementDescrP  pElemDscrIn 
)

Get a bit-mask which represents the set of the levels used by an element.

Parameters
[out]pBitMaskOutcomputed bitmask (must be initialized before calling this function)
[in]pElemDscrInelement descriptor whose used levels are to be got
Returns
SUCCESS if the bit-mask can be setup successfully
Remarks
Required Library: mdlbltin.lib
bool mdlElmdscr_hasLineStyle ( MSElementDescrCP  lineStyleEdP)

Queries if an element descriptor has line style.

Parameters
[in]lineStyleEdPis the element descriptor to query.
Returns
true if the elements descriptor has line style.
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_initOrAddToChainWithTail ( MSElementDescrH  ppHeadDescr,
MSElementDescrH  ppTailDescr,
MSElementDescrP  pDescr 
)

Append a descriptor to a growing chain, maintaining both head and tail pointers within the chain so that subsequent calls can access the tail directly without walking the chain.

Before starting the chain construction, caller initializes both the head and tail pointers to NULL.

Parameters
[in,out]ppHeadDescrpointer to head of chain.
[in,out]ppTailDescrpointer to tail of chain.
[in]pDescrdescriptor to add at tail.
See also
mdlElmdscr_addToChain mdlElmdscr_appendDscr
Remarks
Required Library: mdlbltin.lib
bool mdlElmdscr_isAssociativeRegion ( MSElementDescrCP  edP)

Used to determine whether the specified element descriptor contains an element that is an associative region.

Parameters
[in]edPis the element descriptor to test.
Returns
true if the element is an associative region.
See also
mdlElmdscr_isAssociativeRegionChild
bool mdlElmdscr_isAssociativeRegionChild ( MSElementDescrH  regionEdPP,
MSElementDescrP  edP 
)

Used to determine whether the element contained by the specified element descriptor is a

child element of an associative region.

Optionally, a pointer to the parent associative region can be obtained from this function as well.

Parameters
[out]regionEdPPif not NULL, is set to point to the associative region parent of the element contained by edP, if it is a child of an associative region.
[in]edPis the element descriptor to be tested.
Returns
true if the element is a child of an associative region; otherwise, false.
See also
mdlElmdscr_isAssociativeRegion
Remarks
Required Library: mdlbltin.lib
bool mdlElmdscr_isClosed ( MSElementDescrCP  edP)

Queries if an element descriptor is a closed element; i.e., a shape, complex shape, ellipse or closed B-spline curve.

Parameters
[in]edPis the element descriptor to query.
Returns
true if the element descriptor is a closed element.
See also
mdlElmdscr_open mdlElmdscr_close mdlElmdscr_createShapeWithHolesC mdlElmdscr_isOpen mdlElmdscr_isGroupedHole
Remarks
Required Library: mdlbltin.lib
bool mdlElmdscr_isGroupedHole ( MSElementDescrCP  groupEdP)

Queries if an element descriptor is

a grouped hole element; i.e., an element that has a hole punched in it (such as can be created with mdlElmdscr_createShapeWithHoles).

Parameters
[in]groupEdPis the element descriptor to query.
Returns
true if the elements descriptor is a grouped hole element.
See also
mdlElmdscr_open mdlElmdscr_close mdlElmdscr_createShapeWithHoles
Remarks
Required Library: mdlbltin.lib
bool mdlElmdscr_isOpen ( MSElementDescrCP  edP)

Queries if an element descriptor is an open

element; i.e., a line, line string, curve, open B-Spline curve or complex chain.

Parameters
[in]edPis the element descriptor to query.
Returns
true if the element descriptor is an open element.
See also
mdlElmdscr_open mdlElmdscr_close mdlElmdscr_createShapeWithHoles mdlElmdscr_isClosed mdlElmdscr_isGroupedHole
Remarks
Required Library: mdlbltin.lib
bool mdlElmdscr_isRule ( MSElementDescrCP  edP)

Used to determine whether the specified element descriptor contains an

element of either the DgnElementClass::PrimaryRule or the DgnElementClass::ConstructionRule.

See mselems.h for these definitions.

Parameters
[in]edPis the element descriptor to test.
Returns
true if the element descriptor contains an element of either the DgnElementClass::PrimaryRule or the DgnElementClass::ConstructionRule.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_isSphere ( double *  radiusP,
Dpoint3d centerP,
RotMatrixP  rotMatrixP,
MSElementDescrP  edP 
)

Used to determine whether the

specified element is spherical.

For this to be true, the element must be a surface or solid, have an arc as its profile element with the center of the arc on the axis of revolution and the arc and axis must be in the same plane. If all of these conditions are true, then the element is at least a partial sphere.

Parameters
[out]radiusPis the radius value of the sphere.
[out]centerPis the center point of the sphere.
[out]rotMatrixPis the rotation matrix of the sphere.
[in]edPis the element to test.
Returns
true if the element is spherical, otherwise false.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_numElementsSingle ( MSElementDescrCP  edP)

Used to find the number of child elements within an element descriptor chain.

Parameters
[in]edPis a pointer to the start of the element descriptor chain.
Returns
An integer value indicating the number of child elements found. mdlElmdscr_markElement
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_open ( MSElementDescrH  outEdPP,
MSElementDescrP  inEdP,
DgnModelRefP  modelRef 
)

Converts the closed element inEdP

to an open element, outEdPP.

This function will convert a shape to a line string, an ellipse to an arc, a complex shape to a complex chain etc.

Parameters
[out]outEdPPopen element descriptor
[in]inEdPelement descriptor to open
[in]modelRefis used only to resolve associative points, in most cases MASTERFILE can be passed for this parameter.
Returns
Return SUCCESS if the element is opened successfully and an appropriate error code otherwise.
See also
mdlElmdscr_isOpen mdlElmdscr_isClosed mdlElmdscr_close
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_operation ( MSElementDescrP  elemDescr,
PFElemOperation  elemFunc,
CallbackArgP  params,
int  opFlags 
)

Sets a user call-back function to recursively iterate through all

component elements in a complex element descriptor.

Parameters
[in]elemDescrelement descriptor
[in]elemFuncfunction to call
[in]paramsuser defined
[in]opFlagsdetermines the times at which elmFunc is called for the various elements in an element descriptor. The following values are possible:
Remarks
Element descriptors commonly operate on each element in a complex element. Since many complex elements in MicroStation can be nested, this operation requires a recursive subroutine of the following form:
int myFunction(pointer to element descriptor)
{
while (more elements are in the descriptor)
{
perform required operation
if (this is a header element)
{
myFunction(first component element)
}
step to next component element
}
}
While this procedure is basically straightforward, it can sometimes be inconvenient. The mdlElmdscr_operation function is an implementation of the above algorithm that calls your function, elmFunc, for each element in the descriptor.
The mdlElmdscr_operation function does not use params directly, but params is passed as an argument to elmFunc each time it is called. params is used for a pointer to a structure containing information needed by elemFunc. However, it can also be used as a pointer to a returned status or another value that will fit in an int.
Possible values for opFlag are listed below:
opFlag Meaning
ELMD_PRE_HDR For outermost header elements, call elmFunc for this element before it is called for component elements.
ELMD_PRE_NESTEDHDR For nested header elements, call elmFunc for this element before it is called for component elements.
ELMD_POST_HDR For outermost header elements call elmFunc for this element after it is called for all component elements.
ELMD_POST_NESTEDHDR For nested header elements, call elmFunc for this element after it is called for all component elements.
ELMD_ELEMENT Call elmFunc for component elements.
ELMD_ALL_ONCE Call elmFunc only once for each element. (defined as (ELMD_ELEMENT | ELMD_PRE_HDR | ELMD_PRE_NESTEDHDR)).
ELMD_HDRS_ONCE Call elmFunc once for header elements only (defined as (ELMD_PRE_HDR | ELMD_PRE_NESTEDHDR)).
elmFunc should expect the following parameters:
int elmFunc
(
MSElementP element, //=> element to act upon
void *params, //=> passed from original call
int operation, //=> why you were called
UInt32 offset, //=> offset from header
MSElementDescrP elemDscrP //=> element descr
);
element points to the current element.
params is passed unchanged from the original call to mdlElmdscr_operation.
operation indicates why elmFunc was called (one of the values of opFlag above).
offset is the file position of the current element relative to the outermost header element.
The offset argument is useful for identifying particular component elements.
elmDscrP points to the element descriptor containing the current element.
The elmDescrP argument is rarely needed.
mdlElmdscr_operation extracts information from an element descriptor. elmFunc should not modify the elements passed to it. elmFunc can modify elements through mdlModify_elementDescr.
Returns
If the elmFunc function returns a value other than SUCCESS, mdlElmdscr_operation aborts and returns that value to its caller.
See also
mdlModify_elementDescr
Remarks
Required Library: mdlbltin.lib
StatusInt mdlElmdscr_orientationExt ( TransformP  pTransform,
MSElementDescrCP  pSourceDescr,
DgnModelRefP  modelRef 
)

return a natural coordinate frame for the element.

Parameters
[out]pTransformcoordinate frame.
[in]pSourceDescrsource element
[in]modelRefsource model ref.
Returns
SUCCESS for graphic elements which allow an orientation.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_partialDelete ( MSElementDescrH  outEdPP1,
MSElementDescrH  outEdPP2,
MSElementDescrP  inEdP,
Dpoint3d point1,
Dpoint3d point2,
Dpoint3d point3,
int  view 
)

Returns the portions of inEdP that are not between the projection of point1 and point3 on the element.

This is the same process performed by MicroStation's DELETE PARTIAL command. If inEdP is closed, point2 is used to determine the portion of the element to be deleted. For closed elements, or open elements where the deleted portion includes the beginning or end of inEdP, only a single element is returned and outEdPP2 is set to NULL. If the entire input element is deleted, outEdPP1 is set to NULL as well.

Parameters
[out]outEdPP11st partial elm (or NULL)
[out]outEdPP22nd partial elm (or NULL)
[in]inEdPinput element
[in]point1first point
[in]point22nd point (or NULL)
[in]point33rd point
[in]viewview is used to perform the projection of the input points to the element.
Returns
Returns SUCCESS if the element is successfully partially deleted.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_pointAtDistance ( Dpoint3d position,
Dpoint3d tangent,
double  inputDistance,
MSElementDescrP  edP,
double  inputTolerance 
)

Returns the point and tangent vector at distance along the element.

All input parameters are specified in the current coordinate system.

Parameters
[out]positionpoint on element
[out]tangenttangent direction
[in]inputDistancedistance along elm
[in]edPelement
[in]inputTolerancestroking tolerance
Returns
Returns SUCCESS if it functions correctly and a non-zero error status otherwise.
Remarks
Required Library: mdlbltin.lib
UInt32 mdlElmdscr_read ( MSElementDescrH  elemDescrPP,
UInt32  filePos,
DgnModelRefP  modelRef,
int  expandSharedCells,
UInt32 readFilePos 
)

Reads the element at the position filePos from

the element cache for model modelRef and creates a new element descriptor.

A pointer to the element descriptor is returned in elemDscrPP. mdlElmdscr_readToMaster is similar, but also transforms the elements in the element descriptor to the master file coordinate system if modelRef indicates a reference file. If the element is from the master file, mdlElmdscr_readToMaster is equivalent to mdlElmdscr_read.

Parameters
[out]elemDescrPPelement descriptor
[in]filePosfile position to read from
[in]modelRefelement source
[in]expandSharedCellsUnsupported option, must be 0 or read fails.
[out]readFilePosactual file position
Remarks
If the element at address filePos is a complex header, these functions read and allocate memory for the header and all of its components.
mdlElmdscr_read and mdlElmdscr_readToMaster never return deleted elements; they are skipped. Therefore, the file position for the element descriptor elemDscrPP can differ from filePos if filePos points to a deleted element. The actual file position from which the elements that comprise the element descriptor were read is returned in readFilePos. If the actual file position is not needed, pass NULL for readFilePos.
Applications must free the memory pointed to by elemDscrPP using mdlElmdscr_freeAll when they no longer need this memory.
Returns
Returns the file position of the next element in the file. If the read fails (such as at the end of file), return 0 for the file position and elemDscrPP is not valid. mdlErrno is set to the specific error cause.
See also
mdlElmdscr_freeAll mdlElmdscr_readToMaster
Remarks
Required Library: mdlbltin.lib
UInt32 mdlElmdscr_readComponentToMaster ( MSElementDescrH  edPP,
DisplayPathCP  pathP,
int  elementNumber,
int  expandSharedCells,
bool  returnNonCellHeader,
bool  allowGroupHoles,
UInt32 startFilePosP 
)

Used to read an element from the specified design file and add it to the master design file.

If the desired element is part of a compound element, it can be further specified by its index within the compound element.

Parameters
[out]edPPis the element descriptor created for the element after it is added to the master design file.
[in]pathPis the display to get the component element from.
[in]elementNumberUnsupported option, value is ignore.
[in]expandSharedCellsIf pathP is to a component of s shared cell definition this option controls whether to return the component (with the path transform applied) or to stop at the shared cell instance.
[in]returnNonCellHeaderif true will return the complex header for the component element in the display path.
[in]allowGroupHoleswhen returnNonCellHeader is true, whether group hole cells should be returned.
[in]startFilePosPis the starting file position to read elements from.
Returns
If the operation is completed successfully, the next file position in the master file is returned. Otherwise, zero is returned and mdlErrno is set to either MDLERR_INVALIDREF or MDLERR_READFAILED.
Remarks
Required Library: mdlbltin.lib
UInt32 mdlElmdscr_readToMaster ( MSElementDescrH  elemDescrPP,
UInt32  filePos,
DgnModelRefP  modelRef,
int  expandSharedCells,
UInt32 startFilePos 
)

Reads the element at the position filePos from the element cache for model

modelRef and creates a new element descriptor.

A pointer to the element descriptor is returned in elemDescr. mdlElmdscr_readToMaster is similar, but also transforms the elements in the element descriptor to the master file coordinate system if modelRef indicates a reference file. If the element is from the master file, mdlElmdscr_readToMaster is equivalent to mdlElmdscr_read.

Parameters
[out]elemDescrPPelement descriptor
[in]filePosfile position to read from
[in]modelRefelement source
[in]expandSharedCellsUnsupported option, must be 0 or read fails.
[out]startFilePosactual file pos
Remarks
If the element at address filePos is a complex header, these functions read and allocate memory for the header and all of its components.
mdlElmdscr_read and mdlElmdscr_readToMaster never return deleted elements; they are skipped. Therefore, the file position for the element descriptor elemDscrPP can differ from filePos if filePos points to a deleted element. The actual file position from which the elements that comprise the element descriptor were read is returned in readFilePos. If the actual file position is not needed, pass NULL for readFilePos.
Applications must free the memory pointed to by elemDscrPP using mdlElmdscr_freeAll when they no longer need this memory.
Returns
Returns the file position of the next element in the file. If the read fails (such as at the end of file), returns 0 for the file position and elemDscrPP is not valid. mdlErrno is set to the specific error cause.
See also
mdlElmdscr_freeAll
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_reverse ( MSElementDescrH  outEdPP,
MSElementDescrCP  inEdP,
DgnModelRefP  modelRef 
)

Reverses the direction of inEdP

and returns the reversed element in outEdPP.

Valid element types include lines, line strings, shapes, arcs, curves, B-spline curves, complex chains and complex shapes.

Parameters
[out]outEdPPreversed element
[in]inEdPelement to be reversed
[in]modelRefis the model reference for the element. This is used only to resolve point associations and in most cases MASTERFILE can be used for this parameter.
Returns
Returns SUCCESS if the element is successfully reversed and MDLERR_BADTYPE if the element type is invalid.
Remarks
This function is included in the object library mdllib.ml. This library must be linked into any application calling this function.
See also
mdlElmdscr_reverseNormal
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_reverseNormal ( MSElementDescrH  outEdPP,
MSElementDescrCP  inEdP,
DgnModelRefP  modelRef 
)

Reverses the normal

direction for a surface, solid or closed element.

Parameters
[out]outEdPPpoints to the address of the reversed element.
[in]inEdPis the address of the input element descriptor.
[in]modelRefis the model reference for the element. This is used only to resolve point associations and in most cases MASTERFILE can be used for this parameter.
Returns
Returns SUCCESS if the element is reversed successfully and an appropriate error code otherwise.
See also
mdlElmdscr_reverse
Remarks
Required Library: mdlbltin.lib
UInt32 mdlElmdscr_rewrite ( MSElementDescrP  newElemDscr,
MSElementDescrP  oldElemDscr,
UInt32  filePos 
)

Overwrites the existing MicroStation

element(s) pointed to by oldElemDscrP with the new element(s) pointed to by newElemDscrP at file position filePos.

Parameters
[in]newElemDscrnew elements
[in]oldElemDscrfor compatibility with previous releases. Ignored, just pass NULL!
[in]filePosfile position
Remarks
If the sizes of the two element descriptors differ, MicroStation deletes the old one and appends the new one to the end of the file. Otherwise, it overwrites the old element(s) in the same position.
MicroStation saves the old element(s) in the undo buffer. If a copy of the old element descriptor does not exist, pass NULL for oldElemDscrP and MicroStation will re-read the old element(s) from the cache. Unless you are certain that you have the unmodified element descriptor, pass NULL for oldElmDscrP.
MicroStation remembers the mdlElmdscr_rewrite function, so the user can undo it.
Returns
Returns the file position of the element added to the design file. If the two elements are the same size, this file position is the same as filePos.
Remarks
If an error occurs, the file position is set to zero and the global variable mdlErrno is set to the specific error cause. Possible values for mdlErrno are MDLERR_READONLY, MDLERR_DISKFULL, MDLERR_WRITEINHIBIT, MDLERR_BADELEMENT and MDLERR_WRITEFAILED.
See also
mdlElmdscr_add mdlElmdscr_append
UInt32 mdlElmdscr_rewriteByModelRef ( MSElementDescrP  newEdP,
MSElementDescrP  oldEdP,
UInt32  filePosition,
DgnModelRefP  modelRef 
)

Replaces the specified element descriptor in the given file position, with a new element descriptor from the given modelRef.

Parameters
[in]newEdPthe new element descriptor that is written to the file
[in]oldEdPfor compatibility with previous releases. Ignored, pass NULL!
[in]filePositionthe file position of the old element descriptor
[in]modelRefthe model that is the source of the new element descriptor
Remarks
If the new element descriptor is the same size as the old descriptor, the file position will be the same. If the sizes are not the same, then the new element descriptor is written at another file position.
Returns
The file position of the new element descriptor, or 0 if the operation is not successful.
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_setProperties ( MSElementDescrH  edPP,
DgnPlatform::LevelId const *  level,
UInt32 const *  ggNum,
DgnPlatform::DgnElementClass const *  elementClass,
bool const *  locked,
bool const *  newElm,
bool const *  modified,
bool const *  viewIndepend,
bool const *  solidHole 
)

Changes the level, element class, graphic group, and other properties in the element desciptor pointed to by edPP to the values specified.

Pass NULL for parameters where you want to preserve the existing element value.

Parameters
[in,out]edPPelement to set properties
[in]levellevel (or NULL)
[in]ggNumgraphic group (or NULL)
[in]elementClassclass (or NULL)
[in]lockedlocked (or NULL)
[in]newElmnew (or NULL)
[in]modifiedmodified (or NULL)
[in]viewIndependview independent (or NULL)
[in]solidHolesolid/hole (or NULL)
Remarks
New code should use methods based on ElementHandle.
static void setProperties (EditElementHandleR eeh, LevelId newLevel, DgnElementClass newElmClass, UInt32 newGG, bool newLocked)
{
ElementPropertiesSetterPtr remapper = ElementPropertiesSetter::Create ();
remapper->SetLevel (newLevel);
remapper->SetElementClass (newElmClass);
remapper->Apply (eeh);
ElementPropertiesSetter::SetGraphicGroup (eeh, newGG);
ElementPropertiesSetter::SetLocked (eeh, newLocked);
}
For solid/hole status which is element specific, see IAreaFillPropertiesEdit::SetAreaType. For viewIndependent status which is element specific, see NormalCellHeaderHandler/SharedCellHandler::SetPointCell and TextBlock. The new/modified flags are not useful, there is no reason to set these.
See also
mdlElmdscr_getProperties
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_setSymbology ( MSElementDescrH  edPP,
UInt32 color,
Int32 style,
UInt32 weight,
UInt32 fillColor 
)

Changes the color, weight, and style in the element desciptor pointed to by edPP to the values specified.

Pass NULL for parameters where you want to preserve the existing element value.

Parameters
[in,out]edPPelement descriptor
[in]colorcolor (or NULL)
[in]stylestyle (or NULL)
[in]weightweight (or NULL)
[in]fillColorcolor (or NULL
Remarks
New code should use methods based on ElementHandle.
static void setSymbology (EditElementHandleR eeh, UInt32 newColor, Int32 newStyle, UInt32 newWeight)
{
ElementPropertiesSetterPtr remapper = ElementPropertiesSetter::Create ();
remapper->SetColor (newColor);
remapper->SetSetLinestyle (newStyle, NULL);
remapper->SetWeight (newWeight);
remapper->Apply (eeh);
}
See also
mdlElmdscr_setProperties
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_setVisible ( MSElementDescrP  edP,
bool  visible 
)

Used to set the visibility flag of the contents of the specified element descriptor.

Parameters
[in]edPis the element descriptor containing the element to set.
[in]visibledetermines whether the element is set visible or invisible. Set this value to true to display the element, or false to make the element invisible.
Returns
This function is of type void and does not return a value.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_show ( MSElementDescrP  edP,
WCharCP  currentIndent 
)

Used to print information from the

element descriptor header in a formatted fashion.

The printed values include the element type, its complex status, its 3d status, and if it is a graphic element the symbology values for color, weight, style, level, graphic group number and class. If the element is not a graphic element only its level will be printed.

Parameters
[in]edPis the element descriptor to get the information from to print.
[in]currentIndentis the number of character spaces to indent the information before printing.
Returns
Always returns SUCCESS
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_signedOffset ( MSElementDescrH  outDscrPP,
MSElementDescrCP  curveDescrP,
double  distance,
DVec3dP  normal 
)

Creates an offset of a curve element.

Parameters
[out]outDscrPPoutput geometry
[in]curveDescrPinput geometry
[in]distancedistance to offset
[in]normalvector to resolve directions in cases where the element does not clearly define a plane. For LINES, the offset direction is the cross product of the line direction and this vector.
Returns
Returns ERROR if not an offsetable curve.
Remarks
Required Library: mdlbltin.lib
StatusInt mdlElmdscr_simplifyComplexChainOrShape ( MSElementDescrH  edPP,
DgnModelRefP  modelRef 
)

Used to simplify a complex element, if possible, by concatenating consecutive linear

segments into linestrings.

Parameters
[in]edPPis the complex element to be simplified.
[in]modelRefindicates the model that contains the element.
Returns
SUCCESS if the process is completed successfully.
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_spaceFillet ( MSElementDescrH  ppFilletChain,
MSElementP  pTemplate,
MSElementDescrCP  pCurveA,
MSElementDescrCP  pCurveB,
double  radius,
DPoint3dP  pCenterSelect 
)

Compute circular arc fillets between two elements.

Parameters
[out]ppFilletChaincomputed arc or arcs. If selection point is given, only the arc with center closest to the selector is returned. If selection point is not given, all arcs are returned in a chain
[in]pTemplateis an element from which the symbology settings are copied to the fillet arcs.
[in]pCurveAis the first element to fillet.
[in]pCurveBis the second element to fillet.
[in]radiusis the desired fillet arc radius.
[in]pCenterSelectoptional point to identify preferred center.
Returns
SUCCESS if the fillet can be created, otherwise ERROR.
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_stripAttributes ( MSElementDescrH  elDscrPP)

Removes all of the attribute

data on the elements contained in descriptor elmdscrPP.

If there are complex elements contained in the element descriptor, only the headers of the complex elements are processed.

Parameters
[in,out]elDscrPPelement descriptor to process
See also
mdlElement_extractAttributes mdlElmdscr_stripAttributes mdlElement_appendAttributes mdlElmdscr_extractAttributes mdlElmdscr_appendAttributes
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_stripFill ( MSElementDescrH  edPP)

Removes the fill attribute linkage

from an element.

Parameters
[in,out]edPPpoints to the address of the element descriptor to be modified. This must be a closed element (shape, complex shape, ellipse, grouped hole orphan cell or closed B-spline curve).
Returns
Returns SUCCESS if the element is modified successfully and an appropriate error code otherwise.
See also
mdlElement_setFillColor mdlElmdscr_addFill
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_stroke ( Dpoint3d **  points,
int *  nPoints,
MSElementDescrP  edP,
double  tol 
)

Strokes the element descriptor pointed

to by elmDscrP into vectors in an array pointed to by points.

(This array should be the address of a pointer to a Dpoint3d). MicroStation allocates memory for the vectors and returns the starting address in points.

Remarks
The application programmer must free this memory when finished with it.
Parameters
[out]pointsvectors for edP
[out]nPointsThe number of points in the array is returned in numPoints.
[in]edPelements
[in]tolis the maximum distance (in master units) between the actual curve and the approximating vectors for curved elements.
Returns
Returns SUCCESS if the elmDscrP is stroked and points and numPoints are valid. Returns ERROR if elmDscrP is not valid. Valid element types are LINE_ELM, LINE_STRING_ELM, SHAPE_ELM, ARC_ELM, ELLIPSE_ELM, CURVE_ELM, TEXT_ELM, CMPLX_STRING_ELM and CMPLX_SHAPE_ELM.
See also
mdlElement_stroke
Remarks
For VBA, this function is wrapped by the ConstructVertexList method.
Required Library: mdlbltin.lib
int mdlElmdscr_transform ( MSElementDescrH  edPP,
TransformCP  userTrans 
)

Transforms the element descriptor by the supplied transformation matrix.

The transformation matrix relates to the current coordinate system if one exists.

Parameters
[in,out]edPPelement descriptor
[in]userTranstransformation matrix
Returns
If the element is transformed, returns SUCCESS. If it fails, it returns a non-zero value.
Remarks
New code should use methods based on ElementHandle.
static StatusInt transformElement (EditElementHandleR eeh, TransformInfoCR tInfo)
{
// NOTE: Does not apply mdlCurrTrans or follow next pointers (an element descriptor chain should not be use to construct and ElementHandle).
return eeh.GetHandler ().ApplyTransform (eeh, tInfo);
}
Existing code that needs to support the mdlCurrTrans or element descriptor chains (NULL != edP->h.next) may continue calling mdlElmdscr_transform.
Required Library: mdlbltin.lib
void mdlElmdscr_transformAllowModification ( MSElementDescrH  edPP,
TransformCP  userTrans,
DgnModelRefP  sourceModelRef,
DgnModelRefP  destModelRef,
const UInt32  options 
)

Transforms the element descriptor by the supplied transformation matrix.

The transformation matrix relates to the current coordinate system if one exists. Some important information regarding this function:

  • It may modify the size of the elements. This is important when the transformation must modify a linkage such as a line style rotation matrix.
  • Both source and destination model refs may be passed in. The model refs are used to resolve line styles, levels, fonts, etc. Also, if the model refs are different, then Handler::ChangeUnits will be called to apply any scaling between the model refs for dimensions, line styles, patterns, etc.
  • If the model ref on the element description is invalid, then the supplied source model refs is used.
Parameters
[in,out]edPPElement descriptor to transform.
[in]userTransTransformation matrix to apply
[in]sourceModelRefModel ref where the elements were read or created. Used when (*edPP)->h.modelRef is NULL. Can be the same as destination.
[in]destModelRefModel ref where the elements will be written. Can be the same as source.
[in]optionsAdditional options. See TransformOptionValues for TRANSFORM_OPTIONS_ mask values.
See also
mdlElmdscr_transform
mdlElmdscr_clone
Remarks
Required Library: mdlbltin.lib
int mdlElmdscr_undoableDelete ( MSElementDescrP  elemDescrP,
UInt32  filePos,
bool  display 
)

Deletes the element(s)

pointed to by elemDscrP at file position filePos.

MicroStation needs the element(s) to save in the undo buffer. If the element descriptor does not exist, pass NULL for elemDscrP and MicroStation will re-read the elements from the cache. Doing so adds some overhead to mdlElmdscr_undoableDelete, so always pass the element descriptor if it exists.

Parameters
[in]elemDescrPelement descr to delete
[in]filePosfile position
[in]displayIf display is true, MicroStation erases the elements from the screen as it deletes them. Otherwise, it does not erase them.
Remarks
MicroStation remembers the mdlElmdscr_undoableDelete function, so the user can undo it.
Returns
If the element is deleted, returns SUCCESS. If it fails, it sets mdlErrno and returns one of the following: MDLERR_READONLY, MDLERR_WRITEINHIBIT, MDLERR_BADELEMENT or MDLERR_MODIFYCOMPLEX.
See also
mdlElement_undoableDelete
Remarks
Required Library: mdlbltin.lib
int mdlProject_perpendicular ( DPoint3dP  position,
DPoint3dP  tangent,
DPoint3dP  perpendicular,
MSElementDescrP  edP,
DgnModelRefP  modelRef,
DPoint3dP  inputPoint,
RotMatrixP  inputRotMatrix,
double  inputTolerance 
)

Projects a point to an element on a perpendicular from the element.

The position of the perpendicular endpoint, direction, and the element perpendicular are returned.

Parameters
[out]positionposition of perpendicular end
[out]tangenttangent direction
[out]perpendicularperpendicular direction
[in]edPelement
[in]modelRef(for compounds elements only)
[in]inputPointpoint to project
[in]inputRotMatrixrotation matrix
[in]inputTolerancetolerance
Returns
SUCCESS if the projection is successful and a non-zero error status otherwise.
int mdlProject_tangent ( DPoint3dP  position,
DPoint3dP  tangent,
DPoint3dP  perpendicular,
MSElementDescrP  edP,
DgnModelRefP  modelRef,
DPoint3dP  point,
RotMatrixP  rotMatrix,
DPoint3dP  closestPoint,
double  tolerance 
)

Projects a point to an element along a tangent from the element.

  • Remarks
    Required Library: mdlbltin.lib The position of the tangent's endpoint, direction, and the element perpendicular are returned. If more than one tangent is possible, the tangent closest to closePoint is selected.
    Parameters
    [out]positionposition of tangent end
    [out]tangenttangent direction
    [out]perpendicularperpendicular direction
    [in]edPelement
    [in]modelRef(for compounds elements only)
    [in]pointinput point
    [in]rotMatrixrotation matrix
    [in]closestPointclosest point to tangent
    [in]tolerancetolerance
    Returns
    SUCCESS if the projection is successful, non-zero error status otherwise.
DGNPLATFORM_EXPORT XAttributeChangeSetP QueryXAttributeChangeSet ( ) const
DGNPLATFORM_EXPORT void Release ( )

Decrement the use count for this MSElementDescr. The last reference frees the MSElementDescr.

DGNPLATFORM_EXPORT MSElementDescrP RemoveElement ( )

Removes this element from an element descriptor chain.

It frees the memory allocated for this element and returns a pointer to the next element descriptor in the chain.

Returns
Returns a pointer to the next element descriptor in the chain.
DGNPLATFORM_EXPORT MSElementDescrP ReplaceDescr ( MSElementDescrR  newDscr)

Replace this MSElementDescr, and all of its children, with a new MSElementDescr.

If this MSElementDescr is a component of a complex element, its previous/next/etc. pointers are spliced to point to newDscr.

Parameters
[in]newDscrThe new MSElementDescr to replace this one.
Note
This MSElementDescr is Released (and is no longer valid) after this call.
If the original MSElementDescr has an XAttributeChangeSet, it must be transferred to the newDscr manually by the caller or it will be lost.
DGNPLATFORM_EXPORT MSElementDescrP ReplaceElement ( MSElementCR  element)

Replace the element held by this MSElementDescr with a new element.

If the new element is the same size or smaller (in bytes) as the current element, it is overwritten in place. If thew new element is larger than the current one, a new MSElementDescr is allocated and returned, and this MSElementDescr is Released. If this MSElementDescr is a component of a complex element, the previous/next/etc. pointers are spliced to the MSElementDescr returned by this method.

Parameters
[in]elementThe new element to be held by a (potentially) new MSElementDescr.
Returns
A pointer to the MSElementDescr holding element. This may either point to this MSElementDescr or a new one.
Note
This MSElementDescr is Released (and is no longer valid) after this call.
If the original MSElementDescr has an XAttributeChangeSet, it is preserved on the new MSElementDescr, if one is created.
DGNPLATFORM_EXPORT void SetModelRef ( DgnModelRefP  modelRef)
DGNPLATFORM_EXPORT void Validate ( DgnModelRefP  modelRef,
bool  ignoreIsValid = false 
)

Updates complex header element information based on current components.

Parameters
[in]modelRefElement source.
[in]ignoreIsValidPerform validation even if h.isValid is true. (ex. Application modifies component elements directly)
Remarks
Applications rarely need to call this directly, elements are always validated when added to a model or displayed in dynamics.
Sets h.isValid to true when complete.

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.