diff --git a/src/CADShared/ExtensionMethod/Entity/BlockReferenceEx.cs b/src/CADShared/ExtensionMethod/Entity/BlockReferenceEx.cs index cdeda3235a45a8008fbae8c737731395491d4793..067eba612ce077ee0733f53e0d4c95dba77ada56 100644 --- a/src/CADShared/ExtensionMethod/Entity/BlockReferenceEx.cs +++ b/src/CADShared/ExtensionMethod/Entity/BlockReferenceEx.cs @@ -131,6 +131,7 @@ public static bool ChangeBlockProperty(this BlockReference blockReference, strin public static void ChangeBlockAttribute(this BlockReference blockReference, Dictionary propertyNameValues) { + var num = propertyNameValues.Count; var tr = DBTrans.GetTopTransaction(blockReference.Database); foreach (var item in blockReference.AttributeCollection) { @@ -146,13 +147,15 @@ public static void ChangeBlockAttribute(this BlockReference blockReference, att = (AttributeReference)item; } - using (att.ForWrite()) + if (propertyNameValues.TryGetValue(att.Tag, out var value)) { - if (propertyNameValues.TryGetValue(att.Tag, out var value)) + using (att.ForWrite()) { att.TextString = value; att.AdjustAlignment(blockReference.Database); } + if (--num == 0) + break; } } }