Efficiency: quickly setting multiple parameters by name

Hi there,

I have been having far too many tea breaks waiting for
AdaptiveComponent.ByPoints() and AdaptivComponent.SetParameterByName() to do their work. I’ve been using both designScript and Nodes. its fantastic how interchangeably they are!

My question is this:
I’ve noticed that when I set multiple parameters on each component the set parameterByName function returns too many elements, although it creates the correct number in the Revit Document. AdaptivComponent.SetParameterByName(components, parameters, values) returns (number of components)*(number of values). Is this an unavoidable product of the way the Revit database works, or is it an unnecessary overhead that slows everything down?

I have attached a simplified demonstration of this issue below. Please note that the speed is not an issue here, due to the simplicity of the family.

Any advice appreciated!



SetParameterByNameProblem.dyn (28.4 KB)

I’ve got no solid answer for you, but my understanding of it has been that the SetParameter node outputs the list structure of the parameters being set and not the elements itself. Therefore just repeating the elementID’s for each parameter being set.
Also AdaptiveComponents placemenent in Revit IS slow, and that is even after they added some form of batch adding capabilities in the Revit API and Dynamo a while ago. Maybe they’ll get up to speed in the future. I know that others have used basic generic models instead and used dynamo to set the rotations etc. Like here: https://vasshaug.net/2015/11/30/impossible/
Don’t know what kind of ACs you’re placing though.

By the way, that code block name has to be the most subtle wishlist request I’ve ever seen. :slight_smile:


Thanks Jostein,

This is my first Revit project. Some others in our office have previously used generic single point families instead of adaptive components, which I thought seemed unnecessarily complicated. I didn’t really understand why until reading your link. Thanks for that its great to read through how others have overcome challenges i’m facing :thumbsup:

The adaptive components i’m using have 4 point curtain wall panels with 10 parameters for various widths and offsets and ID. I’m feeding the data to the panels via csv from GH. As soon as they the AC geometry includes anything beyond model lines (extrusions, surfaces etc) the instantiation time starts becoming a problem for ~8000 components :hourglass_flowing_sand:. I will try a comparison using a generic family with a centrepoint and rotations :arrows_counterclockwise: like Håvard Vasshaug. Thanks again!

Yeah, I would second @jostein_olsen here and say that if it can be replaced with a generic model then do it. ACs are really slow, and will bog down your whole model. If, when I decide that I want to use them i usually keep the ACs in a seperate Revit model and link them in, just to give users an option to turn off that link since they slow everything down a lot. The creation process itself can be advanced slightly, using native API methods instead of Dynamo. The reason Dynamo is so slow, is that it creates binding between every AC placed and stores it in the file, basically keeping track of all 8k panels you are creating. Then if you add setting parameters on top of that, then Dynamo really grinds down to a halt. I usually try to avoid Dynamo for large jobs like that. It’s not very fast yet. I hope it gets fast one day.

1 Like

Thanks Konrad,

My next step will the generic model option, still using dynamo.

I’m a little hesitant to dive into the Revit API after reading this. Any advice?

Nathan Miller seems to have some useful resources here. To get me started. I’m comfortable with Python so the revitPythonShell might be a good option.
Are there other ways of interacting with the Revit API? For example could a C# zero touch dynamo node be used to mimic the AdaptiveComponent.ByPoints command using API calls but without the need for dynamo to keep track of the components? Sounds like this would be breaking the intended tight integration with dynamo and Revit, but that’s kind of what i want if it’s whats slowing things down :wink:

You can always mimic the logic of the AC with a parametric geometric representation, that produces static shapes.

You can then have the option to import those entities as sat instances or direct shape elements, or as I like to call them - dumb families :slight_smile:

About setting parameters, because the the inputs of the “Element.SetParameterByName” node are defined as singletons (var), depending on how you set up your lacing, the output will always be replicated by the amount of the most numerous input. This has nothing to do with how revit works and all to do with how dynamo nodes work.

If you want to change this behavior, you’ll have to either implement your own custom logic through python or c# scripting. A second option is to create a wrapper function, that has a defined input and output:

This will not make your graph run faster and will only make the result a bit easier to manage.