Hierarchy of NamedObjects
#2
After reading the 3ds file with Reader3ds you can get the names of read objects from NamedObjects dictionary - it is a dictionary where key is the name of the object and value is the 3D object (Model3DGroup, GeometryModel3D, et.)

NamedObjects is very useful if you want to access the read objects by its name - for example:

((GeometryModel3D)myReader3ds.NamedObjects["headObject"]).Material = new DiffuseMaterial(Brushes.Red);

But if you want to iterate though read objects and get their names I would recommend you to convert the NamedObjects dictionary to ObjectNames dictionary - for example:

var namedObjects = myReader3ds.NamedObjects;
var objectNames = new Dictionary<object, string>();
foreach (KeyValuePair<string, object> namedObject in namedObjects)
{
if (namedObject.Value != null)
objectNames[namedObject.Value] = namedObject.Key;
}
Andrej Benedik
  


Messages In This Thread
Hierarchy of NamedObjects - by fred_2420 - 07-19-2014, 12:26 PM
RE: Hierarchy of NamedObjects - by abenedik - 07-20-2014, 10:26 PM
RE: Hierarchy of NamedObjects - by fred_2420 - 11-07-2014, 03:07 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)