Please, I have difficulties in handling API AutoCAD.Net using Dynamic Blocks. Could you help me?
Thanks in advance.
I'm trying to modify the configuration of a given dynamic block.
The goal is to access the property Table1 Block Dynamic Block and change its value to an existing one.
You can navigate between the records from Table1 Block?
With this code below I have managed to navigate between the dynamic properties of the block and its values, but I can not make the property value set in the block table1.
I tried an example of the link: http://through-the-interface.typepad...blocks/page/3/
however it still fails.
If you have something that can help me I would be very grateful! Attached is a file with dynamic block if you can help me ...
[CommandMethod("getprop")]
static public void GetProps()
{
Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor;
PromptEntityOptions peo = new PromptEntityOptions("\nSelecione o Bloco: ");
peo.SetRejectMessage("\nIsso não é um Bloco."); peo.AddAllowedClass(typeof(BlockReference), false);
PromptEntityResult per = ed.GetEntity(peo); if (per.Status != PromptStatus.OK) return; ObjectId sourceId = per.ObjectId;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockReference brF = (BlockReference)tr.GetObject(sourceId, OpenMode.ForRead);
if (brF != null && brF.IsDynamicBlock) foreach (DynamicBlockReferenceProperty prop in brF.DynamicBlockReferencePropertyCollection)
ed.WriteMessage(string.Format("\n{0}: {1}: ", prop.PropertyName, prop.Value)); tr.Commit();
}
}
}
Thank you!