// Created on: 1994-12-21 // Created by: Dieter THIEMANN // Copyright (c) 1994-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #ifndef _STEPControl_ActorRead_HeaderFile #define _STEPControl_ActorRead_HeaderFile #include "Standard.hxx" #include "Standard_Type.hxx" #include "StepData_Factors.hxx" #include "StepToTopoDS_NMTool.hxx" #include "Transfer_ActorOfTransientProcess.hxx" #include "Standard_Integer.hxx" #include "TopoDS_Shape.hxx" #include "NCollection_List.hxx" #include "TopTools_ShapeMapHasher.hxx" #include "NCollection_IndexedDataMap.hxx" #include "Message_ProgressRange.hxx" #include "Interface_InterfaceModel.hxx" class StepRepr_Representation; class Standard_Transient; class Transfer_Binder; class Transfer_TransientProcess; class StepGeom_Axis2Placement3d; class gp_Trsf; class StepRepr_RepresentationRelationship; class TransferBRep_ShapeBinder; class StepBasic_ProductDefinition; class StepRepr_NextAssemblyUsageOccurrence; class StepShape_ShapeRepresentation; class StepShape_ContextDependentShapeRepresentation; class StepRepr_ShapeRepresentationRelationship; class StepGeom_GeometricRepresentationItem; class StepRepr_MappedItem; class StepShape_FaceSurface; class TopoDS_Shell; class TopoDS_Compound; class StepRepr_ConstructiveGeometryRepresentationRelationship; class StepRepr_MechanicalDesignAndDraughtingRelationship; class StepData_StepModel; //! This class performs the transfer of an Entity from //! AP214 and AP203, either Geometric or Topologic. //! //! I.E. for each type of Entity, it invokes the appropriate Tool //! then returns the Binder which contains the Result class STEPControl_ActorRead : public Transfer_ActorOfTransientProcess { public: Standard_EXPORT STEPControl_ActorRead(const occ::handle& theModel); Standard_EXPORT bool Recognize(const occ::handle& start) override; Standard_EXPORT occ::handle Transfer( const occ::handle& start, const occ::handle& TP, const Message_ProgressRange& theProgress = Message_ProgressRange()) override; //! theUseTrsf - special flag for using Axis2Placement from ShapeRepresentation for transform root //! shape Standard_EXPORT occ::handle TransferShape( const occ::handle& start, const occ::handle& TP, const StepData_Factors& theLocalFactors = StepData_Factors(), const bool isManifold = true, const bool theUseTrsf = false, const Message_ProgressRange& theProgress = Message_ProgressRange()); //! set units and tolerances context by given ShapeRepresentation Standard_EXPORT void PrepareUnits(const occ::handle& rep, const occ::handle& TP, StepData_Factors& theLocalFactors); //! reset units and tolerances context to default //! (mm, radians, read.precision.val, etc.) Standard_EXPORT void ResetUnits(const occ::handle& theModel, StepData_Factors& theLocalFactors); //! Set model Standard_EXPORT void SetModel(const occ::handle& theModel); //! Computes transformation defined by two axis placements (in MAPPED_ITEM //! or ITEM_DEFINED_TRANSFORMATION) taking into account their //! representation contexts (i.e. units, which may be different) //! Returns True if transformation is computed and is not an identity. Standard_EXPORT bool ComputeTransformation( const occ::handle& Origin, const occ::handle& Target, const occ::handle& OrigContext, const occ::handle& TargContext, const occ::handle& TP, gp_Trsf& Trsf, const StepData_Factors& theLocalFactors = StepData_Factors()); //! Computes transformation defined by given //! REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION Standard_EXPORT bool ComputeSRRWT(const occ::handle& SRR, const occ::handle& TP, gp_Trsf& Trsf, const StepData_Factors& theLocalFactors = StepData_Factors()); DEFINE_STANDARD_RTTIEXT(STEPControl_ActorRead, Transfer_ActorOfTransientProcess) protected: //! Transfers product definition entity //! theUseTrsf - special flag for using Axis2Placement from ShapeRepresentation for transform root //! shape Standard_EXPORT occ::handle TransferEntity( const occ::handle& PD, const occ::handle& TP, const StepData_Factors& theLocalFactors = StepData_Factors(), const bool theUseTrsf = false, const Message_ProgressRange& theProgress = Message_ProgressRange()); //! Transfers next assembly usage occurrence entity Standard_EXPORT occ::handle TransferEntity( const occ::handle& NAUO, const occ::handle& TP, const StepData_Factors& theLocalFactors = StepData_Factors(), const Message_ProgressRange& theProgress = Message_ProgressRange()); //! Transfers shape representation entity //! theUseTrsf - special flag for using Axis2Placement from ShapeRepresentation for transform root //! shape Standard_EXPORT occ::handle TransferEntity( const occ::handle& sr, const occ::handle& TP, const StepData_Factors& theLocalFactors, bool& isBound, const bool theUseTrsf = false, const Message_ProgressRange& theProgress = Message_ProgressRange()); //! Transfers context dependent shape representation entity Standard_EXPORT occ::handle TransferEntity( const occ::handle& CDSR, const occ::handle& TP, const StepData_Factors& theLocalFactors = StepData_Factors(), const Message_ProgressRange& theProgress = Message_ProgressRange()); //! Transfers shape representation relationship entity //! theUseTrsf - special flag for using Axis2Placement from ShapeRepresentation for transform root //! shape Standard_EXPORT occ::handle TransferEntity( const occ::handle& und, const occ::handle& TP, const StepData_Factors& theLocalFactors, const int nbrep = 0, const bool theUseTrsf = false, const Message_ProgressRange& theProgress = Message_ProgressRange()); //! Transfers geometric representation item entity such as ManifoldSolidBRep ,...etc Standard_EXPORT occ::handle TransferEntity( const occ::handle& git, const occ::handle& TP, const StepData_Factors& theLocalFactors, const bool isManifold, const Message_ProgressRange& theProgress); //! Transfers mapped item Standard_EXPORT occ::handle TransferEntity( const occ::handle& mapit, const occ::handle& TP, const StepData_Factors& theLocalFactors, const Message_ProgressRange& theProgress); //! Transfers FaceSurface entity Standard_EXPORT occ::handle TransferEntity( const occ::handle& fs, const occ::handle& TP, const StepData_Factors& theLocalFactors, const Message_ProgressRange& theProgress); occ::handle TransferEntity( const occ::handle& theCGRR, const occ::handle& theTP, const StepData_Factors& theLocalFactors = StepData_Factors()); //! Transfers MechanicalDesignAndDraughtingRelationship entity occ::handle TransferEntity( const occ::handle& theMDADR, const occ::handle& theTP, const StepData_Factors& theLocalFactors, const Message_ProgressRange& theProgress); //! Translates file by old way when CDSR are roots. //! Acts only if "read.step.product_mode" is equal Off. Standard_EXPORT occ::handle OldWay( const occ::handle& start, const occ::handle& TP, const Message_ProgressRange& theProgress); private: Standard_EXPORT TopoDS_Shell closeIDEASShell(const TopoDS_Shell& shell, const NCollection_List& closingShells); Standard_EXPORT void computeIDEASClosings( const TopoDS_Compound& comp, NCollection_IndexedDataMap, TopTools_ShapeMapHasher>& shellClosingMap); Standard_EXPORT TopoDS_Shape TransferRelatedSRR(const occ::handle& theTP, const occ::handle& theRep, const bool theUseTrsf, const bool theReadConstructiveGeomRR, const StepData_Factors& theLocalFactors, TopoDS_Compound& theCund, Message_ProgressScope& thePS); private: StepToTopoDS_NMTool myNMTool; double myPrecision; double myMaxTol; occ::handle mySRContext; occ::handle myModel; }; #endif // _STEPControl_ActorRead_HeaderFile