Hello All,
I am trying to update the dynamic block properties using C# .NET, but while doing so I receive the eInvalidInput exception.
The code I am using is below. Any help with this will be highly appreciated.
Thank You
private static void DisplayDynBlockProperties( Editor ed, BlockReference br, string name )
{
// Only continue is we have a valid dynamic block
if (br != null && br.IsDynamicBlock)
{
ed.WriteMessage( "\nDynamic properties for \"{0}\"\n", name );
// Get the dynamic block's property collection
DynamicBlockReferencePropertyCollection pc = br.DynamicBlockReferencePropertyCollection;
// Loop through, getting the info for each property
foreach (DynamicBlockReferenceProperty prop in pc)
{
// Start with the property name, type and description
ed.WriteMessage( "\nProperty: \"{0}\" : {1}", prop.PropertyName, prop.UnitsType );
if (prop.Description != "")
{
ed.WriteMessage( "\n Description: {0}", prop.Description );
}
// Is it read-only?
if (prop.ReadOnly)
{
ed.WriteMessage(" (Read Only)");
}
else if (!prop.ReadOnly)
{
ed.WriteMessage(" (READ WRITE Only)");
}
//Switch Property
if (prop.PropertyName == "STEM_LENGTH" )
{
object[] values = prop.GetAllowedValues();
prop.Value = 48;
// GETTING THE EXCEPTION HERE.
}
.........
..........
}
}
}
@_gile / @Alexander.Rivilis - Could you guys please help out with this.
My final objective is to
1. Read a dynamic block reference from an existing dwg file and
2. Update the properties via code using C# .NET
Thank You for your help in advance.
Solved! Go to Solution.
Solved by _gile. Go to Solution.
Can't find what you're looking for? Ask the community or share your knowledge.