Active Member
Posts: 8
Registered: ‎07-02-2001
Message 1 of 2 (110 Views)

Dynamic block properties from block definition

110 Views, 1 Replies
02-27-2006 10:40 AM
Can we get Dynamic block properties from the block definition. I have some lookup lists and I want to get all available/allowable values from the block definition before inserting an instance of the block.
This would be great to populate my variables and arrays from original blocks instead of hard-coding them in my code.
Posts: 24
Registered: ‎03-14-2006
Message 2 of 2 (110 Views)

Re: Dynamic block properties from block definition

04-27-2006 07:20 AM in reply to: h_najmi
Try this:

It gets the information of a single block selected by user (code is not complete!).


PromptSelectionOptions prSelectionOptions = new PromptSelectionOptions();
prSelectionOptions.SingleOnly = true;
prSelectionOptions.SelectEverythingInAperture = true;
PromptSelectionResult prSelectionResult = ed.GetSelection(prSelectionOptions);


if (trans.GetObject(prSelectionResult.Value[0].ObjectId, OpenMode.ForRead).GetType() == typeof(BlockReference))
BlockReference br = (BlockReference)trans.GetObject(prSelectionResult.Value[0].ObjectId, OpenMode.ForRead);
if (br.IsDynamicBlock)
DynamicBlockReferencePropertyCollection dynBrProColl = br.DynamicBlockReferencePropertyCollection;
foreach (DynamicBlockReferenceProperty dynBrPro in dynBrProColl)
ed.WriteMessage(dynBrPro.PropertyName + " ");
ed.WriteMessage("The block is not dynamic");


You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community