Link DWG Files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey guys,
Should be a trivial question but I can't get this thing done and I can't understand why.
What I'm trying to do is to link some DWG files inside of Revit project.
I've seen from the SDK that now from Revit 2018 there's the API LoadFrom(string Path) and that looked like what I needed, right?
But for some reason I can't use it in my program.
See the code:
// Hardcode the path just for testing
string path = @"C:\Users\atassera\ARC-2228-01.DWG[6].dwg";
using (Transaction trans = new Transaction(doc))
{
trans.Start();
CADLinkType.LoadFrom(path);
trans.Commit();
}Ok the code is not much, I understand, but I thought this would have been pretty much it, considering that the LoadFrom method asks for a file path as a string...
The problem is that Visual Studio doesn't even give me .LoadFrom() as an option/suggestion and if I type it in, then it says "An object reference is required for the non-static field, method, or property....."
I've also seen there's the Link Method (String, DWGImportOptions, View, ElementId) from the Document class, but I don't want to link my DWG file to a view. I just want to normally link it as you would do from the Links Manager. That's why I didn't pursue that path.
So it's clear there's something missing but I can' understand what. Any revelation to share?
Thanks everyone!
Andrea
