The Autodesk.Revit.DB.CADLinkOperations
namespace provides classes and interfaces for working with CAD file links in Autodesk Revit.
Represents a link between a CAD file and a Revit project.
Defines the type of a CAD file link.
Represents a service for managing and interacting with CAD file links.
Defines the status of a CAD file link, whether it is up-to-date or needs to be refreshed.
Defines the insertion point of a CAD file link in a Revit project.
// Get the current CAD link service
ICADLinkService cadLinkService = Autodesk.Revit.ApplicationServices.Application.ActiveAddInId.GetAddInIdInfo().DLLApplicationEntryPoint as ICADLinkService;
// Open a CAD file and create a new CAD link
CADLink newLink = cadLinkService.CreateNewLink("C:\\path\\to\\file.dwg", CADLinkType.Import);
// Refresh the CAD link
newLink.Refresh();
// Check the status of the CAD link
CADLinkStatus status = newLink.GetLinkStatus();
// Set the insertion point of the CAD link
newLink.SetInsertionPoint(CADLinkInsertionPoint.Origin);
// Delete the CAD link
cadLinkService.DeleteLink(newLink);
CAD file links allow Revit projects to reference and display CAD files within the Revit environment. The CADLink
class represents a link between a CAD file and a Revit project, while the CADLinkType
enumeration defines the type of the CAD file link. The ICADLinkService
interface provides methods for managing and interacting with CAD file links, such as creating, refreshing, and deleting links. The CADLinkStatus
enumeration defines the status of a CAD file link, while the CADLinkInsertionPoint
enumeration defines the insertion point of a CAD file link in a Revit project.