[CONNECT C++ U12] ElementTemplateParamsHelper::GetLineStyleName()

The second parameter for this function is a boolean  "isNamedStyle". It seems to be returning an inconsistent result. I have two custom LineStyles that are used in two different Element Templates. When I test GetLineStyleName() using each element template, one will return "true" and the other returns "false". Both *do* return the expected custom LineStyle name. My initial thought was the value returned indicated if the linestyle was a "built-in" linestyle or not:

return "true" - linestyle is 0-7

return "false" - linestyle is "custom" from a linestyle resource file.

it doesn't seem to be behaving like that... What determines the value of the returned "isNamedStyle"?

Bruce

Parents
  • When I test GetLineStyleName() using each element template, one will return "true" and the other returns "false"

    ElementTemplateParamsHelper::GetLineStyleName() is documented as returning an ElementTemplateStatus

    ETSTATUS_Success is BSISuccess, which is zero.  Other values provide an explanation for failure.

    My initial thought was the value returned indicated if the linestyle was a "built-in" linestyle or not

    Documentation has this: If the style is a named style in a DGNLIB file, isNamedStyle will be set to true.

     
    Regards, Jon Summers
    LA Solutions

  • Documentation has this: If the style is a named style in a DGNLIB file, isNamedStyle will be set to true.

    This is not quite true, based on my investigation. When the Element Template contains an entry for LineStyle, and that LineStyle is NOT in the DgnFile, the results are not consistent. I was attempting to use MStnElementTemplateMgr::ActivateElementTemplateByPath() and discovered that my expectation that the MstnElementTemplateMgr would automatically grab the LineStyle from the resource when ActivateElementTemplateByPath() is called is wrong - it does not grab the LineStyle definition from the resource.

    In tracking down the issue, I also discovered that using LineStyleManager::GetNumberFromName(WCharCP, DgnFileR, bool, bool) does not return a LineStyle ID unless that LineStyle was already in the DgnFile. However, using LineStyleManager::GetNumberFromName(WCharCP, DgnFileR, bool) DID! Subtle nuances of that method...

Reply
  • Documentation has this: If the style is a named style in a DGNLIB file, isNamedStyle will be set to true.

    This is not quite true, based on my investigation. When the Element Template contains an entry for LineStyle, and that LineStyle is NOT in the DgnFile, the results are not consistent. I was attempting to use MStnElementTemplateMgr::ActivateElementTemplateByPath() and discovered that my expectation that the MstnElementTemplateMgr would automatically grab the LineStyle from the resource when ActivateElementTemplateByPath() is called is wrong - it does not grab the LineStyle definition from the resource.

    In tracking down the issue, I also discovered that using LineStyleManager::GetNumberFromName(WCharCP, DgnFileR, bool, bool) does not return a LineStyle ID unless that LineStyle was already in the DgnFile. However, using LineStyleManager::GetNumberFromName(WCharCP, DgnFileR, bool) DID! Subtle nuances of that method...

Children
No Data