Setting global linestyle scale on model reference in CONNECT

Hello guys, I have following problem. I cant find replacement in CONNECT version (Microstation CONNECT 15) for this snippet:

ReferenceFile * r = mdlRefFile_getInfo(dgnModelRef);
                r->display.fd_opts.globalLineStyleScales = REF_GLOBALLINESTYLESCALE_REFERENCE;

The remapper file, which is in SDK migration folder mentions DgnAttachment method GetGlobalLineStyleScales(), but the problem is I dont have it there and I want to set it, not get. Did i miss something? Thanks!

  • Hello Jon, thanks for your response. Yes, I´m afraid that the modelRef represented DgnAttachment in my case. However, even if I use the iteration trick from your example and do following 

    DgnModelRefR                model = *ISessionMgr::GetActiveDgnModelP();
            ReachableModelRefCollection refs = model.GetReachableModelRefs();
            for (DgnModelRefP modelRef : refs)
            {
                DgnFileP	pFile = modelRef->GetDgnFileP();
                DgnModelP	pModel = modelRef->GetDgnModelP();
                if (pFile && pModel)
                {
                    if (modelRef->IsDgnAttachment())
                    {
    
                        ModelInfoPtr modelInfo = modelRef->GetDgnModelP()->GetModelInfoCP()->MakeCopy();
                        ModelInfo::LineStyleScaleMode scaleMode = ModelInfo::LineStyleScaleMode::LSSCALEMODE_CompoundScale;
                        if (modelInfo->GetLineStyleScaleMode() != scaleMode)
                        {
                            modelInfo->SetLineStyleScaleMode(scaleMode);
                            modelRef->GetDgnModelP()->SetModelInfo(*modelInfo);
                            modelRef->GetDgnModelP()->SaveModelSettings();
                        } 
    
                    }
                }
            }

    Same thing happens - linestyle on entire model is changed. However, I would like to set the GlobalLineStyleScale on Reference alone. In MDL, I found Bentley::DgnPlatform::RefGlobalLinestyleScale exists, but I cant use it anywhere, so I dont know why it exists there. Maybe I´m missing something. DgnAttachment class offers only SetScaleMode method, which does something else.

    And about the EC schema, I found the property I want to change in DgnModelSchema (click the picture for better view):

    However how to access this property and change it is another mystery for me..

  • Same thing happens - linestyle on entire model is changed

    What do you mean by 'entire model'...

    1. The active model?
    2. The attachment model?

    ReachableModelRefCollection

    There's a note in the help doc: only const iteration is possible.  That means we can't modify the variables obtained via the iterator, which explains your problem.  Unfortunately, help doesn't tell us how to modify an attachment model, which is what you want to do.

    Any suggestions, ?

     
    Regards, Jon Summers
    LA Solutions

  • What do you mean by 'entire model'...

    1. The active model?
    2. The attachment model?

    The current active model setting for linestyle scaling (which can be seen in model properties page)

    However, I want to change the GlobalLineStyleScale on References(DgnAttachments).

  • DgnAttachment class offers only SetScaleMode method

    DgnAttachment inherits from DgnModelRef, so it provides all the properties and methods from that base class.

     
    Regards, Jon Summers
    LA Solutions

  • Hi ,

    and I will take a moment to look at this when we meet this morning and let you know our findings/recommendations.

    Thank you,
    Bob



  • I found solution! 

    mdlRefFile_setIntegerParameters(REF_GLOBALLINESTYLESCALE_REFERENCE, REFERENCE_GLOBALLINESTYLESCALES, attachment);
    Its part of MDL C API and I can´t believe I missed that before. I even managed to use the enum Bentley::DgnPlatform::RefGlobalLinestyleScale (i mean, I´m not sure how long will this old C approach work in CONNECT, but as for now im happy it works as expected!)

    Thank you guys for your time and help :-)

    Answer Verified By: Robert Hook