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!
Hi Lubo B,
Take a look at ..\include\DgnPlatform\DgnFileIO\ModelInfo.h (simply include - ..\DgnPlatform\DgnFile.h, or ..\DgnPlatform\DgnModel.h); where you will find:
HTH,Bob
Hello Robert, thanks for your response! I´ve tried it, however, it changes the linestyle mode on entire model, isn´t there a way to change linestyle scale mode just for the reference, like the code snippet did back in the times?
For reference I´ve used
:
ModelInfo::LineStyleScaleMode scaleMode = ModelInfo::LineStyleScaleMode::LSSCALEMODE_LineStyleScale; modelInfo->SetLineStyleScaleMode(scaleMode); modelRef->GetDgnModelP()->SetModelInfo(*modelInfo); modelRef->GetDgnModelP()->SaveModelSettings();
And to be more clear, I want to change the global linestyle on model reference to Reference, just like in picture
Or is there no way in CONNECT?
I see, thanks for information! However, I still want to keep the CE API as the last resort (for unecessary includes)..
Lubo B said:However, I still want to keep the CE API as the last resort (for unecessary includes)..
Do you mean CE or EC API? ;-)
... but both cases sound really weird to me and I see no reason for such prioritization.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Uhh, i meant EC API! But yeah, if nothing comes up, I will have no other choice.
Hello, sorry for late response, but after some time has passed and I didn´t find a way with native MDL, I´ve decided to give EC API a try. However, it feels like I´m missing something.
FindInstancesScopePtr ptr = FindInstancesScope::CreateScope(*modelRef->GetDgnModelP(), FindInstancesScopeOption(DgnECHostType::Attachment)); ECQueryPtr query = ECQuery::CreateQuery(ECQUERY_PROCESS_SearchAllClasses); DgnECInstanceIterable iterable = Bentley::DgnPlatform::DgnECManager::GetManager().FindInstances(*ptr, *query); for (DgnECInstanceIterable::const_iterator it = iterable.begin(); it != iterable.end(); ++it) { DgnECInstancePtr instance = *it; //just test of changing value, but instance is readonly auto res = instance->SetValue(L"GlobalLineStyleScale", Bentley::ECN::ECValue(L"1")); }
Lubo B said:it changes the linestyle mode on entire model, isn´t there a way to change linestyle scale mode just for the reference modelRef->GetDgnModelP()->SetModelInfo(*modelInfo)
modelRef->GetDgnModelP()->SetModelInfo(*modelInfo)
What is the modelRef in your code: the active model or an attachment?
modelRef
Here's how to enumerate reference attachments with C++.
Regards, Jon Summers LA Solutions
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..
Lubo B said:Same thing happens - linestyle on entire model is changed
What do you mean by 'entire model'...
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, Robert Hook?
Jon Summers said:What do you mean by 'entire model'... The active model? 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).
Lubo B said:DgnAttachment class offers only SetScaleMode method
DgnAttachment inherits from DgnModelRef, so it provides all the properties and methods from that base class.
DgnAttachment
DgnModelRef
Hi Jon Summers,
Artur Goldsweer 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);
Thank you guys for your time and help :-)
Answer Verified By: Robert Hook