Modify Room Calculation Point toggle (Builtin Parameter)

Group,

 

I have another one for you and it may not be possible but from what I am seeing in RevitDbg it should be (I’m new though so I could be looking at it wrong). When I look at a family and look at the Builtin Parameter for Room Calculation point it looks through Revit lookup like this can be set with the API. I have found the examples using the Set Built-in Parameter node in the arch-lab package. I need to turn this flag on in some families we are using (in my example I am using furniture). Below is a capture of my script. Has anyone tried this or am I going down the wrong path? I have a hole series of families that my users would like to enable this function on so I was trying to script it.

Room Calculation Point

 

 

 

Jeff,

Parameter name should be: “ROOM_CALCULATION_POINT” (I am assuming that’s the actual name as I havent looked it up myself).

Parameter Value should be also a list {true};

You see how true is lower case. When you used uppercase it just created a variable for you. Try that. I havent tested this so no clue if it will work.

Thanks Konrad. That didn’t work but I appreciate the info on the upper case lower case thing. I will try a few things and post my results.

It might prove trickier than that. The room calc. point is a family parameter. In Revit each family is a separate document. That means that you actually have to open the family first before you can edit any of its parameters and then manage to load it back inside the project document.

It might be possible to do this through Dynamo but it will require a lot of API-fu.

You can check family parameters like so:

2015-08-04_09-47-59

Dimitar,

 

I have been working n a way to do it inside of the family. We had several family files on a project we were needing to do this for. So my idea was to use dynamo to read a set of files from excel, open the family make the change, save and move to the next. From what I am finding I don’t think it can be done.

Jeff,

Does this work for you?

CaptureHere is how this works. You take a family that you want to override and place it in the folder. You can place multiple families in there if you want to override this parameter for all of them. Use Directory.Contents to get all the family paths and feed that into Python node. Then also feed it a BuiltInParameter name as a string, and a value that you wan this parameter to be overridden to.

Hit Run and what will happen is that it will change that one parameter in the family, reload that family into the model silently and return that newly modified family.

Sounds like a plan?

Good luck!

Capture

Capture

 

Oh Dimitar, does this qualify as API-fu? LOL

Absolutely! Good job as usual.

Hi Konrad,

crazy work! thanks for sharing!

I was wondering if it woud be “easy” to change the python script, to create a new family parameter and set the value?

Not too hard:

After the transaction is started, you can add this:

group = BuiltInParameterGroup.INVALID # invalid is same as “Other” in Revit UI

parameterType = ParameterType.Text # or Integer or Double or Length pick your own

famDoc.FamilyManager.AddParameter(“Param Name”, group, parameterType, true) # true stands for instance parameter

That should do it. But i would convert that into a function to make it more flexible.

Konrad I will give it a try. I got pulled off to another script but am back on this one. I really need to dig down into python. I was headed down the python road after Dimitar mentioned that we would probably have to go the API-Fu way. I will test and let you know.

 

On a side note can you guys point to a good source to learn python? I have done some C#, VBA, VLISP, VBScript, but python seems to be causing a mental block with me.

I would say that if you are familiar with C#, then you can fairly easily compile Zero Touch nodes. The problem with those is that you can’t really “hack away” at them in such a quick and readily accessible way. I mean Python is two clicks away, while Zero Touch requires you to fire up Visual Studio and go through the whole ordeal of compiling a node.
Personally, I learned Python just from trying to solve issues like this, and then googling a lot of problems i ran into. I mean syntax issues and not knowing how to perform certain list functions etc are readily available on Stack Overflow. Then it comes down to just trying it, failing, debugging, trying again and again until it works. :slight_smile: If you are familiar with C# then all of the Revit API examples in the SDK are written in that language so its easy to translate to Python for someone who understands the syntax for both.

Konrad, Thanks. I ran the script and it returns the new family value but the parameter is not getting set. I will keep looking at it. I am attaching the dyn file.

 

Set_Room_Point_Test1

 

I just found my mistake. Oddly enough it was not giving me an error but I was not setting the new value and then closing the transaction

I take that back I still have something wrong. It keeps telling me I am operating outside of the transaction. I am attaching the DYN file but I am assuming that the following section is were the transaction being opened, the action done, and then the transaction being closed.

TransactionManager.Instance.EnsureInTransaction(famDoc) #open the transaction

param.Set(value) #set the value of true into the parameter

TransactionManager.Instance.TransactionTaskDone() #close and commit the transaction

 

Set_Room_Point_Test2

I have it working. I changed the transaction section to not use the EnsureInTransaction.

transaction

1 Like

Hi Jeff,
Is it possible to share this script please ?

Same question…

The photo link is error…, could you send again?