I have a DGN, where I placed a parametric Cell with Variables attached to it (used with constraints). When I only read and write with my function, everything works as expected. When I edit the value of one Parameter inside the Microstation (Element Info), my Function gets old Data, when reading it. Restarting the Microstation doesn't help and I still get the old data. My Function:
if (!(elementIn is ParametricCellElement cell)) return;
ParameterDefinitions defs = cell.CellDefinition.GetParameterDefinitions();
IList<ParameterDefinition> lstDefinitions = defs.GetParameterDefinitions();
foreach (ParameterDefinition def in lstDefinitions)
//IDgnECInstance ins = defs.Properties as IDgnECInstance;
IECInstance ins = cell.CellDefinition.Parameters;
IECPropertyValue pv = ins.FindPropertyValue(def.AccessString, false, false, false, true);
I tried both IDgnECInstance ins = defs.Properties as IDgnECInstance; and IECInstance ins = cell.CellDefinition.Parameters; but it made no difference. The other comment is just an example on how I access the values (the actual access is more complex). The Question now is, how I can get the actual data. Do I access the parameters wrong? Is there a synchronize command? Is the SDK broken? I ripped the Functions from the SDK examples: MicroStation\mdl\examples\Constraints\ParametricModelingExampleThis example is for the Model, but re writing it a bit and it works for Elements too.
Can you please share your modified code sample?
Also, I am guessing that you want to read all variables and then edit them, right?