Node to perform "load into Project" action?

#5

For opening and closing files I use @john_pierson Rhythm nodes… just like you :wink:

1 Like

#6

First, if files are already in the project then my node isnt needed. Next, why should files be open in background if you want them in your project? My node opens and close files (and upgrade if needed from previously versions) on the fly, but dont save them of course…

If you want upgrading including saving and loading at the same time you could try to combine @john_pierson nodes and mine :slight_smile:

or… tweak my code as the following, then it will upgrade and save :slight_smile:
the below line need to change
famDoc.Close(False) -> famDoc.Close(True)

#Copyright(c) 2014-2017, DanEDU Dynamo
#Erik Falck Jørgensen, Technical University of Denmark (DTU)

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

#input assigned the IN variable
paths = IN[0]

#wrap input inside a list (if not a list)
if not isinstance(paths, list): paths = [paths]

#ensure loaded families can overwrite existing families.
class FamilyOption(IFamilyLoadOptions):
	def OnFamilyFound(self, familyInUse, overwriteParameterValues):
		overwriteParameterValues = True
		return True

	def OnSharedFamilyFound(self, sharedFamily, familyInUse, source, overwriteParameterValues):
		source = FamilySource.Family
		overwriteParameterValues = True
		return True

#core data processing
for path in paths:
	try:
		famDoc = app.OpenDocumentFile(path)
		famDoc.LoadFamily(doc, FamilyOption())
		famDoc.Close(True)
	except:
		pass

#output assigned the OUT variable
OUT = paths
0 Likes

#7

Maybe we should take a close look at our workflow…:slightly_smiling_face:

Current workflow (before/without Dynamo)

  1. We have a source directory with family files.
  2. We copy needed family files to project directory.
  3. We open the above families and edit their parameters.
  4. We save the edited families to the project directory.
  5. Then we load the families into the projectfile.

By skipping steps 2, 3 and 4 (edit the families once they are in the project) an accidental “save” command will overwrite the source families.
For now your solutions will do, and gave me something to think about.

Thanks again,
Mark

0 Likes

#8

I have nodes that could support that workflow. The family nodes works exact like that. Meaning that family files placed in a folder can be opened and get their parameters changed, and/or formulas, and/or added shared parameters in the order you choose. In combination with the open and close nodes in the rhythm package :slight_smile:

Then load the families in a project subsequent :slight_smile:

An example is shown below.

1 Like

#9

Eric, you’re the best

That’s exactly what i had in mind, you gave my rough ideas a boost.
One final question:
Would it be hard to edit the “DanEDU.File.LoadFamily” node to accept a “familyDocument” input, and give it a “document” output, like your other nodes.
If it’s a lot of work, forget it, you helped me more than enough.

Kind regards,
Mark

0 Likes

#10

On your request have I made a new node for loading families as family document. It can be used as shown below. Please update to the current DanEDU dynamo package.
BulkUpgradeLoad.dyn (13.2 KB)

All Family Document nodes…

6 Likes

Add parameters in family
Family document add shared parameter
Change Family parameter to shared parameter in ADSK family
Changing family type parameters and creating new types
Family Parameter Swap
Create Parameters in a Revit Family
Edit Formula Value in Project Environment for Multiple Families at Once
Different input for "Document.BackgroundOpen" node?
#11

Hi Erik,

Now i’m totaly satisfied, a big bow for you :thumbsup:
Thank you for your patience, and all the help.

Kind regards,
Mark

1 Like

#12

Hi @erfajo, I’m starting again from your example (without python)… without result.
I’m experiencing problem just at the beginning of the script…
I can not really understand what is “i” filePath…

Antonio

0 Likes

#13

Hi @fablabolbia,

I was searching other topics, and thought the below link was worth mentioning.

https://forum.dynamobim.com/t/solved-very-basic-create-sheets-in-revit-from-excel/15368/4

Maybe the spaces in your path are the problem, as @Marcel_Rijsmus mentioned.

I hope it helps,
Mark

0 Likes

#14

It is hard to say what goes wrong…I cant reproduce your problem.


However, if you have write protected folders or files it will fail… it is important that it does that, since only writable paths and files are usable.

Postscript:
The Directory.ContentsAll node is updated as shown below

1 Like

#15

Dear @erfajo
First thank you for providing your package for Revit Dynamo.
I want to use an add shared parameter workflow based on your nodes. I rebuilded the workflow in Dynamo like in a picture of yours shown above (All Family Document nodes). But now there is occurring a failure. In the Family there never showing up new added parameters. The “DanEDU.FamilyDocument.AddSharedParameter”-Node says “An error occurred! Please veryfy setting”. Are my inputs not correct? All Shared Parameters are in the SPFile and its loaded to the Family. See my attached pictures. I would be very pleased if you can have a look and help me.

Best regards Dan

Shared parameter File detail:
# This is a Revit shared parameter file.
# Do not edit manually.
*META	VERSION	MINVERSION
META	2	1
*GROUP	ID	NAME
GROUP	1	Schlüsselliste
GROUP	2	Projektinformationen
GROUP	3	Raumbuch
GROUP	4	Luftmengenberechnung
GROUP	5	Plankopf
GROUP	6	Leistungsberechnung
GROUP	8	HLS-Bauteile
GROUP	9	Nutzungsvereinbarung

0 Likes

#16

0 Likes

#17

hi @Dan.Worlder

I am the one to blame for my usage of the SP file… so sorry for that. The thing is, I hated that I couldnt sort the content of the groups properly, so I tweaked the file… wups should not do that :wink:

that meas that my file looks like this:

# This is a Revit shared parameter file.
# Do not edit manually.
*META	VERSION	MINVERSION
META	2	1
*GROUP	ID	NAME
GROUP	1	01:   Sheet & Project
GROUP	2	02:   Identity data
GROUP	3	03:   Constraints
GROUP	4	04:   Dimensions
GROUP	5	05:   Energy
GROUP	6	06:   Structural
GROUP	7	07:   Mechanical
GROUP	8	08:   IFC parameters
GROUP	10	10:   CCS Common Instance
GROUP	11	11:   CCS ID
GROUP	12	12:   CCS Common Type
GROUP	15	15:   Sigma
GROUP	18	18:   Dynamo
GROUP	20	20:   API Parameters
GROUP	21	21:   Exported Parameters 

Thats why I must feed my group as “01: Sheet & Project”, but you should not do that, you should feed it as “3-Plan-Parameter”

1 Like

Adding Shared Parameters to a family
#18

Thank you for your fast response @erfajo !

Now i understand…! And it worked fine so far. Added my first Parameters to several Family-Files.
Made my Day :smiley:

Have a nice Weekend later.

Dan

0 Likes

#19

Thanks, and the same to you :slight_smile:
…and sorry for the troubles you got for my pernickety behaviour in my SP file :-S

0 Likes

#20

Hi all,

At the moment i’m creating a list Dynamo Player scripts (Revit 2018.1) from the above workflow.
I thought it would be nice to share some examples with you (for those who are interested).

02 PROJECT DIRECTORY_03 add shared parameters to families_STAIRCASE NUMBER_save.dyn (16.0 KB)
02 PROJECT DIRECTORY_03 add shared parameters to families_STAIRCASE NUMBER_update_save.dyn (17.7 KB)
02 PROJECT DIRECTORY_03 add shared parameters to families_STAIRCASE NUMBER_value_save.dyn (19.3 KB)
02 PROJECT DIRECTORY_03 add shared parameters to families_STAIRCASE NUMBER_value_update_save.dyn (21.0 KB)

Thanks again @erfajo and @john_pierson for these great nodes! works perfect.

Kind regards,
Mark

6 Likes

#21

Hello all,

I am trying to update a parameter name for an element within a family using a project directory. I don’t see a node that would accomplish this. Can you offer any help on this issue?

I am currently trying to change a material name from say “Glass” to “New Glass”.

Thanks.

0 Likes

#22

Hi @jwheeler,

The link below contains a picture of all “DanEDU” nodes you can use on a (background opened) FamilyDocument. So i guess “FamilyDocument.SetParameterByName” is the one you need.

https://forum.dynamobim.com/t/unable-to-add-multiple-sp-to-multiple-families/17742/29?u=mjb-online

Kind regards,
Mark

0 Likes

#23

Hi @MJB-online,

Thank you for the quick response on the last post. This does work for what I need, but I wasn’t completely clear I suppose on what I need. I apologize.

I also need the ability to query what parameters are set up and what there values are in general, because the material I need to update is across multiple families and are set up on different parameter names across those families. A door might have the “glass material” set up under “Glass Parameter” and window family might have it set up under “Glazing Parameter”. Both need to be updated.

Do you know of a node that will accomplish this while working with the same FamilyDocument nodes?

Thank you.

0 Likes

#24

Hi @jwheeler,

I’m sorry i don’t think there are more nodes available for that, then the ones i mentioned above.
Maybe @erfajo can give you some more information, as i can’t help you myself.

Kind regards,
Mark

0 Likes