/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #include "OdaCommon.h" #include #include "IfcFile.h" #include "ExIfcTutorial_COBie.h" #include "IfcCore.h" #include "IfcModel.h" #if defined(COBIE_SUPPORT) #include "IfcCOBie.h" #endif using namespace OdIfc; Tutorial_IfcCOBie::Tutorial_IfcCOBie(const OdString& applicationName) : BaseIfcTutorial(applicationName) { m_tutorialArgsParser. add_param( std::make_shared>(m_fileName, "filename", "input .ifc file")); m_tutorialArgsParser .add_param( std::make_shared(m_noWait, "-NoWait", "disable \"press any key\" on finish.")); } int Tutorial_IfcCOBie::run(const MyServices &svcs, const std::vector& argv, std::ostream& resultStream) { #if defined(COBIE_SUPPORT) auto parseResult = BaseIfcTutorial::run(svcs, argv, resultStream); if (parseResult != 0) { return parseResult; } OdRxModulePtr moduleCOBie = odrxDynamicLinker()->loadModule(OD_T("COBie.tx")); if (moduleCOBie == nullptr) { return 1; } OdIfcFilePtr ifcFile = svcs.createDatabase(); OdResult res = ifcFile->readFile(m_fileName); OdIfcModelPtr model = ifcFile->getModel(sdaiRO); if (model.isNull()) { return 1; } OdCOBie::Ifc2COBiePtr ifc2COBie = OdCOBie::Ifc2COBie::createObject(); if (ifc2COBie->process(model, nullptr) == eOk) { #ifdef _WRITE_COBIE_AS_SPF OdDAI::ModelPtr cobieModel = ifc2COBie->spreadsheet(); cobieModel->repository()->writeFile(OD_T("e://cobie_model.spf")); #else ifc2COBie->ExportToExcel("e://cobie_result.xls"); #endif } moduleCOBie = nullptr; //odrxDynamicLinker()->unloadUnreferenced(); return 0; #else // COBIE_SUPPORT odPrintConsoleString(OdString(OD_T("\nIfcCOBie: COBie module is not enabled."))); return eNotImplementedYet; #endif // COBIE_SUPPORT }