0
我已經爲矩形創建了一個帶有兩個參數(par_l和par_h)的動態塊。爲什麼不在這種情況下沒有發生?我假設par_l應該將項目擴展到500.默認情況下,我有100和100. 我在程序中創建的塊。通過在C#代碼我想操縱它在C#中使用動態塊(用於AutoCad)
[CommandMethod("Elem")]
public void TestCommand()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
Transaction tr = db.TransactionManager.StartTransaction();
BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForWrite);
ed.WriteMessage(bt["prz_podl"]+"");
BlockTableRecord btr = tr.GetObject(bt["prz_podl"], OpenMode.ForWrite) as BlockTableRecord;
Point3d point = new Point3d(0, 0, 0);
BlockReference br = new BlockReference(point, btr.Id);
br.BlockTableRecord = btr.Id;
DynamicBlockReferencePropertyCollection properties = br.DynamicBlockReferencePropertyCollection;
for (int i = 0; i < properties.Count; i++)
{
DynamicBlockReferenceProperty property = properties[i];
if (property.PropertyName == "par_l")
{
ed.WriteMessage(property.Value+"");
property.Value = 500.0;
}
}
tr.Commit();
}