Import Propertyset data from CSV/Excel

Hello everyone,

I’m trying to make a link with my Civil3D 3DSolids and a .csv file. The idea is that a project manager of sorts can fill in the csv file when changes occur I only have to select one of the objects and the .csv file that has been filled in. I’ve seen the webinar about this but can’t really make any sense of it so I can use it.

I want the .csv file to look orderly. On the left are the PropertyNames and on the right are the PropertyValues that have to be filled in manually.

I tried making it work myself (see image below) but i’m not getting far… mostly because my lack of knowledge around scripting and dynamo.

So i’m wondering if someone can help me work this out.

(sorry for the lack of images but I can only upload 1 image because I’m a new user…)
Thank you in advance!

Bas

1 Like

Hi,
you need to seperate your data from the *.csv into two lists.

  1. property Names
  2. property Values

Maybe you can use the node “Get item at index” and use the levels.

And pls show the csv.
Maybe we can set up the csv different and avoid some problems.

I will try the get item at index method. That will probably go a long way already!
Currently the .csv file looks like this:
image

Hi,
i never used csv before…but now i know -> don’t use it, use xlsx
You have more work with csv.
You can load a xlsx file and select the data like that:
image

Thank you for helping me out! The things you recommended work perfectly.

But I think I’ve found a major problem… I want the script to update the propertysets of 3D Solids. But I think you can only select objects…

When running the script I get a warning for the object.

What does the error say?
This works for me:

The error I get is as you see in the image below. I get a null when trying to select all objects in that layer. It looks like it doesn’t recognise 3D Solids as an object.

When using the method you use here, but a little bit different because I want to get all the information automated out of the excel file, I also get an error message:


Is this error because I don’t manually give the information in my dynamofile?

The property set value needs to be a string not a double.
There is a node for this: “String from Object”. Put this between the codeblock and Property.SetValue.
And pls show every output of your nodes.

Using the “String from Object” solves one error message. But the output from propertybyname is null. I think this causes the error message.

These are not names of “parameters” in your property set:


or you name your parameters “1”, “2”…but than you need to trim your string from “1.000” to “1”.
Pls show the property set in Civil 3D.

you can split your strings like that:

That works to get the name right, but not for the value. The value is empty in the PropertySet.PropertyByName, but i can’t add the value in that node. Butt the Property.SetValue shows null in the list.

Mh…could you pls restart your Civil?

It works! But I can only select one object at the time using the select object node. When I try to get all objects (3D Solids) in the layer I get a null output. Does Dynamo not recognise Solids as an object yet in this node? Because this would be my next step to making the proces faster.

There are more than one way to get your objects:
Here is one:
image

I’ve made it work to select all the solids in the layer. But now it doesnt update all the info in the propertysets… It does one value per set (see image)

You can do it like that:

That would work if I manually enter the names of the property’s. But I want the script to also get the names of the propertys automatically from excel file. Using this method I would need different inputs for the name and the value will be filled in at index.

Propertyset V1.dyn (59.0 KB)