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

RE: [CONNECT] How to retrieve values from IECPropertyValue object

$
0
0

I'm running into problems retrieving data. On my element, I found a single instance (Bentley.DgnPlatformNET.DgnEC.DgnECInstanceCollection) which contains (at least) 1 class: LineStringElement. Attempting to iterate through the properties, I see my XAttribute data as a "property" of the line string. However, wen I attempt to grab the actual values of the properties, I always get an "Internal Error: Access Violation" when any property that is NOT a "string" type property is encountered. I can see that there are numerous other "types" included (Long, double, boolean, ECArray, Point3d, etc). I just can't figure out how to retrieve them. The problem is that retrieving the values is not consistent in terms of where it fails. For example, when a boolean type is encountered, sometimes it will return the value and other times it will abort.

foreach (IECProperty prop in instance.ClassDefinition.Properties(true/*include baseclass properties*/))
{
  string type = prop.Type.Name.ToLower();
  IECPropertyValue propValue = instance.GetPropertyValue(prop.Name);
  if (propValue != null)
  {
    switch (type)
    {
      case "boolean":
      message1.BriefMessage = "    PropertyValue (boolean): " /*+ propValue.StringValue*/;  //sometimes fails when "propValue.StringValue" included
      break;
    }
    Bentley.DgnPlatformNET.NotificationManager.OutputMessage(message1);
  }
}

Thanks,

Bruce


Viewing all articles
Browse latest Browse all 7260

Trending Articles