.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: Definition of Dynamic Blocks with .NET API
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I hope bobbydehero will not make a sense on me..
Try this slightly eedited code
{code}
[CommandMethod("DynamicPropertiesTest","dyntest", CommandFlags.Modal )]
public static void TestDynProps()
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.D
Database db = doc.Database;
Editor ed = doc.Editor;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
BlockReference bref = trans.GetObject(ed.GetEntity("\nSelect dynamic block").ObjectId, OpenMode.ForRead) as BlockReference;
if (bref == null)
{
Autodesk.AutoCAD.ApplicationServices.Application.S
return;
}
if (!bref.IsDynamicBlock)
{
Autodesk.AutoCAD.ApplicationServices.Application.S
return;
}
BlockTable bt = (BlockTable)(trans.GetObject(db.BlockTableId, OpenMode.ForRead));
BlockTableRecord btrec = trans.GetObject(bref.DynamicBlockTableRecord, OpenMode.ForRead,false) as BlockTableRecord;
string sDynBlk = btrec.Name;
if (bt.Has(sDynBlk) == true)
{
BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[sDynBlk], OpenMode.ForRead);
if (btr.IsDynamicBlock)
{
try
{
DBDictionary extDictDynBT = (DBDictionary)trans.GetObject(btr.ExtensionDiction
DBObject acadEnhancedBlk = (DBObject)trans.GetObject(extDictDynBT.GetAt("ACAD
EvalGraph graph = null;
ObjectId idGraph = acadEnhancedBlk.ObjectId;
if (!idGraph.IsNull)
graph = (EvalGraph)trans.GetObject(idGraph, OpenMode.ForRead);
if (graph != null)
{
int[] iNodes = graph.GetAllNodes();
foreach (int iNode in iNodes)
{
DBObject node = graph.GetNode((uint)iNode, OpenMode.ForRead, trans);
if (node != null)
{
EvalExpr eExpr = node as EvalExpr;
if (eExpr.GetType() == typeof(BlockLookupAction))
{
BlockLookupAction blua = eExpr as BlockLookupAction;
if (blua != null)
{
Array pDataTable;
LookupColumnDescriptorCollection descArray;
blua.GetLookupTable(out pDataTable, out descArray);
if (pDataTable != null)
{
}
}
}
if (eExpr.GetType() == typeof(BlockLookupParameter))
{
BlockLookupParameter blup = eExpr as BlockLookupParameter;
if (blup != null)
{
BlockParameterPropertyDescriptorCollection props = blup.PropertyDescription;
Array pDataTable;
foreach (BlockParameterPropertyDescriptor prop in props)
{
}
}
}
if (eExpr.GetType() == typeof(BlockFlipParameter))
{
BlockFlipParameter blup = eExpr as BlockFlipParameter;
if (blup != null)
{
BlockParameterPropertyDescriptorCollection props = blup.PropertyDescription;
Array pDataTable;
foreach (BlockParameterPropertyDescriptor prop in props)
{
}
}
}
//--------- add other actions / parameters same way here -------------------//
}
}
}
}
catch (System.Exception ex)
{
Autodesk.AutoCAD.ApplicationServices.Application.S
}
}
}
}
}
{code}
~'J'~
C6309D9E0751D165D0934D0621DFF27919
Re: Definition of Dynamic Blocks with .NET API
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
ed.GetEntity("\nSelect dynamic block"
this still needs a dyna block first, not create one from scrath by program.
Re: Definition of Dynamic Blocks with .NET API
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Do it yourself
I go out from there
C6309D9E0751D165D0934D0621DFF27919


