1 // Created on: 1993-09-14
2 // Created by: Frederic MAUPAS
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _STEPConstruct_ContextTool_HeaderFile
18 #define _STEPConstruct_ContextTool_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <TColStd_SequenceOfInteger.hxx>
25 #include <STEPConstruct_AP203Context.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_Integer.hxx>
28 #include <TColStd_HSequenceOfTransient.hxx>
29 class StepBasic_ApplicationProtocolDefinition;
30 class StepGeom_Axis2Placement3d;
31 class StepData_StepModel;
32 class TCollection_HAsciiString;
33 class STEPConstruct_AP203Context;
34 class STEPConstruct_Part;
35 class STEPConstruct_Assembly;
38 //! Maintains global context tool for writing.
39 //! Gives access to Product Definition Context (one per Model)
40 //! Maintains ApplicationProtocolDefinition entity (common for all
42 //! Also maintains context specific for AP203 and provides set of
43 //! methods to work with various STEP constructs as required
45 class STEPConstruct_ContextTool
52 Standard_EXPORT STEPConstruct_ContextTool();
54 Standard_EXPORT STEPConstruct_ContextTool(const Handle(StepData_StepModel)& aStepModel);
56 //! Initialize ApplicationProtocolDefinition by the first
57 //! entity of that type found in the model
58 Standard_EXPORT void SetModel (const Handle(StepData_StepModel)& aStepModel);
60 Standard_EXPORT Handle(StepBasic_ApplicationProtocolDefinition) GetAPD();
62 Standard_EXPORT void AddAPD (const Standard_Boolean enforce = Standard_False);
64 //! Returns True if APD.schema_name is config_control_design
65 Standard_EXPORT Standard_Boolean IsAP203() const;
67 //! Returns True if APD.schema_name is automotive_design
68 Standard_EXPORT Standard_Boolean IsAP214() const;
70 //! Returns True if APD.schema_name is ap242_managed_model_based_3d_engineering
71 Standard_EXPORT Standard_Boolean IsAP242() const;
73 Standard_EXPORT Handle(TCollection_HAsciiString) GetACstatus();
75 Standard_EXPORT Handle(TCollection_HAsciiString) GetACschemaName();
77 Standard_EXPORT Standard_Integer GetACyear();
79 Standard_EXPORT Handle(TCollection_HAsciiString) GetACname();
81 Standard_EXPORT void SetACstatus (const Handle(TCollection_HAsciiString)& status);
83 Standard_EXPORT void SetACschemaName (const Handle(TCollection_HAsciiString)& schemaName);
85 Standard_EXPORT void SetACyear (const Standard_Integer year);
87 Standard_EXPORT void SetACname (const Handle(TCollection_HAsciiString)& name);
89 //! Returns a default axis placement
90 Standard_EXPORT Handle(StepGeom_Axis2Placement3d) GetDefaultAxis();
92 //! Returns tool which maintains context specific for AP203
93 Standard_EXPORT STEPConstruct_AP203Context& AP203Context();
95 //! Returns current assembly level
96 Standard_EXPORT Standard_Integer Level() const;
98 Standard_EXPORT void NextLevel();
100 Standard_EXPORT void PrevLevel();
102 //! Changes current assembly level
103 Standard_EXPORT void SetLevel (const Standard_Integer lev);
105 //! Returns current index of assembly component on current level
106 Standard_EXPORT Standard_Integer Index() const;
108 Standard_EXPORT void NextIndex();
110 Standard_EXPORT void PrevIndex();
112 //! Changes current index of assembly component on current level
113 Standard_EXPORT void SetIndex (const Standard_Integer ind);
115 //! Generates a product name basing on write.step.product.name
116 //! parameter and current position in the assembly structure
117 Standard_EXPORT Handle(TCollection_HAsciiString) GetProductName() const;
119 //! Produces and returns a full list of root entities required
120 //! for part identified by SDRTool (including SDR itself)
121 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetRootsForPart (const STEPConstruct_Part& SDRTool);
123 //! Produces and returns a full list of root entities required
124 //! for assembly link identified by assembly (including NAUO and CDSR)
125 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetRootsForAssemblyLink (const STEPConstruct_Assembly& assembly);
140 TColStd_SequenceOfInteger myLevel;
141 Handle(StepBasic_ApplicationProtocolDefinition) theAPD;
142 STEPConstruct_AP203Context theAP203;
143 Handle(StepGeom_Axis2Placement3d) myAxis;
154 #endif // _STEPConstruct_ContextTool_HeaderFile