Unload (not delete) dwg links?

I’m looking for a way of unloading dwg links through Dynamo. I don’t want to delete the links, just to unload them for md.

Is this available within the API, and if so, how can I go about it?

Revit 2024, Dynamo 2.19

Quick search found this: Turn on/off Link with the same Script - #2 by Draxl_Andreas

1 Like

Thanks, I’ve been searching “unload” rather than simply “turn off”!

1 Like

unfortunately this is for Revit links, I need something similar with dwg/cad links

Hi @danbuckinghamCA67E probably as here if i understand :wink:

Hi All-

Dan- I assume you want to unload links to not just hide (turn off) the DWG in a particular view as doing so:

  • affects the DWG throughout the entire project

  • saves resources (memory, etc)

Your API question is a good one, as if the API does not handle unloading DWGs, of course Dynamo cannot do it. Looking at RevitApiDocs, there is an “unload” method, but it only appears to apply to Revit links:
Unload Method (revitapidocs.com)

The Link method seems to apply to the other types of files you can link in:
Link Method (revitapidocs.com)

So, I think that for the moment you are out of luck (but I would be glad to have someone prove me wrong!) I also found this, which seems to indicate Autodesk is working on expanding the API for all kinds of linked files:
We need your feedback on Manage links API - Autodesk Community - Revit Products

Maybe you could reach out to that team for more info.

Joe

2 Likes

yeah :wink: or just delele the instance and reload, if it is the user is after

Unfortunately, if you delete the link and load it again, you lose any view specific settings and/or object overrides you have set previously.

Will be great when we have a fully realized linked elements API… I am still waiting to be able to control Revit link category visibility.

1 Like

yeah me to ;)…but this is for importinstance but probably the same issue with viewspecific settings as revit link

Thanks Joe, this is exactly what I’m trying to do. For context, I’ve come on to a project with numerous massive dwg links loaded in as specific locations (some of which are in excess of 450Mb), so I was looking for a way of freeing up memory. The linked files are so heavy that Revit often can’t even load the Manage Links dialogue box…

Thanks for looking into it, I’m not that familiar with the API so its still a bit of mystery to me. I may have to look for alternative ways of handling the links.

One hacky workaround I have used is playing back a Revit Journal file to do this sort of thing.
The journal is a VB Script that can be used to playback via drag and drop, so you could record yourself opening up the Revit project and unloading the DWGs, then cut off the rest of the journal- use that when you want to open the projects without links.

Run it, walk away to get your coffee, and then come back when it’s done.

https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Revit-Creating-a-Playable-Journal-File.html

If you’re going to perform the action on a new instance (which replayable journals do) it’d be orders of magnitude faster and easier to use the transmission data class. I believe that this should work for such a use case, though you’d have to update it to work for DWGs only and in Python.

Of course- which is why coffee is a vital part of the workflow. :wink:

I’m not sure that the methods you have cited work for CAD/DWG links, but only for Revit- I would be happy to be proven wrong, though.

The first method is only valid for RVT links.

As an alternative you can put each link in it’s own workset (a best practice for many reasons) and just close the cad link worksets, which should provide equal results to unloading individually.

1 Like