Create Project Parameters For All Categories


#1

Hi guys,

I’m trying to create multiple project parameters with the “Parameter.CreateProjectParameterForAllCategories” node but something pretty weird happens when I run the scripts:


As you can see from the picture I am trying to create 6 parameters but it gives me this error: "Warning: Parameter.CreateProjectParameterForAllCategories operation failed.
The referenced object is not valid, possibly because it has been deleted from the database, or its creation was undone."
but in revit it actually creates some parameter…but not all of them!

you can see from this picture that it creates 5 instead of 6!

Did anything like this happened to you before? It looks pretty weird to me…


#2

Hi @andreatas

You don’t need dynamo for this. You can do this in Revit itself easily.


#3

Hi @Kulkul

Yeah that’s right, but this is part of a bigger script that I’ll have to hand over to other people so, in order for them not to mess up the workflow I was thinking of automating this part.

Is it something possible?


#4

@andreatas 2 min…


#5

@andreatas It is working as expected. Here is the process in action.


#6

@Kulkul I did the same thing as you did but it still doesn’t work! Can you see why? The weird thing is that it always creates one parameter less than what it’s supposed to and the parameter that doesn’t get created always changes (reporting to your parameters names, one time is 3 that is not created, then is 5 and the time after is 1…without any logic)


#7

@andreatas I think it’s because you have run the script once and then undo once in Revit?
Could it be?
If so you need to delete all the parameters before to run again


#8

Hey @salvatoredragotta

Before rerunning the script I always go back to the initial state of the model and I close and reopen Dynamo and make sure that the parameters are not there. So it shouldn’t be that…

Anyway I have the same problem also if I run the script in a fresh model.

PS EDIT: I tried to run the script in a new empty file (Architectural Template) and it works. So I guess the problem is in the model right? What could it be and why is it always so random?


#9

Could it be this issue?
// There is another strange API “feature”.
// If param has EVER been bound in a project
// (in above iter pairs or even if not there
// but once deleted), Insert always fails!?
// Must use .ReInsert in that case.
// See also similar findings on this topic in:
// http://thebuildingcoder.typepad.com/blog/2009/09/adding-a-category-to-a-parameter-binding.html