/////////////////////////////////////////////////////////////////////////////// // 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_LowLevel.h" //IDS #include "IdsApi.h" Tutorial_IDSFileCreation_LowLevel::Tutorial_IDSFileCreation_LowLevel(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_LowLevel::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; // creating and setting the ids data OdIdsIdsPtr ids = OdIdsIds::createObject(); OdIdsIdsInfoPtr pIdsIdsInfo = OdIdsIdsInfo::createObject(); pIdsIdsInfo->setTitle("A prohibited facet returns the opposite of a required facet"); pIdsIdsInfo->setDescription("Generated via code automation in the Ids Repository on github."); ids->setInfo(pIdsIdsInfo); OdIdsSpecificationsTypePtr specifications = ids->getSpecifications(); if (specifications == nullptr) specifications = OdIdsSpecificationsType::createObject(); OdIdsSpecificationTypePtrArray pSpecificationArray = specifications->getSpecification(); OdIdsSpecificationTypePtr pSpecification = OdIdsSpecificationType::createObject(); pSpecification->setName("A prohibited facet returns the opposite of a required facet"); OdIfcVersion ifcVersion; ifcVersion.value = { "IFC2X3", "IFC4", "IFC4X3_ADD2" }; pSpecification->setIfcVersion(ifcVersion); OdIdsApplicabilityTypePtr applicabilityType = OdIdsApplicabilityType::createObject(); OdXmlAllNI maxOccurs; maxOccurs.setUnbounded(); applicabilityType->setMaxOccurs(maxOccurs); OdIdsEntityTypePtr pEntityType = OdIdsEntityType::createObject(); OdIdsIdsValuePtr pEntityNameValue = OdIdsIdsValue::createObject(); pEntityNameValue->setSimpleValue("IFCWALL"); pEntityType->setName(pEntityNameValue); applicabilityType->setEntity(pEntityType); pSpecification->setApplicability(applicabilityType); OdIdsSpecificationTypeRequirementsPtr pRequirements = OdIdsSpecificationTypeRequirements::createObject(); OdIdsRequirementsTypeAttributePtrArray pAttributes = pRequirements->getAttribute(); OdIdsRequirementsTypeAttributePtr pAttribute = OdIdsRequirementsTypeAttribute::createObject(); OdIdsConditionalCardinality cardinality; cardinality.setValue("prohibited"); pAttribute->setCardinality(cardinality); OdIdsIdsValuePtr pAttributeNameValue = OdIdsIdsValue::createObject(); pAttributeNameValue->setSimpleValue("Name"); pAttribute->setName(pAttributeNameValue); pAttributes.append(pAttribute); pRequirements->setAttribute(pAttributes); pSpecification->setRequirements(pRequirements); pSpecificationArray.append(pSpecification); specifications->setSpecification(pSpecificationArray); ids->setSpecifications(specifications); OdIds::saveIdsInFile(ids, m_idsFileName); return 0; }