Functions
Line Styles

Functions

int mdlLineStyle_numberFromName (Int32 *pStyleNo, WCharCP pWName, DgnModelRefP modelRef, int createIfNotFound)
 Finds the line style number for line style of the given name. More...
 
StatusInt mdlLineStyle_nameFromNumber (WCharP pName, int nameLength, long styleNo, DgnModelRefP modelRef, int option)
 Find the line style name for line style of the given number. More...
 
int mdlLineStyle_extractEffectiveParams (LineStyleParamsP pStyleParamOut, MSElementCP pElementIn, const DgnModelRefP pModelRefIn, void *pElementPathIn, int viewIndexIn)
 The effective line style of an element is the fully resolved line style; in other words, the style with which it will be drawn. More...
 
int mdlLineStyle_extractParams (LineStyleParamsP pStyleParamOut, MSElementCP pElementIn)
 Extract the line style parameter linkage from an element. More...
 
void mdlLineStyle_infoExtract (LineStyleParamsP pParams, LineStyleInfoCP pLsInfo)
 Extracts line style parameters from the specified line style information. More...
 
int mdlLineStyle_getElementDescr (MSElementDescrH pOutDscr, MSElementDescrP pInDscr, DgnModelRefP modelRef, int option)
 Convert an element with a custom line style to the individual primitive elements that represent the line style components. More...
 
int mdlLineStyle_expandSymbolDescr (MSElementDescrH symDscr, MSElementDescrP elmDscr, DgnModelRefP modelRef)
 Duplicate the elements in elmDscr, expand any elements that cannot be used in a point symbol and appends them to the element descriptor chain symDscr. More...
 
int mdlLineStyle_createSymbolResource (DgnPlatform::PointSymRsc **pSymRsc, MSElementDescrP symDscr, Dpoint3d *pOrigin)
 Allocate and initialize a point symbol resource and appends the elements from the element descriptor chain symDscr. More...
 
void mdlLineStyle_freeSymbolResource (DgnPlatform::PointSymRsc **ppSymRsc)
 Reclaim the memory occupied by a point symbol resource. More...
 
StatusInt mdlLineStyle_reloadAll (WCharCP fileName, DgnModelRefP modelRef, long option)
 Reload all line style resources. More...
 
StringListP mdlLineStyle_getLinNames (WCharCP linFileName, int numInfoFields)
 Get a StringList of style names and descriptions in a .lin file. More...
 
StatusInt mdlLineStyle_loadLinDefinition (WCharCP linFileName, WCharCP *definitionsToLoad, int numDefinitions, DgnModelRefP modelRef, double linUnitsToMuFactor)
 Load one or more definitions from a .lin file into the specified design file. More...
 

Detailed Description

Function Documentation

int mdlLineStyle_createSymbolResource ( DgnPlatform::PointSymRsc **  pSymRsc,
MSElementDescrP  symDscr,
Dpoint3d pOrigin 
)

Allocate and initialize a point symbol resource and appends the elements from the element descriptor chain symDscr.

The element descriptor, symDscr, should be created using mdlLineStyle_expandSymbolDescr so that it does not contain elements that cannot be used in a line style definition.

Parameters
[out]pSymRscNew symbol resource (allocated)
[in]symDscrElement descriptor from which resource will be created.
[in]pOriginThe coordinates of the symbol origin must be specified in pOrigin.
Remarks
A symbol description string can be added by filling in the point symbol field, sym.header.descr (see mslstyle.h), with a null terminated ASCII string. Use mdlResource_add to add the point symbol resource to a style library. It is a good idea to pass the point symbol description to mdlResource_add as the resource alias so that the symbol resource can be located by name for use in the PLACE SYMBOL command.
It is the responsibility of the caller to free the memory used by pSymRsc by calling mdlLineStyle_freeSymbolResouce.
Returns
SUCCESS or an error status.
See also
mdlLineStyle_freeSymbolResource
int mdlLineStyle_expandSymbolDescr ( MSElementDescrH  symDscr,
MSElementDescrP  elmDscr,
DgnModelRefP  modelRef 
)

Duplicate the elements in elmDscr, expand any elements that cannot be used in a point symbol and appends them to the element descriptor chain symDscr.

If *symDscr is NULL, a new element descriptor is allocated.

Parameters
[out]symDscrelement descriptor; if *symDscr is not NULL, elements will be appended. If *symDscr is NULL, a new element descriptor will be created. This parameter may not be NULL.
[in]elmDscrexisting element descriptor
[in]modelRefThe modelRef argument is required to resolve associative points and shared cell definitions. Use ACTIVEMODEL for the active model, or a valid DgnModelRefP to indicate information from a referenced file.
Remarks
It is the responsibility of the caller to free the memory used by symDscr by calling mdlElmdscr_freeAll.
Returns
SUCCESS or an error status.
int mdlLineStyle_extractEffectiveParams ( LineStyleParamsP  pStyleParamOut,
MSElementCP  pElementIn,
const DgnModelRefP  pModelRefIn,
void *  pElementPathIn,
int  viewIndexIn 
)

The effective line style of an element is the fully resolved line style; in other words, the style with which it will be drawn.

. If a line style is by level, this function will extract the level override parameters, and then apply the element override parameters. This is different from mdlLineStyle_extractParams which will return only the element line style parameters. Use LineStyleManager::GetNumberFromName() or LineStyleManager::GetStyleIDForDesignFile() for a newer API.

Parameters
[out]pStyleParamOutCustom parameters applied to line style on this element.
[in]pElementInElement to get lines style for.
[in]pModelRefInModel ref associated with this element.
[in]pElementPathInElement path (currently unused).
[in]viewIndexInThe view index is used to extract whether the line style overrides are active for the element.
Returns
SUCCESS if the element has a custom line style and has parameters; ERROR if it is one of the standard eight codes (0-7) or has no parameters.
See also
mdlLineStyle_extractParams
mdlElement_getEffectiveLineStyle
int mdlLineStyle_extractParams ( LineStyleParamsP  pStyleParamOut,
MSElementCP  pElementIn 
)

Extract the line style parameter linkage from an element.

The parameters describe specific overrides to a line style that apply only to the particular element. See the StyleParams structure for a list of the possible overrides.

Parameters
[out]pStyleParamOutcustom parameters applied to line style on this element.
[in]pElementInpoints to element to get lines style for.
Returns
SUCCESS if the element has a custom line style and has parameters; ERROR if it is one of the standard eight line codes (0-7) or has no parameters.
See also
mdlLineStyle_extractEffectiveParams
void mdlLineStyle_freeSymbolResource ( DgnPlatform::PointSymRsc **  ppSymRsc)

Reclaim the memory occupied by a point symbol resource.

Parameters
[in]ppSymRscthe symbol resource, previously allocated by mdlLineStyle_createSymbolResource
See also
mdlLineStyle_createSymbolResource
int mdlLineStyle_getElementDescr ( MSElementDescrH  pOutDscr,
MSElementDescrP  pInDscr,
DgnModelRefP  modelRef,
int  option 
)

Convert an element with a custom line style to the individual primitive elements that represent the line style components.

Parameters
[out]pOutDscrpoints to the address of an element descriptor containing the component elements representing the line style.
[in]pInDscris an element with a custom line style.
[in]modelRefis the model containing pInDscr. ACTIVEMODEL can be used for the active model, or a valid DgnModelRefP can be specified for a referenced model.
[in]optionIf option is set to LSOPT_SETGG, the output elements are placed in a graphic group. If it is zero, they are not.
Returns
SUCCESS or an appropriate error code. See mdlerrs.r.h for a list of codes.
StringListP mdlLineStyle_getLinNames ( WCharCP  linFileName,
int  numInfoFields 
)

Get a StringList of style names and descriptions in a .lin file.

See LineStyleUtil::GetLinNameList() for a better API than stringlists.

Parameters
[in]linFileNameThe name of the lin file to parse.
[in]numInfoFieldsThe number of info fields for the StringList. If it is to be used in a dialog box, this should be 1.
Returns
A pointer to a StringList if successful; otherwise NULL. The StringList has 2 columns names and descriptions.
Remarks
It is the responsibility of the caller to free the memory used by the StringList by calling mdlStringList_destroy.
void mdlLineStyle_infoExtract ( LineStyleParamsP  pParams,
LineStyleInfoCP  pLsInfo 
)

Extracts line style parameters from the specified line style information.

Parameters
[in,out]pParamsa DgnPlatform::LineStyleParams structure pointer indicating where the data will be copied to.
[in]pLsInfothe DgnPlatform::LineStyleInfo to copy the style parameters from.
Remarks
Style parameters are used in a linkage, and line style information structures are used in the TCB and other places.
StatusInt mdlLineStyle_loadLinDefinition ( WCharCP  linFileName,
WCharCP *  definitionsToLoad,
int  numDefinitions,
DgnModelRefP  modelRef,
double  linUnitsToMuFactor 
)

Load one or more definitions from a .lin file into the specified design file.

Parameters
[in]linFileNameThe name of the lin file to parse.
[in]definitionsToLoadAn array of strings containing the names of the definitions to load.
[in]numDefinitionsThe number of names in the array definitionsToLoad.
[in]modelRefA modelRef from the design file to load the definitions. Since linestyles are file-wide, any model ref from the file is acceptable.
[in]linUnitsToMuFactorA conversion factor from the units in the .lin file to the master units of the DGN file.
Remarks
This function will return an error for any failure, it may be called with each individual line style to load rather than will all the styles for a given .lin file. This technique will suffer some performance loss, but will allow the caller to provide detailed error messages.
Returns
If all requested defintions are added, SUCCESS will be returned. If any definition fails, then an error code will be returned. If the number of styles loaded is different than numDefinitions, MDLERR_STYLENOTFOUND will be returned.
StatusInt mdlLineStyle_nameFromNumber ( WCharP  pName,
int  nameLength,
long  styleNo,
DgnModelRefP  modelRef,
int  option 
)

Find the line style name for line style of the given number.

The number is the value that is stored on the element; the name is what is displayed in the dialog box or acquired from functions such as mdlLineStyle_nameGetStringList. Use LineStyleManager::GetNameFromNumber() for a newer API that returns a WString.

Parameters
[out]pNamethe line style name, or "\0" if not found. This parameter can be NULL when checking for existence.
[in]nameLengthThe number of characters in the buffer pName.
[in]styleNothe line style number to find.
[in]modelRefthe model to search for the line style. Line style ids are dependent on the name map of the file they are in.
[in]optionCurrently unused; pass 0 for compatibility with future versions.
Returns
SUCCESS if the name exists in the modelRef's name map.
See also
mdlLineStyle_numberFromNameW mdlLineStyle_nameFromNumber
int mdlLineStyle_numberFromName ( Int32 pStyleNo,
WCharCP  pWName,
DgnModelRefP  modelRef,
int  createIfNotFound 
)

Finds the line style number for line style of the given name.

The number is the value that is stored on the element; the name is what is displayed in the dialog box or acquired from functions such as mdlLineStyle_getNameListModelW.

Parameters
[out]pStyleNoThe line style number, or 0 if not found. Can be NULL to just check for existence.
[in]pWNameThe line style name to find an ID for.
[in]modelRefThe model to search for the line style. Line style ids are dependent on the name map of the file they are in.
[in]createIfNotFoundIf the name is not found and this option is true, then a new name map entry will be created. Programs that plan on using this number to set the line style should always pass true.
Returns
SUCCESS if the named style is found, ERROR if not found or created.
See also
mdlLineStyle_nameFromNumberW mdlLineStyle_numberFromName
StatusInt mdlLineStyle_reloadAll ( WCharCP  fileName,
DgnModelRefP  modelRef,
long  option 
)

Reload all line style resources.

It is necessary when a resource file that is currently loaded in MicroStation is modified.

Parameters
[in]fileNamethe name of the file that changed. If this is not NULL, this resource file will be closed completely and reopened in MicroStation read-only to access the styles.
[in]modelRefThe modelRef to reload the name map for; usually ACTIVEMODEL.
[in]optionCurrently unused; should be set to 0.
Returns
SUCCESS if the reload operation succeeded.

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