[AUTOCAD MEP]_AECPROPERTYRENUMBERDATA,带栅栏选择
有没有办法使用_AECPROPERTYRENUMBERDATA(propertyrenumberdata)选择具有File或类似功能的多个对象?**** Hidden Message ***** AutoCAD MEP附带的一种方法我不知道。
可以通过插件实现,而且相对容易
可以按对象选择的顺序、坐标、对象插入图形的顺序、逐个重新排序(由MEP实现)或其他方式重新排序。根据需要实施
我在想用增量值和另一个标记创建另一个属性集数据,但您的方法听起来很有趣。请解释一下如何重新插入对象或按对象选择顺序重新排序? 使用SortedDictionary操作PropertySet的AutoIncrementDataType的基本示例。
在windows窗体对话框中:
帮助器方法:
public static class GhAecPropertySetHelper
{
public static List GetPropertySetDefinitionNamesWithAutoIncrementDataType(Database db)
{
List lst = new List();
ObjectId psdId = ObjectId.Null;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
DictionaryPropertySetDefinitions psdDict = new DictionaryPropertySetDefinitions(db);
ObjectIdCollection psdIds = psdDict.Records;
foreach (ObjectId id in psdIds)
{
PropertySetDefinition psdf = (PropertySetDefinition)tr.GetObject(id, OpenMode.ForRead, false, false);
PropertyDefinitionCollection pdc = psdf.Definitions;
foreach (PropertyDefinition pd in pdc)
if (pd.DataType == Autodesk.Aec.PropertyData.DataType.AutoIncrement)
{
lst.Add(psdf.Name);
break;
}
}
tr.Commit();
}
return lst;
}
public static List GetAutoIncrementPropertyDefinitionNames(string propSetDefName, Database db)
{
List lst = new List();
ObjectId psdId = ObjectId.Null;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
DictionaryPropertySetDefinitions psdDict = new DictionaryPropertySetDefinitions(db);
if (psdDict.Has(propSetDefName, tr))
{
// Assign the return variable the ObjectId of the property set
psdId = psdDict.GetAt(propSetDefName);
PropertySetDefinition psdf = (PropertySetDefinition)tr.GetObject(psdId, OpenMode.ForRead, false, false);
PropertyDefinitionCollection pdc = psdf.Definitions;
foreach (PropertyDefinition pd in pdc)
if (pd.DataType == Autodesk.Aec.PropertyData.DataType.AutoIncrement)
lst.Add(pd.Name);
}
tr.Commit();
}
return lst;
}
public static bool SetValueFromPropertySetId(string propName, ObjectId propSetId, Object value, Database db)
{
bool findAny = false;
int propSetDefId = 0;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
try
{
PropertySet propSet = (PropertySet)trans.GetObject(propSetId, OpenMode.ForWrite, false, false);
propSetDefId = propSet.PropertyNameToId(propName);
if ((propSet.IsWriteEnabled))
{
propSet.SetAt(propSetDefId, value);
findAny = true;
}
}
catch (AcException)
{
// most likely eKeyNotFound.
}
trans.Commit();
}
return findAny;
}
public static ObjectId GetPropertySetDefinitionIdByName(string propSetDefName, Database db)
{
// Create objectId to hold the property set objectId and
// set the default value equal to null.
ObjectId psdId = ObjectId.Null;
AcDb.TransactionManager tm = db.TransactionManager;
using (Transaction trans = tm.StartTransaction())
{
// Create a Property Set Dictionary
AecPropDb.DictionaryPropertySetDefinitions psdDict = new AecPropDb.DictionaryPropertySetDefinitions(db);
// Check to see if the dictionary contains the name of the property set we are looking for
if (psdDict.Has(propSetDefName, trans))
{
// Assign the return variable the ObjectId of the property set
psdId = psdDict.GetAt(propSetDefName);
} // End If Block
trans.Commit();
} // End Using Statement
return psdId;
}
}
请问怎么把这个更新到NET framework 4.8? 你好@Hanauer
有可能
共享一个完整的项目吗
我不能像你那样安排它,我犯了错误
谢谢
页:
[1]