Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: [CONNECT C++] ECProperty value list

$
0
0

[quote user="Paul Connelly"]auto map = attr->GetValue(value, L"ValueMap", i);
ECValue integer, displayString;
map->GetValue(integer, L"Value");[/quote]

Thanks for the hint: you set me off on the right track.  Unfortunately, that doesn't compile — ECValue (auto's type) doesn't have a GetValue() method.

For those <ValueMap><ValueMap>pair1</ValueMap><ValueMap>pair2</ValueMap></ValueMap> structures we need to use ECValue.GetStruct() to obtain an ECInstance that we can then query for the pair1, pair2 values.

ECN::ECClassCP      formatClass { schema->GetClassCP (L"ClassName") };
ECPropertyIterable  props       { formatClass->GetProperties () };

for (ECPropertyCP prop: props)
{
  IECInstancePtr    standardVals = prop->GetCustomAttribute (L"EditorCustomAttributes", L"StandardValues");
  ECValue           valuesArray;
  standardVals->GetValue (valuesArray, L"ValueMap");
  if (valuesArray.IsArray ())
  {
    ECValue         valueMap;
    for (uint32_t   i = 0; i < valuesArray.GetArrayInfo().GetCount(); ++i)
    {
       standardVals->GetValue (valueMap, L"ValueMap", i);
       if (valueMap.IsStruct ())
       {
         IECInstancePtr pair  = valueMap.GetStruct ();
         ECValue        integer, displayString;
         pair->GetValue (integer, L"Value");
         pair->GetValue (displayString, L"DisplayString");
       }
    }
}

Here's an extract for AreaClass/Units...

US Survey Inches=1124
US Survey Feet=1099
US Survey Miles=1049
Micrometers=2150
Millimeters=2125
Centimeters=2100
Meters=2075
Kilometers=2050
MicroInches=1175
Mils=1150
Inches=1125
Feet=1100
Yards=1075
Miles=1050
Acres=-3
(Use Active Sub Units)=-2
(Use Active Master Units)=-1
'Units' valuesArray count=17


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>