Горизонтальный текст в радиусе аннотации. [Autocad]
У меня есть два открытых файла. Один использует горизонтальный текст в аннотации радиуса (см. Первое изображение). Второй использует прямую линию в аннотации радиуса (см. Второе изображение). Я не могу найти никакой разницы в настройках двух файлов. Как я могу получить аннотацию второго файла, как первый?
1 ответ
Для непрограммного подхода вы можете импортировать "Размерный стиль" из одного чертежа в другой.
Используя программирование, просто перечислите все свойства стиля и сравните. Ниже приведен код для сущностей, но вам необходимо настроить 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();
}
}
Источник: Сравнение свойств двух объектов