Dynamo eKeyNotFound Error

I am trying to set property values in my .dwg file for all block references in model space. Eventually I want it to number all block reference elements incrementally starting by 1, by 1. Right now, I am just trying to make my dynamo script make all blocks have a particular property set read “1”. When I do this, though, I am getting an error at the very end of “Property.SetValue operation failed. Error eKeyNotFound”. Any advice is welcomed!

Hi @jbrunkhorst,

Are you able to share a screenshot or the DYN + DWG?

Is the data type for the property definition something other than “Text”?

Ultimately, I want the property for each block reference to be a number. Not sure if that is what you mean by property definition or not.

I think I got my example to work! The example being where I just get a default value of “1” applied to all block reference property set for “TRKR”. The problem I think I found was that it was for “TRKR_NUM” at first, but then I tried removing “_NUM” and now it works. But if you could help give me guidance to where I can apply a sequence so each block reference gets a unique number applied to each property set!

The property set definition contains the configuration for the different properties that you want (called property definitions). Those property definitions have a data type assigned to them (Text, Integer, Real, etc.). When you set the values of those properties using Dynamo, the data type needs to match. In your example above, you were inputting “1” which is a text string. If the property definition for TRKR_NUM specifies a data type that is anything other than Text, then you will get an error.

In fact, Dynamo only supported setting the values of Text properties prior to Civil 3D 2025.1. From that version onwards, you can set the value for any data type.

Fantastic, thank you for the insight!

Do you have any advice on how to apply a sequence to the property value?

Try using the Sequence node. Something like this.

Yeah that is what I have been messing with, but once I try to push the list from the sequence node to the propertyValue of the UpdateProperty node, it gives me an error. I think it is trying to read a string for the property value?

Correct.

You’ll have to upgrade if you need the ability to set values of different data types.

If that isn’t an option, then you need two things:

  1. The TRKR_NUM property definition needs to have a “Text” data type
  2. The sequence that you generate needs to be strings. You can use String from Object to convert the integers from your sequence.