Add PropertySetDefinition from Excel

Is it possible to create a PropertySetDefinition from an Excel/CSV file. Properties come from the rows in the first column of the file. I know how to edit the values of the properties via Dynamo, I just can not set the PropertySetDefinition via Dynamo.

My purpose is to avoid creating Properties manually in the Stylemanager. Especially if there are changes in the list, rework is needed.

Any help is appreciated!

Check out this screencast by Paolo Serra : https://knowledge.autodesk.com/support/civil-3d/learn-explore/caas/screencast/Main/Details/38cdeaa3-d2b3-459e-8a0b-70f627884ba2.html

Thank you! I have seen that. Unfortunately the workflow for Setting psetdefinition Works only with JSON file. Excel is what I am looking for since it is More flexible

Holen Sie sich Outlook fĂĽr iOS

In my opinion you can try modules for creating Json from Excel in the new version of the Dynamo Sandbox with Python 3 support. Or you can have a look at new possibility of Civil 3d to import property sets via XML file.

Thank you! I had a look in the web and could not find anything in practice about XML or JSON from Excel. Do you have any link for me? Or give me some details what do you really mean?

Hello @albano.haruni, I mean there are some modules which could help. It is for Python 3. More information here: [New Feature Preview] Python 3 Support Issue Thread

Look for example for “excel 2 json” or “Pandas DataFrame to json”. I have no experience yet, but I in my opinion it can help you.

You can find more information about Pandas here: https://jakevdp.github.io/PythonDataScienceHandbook/

Or you can build XML using IronPython: https://docs.python.org/2.7/library/xml.etree.elementtree.html

You can use Civil 3D to import Psets from XML: https://knowledge.autodesk.com/support/civil-3d/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Civil3D-SurveyShape/files/GUID-25F75F92-3FDB-471D-A470-92A042E1E219-htm.html

1 Like

Thank you @Drbohlav! Unfortunately those links are some promising threads for the future but not anyhing really helpful for me for the moment. The last Autodesk-link does not work for me, I already tried it.

Hello @albano.haruni, one solution came to my mind. You can create manually one property set definition with many properties as a container. In excel you can define names of new property set definitions and what properties should be copied. You can copy original property set definition with new names and properties defined in excel. You can also rename properties in new property set definitions. I am trying to prepare this in Python.

I get your point and hope you are successful with that @Drbohlav.

Hello! I’m editing a code to create the set properties automatically using an excel table, but the last two lists are registering null values. I believe that if this is resolved the properties will be created. Could you tell if there’s something wrong at any stage?

Hi @jhonne.arq ,

the Document.PropertySetDefinitionByName only returns existing propertysetdefinitions and does not create them. Do the prop set defs exist in the drawing?
If not, first create them using the PropertySetsExtensions.PropertySetDefinitionByParameters node or manually.

1 Like

Hi @kovacsv!

Thanks!
Note that the last node is just what you suggested.
Do you know where I should correct to generate the property definitions?

The node Document.PropertySetDefinitionByName ask for a propertyset definition name but you try to fold the properties in to the node.
Try to create the propertyset definition manuelly in the file and the add the property set name in the node as string and see if it works

thank you Patrick!

The creation of property definitions from excel worked. Now I’m studying how to insert automatic properties through Dynamo.
If you know of any way and can share I would appreciate it.

Thanks!

Can you show the latest graph and what you have come up with so far?

yes of course

For now I stopped at this stage. I decided to study the basic topics a little more and I’ll be back soon with more questions. If you want to suggest something to improve and insert automatic properties, you are also welcome.

I think creating atomatic properties goes the python way right now. There is no node for that as far as I know. If the propery set definitons and the properties can be the same in every file, creating them manually in the .dwt would be easier.
So as for the workflow: create prop set defs in the dwt and then create a script that adds them to bjects and owerwrites selected properties.

1 Like

We use property sets in one of our large w&S project and we got really big issues different versions of property set definitions when we added them to Pipes and structures in the design file and then start to share the objects by using Data shortcuts. We wasn’t aware of it but it’s a common issue with property sets so keep that in mind if you will be using Dynamo to create the property set definitions. Now we keep that in mind and also added a version history to the property set so test your workflow so that it doesn’t mess upp your files with drefs and add multiple versions of property sets

Our workflow is

  1. Add Propertyset defintion first time
    Have a .scr-file to add propertyset definition to the file as a block, explode the block, delete/purge the block and then run dynamo script that update the propertyset silent using the command AECCRUNDYNAMOSCRIPT

  2. Update Propertyset
    run a .scr file that run the dynamo script to update propertysets on obejcts using AECCRUNDYNAMOSCRIPT without adding the property set definition.

2 Likes

Hi all, in my opinion and from my experience is the best way to create “empty” dwg only with property sets and property definitions. Second step is to reference property sets to every dwg you want. You can than update property sets and property definition only in one place. Manage tab → Reference → Property set tab

You can reference property sets definitions from many dwg not only one.

2 Likes

Hi, I combine these two nodes from Civil3DToolkit package


Don’t forget that you can create also list data type with Dynamo OOTB nodes from Civil3DToolkit which is very time consuming if you try to do it manualy:

1 Like