/////////////////////////////////////////////////////////////////////////////// // 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. /////////////////////////////////////////////////////////////////////////////// //ODA #include "OdaCommon.h" #include "ExIfcTutorial_IDSFileCreation_HighLevel.h" //IDS #include "IdsApi.h" Tutorial_IDSFileCreation_HighLevel::Tutorial_IDSFileCreation_HighLevel(const OdString& applicationName) : BaseIfcTutorial(applicationName) { m_tutorialArgsParser. add_param( std::make_shared>(m_idsFileName, "filename", "output .ids file")); m_tutorialArgsParser .add_param( std::make_shared(m_noWait, "-NoWait", "disable \"press any key\" on finish.")); } int Tutorial_IDSFileCreation_HighLevel::run(const MyServices& svcs, const std::vector& argv, std::ostream& resultStream) { auto parseResult = BaseIfcTutorial::run(svcs, argv, resultStream); if (parseResult != 0) return parseResult; OdRxModulePtr moduleIDS = odrxDynamicLinker()->loadModule(OD_T("IDS.tx")); if (moduleIDS == nullptr) return 1; // 1 file creation { OdIdsIdsPtr ids = OdIdsIds::createObject(); OdIds::createIdsInfo(ids, "A prohibited facet returns the opposite of a required facet", "Generated via code automation in the Ids Repository on github."); OdIdsSpecificationTypePtr pSpecification = OdIds::createIdsSpecification(ids, "A prohibited facet returns the opposite of a required facet", new OdAnsiStringArray{ "IFC2X3", "IFC4", "IFC4X3_ADD2" }); //OdIdsSpecificationType::createObject(); OdIdsApplicabilityTypePtr applicabilityType = OdIdsApplicabilityType::createObject(); OdXmlAllNI maxOccurs; maxOccurs.setUnbounded(); applicabilityType->setMaxOccurs(maxOccurs); OdIds::createIdsEntity(applicabilityType, "IFCWALL"); pSpecification->setApplicability(applicabilityType); OdIdsSpecificationTypeRequirementsPtr pRequirements = OdIdsSpecificationTypeRequirements::createObject(); OdIds::createIdsRequirementsTypeAttribute(pRequirements, "Name", "prohibited"); pSpecification->setRequirements(pRequirements); OdString filename = m_idsFileName; if (int index = filename.find(L".ids")) filename.insert(index, L"_01"); OdIds::saveIdsInFile(ids, filename); } // 2 file creation { OdIdsIdsPtr ids = OdIdsIds::createObject(); OdIds::createIdsInfo(ids, "Values should match exactly if lightweight classifications are used", "Generated via code automation in the Ids Repository on github."); OdIdsSpecificationTypePtr pSpecification = OdIds::createIdsSpecification(ids, "Values should match exactly if lightweight classifications are used", new OdAnsiStringArray{ "IFC2X3", "IFC4"}); OdIdsApplicabilityTypePtr applicabilityType = OdIdsApplicabilityType::createObject(); OdXmlAllNI maxOccurs; maxOccurs.setUnbounded(); applicabilityType->setMaxOccurs(maxOccurs); OdIds::createIdsEntity(applicabilityType, "IFCSLAB"); pSpecification->setApplicability(applicabilityType); OdIdsSpecificationTypeRequirementsPtr pRequirements = OdIdsSpecificationTypeRequirements::createObject(); OdIdsRequirementsTypeClassificationPtr pClassification = OdIds::createIdsRequirementsTypeClassification(pRequirements, "1"); OdIdsIdsValuePtr pValue = OdIdsIdsValue::createObject(); OdXmlRestriction restriction; restriction.base = "xs:string"; restriction.pattern = "\\w+"; pValue->setRestriction(restriction); pClassification->setSystem(pValue); pSpecification->setRequirements(pRequirements); OdString filename = m_idsFileName; if (int index = filename.find(L".ids")) filename.insert(index, L"_02"); OdIds::saveIdsInFile(ids, filename); } return 0; }