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.
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)
Hi there, thank you very much for the input and the solution. I am only scratching the surface of Dynamo for Civil 3D. I come here from the other Dynamiized software (Revit) and I could point out that you have to run Dynamo twice, because during first run, with presented connection of nodes, you are creating PropertySetDefinition and PropertyDefinition. For obvious reasons, PropertyDefinition cannot be created before PropertySetDefinition is there. So, all you need to do is add waiting node. See the snip. Cheers!