怎么遍历取当前图纸指定块的Position坐标?
求代码 谢谢```````````````````````````public static void tta()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
var resStr =
ed.GetString("\nPlease Input BlockName:");
if (resStr.Status != PromptStatus.OK)
return;
var resSel =
ed.SelectAll(
new SelectionFilter(
new TypedValue[]
{
new TypedValue(0, "Insert"),
new TypedValue(2, resStr.StringResult)
}));
if (resSel.Status != PromptStatus.OK)
return;
using (var tr = db.TransactionManager.StartTransaction())
{
foreach(var id in resSel.Value.GetObjectIds())
{
var br = tr.GetObject(id, OpenMode.ForRead) as BlockReference;
ed.WriteMessage("\n{0}", br.Position);
}
}
}
页:
[1]