Hi, I have V8i MDL code using
mdlElementTemplate_getElementParam() and
mdlElementTemplate_getNumElementParams()
Looking for a replacement of these functions, I searched the Connect 10 Update 14 SDK and found:
ElementTemplateParamsHelper::GetEntryCount (UInt32& numEntries, ECN::IECInstanceCR etInstance, ElementParameterType param);
ElementTemplateParamsHelper::GetElementColor(UInt32& color, DgnModelRefP modelRef, ECN::IECInstanceCR etInstance, UInt index=0);
How do I fill the input parameter ECN::IECInstanceCR etInstance?
Hi Tom,
I guess information in ElementTemplateNode Struct Reference chapter in SDK documentation can help you. There are code snippets available for CRUD operations with element templates.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: Tom Torell
Hi Jan,thank you, this was the information I was looking for.Now I'm able to migrate and compile my code for Connect. Till yet I can't confirm if this is working correctly at runtime; I will confirm this later, when I tested my application.The solution is quite simple, if you know what to do, so I share my example code snippet here:
#include <Mstn\MdlApi\MdlApi.h> DGNPLATFORM_TYPEDEFS(TemplateSymbologyRemapper) #include <Mstn\XDataTree\MstnElementTemplate.h> { MstnElementTemplateMgrStatus stat; ElementTemplateNodePtr pElementTemplate = NULL; ECN::IECInstancePtr etPropertyInstance; UInt32 uiCntParam = 0; UInt32 uiColor = 0; stat = MstnElementTemplateMgr::CreateFromExisting(pElementTemplate, szTemplatePath); if (stat != MSTNELEMENTTEMPLATE_STATUS_SUCCESS) { ; // Error Handling ... } etPropertyInstance = pElementTemplate->GetOrCreateDefaultInstance(); stat = ElementTemplateParamsHelper::GetEntryCount(uiCntParam, *etPropertyInstance, ElementParameterType::ELEMENTPARAM_Color); if (stat != MSTNELEMENTTEMPLATE_STATUS_SUCCESS) { ; // Error Handling ... } stat = ElementTemplateParamsHelper::GetElementColor(uiColor, ACTIVEMODEL, *etPropertyInstance); if (stat != MSTNELEMENTTEMPLATE_STATUS_SUCCESS) { ; // Error Handling ... } }
Best regards,Tom