Stepping Into your macros and “Is this an import or a link?”

link

At Do U Revit, there is a post about finding and eliminating CAD imports from your Revit project. This is easy to do with a little bit of macro writing, and it also offers an opportunity for me to write about the “Step Into” macro command, which is a great way to explore the API and figure out how you might solve a specific problem.

In this case, I write a macro that prompts the user to select an element. If I select a DWG import and a DWG link, is there any way inside the API that I will be able to tell one from the other? If I want to write a filter to get all imports or all links, what data can I use to get them?

The answer is that imports and links both belong to the API’s ImportInstance class and this class has a property IsLinked (as shown in this screenshot from the API help file).

To learn how to find the answer, watch this video.

One thought on “Stepping Into your macros and “Is this an import or a link?”

Leave a comment