Setting Column Height with Element.SetParameterByName

 

 

 

 

 

Starting with a simple 4 point rectangle to faciliate learning, columns were smoothly placed but I continue to get the error “Warning: Element.SetParameterByName operation failed. No parameter found by that name.” when trying to set the top height. Why am I getting this error and what should I do to fix it? Thanks.

 

15-09-15 family instance issue

You’re trying to set the height of a Family Type, not the elements which actually contain the height parameter.

In addition to what Danny said, the input for the Set Parameter by Name should be the Level element for Level 2, not the words “Level 2”.

Ah what a silly mistake. However, after putting through the correction I regret to inform the error continues same as above. It makes sense Dynamo wants to get the actually element to align the column too but I’m not sure what I’m missing now as “Level 2” is clearly visible in the Metic mass. Could this be because it’s not a project? Thanks,

15-09-15 family instance issue

 

 

use the get level by name twice2015-09-16_12h40_43

Ok. Correcting that mistake I’m, unforunately, getting the same error.

 

15-09-16 family instance issue

Get rid of Get Level by Name and feed the the string “Level 2” directly to the value port in Element.SetParameterByName

setColumn LevelI disagree with Vikram. I think the Get Level By Name is correct. The issue now is that you are feeding the Element Types into the the element port. The Level info for a column exists as part of the Instance, not the Type. So you should pull a string off of the AllElementsOfType node (which is giving you the instances of that column) and feed it into the Elements port of the SetParameterByName node.

 

 

Wow this is complicated. The instance I restrung the path as per your image two things happened: Good news - the Dynamo error was fixed, The bad news - I got an error in REVIT: “A serious error has occurred. It is strongly recommended that you use Save As to save your work in a new file before continuing.”

Might it be setting the top of the columns below the bottom of the columns? That would definitely throw an error. It usually would not cause a crash, but if it happens for a lot of columns at once…perhaps. Also, I’d suggest switching to Manual Run Mode when learning Dynamo.

Blair, It’s not complicated at all.

Create elements and then alter parameters of the created elements.

Try this, the workflow is sequential .

20150918-1

2 Likes

I regret to inform you that when I replicated your exact image in Dynamo 8.2 it continued to give the same error in REVIT: “A serious error has occurred. It is strongly recommended that you use Save As to save your work in a new file before continuing.” I’m assuming someone somewhere regularly sets column heights through dynamo as a matter of course?

1 Like

Blair-

Can you share your RVT file? You might want to check and verify that you only have one parameter in your column called “Top Level”. If you happen to have a family or project parameter by that same name (which Revit will allow you to do…), this script will fail on you, since Dynamo does not know which parameter named “Top Level” you are referring to (I tested and confirmed this…). There is no problem with Dynamo. The script that Vikram posted works perfectly (see image below). The problem you are encountering is likely a Revit issue (either your family or your file).ColumnSetHeights

 

1 Like

I think you’re on the right track Ben. Dynamo is picking up two “Top Level” paras and two “Bottom Level” para even though the REVIT concept mass family is only showing one of each when I initially checked. I will investigate that angle more thoroughly tomorrow at lunch.

Try running the script in a new project created using “Template = None” and using one of the columns from the library that installs with Revit (clean Revit file with clean (ish) families). You’ll need to just create a few levels then load the column family. If it does not work in that case, then there is perhaps an issue with your script (does it exactly match Vikram’s?). Once you confirm that it works in that case, then try loading your column family into the clean project and try again. If it still works, then have a look at your firm’s Revit Template in the Manage-Project Parameters area for parameters that might be duplicates of some other built-in Revit parameters.

As you get deeper into Dynamo, you’ll be doing a lot of Element.SetParameterValueByName, so you will likely want to clean out all of those duplicates and make all of you parameter names unique. There are ways to specify which parameter you want if you have duplicate named parameters, but that’s going to involve some more in depth python-ing and some digging into parameter GUIDS, etc.

1 Like

Well the good news is that running the script in a new empty template works. So that is worth celebrating and I’ve set the problem to solved. It’s a bit disconcering where the duplicate parameters are coming from but at least we now have a solution they come up again.

1 Like

Thank you bro
It fit to my assignment.

1 Like