»
// *ALL* elements are
bundled together and accessible via Document's ElementIterator
» string line;
» Element elem;
» ElementIterator iter = commandData.Application.ActiveDocument.Elements;
» while( iter.MoveNext() )
»
{
»
elem = iter.Current as Element;
»
line = "Id=" + elem.Id.Value.ToString(); // Element Id
»
line += "; Class=" + elem.GetType().Name; // Element class
(System.Type)
» // Element Category, not implemented for
all classes, may return null:
»
line += "; Category=" + ( null == elem.Category ? string.Empty : elem.Category.Name );
» // Element Name (different meaning for different
classes, but mostly implemented logically")
» // Later, we'll see that more precise
info on elements can be obtained in class-specific ways...
»
line += "; Name=" + elem.Name;
»
sw.WriteLine( line );
»
}
Id=16; Class=DimensionType; Category=; Name=Linear -
3mm Arial
Id=17; Class=Element; Category=; Name=
Id=19; Class=Element; Category=; Name=
Id=20; Class=FillPattern; Category=; Name=Solid
fill
. . .
Id=126907; Class=Element; Category=; Name=M_W-Wide
Flange
Id=126908; Class=Element; Category=;
Name=W310X38.7
Id=126933; Class=Element; Category=; Name=Section
Boxes
Id=126939; Class=Wall; Category=Walls; Name=Generic -
200mm