/////////////////////////////////////////////////////////////////////////////// // 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 "ExIfcTutorial_05.h" #include "daiUtils/daiUtils.h" Tutorial_05::Tutorial_05(const OdString& applicationName) : BaseIfcTutorial(applicationName) { m_tutorialArgsParser .add_param( std::make_shared>(m_ifcFileName, "filename", "input .ifc file")); m_tutorialArgsParser .add_param( std::make_shared(m_noWait, "-NoWait", "disable \"press any key\" on finish.")); } int Tutorial_05::run(const MyServices& svcs, const std::vector& argv, std::ostream& resultStream) { auto parseResult = BaseIfcTutorial::run(svcs, argv, resultStream); if (parseResult != 0) { return parseResult; } OdIfcFilePtr pFile = svcs.createDatabase(); OdResult res = pFile->readFile(m_ifcFileName); if (res == eOk) { odPrintConsoleString(OD_T("\nFile opened successfully.\n")); } else { odPrintConsoleString(OD_T("\nFile open error. Press any key to finish...")); if (m_noWait != true) { getchar(); } return res; } odPrintConsoleString(OD_T("\nRetrieving property information\n")); OdIfcModelPtr pModel = pFile->getModel(); OdString stepLine; OdDAI::ApplicationInstancePtr pInstance; OdDAI::InstanceIteratorPtr pIt = pModel->newIterator(); while (!pIt->done()) { if (pIt->id().isValid()) { stepLine = OdDAI::Utils::getStepLine(pIt->id().openObject()).c_str(); odPrintConsoleString(OD_T("\n") + stepLine); } pIt->step(); } odPrintConsoleString(OD_T("\n\nProcess finished\n")); return eOk; }