Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Reading Point Cloud Project Data from .rcp Files

Drawings SDK provides access to the RCP format using a special service. This topic describes how to use the service to load data from the RCP format.

What is an .rcp file?

RCP (Reality Capture Project) is a file format that stores point cloud project data. A point cloud is a set of vertices in a three-dimensional coordinate system that is created by 3D scanners and used for 3D-representations of object surfaces. For more details about point clouds, see Working with Point Clouds.

A point cloud project operates with a set of point cloud scans as a whole unit. After importing a point cloud project, you will be working with the whole point cloud, not with separate files. Point cloud project files have an ".rcp" file extension. The file is a ZIP-archive that contains two preview images and an .xml file with point cloud project information. The information stored in the .xml file contains a set of links to the scan files (.rcs files), a set of their properties as well as common properties of the project. This means that an .rcp file stores only the links to the point cloud laser scan files; it does not contain the scan files. To import a point cloud project to an application, its .rcs files must be available.

Reading an .rcp file

To read point cloud project data from .rcp files, Kernel SDK provides the RcsFileServices.tx extension module (the same as used to read data from .rcs files, see Reading Point Cloud Data from .rcs Files). The module contains the getRcpFileReader() method which reads project data from an .rcp file:

virtual OdRcpFileReaderPtr getRcpFileReader(const OdString& filePath) const = 0;

The method takes a path to the .rcp file as an argument and returns a smart pointer to an object of the OdRcpFileReader class, which contains the XML data read from the .rcp file. For example:


// Create and initialize the RCS file service instance
OdRxRcsFileServicesPtr pRcsFileServices;
pRcsFileServices = odrxDynamicLinker()->loadApp(RX_RCS_FILE_SERVICES);

if (!pRcsFileServices.isNull())
{
  // Create RCP file reader instance
  OdRcpFileReaderPtr pRcpFileReader;
  // Read the point cloud project
  try
  {
    pRcpFileReader = pRcsFileServices->getRcpFileReader(filename);
  }
  catch (OdError_CantOpenFile& e)
  {
    return eCantOpenFile;
  }
}

Working with properties of a point cloud project

Once the data is read to an OdRcpFileReader object, you'll get access to the project information using the following OdRcpFileReader class methods:

Method Description
virtual void getAllRcsFilePaths( OdStringArray &list ) const = 0; Fills the string array using paths to .rcs files of the project.
virtual void getAllRcsRelativeFilePaths( OdStringArray &list ) const = 0; Fills the string array using relative paths to .rcs files of the project.
virtual OdGeMatrix3d getGlobalTransformation() const = 0; Returns the global transformation matrix of the project.
virtual OdUInt32 getTotalRegionsCount() const = 0; Returns the total regions count.
virtual OdUInt32 getTotalScansCount() const = 0; Returns the total scans count.
virtual OdString getCoordinateSystemName() const = 0; Returns the coordinate system name.
virtual OdInt8 hasRGB() const = 0; Returns 1 if all .rcs files of the project contain RGB.
Returns 0 if at least one .rcs file of the project contains RGB.
Returns -1 if no .rcs file of the project contains RGB.
virtual OdInt8 hasNormals() const = 0; Returns 1 if all .rcs files of the project contain normals.
Returns 0 if at least one .rcs file of the project contains normals.
Returns -1 if no any .rcs file of the project contains normals.
virtual OdInt8 hasIntensity() const = 0; Returns 1 if all .rcs files of the project contain intensity.
Returns 0 if at least one .rcs file of the project contains intensity.
Returns -1 if no any .rcs file of the project contains intensity.
virtual OdString getRcsFilePath(const OdString &guid) const = 0; Returns the path to the .rcs file specified by guid.
virtual OdString getRcsRelativeFilePath(const OdString &guid) const = 0; Returns the relative path to the .rcs file specified by guid.
virtual OdUInt64 getTotalAmountOfPoints() const = 0; Returns the total number of points for the point cloud project.
virtual void writeAllXmlDataToStream(OdStreamBuf* s) = 0; Writes all point cloud project XML data to a stream.
virtual OdGeExtents3d getExtents() const = 0; Returns the full extents of the point cloud project.

The following sample demonstrates how you can use the interfaces described above to get the paths to each scan file within a project:


// Create an instance of a Point Cloud Object within the ODA vectorization framework
OdDbPointCloudItemPtr pItem;

// Create and initialize the RCS file service instance
OdRxRcsFileServicesPtr pRcsFileServices;

pRcsFileServices = odrxDynamicLinker()->loadApp(RX_RCS_FILE_SERVICES);

// Create RCP file reader instance and read the point cloud project
if (!pRcsFileServices.isNull())
{
  OdRcpFileReaderPtr pRcpFileReader;

  try
  {
    pRcpFileReader = pRcsFileServices->getRcpFileReader(filename);
  }
  catch (OdError_CantOpenFile& e)
  {
    return eCantOpenFile;
  }
  
  // ExPointCloudExProjItem is an interface of a Point Cloud Ex Object within 
  // the ODA vectorization framework. It is inherited from the OdDbPointCloudExProjItem class.
  ExPointCloudExProjItemPtr exItem = ExPointCloudExProjItem::createObject();

  // Get the point cloud project data
  exItem->m_pRcpFileReader = pRcpFileReader;

  exItem->m_extents = pRcpFileReader->getExtents();

  OdStringArray allRcsFilePaths;
  OdStringArray allRcsRelativeFilePaths;
  pRcpFileReader->getAllRcsFilePaths(allRcsFilePaths);
  pRcpFileReader->getAllRcsRelativeFilePaths(allRcsRelativeFilePaths);
  OdUInt64 totalAmountOfRcsFiles = allRcsFilePaths.size();
  exItem->m_rcsItems.resize(totalAmountOfRcsFiles);
  for (OdUInt64 rcsIndex = 0; rcsIndex < totalAmountOfRcsFiles; rcsIndex++)
  {
    exItem->m_rcsItems[rcsIndex].m_pathToRcs = allRcsFilePaths[rcsIndex];
    exItem->m_rcsItems[rcsIndex].m_relativePathToRcs = allRcsRelativeFilePaths[rcsIndex];
  }

  // Set the data from the project to the object
  pItem = exItem;
}

For more details, see the ExPointCloudHost sample application located in the Drawing\Examples subdirectory of the ODA installation folder (for example, C:\Program Files\Open Design Alliance).

See Also

Importing from Other Formats Reading Point Cloud Data from .rcs Files
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.