OrchidForDynamo icon indicating copy to clipboard operation
OrchidForDynamo copied to clipboard

Document.LoadFamily node not working using Revit 2023 but works using Revit 2020

Open jarods350z opened this issue 2 years ago • 9 comments

Windows 10 Revit: 2023.0.2 Dynamo: 2.13.1.3887 Orchid: 213.0.1.8

have the node Document.LoadFamily in my dynamo script. I ran my script in a family environment (border)

It should replace the family in the file with one that is picked on the network with the same name (state seal)

Got an error that I need to run this command in a project document

P.S. this works fine using Revit 2020

orchid error

Add Seals_script.zip

jarods350z avatar Aug 10 '22 21:08 jarods350z

I will test it asap :-) however I will correct you wrong naming of the graph, into "Add.Seals_graphs" Scriptting is only what happens in code blocks and in python script nodes... nowhere else.

erfajo avatar Aug 11 '22 12:08 erfajo

Thanks you so much for your quick response.

as a reminder, I run this node in a border annotation family not in a project. it replaces a placeholder state seal with the state seal where the new project is located. both families have the same name

jarods350z avatar Aug 11 '22 13:08 jarods350z

aha, that was why I could not replicate the error. The error message says it all... This node works only in a project file, not in a family document file! If the target is a family document, then use the comparative node for families :-) If it had worked earliere must it be and older version you have of my package, I have added a test there should test if it is a project og a family document now... However, I did made som missing cases of nodes while testing, so the new version have more nodes for loading families :-)

please note the blue circle on nodes meant for family documents, and red circle for project documents :-)

erfajo avatar Aug 11 '22 15:08 erfajo

OK looks like I need to change the way my file looks at the revit family, because it says it cant use a string to load. any suggestions orchid error new ?

jarods350z avatar Aug 11 '22 17:08 jarods350z

sure, just open the file in background, and close it again when you have ended the usage. Add Seals_graph.dyn.txt (remove ".txt") Add Seals_graph It is better to have the proper object instead of doing it with a string value, I have marked the node internally so loading with strings will end at some point and will be replaced with this much more informed way to do it, since the user has a better understanding what is happening. The node that takes string values do what is shown above... is is opening in backgound, it is loading, and it is closing the document again.

erfajo avatar Aug 12 '22 06:08 erfajo

I have decided to mark the nodes taking a file from a string as obsolete when the next version is released.

And I found that dynamo has an error in the earlier version, if you had several nodes named as the same but taking different input, then would dynamo not see it as an error if it was fed with a wrong type. Meaning, if the family node took a string, a Family, or a Document, and if the node only should take a string value but got a document, then would it just recycle to another method (node) without warning and returning a correct result. This I very dangerous and I am glad that this has been removed in the latest dynamo version.

erfajo avatar Aug 12 '22 11:08 erfajo

Wow thank you that works when I run it directly from Dynamo. Unfortunately, it only works a few times when I run it through pyrevit or the Dyno Browser. (It acts the same, but nothing is replaced) But this at least gives me hope.

It might be because it needs to update the family from 2020 to 2023 first so the data stream await runs out of time before the close. I will keep testing.

Thanks again for the help here is my final script if you want it Add Seals.zip .

jarods350z avatar Aug 12 '22 13:08 jarods350z

That was it! Once I opened a few of the seals and upgraded the families to Revit 2023 it worked fine through the toolbars. It must stall in the upgrade process just a FYI.

jarods350z avatar Aug 12 '22 13:08 jarods350z

Sure an upgrade session is not something I under any circumstances can manage… this is something that is handled only inside Revit and does not send feedback to Dynamo. Meaning, you have to do the upgrade process in a manner where you are sure no other things must happen which can conflict with that.

remember no scrips only graphs... unless you really are scripting in code blocks or having it all as a python script... meaning no class or definition calls in your python script, unless you can answer yes to that you have moved far beyond scripting. https://erfajo.blogspot.com/2019/03/graphs.html

erfajo avatar Aug 12 '22 13:08 erfajo