Adding values to property of object

Hello,

I would like to create script which can import property set name, properties, data type of property and values from file and add them to selected objects.
My script is semi-working.
Problem:

If I add them for the first time to object it adds properties name but no values (error like no pointer) If I select it again and run then it works.

But only for one object. I think there is problem with Handle which is automatic property but no idea how to import it to my scrip without python.

Also I can set data type of property but then it doesnt accept my values from file so its not implemented yet. That is just for info.

file:
image
my script:
propSetFromEXCEL.dyn (60.2 KB)

2 Likes

I tried to get this working and was running into the same issues as you. I was able to get it to work but had to use some work arounds.

1.) I noticed the “PropertySetsExtensions.PropertySetDefinitionByParameters” node was not functioning properly. At least the “applyTo” input. No matter what strings I passed to it for object types, the property set definition that was generated was not checkmarking the object type to allow the property set to be applied to objects. My workaround was to pass a “True” bool to the “appliesToAll” input.

2.) The “Object.AddPropertySet” node expects an input from the base autoCAD selection tool. This is why passing in a single object with the “select object” node works but the “select objects” node in the toolkit does not work. I had to pass the “select objects” node through an object.layer node to return the objects in the format that the “Object.AddPropertySet” expects. There is probably a better way to convert the objects but that is a question of it’s own. “How to format the ‘select objects’ node such that the data is in the format that the base dynamo nodes expect”.

I was able to get it to work, but I had to run the script twice and use the select objects node two separate times for it to properly apply the values to the objects. I am unsure of why this is the case. But perhaps someone more knowledgeable than I could shine additional light on these issues. I had to fight with this a lot to even get it to be operational!
propSetFromEXCEL.dyn (75.1 KB)

1 Like

Thanks a lot!

Nice solution. :slight_smile:

1 Like

Hello
Can you put screen shoot of the script because i Can’t open your file may be because of m’y version of civil 3d or dynamo.
Thank you

2 Likes

thank you very much

1 Like