Issue with Generating Shattered SCZ and SCS Files – Only Single File Created

Hi TechSoft3D Team,

I am trying to export a CAD file to shattered SCZ , SCS and master.xml using HOOPS Communicator/Authoring SDK, but I am only getting a single .scz and .scs file, instead of multiple shattered parts.

Here’s the code I am using:

bool HoopsConverter::ExportToShattered(const MY_CHAR* license, const MY_CHAR* input, const MY_CHAR* output) {
    std::string startTime = GetFormattedTime();
    auto start = std::chrono::high_resolution_clock::now();
try {
    // Initialize converter
    Converter converter;
    converter.SetLogfile(logFilePath.c_str());
    if (!converter.Init(license)) {
        LogMessage("ERROR: SCZ Converter initialization failed.");
        return false;
    }

    Importer importer;
    if (!importer.Init(&converter)) {
        LogMessage("ERROR: SCZ Importer initialization failed.");
        return false;
    }

    SC_Import_Options importOptions;
    if (!importer.Load(input, importOptions)) {
        LogMessage("ERROR: Failed to load input file: " + std::string(input));
        return false;
    }

    Exporter exporter;
    if (!exporter.Init(&importer)) {
        LogMessage("ERROR: SCZ Exporter initialization failed.");
        return false;
    }

    // Ensure directories exist
    std::string outputDir = std::string(output);
    std::string scsDir    = outputDir + "/scs";
    std::string sczDir    = outputDir + "/scz";
    fs::create_directories(outputDir);
    fs::create_directories(scsDir);
    fs::create_directories(sczDir);

    std::string xmlFile = outputDir + "/master.xml";

    // Setup export options
    SC_Export_Options exportOptions;
    exportOptions.export_assemblytree          = true;
    exportOptions.export_materials             = true;
    exportOptions.export_physical_properties   = true;
    exportOptions.export_attributes            = true;
    exportOptions.export_measurement           = true;
    exportOptions.prepare_shattered_xml        = xmlFile;
    exportOptions.prepare_shattered_scs_parts  = scsDir;
    exportOptions.prepare_shattered_parts      = sczDir;
    exportOptions.compute_bounding_boxes       = "All";

    // Export shattered SCZ
    if (!exporter.WriteSCShattered(exportOptions)) {
        LogMessage("ERROR: Failed to export SCZ files.");
        return false;
    }

    if (!fs::exists(xmlFile)) {
        LogMessage("WARNING: master.xml not created at: " + xmlFile);
    }

} catch (const std::exception& e) {
    LogMessage(std::string("Exception in ExportToSCZ: ") + e.what());
    return false;
}

return true;
}

Problem:

  • The export completes successfully, and I get one .scz file in scz/ and one .scs file in scs/.

  • The master.xml file is created correctly but not sure is correct .

  • No other shards are generated, even though my CAD model contains multiple components/subassemblies.

What I want:

  • Multiple shattered .scz files for each part/component.

  • Corresponding .scs files for each part/component.

  • master.xml listing all part/component.

Questions:

  1. Is there any issue in my code that prevents shattering?

  2. Are there additional SC_Export_Options flags I need to set to force shattering?

  3. Could the problem be related to input file naming, directory paths, or something else?

Any help or guidance would be appreciated!

Thanks.

Is the source CAD file itself comprised of an assembly file and individual part files? Or is the source file one monolithic file?

Could you advise how we can determine if the file is monolithic? We have a Navisworks source file, and when we use https://github.com/toshi-bata/shattered, it shatters properly.

In the link you provided, there is this description:

shattered assembly can be created from some native CAD formats whose sub-components reside in individual files such as CATIA V5, Creo - Pro/E, NX or SolidWorks

In other words, if the source file is just one file, it is monolithic.