RELOAD ALL CAD Links in one command

RELOAD ALL CAD Links in one command

Anonymous
Not applicable
2,300 Views
2 Replies
Message 1 of 3

RELOAD ALL CAD Links in one command

Anonymous
Not applicable

15 Years of programming in AutoLisp have me wondering if there is a way to create a "Routine / Shortcut" for reloading all the CAD links in one easy step? 

 

We were thinking of a two keystroke command like "RL" that would do the equivalant of opening the Manage tab and performing a Reload on ALL the files.

 

I'm currently going through the C# programming guide and wanted to make sure: 

#1  That the code I'm trying to write isn't already written? 

#2  That C# is the best / most efficent way to program in Revit 2014?

#3  If anyone can point me to a place that has similar code ideas to use as a reference? 

 

Frankly any help would be appreciated.  

 

Thanks

 

 

0 Likes
2,301 Views
2 Replies
Replies (2)
Message 2 of 3

jeremytammik
Autodesk
Autodesk

Dear Lord Raven,

 

Thank you for your interesting query.

 

I would definitely assume that this is possible, and quite easy to boot.

 

First, let me address your other questions:

 

#1 I am not aware of any existing public code to achieve this, surprisingly enough, although it sounds eminently suitable for automation.

 

#2 Well, discussions on pros and cons of programming languages can get a religious and even fanatical edge sometimes.

 

The only way to create a Revit add-in is via the .NET API. It is language agnostic, in theory. In practice, most of the existing sample code and my personal preference is indeed C#. Since all .NET languages compile down to IL, you can decompile any assembly back into any other .NET language. That can be used to translate between different languages as well. In summary, yes, I think C# is a good choice for you.

 

#3 I publish all my code on The Building Coder, both for my own and other's use and enjoyment:

 

http://thebuildingcoder.typepad.com

 

Now, back to the reloading issue:

 

I would assume that the following would work:

 

1. Implement a new external command and link it to the RL keyboard shortcut.

 

2. In your Execute method, retrieve all the CAD links that you wish to reload using a filtered element collector.

 

3. On each of the CAD link elements, call the RevitLinkType.Reload method.

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 3

Anonymous
Not applicable

First of all let me say thank you for the response.  I've visited your blog and skimmed through some of your code, but haven't had a chance to get any further with chasing down this code.  (Project deadline)  I'm hoping to look at the issue next week...

 

I was encouraged that you felt this would be a simple solution, but I don't know that I feel the same way, due to my lack of understanding with C# and how Revit commands work?  In CAD I can easily determine the command for a particular action, Revit seems to hide that information?  Clicking a button doesn't tell me how to invoke the command in a routine?   Is there a resource that better explains Revit commands?  Or how to find them out? 

 

Thanks again for the help.

\

 

0 Likes