Manifold Geometry // Многообразная Геометрия

/ Просмотров: 435

In the OpenCascade ecosystem, it's pretty handy to rely upon what's called OSD or Operating System Dependent package. This brief blog post is aimed to highlight one technique for working with a filesystem at the lower level without the employment of additional dependencies in software based on OpenCascade.

"OpenCascade ecosystem" is probably a bit voluntaristic phrase aimed to emphasize the central role that the OpenCascade library holds in the open-source CAD field. In Analysis Situs, we ground the feature recognition framework on top of it. Likewise, a tremendous number of software packages (both applications and derived libs) are based on different tools from this library.

Here is a code snippet to iterate all files having "tcl" extension in a specific "dir" directory:

OSD_Path path(dir);
//
for ( OSD_FileIterator fi(path, "*.tcl"); fi.More(); fi.Next() )
{
OSD_Path filePath;
fi.Values().Path(filePath);

TCollection_AsciiString filename;
filePath.SystemName(filename);
filename = dir + "/" + filename;

std::cout << filename.ToCString() << std::endl;
}

The advantage of this approach is that you do not need anything but the pure OpenCascade library that you're presumably already using. Personally, I employ this simple technique to execute all Tcl scenarios for the purpose of unit testing.