Adding Shared Parameters to a family

Hi All

I have been asked by someone in the office to produce a script that would allow him to add a number of parameters (from a shared parameter .txt file) to a Revit family in one go (I believe he is updating our Revit Family Library, so will have a lot to do).

I have seen similar posts but they all seem to be adding the shared parameters into a project and not a family.

I am still relatively new to Dynamo so I apologise in advance if I am not up to scratch.

If anyone could point me in the correct direction or shed any light on the topic it would be much appreciated.

Cheers

Jordan

3 Likes

try to see this post

1 Like

Thanks @erfajo

Unfortunately I cant seem to get it to work.

The files are opening but close straight away without the shared parameters being added.

I have copied the finished script from your last post, so don’t understand how an error has occurred.

try to see this then… hope this can inspire your to do your graph. What you should learn from this is, bulk open (bulk upgrade) using Rythm nodes (@john_pierson) and closing them again with Rythm nodes.

This is how I bulkopened all my families and added my shared parameters the first time.

BulkUpgrade-sharedParameter.dyn (18.1 KB)

This is how I bulkupgrade from one version to another every year for the DanEDU Content package for revit families… this is several hundred objects I need to update every year. I add the new version Id to all families, but add also other copyright elements to the objects, just in case :slight_smile:

BulkUpgrade-copyright.dyn (15.6 KB)

postscript… the graphs and .dyn files is updated with nodes that can be found in the “DanEDU Dynamo” packlage!

2 Likes

Thank you @erfajo !

Not meaning to push my luck but could you tell me where to find the Directory. ContentsAll node that you have used within your graph.

I don’t seem to have it within my downloaded packages.

Thanks again for all of your help!

Sorry… thats one of my nodes… DanEDU dynamo package.

But you can use the below, that will give you same as long as everything is in that root folder, the OOTB node doesn’t give you a deep search.

postscript… post Adding Shared Parameters to a family is updated, holding a note for all packages including mine :slight_smile:

Thanks,

I have run the graph and it seems to be encountering a problem. the add.shared parameter node has given me a warning saying that there is a problem with line 33 in the code.

Is there an obvious reason why this is happening? What is that line referring to?

I apologise once again at my lack of Dynamo / Coding knowledge.

Please see screenshot of warning message.

woopsa daisy :slight_smile:

my bad… bad programming… I am so sorry :slight_smile:

My code doesn’t run on only one file, it needs at least two. Since none of my folders only contains one family, I don’t have the problem… give me some minutes and I can upload a new one.
or you can cheat and put two files in you folder throwing the other one away

postscript… post Adding Shared Parameters to a family is updated, having no errors :slight_smile:

No problem- we don’t normally have just the one but as it’s a test I didn’t want to overload it.

I have added another file to the folder. Unfortunately the result is still the same :confused:

I have updated my original post, including note for my own nodes :wink:

No one should download my initial mistakes… So here you go :slight_smile:

Unfortunately it is still not working.

Not sure what I have done wrong :confused: the same error message is coming up.

let me guess… you take List[0] twice before closing… remove one of them :wink:

the python script nodes is working like this…
list[0] passes the documents which goes in
list[1] passes a log telling you if the script succeeded file for file.

I have done… Guess what! a new error message.

The message this time shows a problem within the TransactionManager.Instance.EnsureInTransaction(doc) line.

please check what I have done… compare your script to mine in post

you removed the wrong list[0]… that one was indeed needed, but two twice after each other isn’t!

…and most important, you are not trying to (re)open a family that is open already?
Don’t ‘stand’ in the same folder as the one you are using to bulk open from!
Give your Revit a restart, open something form a different folder or start Revit with an empty project!

Thank you ! it all turned into a blur up until that last post.

I have managed to get it to work (with your help :stuck_out_tongue:) when adding a single parameter but unfortunately it still doesn’t want to work when adding more than one.

Obviously just by doing it one parameter at a time will save a large amount of time but if I can fix in to get them working in one process then that would be great.

Try to follow how it works in post

Hello!

disclaimer: New to dynamo and probably the worst thing to tackle but duty calls!

I have been trying to follow this dynamo code for the last week and have been unable to get it remotely working. I am on RVT 2017 with dynamo. 1.3.0. I have tried using dynamo by it self, with a family open, with a project open, with a project and family open, or a new family from a template saved in a different location and have been completely stumped.

I am unable to even get it to recognize a folder for some odd reason past the first node.
is this something that need to opened and closed multiple times? as if the nodes need to be switched in a specific order?

I am unable to upload any files other then the screen cap due to being a new user.
The .dyn I am using Adding Shared Parameters to a family (23.2 KB) BulkUpgrade-sharedparameter.dyn

The folder I have the 2 families in (Family1.rfa and Family2.rfa) is called ‘fami test’ and is located on the desktop. The .dyn is being run from the desktop (have tried in MyDocuments, Downloads, even off a server, and no luck)

Is there a specific order that this needs to run in? am completely lost at this point but not giving up that fast as I have over 500 families to add these parameters to! this is an old smaller .txt shared parameter file am testing with. The current one is about 3 times as large.

Thanks to anyone who can help!

This is a Revit shared parameter file.

Do not edit manually.

*META VERSION MINVERSION
META 2 1
*GROUP ID NAME
GROUP 2 Site Data
GROUP 3 Owner Information
GROUP 7 Project Scheduling
GROUP 8 MEP Schedules
GROUP 9 ARCH Schedules
GROUP 10 Structural
*PARAM GUID NAME DATATYPE DATACATEGORY GROUP VISIBLE DESCRIPTION USERMODIFIABLE
PARAM 34223f01-bd95-490b-b129-48cc553fa3f1 C.B. TEXT 8 1 1
PARAM 8fa3ee03-2c92-4fdf-b859-38df65478709 Remarks TEXT 7 1 1
PARAM ba5da615-a1e0-44e6-905a-f7825623f442 MCA ELECTRICAL_CURRENT 8 1 1
PARAM 5d060219-5f78-4335-b79d-26788a63532c Lot Number TEXT 2 1 1
PARAM 43c0621e-8960-45e8-98f7-ce6458bea906 Governing Agency TEXT 2 1 1
PARAM ee8e9625-fdf3-4dc9-92fe-5382c40fcdb3 Vent Diameter LENGTH 8 1 1
PARAM 04a1902a-48f4-4e5b-ab46-bcff5a58ff79 Ambient Tempature HVAC_TEMPERATURE 8 1 1
PARAM 8831502e-9dcf-46a0-adac-edec88c7ef7d Length LENGTH 7 1 1
PARAM 2a421b2f-16b3-4e61-a485-975a14b72484 Zoning TEXT 2 1 1
PARAM 13475232-55ef-420d-bb3b-8e839e50389c Fax TEXT 3 1 1
PARAM 6726243b-505c-47ec-8b3d-cd138de47b78 Usage TEXT 7 1 1
PARAM 42ada13c-b44c-47e0-b0cb-d064a7bafa3f WB HVAC_TEMPERATURE 8 1 1
PARAM 30f16f44-ecce-4efc-88e1-a086df7ab2ef Address TEXT 3 1 1
PARAM 957c8944-2102-4b06-aa11-18833b795f78 Project City TEXT 2 1 1
PARAM ce83cd46-ed09-4ad7-ba58-7b3cd641e822 Exhaust Collar Qty INTEGER 8 1 1
PARAM 878e4b50-31e2-4531-92b9-329f32fd98c1 Phone TEXT 3 1 1
PARAM bdcfcc51-cf4c-475f-871e-2d15040ca098 Supply Air Flow HVAC_AIR_FLOW 8 1 1
PARAM 9b76fb54-c6e1-46cb-b399-541066e51357 Drive Arrangment TEXT 8 1 1
PARAM e59aed55-3788-497e-b7ad-360b16e642fe Noise Criteria NUMBER 8 1 1
PARAM 561e6d59-fd00-4efd-b7fa-f59c837edda3 Project Area TEXT 2 1 1
PARAM 8400455a-cb83-4433-a41b-16f2b0137060 Cooling Capacity HVAC_AIR_FLOW 8 1 1
PARAM b67a4e6e-b1b1-4a46-a6e2-690a0a62e2b0 EER NUMBER 8 1 1
PARAM 47a61270-9f73-4733-869b-e87e314bbfd3 MOCP ELECTRICAL_CURRENT 8 1 1
PARAM b865f570-516f-4d65-8619-156dd4864f55 Exhause Collar Size TEXT 8 1 1
PARAM 6fa53b72-c8dd-4535-9092-26744ed5d527 Unit Weight INTEGER 7 1 1
PARAM 18d88e73-e746-40da-8776-72ccd4f12de8 Date Of Survey TEXT 2 1 1
PARAM 1d54aa74-16d0-4fd1-85ae-c7948dfa519a Key Note Text TEXT 7 1 1
PARAM cdf08879-7ac0-44eb-b976-d9ebbc63a438 Moisture Removal INTEGER 8 1 1
PARAM 58f6f680-c435-422a-b64e-ea159a00e4d5 Exhaust Air Flow HVAC_AIR_FLOW 8 1 1
PARAM 4454338f-e372-4c98-a9f8-8eb91522234b Number of Poles NOOFPOLES 8 1 1
PARAM f47f5792-9d27-4e3e-a6d1-11b18e01f8a7 District Number TEXT 2 1 1
PARAM c83ca094-6efc-4fc7-9c75-61d8ff0314b0 Height LENGTH 7 1 1
PARAM 9ccc599b-ca12-44d5-a49e-36f367736164 Width LENGTH 7 1 1
PARAM 77ec639f-6151-4e3c-aef1-7b37bbacf7c5 Motor HP NUMBER 8 1 1
PARAM 19c14fa0-5162-45b2-8a8f-195d82354a41 Tons NUMBER 8 1 1
PARAM 4e393ea3-0a57-40bc-8d47-fe25900da83d Waste Diameter LENGTH 8 1 1
PARAM 5e8276a5-e8d9-473b-99d0-d7d816b20560 Supply External Static Pressure HVAC_PRESSURE 8 1 1
PARAM 70bef0ae-aeb3-4d41-a9a4-6ae125ce174f MIN O.A. CFM HVAC_AIR_FLOW 8 1 1
PARAM eddaffb7-62bc-4798-838c-fbc8336575a0 HW Diameter LENGTH 8 1 1
PARAM 2ef8d4be-e806-413b-ba8c-fdc513936da3 Sensible Cooling Capacity HVAC_COOLING_LOAD 8 1 1
PARAM a42631bf-ce1d-43e5-9a3c-ca0371df7c12 Project Juristiction TEXT 2 1 1
PARAM 3f24aec4-3627-49f2-be93-7672d81430f8 Wp NUMBER 10 1 1
PARAM 7bef19c6-1249-4a9d-8348-5a10c983ab05 Voltage ELECTRICAL_POTENTIAL 8 1 1
PARAM 718f26cf-8904-412c-9e41-49eebf2b93d6 Amps NUMBER 8 1 1
PARAM 21a919d4-a833-4319-b912-bb6a399cfcfb Phase INTEGER 8 1 1
PARAM a2b945d9-ef15-422f-a6ad-20d9225f2caa CW Diameter LENGTH 8 1 1
PARAM 9154f7db-aba6-4c0c-9183-dc33e0577aae Finish TEXT 7 1 1
PARAM 428b6de2-afb4-4726-bc45-524b40abfa18 Area Of Disturbance TEXT 2 1 1
PARAM a91cd5e6-7004-4d5c-ba8d-fd6d47e1056c OBD YESNO 8 1 1
PARAM d8ae1ee9-f69c-4b43-a9d5-ec44099a1a44 Supply Fan Blade Speed NUMBER 8 1 1
PARAM 41af48e9-647c-4795-9057-8dd43fb36276 Electric Heat kw LENGTH 8 1 1
PARAM c4cc96ef-4f7e-4b16-a9d8-6c120b21f93c P.I.N. TEXT 2 1 1
PARAM d321a6f4-8e6a-4c1e-af14-c36c4d62dabc MAX O.A. CFM HVAC_AIR_FLOW 8 1 1
PARAM e1e966f5-0ef9-4066-9975-e844653a75f4 Name TEXT 3 1 1
PARAM 2a63fffa-ddee-4abd-824b-763d6cac083d DB HVAC_TEMPERATURE 8 1 1
PARAM ca1f3cfe-b8b8-4a6a-a757-4f6c1a462a58 Controlled By TEXT 8 1 1

For a start you need to have some files, a null list will not work. Try folder path without blank spaces!
You need to fix this part… otherwise will nothing work!
The folder I have the 2 families in (Family1.rfa and Family2.rfa) is called ‘fami test’ and is located on the desktop. The .dyn is being run from the desktop (have tried in MyDocuments, Downloads, even off a server, and no luck)

In the code block you are asking if it is shared parameters… below is the code from Family document add shared parameter

docs = IN[0] #document list
spfile = IN[1] #shared parameter file as string
group_name = IN[2] #group in shared parameter file
param_name = IN[3] #parameter name in shared parameter file
exec("param_group = BuiltInParameterGroup.%s" % IN[4]) #BuiltInParameterGroup as string
instance = IN[5] #boolean value for instance

As you can see, and can see in the image you are asking for, the lines with “Creator xxx” is shared parameters which goes into IN[3]

Finally yet importantly… open a new post referring to this post instead of continuing on an old post!

I’ve been having zero luck with any of the Directory.Contents nodes lately (OOTB and custom). Has something changed?
I was able to get Python to find files for me though:

from System.IO import Directory, SearchOption

dir = IN[0]
searchstring = IN[1]
foundfiles = []

if Directory.Exists(dir):
	dirfiles = Directory.GetFiles(dir, ".", SearchOption.AllDirectories)
	for file in dirfiles:
		if searchstring not in file:
			continue
		else:
			foundfiles.append(file)
	OUT = foundfiles
else:
	OUT = "Directory does not exist."