BimRv SDK: Manage Attached Files

Alexander Odnorog

March 23, 2023

Link Manager is an OdaBimApp tool that allows you to manage the files attached to a building model. The manager displays the added CAD files, DWF markups, and point cloud files. You can also create new links to RVT files and edit existing links if they are not valid.

To open Link Manager in OdaBimApp:

  1. Open any RVT file.
  2. Choose Format > Manage Link.
manage link

Each tab is for different file formats: Revit (RVT), IFC, CAD Formats, DWF Markups, Point Clouds, Topography, PDF, and Images.

For all file types except DWF Markups and Topography, you can see the file name, path to the saved file, and the path type (relative or absolute).

Links to Revit (RVT) files can be edited by selecting the required file and clicking Edit File Path.

edit file path

In the new window, you can change the saved path and path type.

save

Also, you can add a new link to the RVT file or delete an existing one. These features are available only for RVT files.

Extend Functionality

RVT and IFC File Formats

The supported file type extensions are .rvt, .ifc, .ifcXML, and .ifcZIP.

To get all available links, use the getAppInfo() method with a specific parameter:


pRvtLinkTracking = database()->getAppInfo(OdBm::ManagerType::RvtLinkTracking);

To work with links to RVT and IFC files, use the OdBmRvtLinkSymbol class in the database. To get basic information about a referenced file, use the following methods:

  • getFullDisplayPath() — Gets the displayed file path given the type of path.
  • getOtherDocModelLocation(), getLastKnownModelPath(), getPath() — Gets the full file path.
  • getSymbolInfo(), getName() — Gets the filename with its extension.
  • getRelative() — Gets the path type. If the method returns true, it is a relative path, otherwise it is absolute.
  • getShouldLoadSource() — Gets the status of a linked file. If the method returns true (loaded), the model of the linked file is vectorized; if the method returns false (unloaded), the model of the linked file is not vectorized.
  • getLinkOriginFileType() — Gets the file format. Returns a value from the OdBm::LinkOriginFileType::Enum enumeration.

To copy the UI element behavior of Link Manager, use the following code:

  • Loaded/Unloaded button — Changes the load status. To control the status, use the setShouldLoadSource() method.
  • Add button — Adds a new link for a RVT file.
ODBM_TRANSACTION_BEGIN(tr, m_pDb);
tr.start();

// Create RvtLinkSymbol
OdBmRvtLinkSymbolPtr pNewRvtLinkSymbol = OdBmRvtLinkSymbol::createObject();
m_pDb->addElement(pNewRvtLinkSymbol);
pNewRvtLinkSymbol->addNewLinkFile(sPath, 0);

//  Create RvtLinkInstance
OdBmRvtLinkInstancePtr pNewRvtLinkInst = OdBmRvtLinkInstance::createObject();
pNewRvtLinkInst->addNewLinkInstance(pNewRvtLinkSymbol->id());
m_pDb->addElement(pNewRvtLinkInst);

// Add new RvtLinkSymbol to Manager
OdBmRvtLinkTrackingPtr pRvtLinkTracking = m_pDb->getAppInfo(OdBm::ManagerType::RvtLinkTracking);
OdBmSet aRvtLink;
pRvtLinkTracking->getElemIdSet(aRvtLink);
aRvtLink.insert(pNewRvtLinkSymbol->id());
pRvtLinkTracking->setElemIdSet(aRvtLink);

// Add new RvtLinkInstance to Manager
OdBmRvtLinkInstTrackingPtr pRvtLinkInstTracking = m_pDb->getAppInfo(OdBm::ManagerType::RvtLinkInstTracking);
OdBmSet aRvtLinkInst;
pRvtLinkInstTracking->getElemIdSet(aRvtLinkInst);
aRvtLinkInst.insert(pNewRvtLinkInst->id());
pRvtLinkInstTracking->setElemIdSet(aRvtLinkInst);

tr.extend(pNewRvtLinkSymbol->id(), true);
tr.extend(pNewRvtLinkInst->id(), true);
tr.commit();
ODBM_TRANSACTION_END();

Edit Path button — Allows you to edit an invalid path to an existing file. The appropriate method is setNewFilePath().

CAD File Formats

The CAD file formats supported in ODA Bim App are .dwg, DXF, DGN, SAT, SKP, and 3DM.

To get all available links, use the getAppInfo() method with a specific parameter:


pRvtLinkTracking = database()->getAppInfo(OdBm::ManagerType::LinkedFileInfo);

To work with CAD file formats, use the OdBmMasterImportSymbol class in the database. To get basic information about a referenced file, use the following methods:

  • getImportFileData(), getFullName() — Gets the file name with its file extension.
  • getFullDisplayPath() — Gets the displayed file path given the type of path.
  • getImportFileData(), getIsRelative() — Gets the path type. If the method returns true, it is relative path, otherwise it is absolute.
  • getSize() / 1024 — Gets the file size in kilobytes.
  • getImportFileData(), getLoadedStatus() — Gets the status of a linked file. If the method returns true (loaded), the model of the linked file is vectorized; if the method returns false (unloaded), the model of the linked file is not vectorized.
Point Cloud File Formats

The point cloud file formats supported in ODA Bim App are RCP and RCS.

To get all available links, use the getAppInfo() method with a specific parameter:


pRvtLinkTracking = database()->getAppInfo(OdBm::ManagerType::PointCloudTypeTracking);

To work with point cloud formats, use the OdBmPointCloudType class in the database. To get basic information about a referenced file, use the following methods:

  • getSymbolInfo(), getName() — Gets the file name with its file extension.
  • getFullDisplayPath() — Gets the displayed file path given the type of path.
  • getIsLoaded() — Gets the status of a linked file. If the method returns true (loaded), the model of the linked file is vectorized; if the method returns false (unloaded), the model of the linked file is not vectorized.
PDF and Image File Formats

The supported PDF and image file formats are PDF and BMP, JPG, JPEG, PNG, and TIF.

To get all available links, use the getAppInfo() method with a specific parameter:

pRvtLinkTracking = database()->getAppInfo(OdBm::ManagerType::ElementTracking);

To work with PDF and image file formats, use the OdBmImageSymbol class in the database. To get basic information about a referenced file, use the following methods:

  • getSymbolInfo(), getName() — Gets file name with the file extension.
  • getFullDisplayPath() — Gets the displayed file path given the type of path.
  • getPathType() — Gets the file type.