HowTo : How to display the Attribute string after vdInsert's explode
Article | 60001138 |
Type | HowTo |
Product | Engine |
Version | 6 |
Date Added | 4/30/2010 |
Submitted by | Sami Tainio |
Keywords | |
Subject
How to display the Attribute string after vdInsert's explode
Summary
Is it possible to display the value and not the tag of a vdAttribute after the explode of the vdInsert ?
Solution
This is what happen to all CAD software for inserts that have Attributes (vdAttribDef & vdAttribs) inside. It is not a problem or a bug. If you like to keep the text displayed the same then you have to use a "special" explode that will change the TagString property of these attrib-definitions. See the code below :
private void button2_Click(object sender, EventArgs e)
{
VectorDraw.Professional.vdFigures.vdInsert ins = vdFramedControl1.BaseControl.ActiveDocument.ActiveLayOut.Entities[0] as VectorDraw.Professional.vdFigures.vdInsert;
// assume that the drawing contains only a vdInsert with attributes so this is Entity 0.
if (ins == null) return;
VectorDraw.Professional.vdCollections.vdEntities exploded_entities = ins.Explode();
vdFramedControl1.BaseControl.ActiveDocument.UndoHistory.StoreUndoGroup(true, "EXPLODE");
ins.Deleted = true;
foreach (VectorDraw.Professional.vdPrimaries.vdFigure var in exploded_entities)
{
vdFramedControl1.BaseControl.ActiveDocument.ActiveLayOut.Entities.AddItem(var);
VectorDraw.Professional.vdFigures.vdAttribDef def = var as VectorDraw.Professional.vdFigures.vdAttribDef;
if (def != null)
{
def.TagString = def.ValueString.ToString(); // this is the code that you want that the default explode function do not have
}
var.Invalidate();
}
vdFramedControl1.BaseControl.ActiveDocument.UndoHistory.StoreUndoGroup(false, "EXPLODE");
}