【MS CE C++】通过ElementPropertiesSetterPtr 如何设置线型 linestyle

请问一下,通过ElementPropertiesSetterPtr 如何设置 linestyle?

ElementPropertiesSetterPtr pPropsSetter = ElementPropertiesSetter::Create();
pPropsSetter->SetLinestyle

Parents Reply Children
  • ElementPropertiesSetterPtr pPropsSetter = ElementPropertiesSetter::Create();
    pPropsSetter->SetColor(COLOR_BYLEVEL);
    pPropsSetter->SetWeight(4);
    DgnFileP dgnFile = ISessionMgr::GetActiveDgnFile();
    Int32 style = LineStyleManager::GetNumberFromName(L"{ -E- }", *dgnFile, true);
    if (style != STYLE_Invalid)
    	pPropsSetter->SetLinestyle(style, NULL);
    pPropsSetter->Apply(eeh);



  • 符工,我这边测试输出的线型结果是-9,也没有赋上属性

    EditElementHandle ehRD;
        LineStringHandler::CreateLineStringElement(ehRD, NULL, pts, 5, false, *destModelP);
        ElementPropertiesSetterPtr pSetterRD = ElementPropertiesSetter::Create();
        pSetterRD->SetColor(COLOR_BYLEVEL);
        pSetterRD->SetWeight(4);
        DgnFileP dgnFile = ISessionMgr::GetActiveDgnFile();
        Int32 lineStyle = LineStyleManager::GetNumberFromName(L"{ -E- }", *dgnFile, true);
        
        printf("lineStyle is %d\n", lineStyle);
        if (lineStyle != STYLE_Invalid)
        {
         pSetterRD->SetLinestyle(lineStyle, NULL);
        }
        pSetterRD->Apply(shpEh);
        ehRD.AddToModel();

    Work smart, not just work hard!

  • 不好意思,是我是我写错了。。。。

     pSetterRD->Apply(shpEh);
        ehRD.AddToModel();

    应该改为

     pSetterRD->Apply(ehRD);
        ehRD.AddToModel();

    抱歉抱歉。。。。

    Work smart, not just work hard!