I have two files open. One uses horizontal text in radius annotation (see the first picture). The second uses a straight line in radius annotation (see the second picture). I cannot find any difference in the settings of the two files. How do I get the second file's annotation like the first?
Asked
Active
Viewed 106 times
1 Answers
0
For a non-programmatic approach, you can import the 'Dimension Style' from one drawing to the other.
Using programming, just enumerate all properties of the style and compare. Below is a code for entities, but you need to adjust for Dim Style:
[CommandMethod("compEnt")]
public static void CmdCompareEntities()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
ObjectId id1, id2;
//select the entities
PromptEntityResult per1, per2;
per1 = ed.GetEntity("\nSelect first entity: ");
id1 = per1.ObjectId;
per2 = ed.GetEntity("\nSelect second entity: ");
id2 = per2.ObjectId;
//some error check
if (per1.Status != PromptStatus.OK ||
per2.Status != PromptStatus.OK) return;
Database db =
Application.DocumentManager.MdiActiveDocument.Database;
using (Transaction trans =
db.TransactionManager.StartTransaction())
{
//open the entities
Entity ent1 = (Entity)trans.GetObject(id1, OpenMode.ForRead);
Entity ent2 = (Entity)trans.GetObject(id2, OpenMode.ForRead);
Type entType1 = ent1.GetType();
Type entType2 = ent2.GetType();
//the two entities should be the same type
if (!entType1.Equals(entType2)) return;
//get the list of properties and iterate
System.Reflection.PropertyInfo[] props =
entType1.GetProperties();
foreach (System.Reflection.PropertyInfo prop in props)
{
try
{
//get both values property value
object val1, val2;
val1 = prop.GetValue(ent1, null);
val2 = prop.GetValue(ent2, null);
if (val1 != null & val2 != null)
{
//are equal?
if (!(val1.Equals(val2)))
{
//if not, write the value
ed.WriteMessage("\n{0} is different: {1} | {2}",
prop.Name, val1.ToString(), val2.ToString());
}
}
}
catch (Autodesk.AutoCAD.Runtime.Exception ex)
{
}
}
trans.Commit();
}
}

Augusto Goncalves
- 8,493
- 2
- 17
- 44