/////////////////////////////////////////////////////////////////////////////// // 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. /////////////////////////////////////////////////////////////////////////////// // StepImporter.h: interface for the OdStepImporter class. // ////////////////////////////////////////////////////////////////////// #ifndef _DWG2STEP_IMPORTER_H_INCLUDED_ #define _DWG2STEP_IMPORTER_H_INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "StepImport.h" #include "StepImportProperties.h" #include "daiStepFile.h" #include "daiAuditInfo.h" class OdGiDrawable; class OdStepEntityCreator; class OdDb3dSolid; class OdDbBody; class OdDbSurface; class OdDbRegion; class OdDbPolyline; class OdDbCurve; class OdDbLayerTable; class OdDbBlockTableRecord; class OdDbBlockReference; class OdDbDimension; class OdDbSolid; class OdDbMText; class OdDbViewport; class OdBrBrep; /** \details Contains declarations related to the functionality of converting data from the .dwg to the STEP format. */ namespace DWG_STEP_IMPORT { /** \details A class that implements .dwg to .step conversion functionality. */ class OdStepImporter : public OdStepImport { //DOM-IGNORE-BEGIN OdStepImportPropertiesPtr _properties; OdDAI::ModelPtr m_pModel; OdDAIObjectId m_subContextId; OdDAIObjectId m_geometryUnitsContextId; OdDAIObjectId m_mechanicRepresentationPresentationId; //For AP242 only OdDAIObjectId m_globalDraughtingModel; std::map m_referencedObjects; std::map m_objectContexts; std::map m_objectRepresentations; std::map m_layersObjects; std::map, OdDAIObjectId> m_objectsDraughtingModels; OdDAIObjectIds m_geometricUsage; OdDbObjectIdArray m_dimensions; std::map m_colorMap; std::map m_loadedFiles; OdDAI::AuditInfoPtr m_pLogger; //DOM-IGNORE-END public: //DOM-IGNORE-BEGIN ODRX_DECLARE_MEMBERS(OdStepImporter); //DOM-IGNORE-END /** \details Creates a new instance of the .dwg-.step converter with default parameters. */ OdStepImporter(); /** \details Converts an input .dwg drawing to an .step file. \returns The ImportResult::success value if the conversion process was successfully finished; otherwise, the method returns an appropriate error code. */ virtual ImportResult import() ODRX_OVERRIDE; /** \details Retrieves the properties of the .dwg to .step conversion process. \returns A smart pointer to an Rx dictionary object that contains the conversion properties values. */ virtual OdRxDictionaryPtr properties() ODRX_OVERRIDE; /** \details A method that writes converted STEP model into a file with defined file name. \returns eOk if writing is successful; appropriate error code otherwise. */ virtual OdResult writeStepFile(const OdString &fileName) ODRX_OVERRIDE; private: OdDAIObjectIds importLayerTableEntity(OdDbLayerTable* pTable, OdStepEntityCreator& creator); OdDAIObjectIds importBlockTableRecordEntity(OdDbBlockTableRecord* pEnt, OdStepEntityCreator& creator); OdDAIObjectIds importPaperSpaceEntity(OdDbBlockTableRecord* pEnt, OdStepEntityCreator& creator, OdGeMatrix3d* transformation = nullptr); OdDbStub* importBlockReferenceEntity(OdDbBlockReference* pEnt, OdStepEntityCreator& creator); OdDbStub* importEntityByDefault(OdDbEntity* pEnt, OdStepEntityCreator& creator, bool isSolid = true); OdDbStub* import3dSolidEntity(OdDb3dSolid* pEnt, OdStepEntityCreator& creator); OdDbStub* importBodyEntity(OdDbBody* pEnt, OdStepEntityCreator& creator); OdDbStub* importSurfaceEntity(OdDbSurface* pEnt, OdStepEntityCreator& creator); OdDbStub* importRegionEntity(OdDbRegion* pEnt, OdStepEntityCreator& creator); OdDbStub* importBrepEntity(OdDbEntity* pEnt, const OdBrBrep& brep, OdStepEntityCreator& creator, bool asManifoldSolidBrep = true); OdDbStub* importPolylineEntity(OdDbPolyline* pEnt, OdStepEntityCreator& creator); OdDbStub* importCurveEntity(OdDbCurve* pEnt, OdStepEntityCreator& creator); OdDbStub* importDimensionEntity(OdDbDimension* pEnt, OdStepEntityCreator& creator); OdDAIObjectId importViewportEntity(OdDbViewport* pEnt, OdStepEntityCreator& creator, OdGeMatrix3d* transformation = nullptr); OdDbStub* importEntity(OdGiDrawable* pEnt, OdDAI::ModelPtr pModel, OdDbStub* subContextId, OdDbStub* unitsContextId, OdDAIObjectIds& stylesId, bool asItem = false); OdResult initStepFile(OdStepFilePtr pDb, OdStepEntityCreator& creator); ImportResult importGeometry(OdStepEntityCreator& creator); void createDimensionShapeAspect(OdDbDimension* pEnt, const OdDAIObjectId& draughtingCalloutId, const OdUInt64Array& representationsList, OdStepEntityCreator& creator); OdDAIObjectId createDimensionalObject(const OdDAIObjectId& draughtingCalloutId, const OdUInt64Array& representationsList, const OdAnsiString& dimensionType, OdStepEntityCreator& creator); OdDAIObjectId getShapeAspect(const OdDAIObjectId& representationId, const OdDAIObjectId& geometryId, const OdDAIObjectId& definitionId, OdStepEntityCreator& creator); OdDAIObjectId importColor(const OdCmEntityColor& color, OdStepEntityCreator& creator); OdDAIObjectIds importBlockTableRecordEntityAsDimension(OdDbBlockTableRecord* pEnt, OdStepEntityCreator& creator); OdDbStub* importCurveEntityAsTessellatedCurveSet(OdDbCurve* pEnt, OdStepEntityCreator& creator); OdDbStub* importSolidEntityAsTriangulatedSurfaceSet(OdDbSolid* pEnt, OdStepEntityCreator& creator); OdDbStub* importMTextEntityAsTriangulatedSurfaceSet(OdDbMText* pEnt, OdStepEntityCreator& creator); OdDAIObjectId importColour(OdStepEntityCreator& creator, OdDbEntity* pDwgEntity, const OdDAIObjectId& objectId, bool isSolid = true /*or 2d curve*/); OdDAIObjectId addItemToMechanicRepresentationPresentation(const OdDAIObjectId& item); OdDAIObjectId addItemToGlobalDraughtingModel(const OdDAIObjectId& item); OdDAIObjectId createTransformation(const OdDAIObjectIds& ids, const OdDAIObjectId& contextId, OdGeMatrix3d transformation, OdStepEntityCreator& creator, const OdString& transformationProductName); void representationsListUpdate(OdDbEntity* pDbEntity, const OdDAIObjectId& stepRepId); void layersListUpdate(OdDbEntity* pDbEntity, const OdDAIObjectId& stepRepId); }; } #endif // _DWG2STEP_IMPORTER_H_INCLUDED_