Hi,
First of all - thank you for appreciating our efforts in diagramming!
Regarding your questions:
1) Adding shapes
The drawing is partitioned in layers. Of all layers in the diagram only one is active at a time and you will typically add shapes to the active layer. By default the drawing is created with a single layer which is at the same time the active one. You add shapes to the active layer like this:
drawing.ActiveLayer.AddChild(shape);
If you have a library, and you want to create a shape instance for a master contained in it you can use the NMaster CreateInstance method:
NMaster master = library.GetChildByName("My Shape") as NMaster;
master.CreateInstance(drawing.ActiveLayer, new NPointF(100, 100));
2) Attaching data to masters
A common misunderstanding is that the master contains only a single shapes - in fact it can contain several elements and even connected structures - so the master is in fact a drawing clipping. So when a master is dropped on a drawing it can actually create several shape instances in the drawing.
The best way to attach custom data to shapes contained in the library is to load the library and assign the Tag property of each shape that is contained within your master. If your library has only one shape per master - then you can use this code:
foreach (NMaster master in libraryDocument)
{
foreach (NDiagramElement element in master)
{
element.Name = master.Name;
element.Tag = "Shape of " + master.Name;
}
}
When the shape is dropped to the drawing its tag will remain the same (the name may be automatically changed if you drop for example two shapes named Car - the second will be automatically named Car_1).
3) More for tags
Since the diagram has no way of knowing what type of object you are assigning to the Tag property, the tag objects must obey to the following criterias:
a) have a default constructor
b) be marked as serialiable
c) implement the ICloneable interface
Hope this helps - questions or comments - please feel free...
Best Regards,
Nevron Support Team