实体和保持xdata爆炸
是否有人有一个代码段可以循环遍历模型空间,并针对每个实体进行分解,并将父实体的 xdata 传递给分解的子实体?做了一个搜索,找不到任何有效的东西。
**** Hidden Message ***** 第一次尝试时,它陷入了一个无休止的循环
//Loop through entities in model space
foreach (ObjectId objectId in wModelSpace)
{
var curve = (Curve)tr.GetObject(objectId, OpenMode.ForRead);
double extdia = ExtensionMethods.PipeExtDiaForObject(curve, regAppName);
DBObjectCollection tempDBObjects = new DBObjectCollection();
curve.Explode(tempDBObjects);
foreach (Curve obj in tempDBObjects)
{
Polyline polyObj = ExtensionMethods.ConvertToPolyline(obj);
polyObj.SetDatabaseDefaults();
ms.AppendEntity(polyObj);
tr.AddNewlyCreatedDBObject(polyObj, true);
ExtensionMethods.SetPipeExtDiaOnObject(tr, polyObj, (float)extdia, regAppName);
}
//erase original curve
var originalCurve = (Entity)tr.GetObject(curve.ObjectId, OpenMode.ForWrite);
originalCurve.Erase();
}
代码的问题是,尽管循环用力推
页:
[1]