Functions
Element Associations

Functions

int mdlAssoc_getElement (MSElementP outElmP, UInt32 *filePosP, DgnPlatform::ElementId tagValue, DgnModelRefP modelRef)
 Attempts to locate the element with the unique ID elemID in the model specified by modelRef. More...
 
int mdlAssoc_getElementDescr (MSElementDescrH outElDPP, UInt32 *filePosP, DgnPlatform::ElementId tagValue, DgnModelRefP modelRef, bool expandShared)
 
Search for the element with the unique ID specified by elemID and, if found,

return an element descriptor that contains the element and any child elements it might have if it is a complex element. More...

 
int mdlAssoc_tagElementValue (DgnPlatform::ElementId *tagValue, MSElementP elemP, DgnModelRefP modelRef, DgnPlatform::ElementId inTag)
 Assign a new tag value to the specified element if it doesn't already have one. More...
 
StatusInt mdlAssoc_extractPoint (DgnPlatform::AssocPoint *assoc, MSElementCP elemP, int pointNum, int maxPoints)
 Extracts the association information from the specified point on the given element. More...
 
StatusInt mdlAssoc_insertPoint (MSElementP elemP, DgnPlatform::AssocPoint *assocPointP, int pointNum, int maxPoints)
 Insert an association point to the specified element. More...
 
StatusInt mdlAssoc_vertexAddedOrRemoved (MSElementP elemP, int pointNum, int maxPoints, bool inserted)
 Adjust association point indices for the specified element. More...
 
StatusInt mdlAssoc_getPoint (DPoint3dP outPoint, DgnPlatform::AssocPoint *assoc, DgnModelRefP modelRef)
 Uses the information in assocPoint to create a 3D data point that is returned in outPoint. More...
 
StatusInt mdlAssoc_getPointFromElement (DPoint3dP outPoint, MSElementP elemP, int pointNum, int maxPoints, DgnModelRefP modelRef)
 Uses the element and point number to create a 3D data point that is returned in outPoint. More...
 
StatusInt mdlAssoc_removePoint (MSElementP elemP, int pointNum, int maxPoints)
 Removes from element. More...
 
StatusInt mdlAssoc_resolveAssociations (MSElementP elemP, DgnModelRefP modelRef)
 Removes all association points from an element. More...
 
StatusInt mdlAssoc_getRoot (ElementRefP *elemRefP, DgnModelRefP *elemModelRefP, TransformP elemTransformP, int *nRootsP, DgnPlatform::AssocPoint *assocPointP, DgnModelRefP modelRef, int rootIndex)
 Returns the roots of an assoc point. More...
 
StatusInt mdlAssoc_createArc (DgnPlatform::AssocPoint *assoc, double angle, int keyPoint, DisplayPathCP path, DgnPlatform::ElementId elemId)
 Creates an association that represents a point on an arc or ellipse element. More...
 
StatusInt mdlAssoc_createKeypoint (DgnPlatform::AssocPoint *assoc, int vertex, int nVertex, int numerator, int divisor, DisplayPathCP path, DgnPlatform::ElementId elemId)
 Creates an association that represents a point on a linear element. More...
 
StatusInt mdlAssoc_createLinear (DgnPlatform::AssocPoint *assoc, DPoint3dP inPoint, int vertex, int nVertex, int lineNo, DisplayPathCP path, DgnPlatform::ElementId elemId)
 Creates an association that represents a point on a linear element. More...
 
StatusInt mdlAssoc_createIntersection (DgnPlatform::AssocPoint *assoc, int index, int seg1, int seg2, int nSeg1, int nSeg2, DisplayPathCP path1, DisplayPathCP path2, DgnPlatform::ElementId elemId1, DgnPlatform::ElementId elemId2)
 Create an intersection association between the two elements identified by the elemId1 and elemId2 parameters. More...
 
StatusInt mdlAssoc_createMline (DgnPlatform::AssocPoint *assoc, int vertex, int nVertex, int lineNo, double offset, int joint, DisplayPathCP path, DgnPlatform::ElementId elemId)
 Creates an association that represents a point on a multi-line element. More...
 
StatusInt mdlAssoc_createOrigin (DgnPlatform::AssocPoint *assoc, int option, DisplayPathCP path, DgnPlatform::ElementId elemId)
 Creates an association that represents the origin of the base element. More...
 
StatusInt mdlAssoc_createBCurve (DgnPlatform::AssocPoint *assoc, double u, DisplayPathCP path, DgnPlatform::ElementId elemId)
 Creates an association that represents a point along a B-spline curve. More...
 
bool mdlAssoc_getCurrent (DgnPlatform::AssocPoint *assoc, DPoint3dP pointP, int option, UInt16 createMask)
 Gets the current associative point. More...
 
int mdlAssoc_stripTag (MSElementP elemP)
 Remove an association tag from a single element. More...
 
void mdlElmdscr_stripTags (MSElementDescrH edPP)
 Remove the association tags from all elements within the element descriptor. More...
 
int mdlAssoc_tagElementDescr (DgnPlatform::ElementId *newTagP, MSElementDescrP elDscrP, DgnModelRefP modelRef)
 Get the tag value from an element at the specified offset within the specified element descriptor. More...
 

Detailed Description

Function Documentation

StatusInt mdlAssoc_createArc ( DgnPlatform::AssocPoint *  assoc,
double  angle,
int  keyPoint,
DisplayPathCP  path,
DgnPlatform::ElementId  elemId 
)

Creates an association that represents a point on an arc or ellipse element.

Parameters
[out]assocIf a valid association is created, the association information is returned in assoc.
[in]anglethe angle (in radians) from the primary axis of the arc or ellipse to the association point. This argument is used only when the value of keyPoint is.
[in]keyPointdetermines the type of association that is created. This argument must be set to one of the following defined constants:
Association Type Association Point Location
ASSOC_ARC_ANGLE angle radians from the primary axis
ASSOC_ARC_CENTER center of the arc or ellipse
ASSOC_ARC_START arc start point
ASSOC_ARC_END arc end point
[in]pathdisplay path for the element.
[in]elemIdused if path is NULL...i.e. creating assoc to element that has not been added to the file yet. No verification on the association can be done in this case.
Returns
SUCCESS (zero) if it is able to create a valid association. Otherwise, it returns a non-zero value.
See also
mdlAssoc_getPoint
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_createBCurve ( DgnPlatform::AssocPoint *  assoc,
double  u,
DisplayPathCP  path,
DgnPlatform::ElementId  elemId 
)

Creates an association that represents a point along a B-spline curve.

Parameters
[out]assocIf a valid association is created, the association information is returned in assoc.
[in]uthe parameter along the B-spline curve representing the associative point.
[in]pathdisplay path for the element.
[in]elemIdused if path is NULL...i.e. creating assoc to element that has
Returns
SUCCESS (zero) if it is able to create a valid association. Otherwise, it returns a non-zero value.
See also
mdlAssoc_getPoint
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_createIntersection ( DgnPlatform::AssocPoint *  assoc,
int  index,
int  seg1,
int  seg2,
int  nSeg1,
int  nSeg2,
DisplayPathCP  path1,
DisplayPathCP  path2,
DgnPlatform::ElementId  elemId1,
DgnPlatform::ElementId  elemId2 
)

Create an intersection association between the two elements identified by the elemId1 and elemId2 parameters.

Parameters
[out]associs the intersection association created by the operation.
[in]indexis the index of the intersection between the two elements where the association will be created. The number of intersections between two elements can be found via the mdlIntersect_allBetweenElms function.
[in]seg1is the index of the segment of element 1 where the intersection occurs.
[in]seg2is the index of the segment of element 2 where the intersection occurs.
[in]nSeg1the number of vertices of element 1. This parameter is optional, you can pass zero. If non-zero this value is used to avoid the association jumping as vertices are inserted/deleted.
[in]nSeg2the number of vertices of element 2. This parameter is optional, you can pass zero. If non-zero this value is used to avoid the association jumping as vertices are inserted/deleted.
[in]path1display path for the element1.
[in]path2display path for the element2.
[in]elemId1used if path1 is NULL...i.e. creating assoc to element that has not been added to the file yet. No verification on the association can be done in this case.
[in]elemId2used if path2 is NULL...i.e. creating assoc to element that has not been added to the file yet. No verification on the association can be done in this case.
Returns
returns SUCCESS if the operation is successful
See also
mdlAssoc_getPoint mdl_createIntersection
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_createKeypoint ( DgnPlatform::AssocPoint *  assoc,
int  vertex,
int  nVertex,
int  numerator,
int  divisor,
DisplayPathCP  path,
DgnPlatform::ElementId  elemId 
)

Creates an association that represents a point on a linear element.

Parameters
[out]assocIf a valid association is created, the association information is returned in assoc. Linear elements are lines, line strings and shapes.
[in]vertexthe index of the vertex directly preceding the association point.
[in]nVertexthe total number of vertices of the linear element. This parameter is optional, you can pass zero. If non-zero this value is used to avoid the association jumping as vertices are inserted/deleted.
[in]numeratorthe distance from vertex number vertex in units of divisor as described below. Its range must be between 0 and 32767.
[in]divisorthe number of units (segments) to be considered between the points at vertex and vertex+1. The values of numerator and divisor are used together as the fraction of the distance between the points at vertex and vertex+1, where the association point will be located. The denominator must be between 1 and 32767.
[in]pathdisplay path for the element.
[in]elemIdused if path is NULL...i.e. creating assoc to element that has not been added to the file yet. No verification on the association can be done in this case.
Returns
returns SUCCESS (zero) if it is able to create a valid association. Otherwise, it returns a non-zero value.
See also
mdlAssoc_createLinear mdlAssoc_getPoint
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_createLinear ( DgnPlatform::AssocPoint *  assoc,
DPoint3dP  inPoint,
int  vertex,
int  nVertex,
int  lineNo,
DisplayPathCP  path,
DgnPlatform::ElementId  elemId 
)

Creates an association that represents a point on a linear element.

This function is similar to mdlAssoc_createKeypoint but has the advantage that it creates associations to multi-line elements as well as other linear elements. Also, this function does not require the numerator and divisor parameters as does mdlAssoc_createKeypoint. Instead, this function automatically calculates the keypoint numerator and divisor based on inPoint and the specified segment of the linear element.

Parameters
[out]assocIf a valid association is created, the association information is returned in assoc.
[in]inPointis the location on the specified linear element that is converted to an associative point.
[in]vertexis the index of the vertex directly preceding the associative point.
[in]nVertexthe total number of vertices of the linear element. This parameter is optional, you can pass zero. If non-zero this value is used to avoid the association jumping as vertices are inserted/deleted.
[in]lineNois a line number used for multi-lines only.
[in]pathdisplay path for the element.
[in]elemIdused if path is NULL...i.e. creating assoc to element that has not been added to the file yet. No verification on the association can be done in this case.
Returns
SUCCESS if a valid linear association is created. Otherwise an non-zero error status is returned.
See also
mdlAssoc_createKeypoint
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_createMline ( DgnPlatform::AssocPoint *  assoc,
int  vertex,
int  nVertex,
int  lineNo,
double  offset,
int  joint,
DisplayPathCP  path,
DgnPlatform::ElementId  elemId 
)

Creates an association that represents a point on a multi-line element.

Parameters
[out]assocIf a valid association is created, the association information is returned in assoc.
[in]vertexthe index of the vertex directly preceding or at the association point.
[in]nVertexthe total number of vertices of the linear element. This parameter is optional, you can pass zero. If non-zero this value is used to avoid the association jumping as vertices are inserted/deleted.
[in]lineNoindicates which line in the multi-line is the association's object. This value is an index into the multi-line profile information that was copied into the multi-line from the tcb when the multi-line was created.
[in]offsetthe distance from the specified vertex to the association point, measured along the work line and divided by the work line length. The information needed to calculate this parameter can be obtained using the mdlVec_... functions. offset is not used if joint is set to true.
[in]jointIf joint is true, the association point is at the intersection of the line specified by lineNo and the joint vector is at vertex. In other words, the association point will always be on the joint.
[in]pathdisplay path for the element.
[in]elemIdused if path is NULL...i.e. creating assoc to element that has
Returns
SUCCESS (zero) if it is able to create a valid association. Otherwise, it returns a non-zero value.
See also
mdlAssoc_getPoint
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_createOrigin ( DgnPlatform::AssocPoint *  assoc,
int  option,
DisplayPathCP  path,
DgnPlatform::ElementId  elemId 
)

Creates an association that represents the origin of the base element.

Origin associations can currently be created for cell headers, shared cells, text nodes and text elements. For elements other than these, an associative point representing the lower left-hand corner of the range block for the element is created.

Parameters
[out]assocIf a valid association is created, the association information is returned in assoc.
[in]optionOrigin of association options.
[in]pathdisplay path for the element.
[in]elemIdused if path is NULL...i.e. creating assoc to element that has
Returns
SUCCESS (zero) if it is able to create a valid association. Otherwise, it returns a non-zero value.
See also
mdlAssoc_getPoint
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_extractPoint ( DgnPlatform::AssocPoint *  assoc,
MSElementCP  elemP,
int  pointNum,
int  maxPoints 
)

Extracts the association information from the specified point on the given element.

Parameters
[out]assocAssociation information
[in]elemPelement to extract point from
[in]pointNumindex of point to extract
[in]maxPointsmax assoc pts on element
Returns
SUCCESS if the information is found, ERROR if an error occurs
See also
mdlAssoc_insertPoint
Remarks
Required Library: mdlbltin.lib
bool mdlAssoc_getCurrent ( DgnPlatform::AssocPoint *  assoc,
DPoint3dP  pointP,
int  option,
UInt16  createMask 
)

Gets the current associative point.

Parameters
[out]assocthe current association point
[out]pointPlocation of current association
[in]optionOption (pass zero)
[in]createMaskelement categories not to create associations for, use ASSOC_CREATE_MASK_ defines or pass 0 to not restrict allowed associations. For example to create an associative dimension you would want to check that dimension associations are enabled so you would pass ASSOC_CREATE_MASK_DIMENSION.
Returns
true if associative point returned
See also
mdlAssoc_extractPoint
Remarks
Required Library: mdlbltin.lib
int mdlAssoc_getElement ( MSElementP  outElmP,
UInt32 filePosP,
DgnPlatform::ElementId  tagValue,
DgnModelRefP  modelRef 
)

Attempts to locate the element with the unique ID elemID in the model specified by modelRef.

The element association functions (mdlAssoc_...) provide access to the element association capabilities used to create association points in dimensions, multi-lines, cells, and shared cells. An association point (DgnPlatform::AssocPoint) is information that represents a point on a persistent element. The actual coordinates of the association point can be extracted at any time.

To create an association, you require the element id of a persistent element that is the association's target or object. Elements are assigned a unique element id when they are added to the design file. The mdlAssoc_create... functions use the element id to create an association point.

Once an association point is created, it can be passed to any of the dimension, multi-line, or shared cell functions that use association points to define geometry.

Parameters
[out]outElmPIf found, the element is returned in element If NULL is passed for element or filePos, the corresponding data is not returned.
[out]filePosPIf found, the element's file position is returned in filePos.
[in]tagValuethe tag (unique ID number) of the element that is the association's object (or root).
[in]modelRefindicates the model that the element is in.
Returns
SUCCESS (zero) if the requested element is located. If the function is unable to locate the element, it returns a non-zero value.
See also
Remarks
Required Library: mdlbltin.lib
int mdlAssoc_getElementDescr ( MSElementDescrH  outElDPP,
UInt32 filePosP,
DgnPlatform::ElementId  tagValue,
DgnModelRefP  modelRef,
bool  expandShared 
)

Search for the element with the unique ID specified by elemID and, if found,

return an element descriptor that contains the element and any child elements it might have if it is a complex element.

Parameters
[out]outElDPPReturn element descr or NULL
[out]filePosPReturn file position or NULL
[in]tagValueTag value to search for
[in]modelRefsource of tagged element
[in]expandSharedexpand shared cells
Returns
SUCCESS if the element is found and an element descriptor was successfully created. MDLERR_BADFILENUMBER is returned if modelRef is not valid. May return ERROR if the element descriptor could not be created.
See also
mdlElement_getID
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_getPoint ( DPoint3dP  outPoint,
DgnPlatform::AssocPoint *  assoc,
DgnModelRefP  modelRef 
)

Uses the information in assocPoint to create a 3D data point that is returned in outPoint.

An mdlAssoc_create... function must create the information in assocPoint.

Parameters
[out]outPointthe point created by the function.
[in]assocassociation information used to create the point.
[in]modelRefthe model that contains the element and the association.
Returns
SUCCESS (zero) if a valid point is created in dPoint. If the information in assocPoint is invalid, the function returns a non-zero value.
See also
mdlAssoc_createArc mdlAssoc_createIntersection mdlAssoc_createKeypoint mdlAssoc_createMline
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_getPointFromElement ( DPoint3dP  outPoint,
MSElementP  elemP,
int  pointNum,
int  maxPoints,
DgnModelRefP  modelRef 
)

Uses the element and point number to create a 3D data point that is returned in outPoint.

An mdlAssoc_create... function must create the information in assocPoint.

Parameters
[out]outPointthe point created by the function.
[in]elemPelement to get the point from.
[in]pointNumpoint number to get.
[in]maxPointstotal number of points on element.
[in]modelRefthe model that contains the element and the association.
Returns
SUCCESS (zero) if a valid point is created in dPoint. If the information in assocPoint is invalid, the function returns a non-zero value.
See also
mdlAssoc_getPoint
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_getRoot ( ElementRefP *  elemRefP,
DgnModelRefP *  elemModelRefP,
TransformP  elemTransformP,
int *  nRootsP,
DgnPlatform::AssocPoint *  assocPointP,
DgnModelRefP  modelRef,
int  rootIndex 
)

Returns the roots of an assoc point.

Parameters
[out]elemRefPextracted root element ref.
[out]elemModelRefPmodel ref for the extracted root elem ref.
[out]elemTransformPtransform applied to root element ref.
[out]nRootsPnumber of roots in this assoc, 1 or 2.
[in]assocPointPassoc point to extract the root from.
[in]modelRefthe model that contains the assoc point.
[in]rootIndexwhich root to extract, 0 or 1 (intersect assoc has 2 roots)
Returns
SUCCESS (zero) if the requested root is extracted.
See also
mdlAssoc_getPoint
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_insertPoint ( MSElementP  elemP,
DgnPlatform::AssocPoint *  assocPointP,
int  pointNum,
int  maxPoints 
)

Insert an association point to the specified element.

Parameters
[in]elemPelement to add association information to
[in]assocPointPAssociation information
[in]pointNumindex of point to insert
[in]maxPointsmax assoc pts on element
Returns
SUCCESS if the information is found, ERROR if an error occurs
See also
mdlAssoc_extractPoint
StatusInt mdlAssoc_removePoint ( MSElementP  elemP,
int  pointNum,
int  maxPoints 
)

Removes from element.

An mdlAssoc_create... function must create the information in assocPoint.

Parameters
[in]elemPelement to remove assoc point from.
[in]pointNumpoint number to remove.
[in]maxPointstotal number of points on element.
Returns
SUCCESS (zero) if point was associative and was removed. If the information is invalid, the function returns a non-zero value.
See also
mdlAssoc_getPoint
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_resolveAssociations ( MSElementP  elemP,
DgnModelRefP  modelRef 
)

Removes all association points from an element.

Parameters
[in]elemPelement to remove assoc point from.
[in]modelRefthe model that contains the element and the association.
Returns
SUCCESS (zero) if associative points removed. If the information is invalid, the function returns a non-zero value.
See also
mdlAssoc_getPoint
Remarks
For an ATTRIBUTE_ELM element (tag element) that is associated with a base element, this computes the distance from the tag to the base element and adds that distance to the origin of the tag. Then it breaks the association between the tag and the base element.
For all element types, the final step is to remove all association point dependency linkages.
Required Library: mdlbltin.lib
int mdlAssoc_stripTag ( MSElementP  elemP)

Remove an association tag from a single element.

Parameters
[in]elemPelement to strip tag from
Returns
SUCCESS if the operation is complete successfully, ERROR otherwise
See also
mdlAssoc_stripTags
Remarks
Required Library: mdlbltin.lib
int mdlAssoc_tagElementDescr ( DgnPlatform::ElementId *  newTagP,
MSElementDescrP  elDscrP,
DgnModelRefP  modelRef 
)

Get the tag value from an element at the specified offset within the specified element descriptor.

If the specified element does not have a tag, then it is assigned a tag and the new tag value is returned in the newTagP argument. This function will return an error if the element descriptor has the complex bit set.

Parameters
[out]newTagPis the new tag created by the function.
[in,out]elDscrPis the element descriptor to which the tag is added.
[in]modelRefindicates the model containing the element receiving the tag.
Returns
SUCCESS if the operation is completed successfully, otherwise ERROR
See also
mdlAssoc_tagElementValue
Remarks
Required Library: mdlbltin.lib
int mdlAssoc_tagElementValue ( DgnPlatform::ElementId *  tagValue,
MSElementP  elemP,
DgnModelRefP  modelRef,
DgnPlatform::ElementId  inTag 
)

Assign a new tag value to the specified element if it doesn't already have one.

Parameters
[out]tagValueis the tag value assigned to the element.
[in]elemPis the element that receives the tag.
[in]modelRefinidcates the model containing the element.
[in]inTagis the input tag value, or zero.
Returns
SUCCESS if the operation completed successfully, otherwise ERROR.
See also
mdlAssoc_tagElementDescr
Remarks
Required Library: mdlbltin.lib
StatusInt mdlAssoc_vertexAddedOrRemoved ( MSElementP  elemP,
int  pointNum,
int  maxPoints,
bool  inserted 
)

Adjust association point indices for the specified element.

Parameters
[in]elemPelement to add association information to
[in]pointNumindex of point added/removed
[in]maxPointsmax assoc pts on element
[in]insertedpass true is vertex has been added; false if it's been removed
Returns
SUCCESS if the information is found, ERROR if an error occurs
See also
mdlAssoc_extractPoint
Remarks
Required Library: mdlbltin.lib
void mdlElmdscr_stripTags ( MSElementDescrH  edPP)

Remove the association tags from all elements within the element descriptor.

Parameters
[out]edPPelement descriptor to strip tags from
See also
mdlAssoc_stripTag
Remarks
Required Library: mdlbltin.lib

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