Node to perform "load into Project" action?


#1

Hi all,

Does anyone know if there is a node for the Revit command “Load into Project” ?
Below is a schematic version of the workflow i have in mind.
I like the “Document.BackgroundOpen” and “Document.Close” nodes of @john_pierson (Rhythm) very much.
They are perfect for batch upgrade family files.
But with this extra node (Third step), i could use them for a lot of DynamoPlayer scripts.

I have seen Python scripts here on the forum that perform all 4 steps in one action, but they are often writen for very specific tasks. I have no Python knowledge, so i can’t change them, or write my own.

I hope there are nodes that i am not aware of.

Kind regards,
Mark


Load Family Into UnOpened Projects
#2

DanEDU.File.LoadFamily
loadFamily.dyn (7.6 KB)

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


#3

Hi Erik,

Thanks a lot :thumbsup:
I have your package installed, but i missed this one.

PS. Is there also a node that can “background open” families from the current project (instead of loading from a directory) ?

Thanks again,
Mark


#4

Hi Eric,

Maybe i cheerded too soon…
Can this node be fitted in my 4 step workflow (or does it only work with a filepath as input).
It is my goal to use it on Families that are already background opened.

Kind regards,
Mark


#5

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


#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

#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


#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.


#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


#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…


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


#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


#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


#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


#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


#16


#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”


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


#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


#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