Manipulate data from the csv

hey everyone… does anyone have idea how i can change the color of the 3d model (elements) on revit on concordance with the status of the csv

To change the color of elements inside Revit you need to change the material of those elements.
There is no other way to change their color inside Revit (that i know of)

I would group elements based on the status then use Element.OverrideInView with a list of colors

2 Likes

Setup up a view filter for each possible status on a new parameter. Then push the parameter values from the CSV to the elements.

hey, do you think you could show me how i can do these? i am a bit new on dynamo
i will appreciate it, thanks

I’m a bit busy this week with meetings before the holiday break, but this is the holidays so I’ll give you some written instructions as much of this is pretty close to a demo I do once a week or so. For the option I posted you’d manually build the filters, so nothing Dynamo to show there. Then in Dynamo:

First up make sure you are in manual execution here. You don’t want to get stuck in an infinite loop. Run the graph after each paragraph to know that you haven’t hit a snag.

Use a List.Deconstruct node to pull the headings out of your CSV data. Then wire the ‘first’ output into a watch node. This will give you a reference of what index in the lists has which data.

Next use a List.Transpose node to view the remaining data from the deconstruct node by columns instead of rows.

Now double click on the canvas adjacent to the output of the Transpose node to create a new code block, and in it type ‘data’ to create a new inout variable called data, and then click in the background to finish editing the code. Note that the code block will add the end line character ‘;’ to your code, but this will only work for the last line you type - any other time you finish a line type the whole thing out.

Wire the transposed data into the data input. We now need to get the ID from the data set and convert that to elements. Go back to the watch node and find out which index contains your global ID values, then in the code block type a new line ‘GUIDs = data[index];’ where the index is the index you found in the watch node.

Later on we will also need the status, so let’s grab that now too. Put in a few extra lines after the GUID line and this next one so we can easily ID it in the future, and type ‘stat = data[indx];’ where indx is the index which the status is located in the watch node from the deconstruct node.

Now let’s convert those pesky GUIDs to elements - there are a few packages which can help with this, but we have already started some design script so let’s go ahead and keep at it - in the line of the code block right below the GUID line type this (copy paste here should work): elems = Revit.Elements.ElementSelector.ByUniqueId(GUID); put a watch node on the canvas and wire the elems line into it so we can be sure there aren’t any errors - everything should have a number highlighted in green. You can delete the watch node once you run the graph to confirm.

Ok, now we have the elements, and the values we want to set - just need to add the parameter name we want to push the data to. I’m going to use “comments” here but really you should use whatever parameter you set up to use your filter. In the line right below the ‘elems’ line type ‘ “Comments”; ’, including the double quotes which let Dynamo you want the world Comments not a new variable. Don’t forget the ‘;’ character at the end of the line.

Last step is to set the parameter values, so place an Element.SetParameterValueByName node on the canvas, and wire the elements from the elems line of the code block into the element input, the parameter name (“Comments”, or whatever you used) as the parameter, and the data from the stat line as the value.

This should do the trick - I put instructions for as many of the ‘gotcha’ moments as I could think of. Post the results or if you get stuck and I’ll try to find a moment to set you back on course.

Hey thanks for your answer…i tried to set these up but got stuck i will send you the dynamo file i have done till the moment so its easier to explain…thanks in advanced
ELEMENTS FILTER.dyn (157.8 KB)

I can’t actually do anything with this file as you didn’t provide all the other parts associated with the workflow. That said hopefully you can work with the images and notes I’m providing here.

Workflow I outlined above starts here:

If you try to implement it in another area of the graph it’ll have to be… well a completely different workflow.

The rest of my workflow is outlined here:

Jacob thanks for the help you are giving me, i was working on what you told but i am having trouble with the script (code block)

Almost there by the looks of it.

That gets written in a code block node as shown, not a Python node.

it gave me error in the code block: the null value cant proyect in int32
and in elementsetparameter: Element.Error in the operation SetParameterValueByName

any idea why?

Can you post the files required to rebuild? ie: the RVT and CSV. Even if it’s just one or two elements.

you are missing some inputs in your code block, that is why it is erroring

Not so much there are inputs missing… the code wasn’t written correctly. See if this clarifies @vickykurlem, and if not post a small sample rvt and csv and I’ll have a look.

Jacob, thanks yes i will send you those files becuase see…it still with errors and not showing nothing on the model…i cant upload the revit file if you facilitate me a mail i could send it

MANIPULATE DATA FROM THE CSV.dyn (157.1 KB)

1 Like

good morning, i would like to know if someone could help me on this. it still showing error and not showing nothing on the model…i dont know how to continue…

forget the script, get all elements of the project, ask for the uniqueID of all of them, get the indices that match with your CSV file uniqueIds and get the elements of the project by the indices obtained. Create a shared parameter to push the data on the elements that you like, Comments parameter values will disappear eventually.

I dug into this some over the weekend, and it seems that the GUID isn’t valid in the document - that is someone deleted the object in the model which you’re working with after the export which generated the GUID was created. I’ll be poking at this again today, but you may have to find another way to get your element relationships back as things appear to just have been removed from the file and made anew (or just omitted).

1 Like

this part i have already done it…so thats the reason that now i am seeing the way to show that information on the model with colors…

MANIPULATE DATA FROM THE CSV.dyn (92.0 KB)

thanks again…personally it sound a bit weird to me that elements have been removed as well as only 15/44 elements were on concordance, but, meanwhile i can show at least some of them on the model the workflow works to me