.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Block Table Record of a Dynamic Block

2 REPLIES 2
Reply
Message 1 of 3
Rob.O
1243 Views, 2 Replies

Block Table Record of a Dynamic Block

Hi all!

 

I am trying to access the block table record of a dynamic block, but am not having much luck.  I am able to see the block table property name when I loop through the dynamic block, but I cannot figure out how to access the list I have in the block table.

 

I basically want to pull out all of the available options from a particular column in the block table and dump them into a combobox on my form.

 

I am able to do this with the visibility property of the same block using the DynamicBlockReferenceProperty.GetAllowedValues() method, but it does not seem to work for a block table.

 

Below is what I am using to get the values of the visibility property:

 

 

Dim strDynParameterName As String = "VISIBILITY1"
Dim acDynBref As BlockReference = obj.GetObject(OpenMode.ForRead)

Dim DynPc As DynamicBlockReferencePropertyCollection = acBref.DynamicBlockReferencePropertyCollection

For Each DynProp As DynamicBlockReferenceProperty In DynPc

If DynProp.PropertyName.Equals(strDynParameterName, StringComparison.OrdinalIgnoreCase) = True Then

For Each value As Object In DynProp.GetAllowedValues()
cboWeldType.Items.Add(value)
Next
End If
Next

 Any ideas?

 

2 REPLIES 2
Message 2 of 3
StormyC
in reply to: Rob.O

Can you get the 'PropertyName', 'UnitsType' & if present 'Description' from all the properties in?

DynamicBlockReferencePropertyCollection?

 

If so I think the problem is that the values your extracting are not constrained and don't have a allowed value list.

 

It will have a 'value' though that you should still be able to extract.

Message 3 of 3
finnishflash
in reply to: Rob.O

Here's an earlier reply on the topic. I couldn't locate it using the discussion board search engine but thanks to Google it came up:

 

http://forums.autodesk.com/t5/NET/Definition-of-Dynamic-Blocks-with-NET-API/m-p/2377920

 

It's an old post and I'm not sure it was possible back then (Acad 2009), but after browsing

namespace Autodesk.AutoCAD.Internal.DatabaseServices

it seems the dynamic property definition classes might have become exposed in the current managed API (2011).

 

Try iterating the EvalGraph nodes and look for the one of type BlockPropertiesTable, you should be able to get the BlockPropertiesTableColumnCollection from that node.

 

Good luck!

/Paavo Rantanen

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost