Message 1 of 3
MLeader AttributeReference width factor change
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to change the width factor of an attribute which is in a Mleader. I tested the code below and it doesn't work. But, if I use the same code to change the attribute value it works.
MLeader ml = tr.GetObject(id, OpenMode.ForWrite) as MLeader;
if (ml != null)
{
BlockTableRecord btrBlock = tr.GetObject(ml.BlockContentId, OpenMode.ForRead) as BlockTableRecord;
if (btrBlock.HasAttributeDefinitions)
{
foreach (ObjectId atId in btrBlock)
{
DBObject obj = tr.GetObject(atId, OpenMode.ForRead);
if (obj is AttributeDefinition)
{
AttributeDefinition adef = obj as AttributeDefinition;
if (adef.Tag.Equals(GhAcBubbleSettings.BubbleId))
{
AttributeReference aref = ml.GetBlockAttribute(adef.Id);
if (!aref.IsErased && aref.Tag.Equals(bid))
{
if (isWidhtAuto)
widthFactor = aref.GetBestFitWidthFactor();
aref.WidthFactor = widthFactor;
// force regen the entity?
aref.Visible = aref.Visible;
ml.SetBlockAttribute(adef.Id, aref);
break;
}
}
}
}
}
}
Thanks for any reply.