Applying parameter values from previous elements in script (not working)

I am writing a script to mass replace detail components in a project (I imported a lot of different views in with the same component and Revit change the family/type to XXX1, XXX2, etc., despite the issue supposedly being fixed). The issue is that the detail component is a break line and the variables reset to the default if I simply replace the type. It is line based, and the actual length of the component does stay the same, but other variables don’t. I tried to take the values from the elements before their types are changed and apply it to the elements after the type change. However, this isn’t working. I think it’s because, by the time the Element Parameter node runs, the Element Type node has already changed the types and reset the parameter values. Usually grasshopper can back track and take data from previous nodes as it was, but I guess Rhino.Inside doesn’t do that. How can I fix this? I tried duplicating the elements before the type is changed, but that doesn’t work because they aren’t 3D model components. I also tried cloning in the same way, but the clones get “reset” as well. I’m thinking someway to copy the data from the query elements node and “set it aside” so it’s not affected when the types get changed, and then get referenced by the Inspect Element node, but I’m not sure if that’s best, and i’m not sure how to do that.

Can you post your family? I would like to see the parameters you are modifying. Thanks

I can’t post the family at the moment, but they are length parameters.

This should be working fine since you are working downstream, so the values from the first inspect node should have its values stored and applied after you change the type.

If you notice the original “Param 1” value of 500 remains the same upstream (the first panel) even if i update the type or parameter value downstream.

Also, if you make the parameters, with values you want to retain, shared parameters and give them the value, then when you change to a new family the values of these parameters will remain the same without the need to go through grasshopper.

This should be working fine since you are working downstream, so the values from the first inspect node should have its values stored and applied after you change the type.

I know, which is why I’m confused. Maybe it has to do with the fact that I am querying families/types? Here’s my full script.

After the Query Elements node from the “Elements” output, place a stream filter and use a “button” to pass the elements through and see if running it manually solves the problem and let us know.

But also, query does not recompute when upstream hmm…

You should also place panels after the inspect elements parameter values and see what happens with the values during computation and see where/when it goes wrong

So, I’m not sure I understand how you want me to use the stream filter.

On another note related to using more panels, I tried looking at the output of the query elements node, and the output shows JUST the type “Break Line,” that is, the type I’m changing everything to, and doesn’t show any of the other types “Break Line1”, “Break Line2”, etc. that the elements were before. Which means the node isn’t actually keeping track of the original data and is re-computing.

Did you run the script more than one time, so everything got changed without undoing the run in revit?

Also, the stream filter/ running it manual with data dam, should be similar to just running the script once so not sure that’s the problem.

If you can replicate the issue in a different sample file, will have a look at it

No. I undid everything in Revit.

I don’t know either. This seems to defy grasshopper logic, so I’m wondering if maybe it’s a bug.

Can you provide an example file and system details (RiR about info)? I’m not able to reproduce this behavior.

Sorry, what is RiR? When you say you haven’t been able to reproduce this, have you been trying my script (the exact one from above), and it has been working for you? Because that would be an important development.

RiR = Rhino inside revit

We can not test your script because we do not have the same test subjects (families and script) but when applying the same concept to test samples we get the expected result and not the result you are getting.

You can also ask if you can share your files privately with @Japhy and the team so that they can assist you, if you do not want to share the files publicly.

@Japhy, can I message you privately and share the families and script? I am unfortunately not able to share the files publicly.

Sure thing, zip the files and upload here please.

upload privately to mcneel

@Japhy any update on the issue? Did you get the files I uploaded?

Looking now. A few questions.

You have two families both with only 1 type.

What type are you changing replacing? Can you give a quick synopsis of exactly what you are trying to do?

From what i read above there would be another type in the Breakline or even another family say xxx1, that you want to change to xxx2, then inherit its parameters?

The two Revit families I sent you are the two families that I am trying to change to, I’ll use the break line as an example (We’ll, call it “Break Line”). I imported a bunch of drafting views from other (older) projects into the one I am currently working in. Those other/older details have break line components. Some of the break line components are from the Break Line family, some are older versions of the Break Line family, and some were created by people by copying Break Line into their project and renaming it, e.g. “break line”, “Break Line_2018”, etc. When I imported the views into my current project Revit simply added a number to the end of any duplicate family and type names (even though this bug was supposed to be fixed). Here is an example of the families/types I currently have in my file (except multiply by 5, with 2,000+ instances):

Family: Break Line
Types: Break Line

Family: Break Line1
Types: Break Line
Break Line 2
Break Line 3
Break Line 4

Family: Break Line2
Types: Break Line
Break Line 2
Break Line 3
Break Line 4

Family: break line
Type: break line
break line 2

Family: break line2
Type: Break Line2

Family: Break Line_2018
Type: Break Line

Each of the original break line instances (in the views I imported) obviously have their own lengths/parameter values appropriate to the detail they are in. I am trying to replace them all with the newest (correct) version (Break Line), type “Break Line”, in accordance with my Revit standards, and assign the existing parameter values to the new Break Line instances. Basically, after this process is done I’m going to purge the project and I want the only thing left to be Break Line, type: Break Line. That’s it.

If you want to recreate it, simply copy the family I gave you, change the family names to XXX1, XXX2, etc. and the type to XXX1, XXX2, etc. Then create instances of those types and try to replace them with the original “XXX”

P.S. I edited this a bit to fix some issues and clarify some things.

1 Like

I think i would do something like this, where we internalize the data then apply after you change the type.


GetBreakLines.gh (17.2 KB)

That worked. Thank you!