File indexing completed on 2025-01-18 10:05:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _STEPCAFControl_Writer_HeaderFile
0017 #define _STEPCAFControl_Writer_HeaderFile
0018
0019 #include <MoniTool_DataMapOfShapeTransient.hxx>
0020 #include <NCollection_Vector.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 #include <STEPCAFControl_DataMapOfLabelShape.hxx>
0024 #include <STEPCAFControl_DataMapOfLabelExternFile.hxx>
0025 #include <STEPControl_Writer.hxx>
0026 #include <StepAP242_GeometricItemSpecificUsage.hxx>
0027 #include <StepData_ConfParameters.hxx>
0028 #include <StepDimTol_Datum.hxx>
0029 #include <StepDimTol_GeometricTolerance.hxx>
0030 #include <StepDimTol_HArray1OfDatumSystemOrReference.hxx>
0031 #include <StepRepr_ProductDefinitionShape.hxx>
0032 #include <StepVisual_DraughtingModel.hxx>
0033 #include <StepVisual_HArray1OfPresentationStyleAssignment.hxx>
0034 #include <TDF_LabelSequence.hxx>
0035 #include <TDF_LabelMap.hxx>
0036 #include <XCAFDimTolObjects_GeomToleranceObject.hxx>
0037
0038 class XSControl_WorkSession;
0039 class TDocStd_Document;
0040 class STEPCAFControl_ExternFile;
0041 class TopoDS_Shape;
0042 class StepData_Factors;
0043
0044
0045
0046
0047
0048
0049
0050 class STEPCAFControl_Writer
0051 {
0052 public:
0053 DEFINE_STANDARD_ALLOC
0054
0055 public:
0056
0057
0058
0059
0060 Standard_EXPORT STEPCAFControl_Writer();
0061
0062
0063
0064
0065 Standard_EXPORT STEPCAFControl_Writer(const Handle(XSControl_WorkSession)& theWS,
0066 const Standard_Boolean theScratch = Standard_True);
0067
0068
0069
0070 Standard_EXPORT void Init(const Handle(XSControl_WorkSession)& theWS,
0071 const Standard_Boolean theScratch = Standard_True);
0072
0073
0074
0075
0076
0077
0078 Standard_EXPORT IFSelect_ReturnStatus Write(const Standard_CString theFileName);
0079
0080
0081
0082 Standard_EXPORT IFSelect_ReturnStatus WriteStream(std::ostream& theStream);
0083
0084
0085
0086
0087
0088
0089
0090 Standard_EXPORT Standard_Boolean Transfer(const Handle(TDocStd_Document)& theDoc,
0091 const STEPControl_StepModelType theMode = STEPControl_AsIs,
0092 const Standard_CString theIsMulti = 0,
0093 const Message_ProgressRange& theProgress = Message_ProgressRange());
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105 Standard_EXPORT Standard_Boolean Transfer(const Handle(TDocStd_Document)& theDoc,
0106 const StepData_ConfParameters& theParams,
0107 const STEPControl_StepModelType theMode = STEPControl_AsIs,
0108 const Standard_CString theIsMulti = 0,
0109 const Message_ProgressRange& theProgress = Message_ProgressRange());
0110
0111
0112 Standard_EXPORT Standard_Boolean Transfer(const TDF_Label& theLabel,
0113 const STEPControl_StepModelType theMode = STEPControl_AsIs,
0114 const Standard_CString theIsMulti = 0,
0115 const Message_ProgressRange& theProgress = Message_ProgressRange());
0116
0117
0118
0119
0120 Standard_EXPORT Standard_Boolean Transfer(const TDF_Label& theLabel,
0121 const StepData_ConfParameters& theParams,
0122 const STEPControl_StepModelType theMode = STEPControl_AsIs,
0123 const Standard_CString theIsMulti = 0,
0124 const Message_ProgressRange& theProgress = Message_ProgressRange());
0125
0126
0127 Standard_EXPORT Standard_Boolean Transfer(const TDF_LabelSequence& theLabelSeq,
0128 const STEPControl_StepModelType theMode = STEPControl_AsIs,
0129 const Standard_CString theIsMulti = 0,
0130 const Message_ProgressRange& theProgress = Message_ProgressRange());
0131
0132
0133
0134
0135 Standard_EXPORT Standard_Boolean Transfer(const TDF_LabelSequence& theLabelSeq,
0136 const StepData_ConfParameters& theParams,
0137 const STEPControl_StepModelType theMode = STEPControl_AsIs,
0138 const Standard_CString theIsMulti = 0,
0139 const Message_ProgressRange& theProgress = Message_ProgressRange());
0140
0141 Standard_EXPORT Standard_Boolean Perform(const Handle(TDocStd_Document)& theDoc,
0142 const TCollection_AsciiString& theFileName,
0143 const Message_ProgressRange& theProgress = Message_ProgressRange());
0144
0145
0146
0147 Standard_EXPORT Standard_Boolean Perform(const Handle(TDocStd_Document)& theDoc,
0148 const Standard_CString theFileName,
0149 const Message_ProgressRange& theProgress = Message_ProgressRange());
0150
0151
0152
0153
0154
0155 Standard_EXPORT Standard_Boolean Perform(const Handle(TDocStd_Document)& theDoc,
0156 const Standard_CString theFileName,
0157 const StepData_ConfParameters& theParams,
0158 const Message_ProgressRange& theProgress = Message_ProgressRange());
0159
0160
0161
0162 const NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>& ExternFiles() const { return myFiles; };
0163
0164
0165
0166 Standard_EXPORT Standard_Boolean ExternFile(const TDF_Label& theLabel,
0167 Handle(STEPCAFControl_ExternFile)& theExtFile) const;
0168
0169
0170
0171 Standard_EXPORT Standard_Boolean ExternFile(const Standard_CString theName,
0172 Handle(STEPCAFControl_ExternFile)& theExtFile) const;
0173
0174
0175 STEPControl_Writer& ChangeWriter() { return myWriter; }
0176
0177
0178 const STEPControl_Writer& Writer() const { return myWriter; }
0179
0180
0181 void SetColorMode(const Standard_Boolean theColorMode) { myColorMode = theColorMode; }
0182
0183 Standard_Boolean GetColorMode() const { return myColorMode; }
0184
0185
0186 void SetNameMode(const Standard_Boolean theNameMode) { myNameMode = theNameMode; }
0187
0188 Standard_Boolean GetNameMode() const { return myNameMode; }
0189
0190
0191 void SetLayerMode(const Standard_Boolean theLayerMode) { myLayerMode = theLayerMode; }
0192
0193 Standard_Boolean GetLayerMode() const { return myLayerMode; }
0194
0195
0196 void SetPropsMode(const Standard_Boolean thePropsMode) { myPropsMode = thePropsMode; }
0197
0198 Standard_Boolean GetPropsMode() const { return myPropsMode; }
0199
0200
0201 void SetSHUOMode(const Standard_Boolean theSHUOMode) { mySHUOMode = theSHUOMode; }
0202
0203 Standard_Boolean GetSHUOMode() const { return mySHUOMode; }
0204
0205
0206 void SetDimTolMode(const Standard_Boolean theDimTolMode) { myGDTMode = theDimTolMode; };
0207
0208 Standard_Boolean GetDimTolMode() const { return myGDTMode; }
0209
0210
0211 void SetMaterialMode(const Standard_Boolean theMaterialMode) { myMatMode = theMaterialMode; }
0212
0213 Standard_Boolean GetMaterialMode() const { return myMatMode; }
0214
0215 protected:
0216
0217
0218
0219
0220 Standard_Boolean transfer(STEPControl_Writer& theWriter,
0221 const TDF_LabelSequence& theLabels,
0222 const STEPControl_StepModelType theMode = STEPControl_AsIs,
0223 const Standard_CString theIsMulti = 0,
0224 const Standard_Boolean isExternFile = Standard_False,
0225 const Message_ProgressRange& theProgress = Message_ProgressRange());
0226
0227
0228
0229
0230
0231
0232
0233 TopoDS_Shape transferExternFiles(const TDF_Label& theLabel,
0234 const STEPControl_StepModelType theMode,
0235 TDF_LabelSequence& theLabelSeq,
0236 const StepData_Factors& theLocalFactors,
0237 const Standard_CString thePrefix = "",
0238 const Message_ProgressRange& theProgress = Message_ProgressRange());
0239
0240
0241 Standard_Boolean writeExternRefs(const Handle(XSControl_WorkSession)& theWS,
0242 const TDF_LabelSequence& theLabels) const;
0243
0244
0245 Standard_Boolean writeColors(const Handle(XSControl_WorkSession)& theWS,
0246 const TDF_LabelSequence& theLabels);
0247
0248
0249 Standard_Boolean writeNames(const Handle(XSControl_WorkSession)& theWS,
0250 const TDF_LabelSequence& theLabels) const;
0251
0252
0253 Standard_Boolean writeDGTs(const Handle(XSControl_WorkSession)& theWS,
0254 const TDF_LabelSequence& theLabels) const;
0255
0256
0257 Standard_Boolean writeDGTsAP242(const Handle(XSControl_WorkSession)& theWS,
0258 const TDF_LabelSequence& theLabels,
0259 const StepData_Factors& theLocalFactors);
0260
0261
0262 Standard_Boolean writeMaterials(const Handle(XSControl_WorkSession)& theWS,
0263 const TDF_LabelSequence& theLabels) const;
0264
0265
0266
0267 Standard_Boolean writeValProps(const Handle(XSControl_WorkSession)& theWS,
0268 const TDF_LabelSequence& theLabels,
0269 const Standard_CString theIsMulti) const;
0270
0271
0272 Standard_Boolean writeLayers(const Handle(XSControl_WorkSession)& theWS,
0273 const TDF_LabelSequence& theLabels) const;
0274
0275
0276 Standard_Boolean writeSHUOs(const Handle(XSControl_WorkSession)& theWS,
0277 const TDF_LabelSequence& theLabels);
0278
0279
0280
0281
0282 void prepareUnit(const TDF_Label& theLabel,
0283 const Handle(StepData_StepModel)& theModel,
0284 StepData_Factors& theLocalFactors);
0285
0286 Handle(StepRepr_ShapeAspect) writeShapeAspect(const Handle(XSControl_WorkSession)& theWS,
0287 const TDF_Label theLabel,
0288 const TopoDS_Shape& theShape,
0289 Handle(StepRepr_RepresentationContext)& theRC,
0290 Handle(StepAP242_GeometricItemSpecificUsage)& theGISU);
0291
0292 void writePresentation(const Handle(XSControl_WorkSession)& theWS,
0293 const TopoDS_Shape& thePresentation,
0294 const Handle(TCollection_HAsciiString)& thePrsName,
0295 const Standard_Boolean theHasSemantic,
0296 const Standard_Boolean theHasPlane,
0297 const gp_Ax2& theAnnotationPlane,
0298 const gp_Pnt& theTextPosition,
0299 const Handle(Standard_Transient)& theDimension,
0300 const StepData_Factors& theLocalFactors);
0301
0302 Handle(StepDimTol_Datum) writeDatumAP242(const Handle(XSControl_WorkSession)& theWS,
0303 const TDF_LabelSequence& theShapeL,
0304 const TDF_Label& theDatumL,
0305 const Standard_Boolean isFirstDTarget,
0306 const Handle(StepDimTol_Datum)& theWrittenDatum,
0307 const StepData_Factors& theLocalFactors);
0308
0309 void writeToleranceZone(const Handle(XSControl_WorkSession)& theWS,
0310 const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject,
0311 const Handle(StepDimTol_GeometricTolerance)& theEntity,
0312 const Handle(StepRepr_RepresentationContext)& theRC);
0313
0314 void writeGeomTolerance(const Handle(XSControl_WorkSession)& theWS,
0315 const TDF_LabelSequence& theShapeSeqL,
0316 const TDF_Label& theGeomTolL,
0317 const Handle(StepDimTol_HArray1OfDatumSystemOrReference)& theDatumSystem,
0318 const Handle(StepRepr_RepresentationContext)& theRC,
0319 const StepData_Factors& theLocalFactors);
0320
0321 private:
0322
0323 STEPControl_Writer myWriter;
0324 NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> myFiles;
0325 TDF_LabelMap myRootLabels;
0326 STEPCAFControl_DataMapOfLabelShape myLabels;
0327 STEPCAFControl_DataMapOfLabelExternFile myLabEF;
0328 STEPCAFControl_DataMapOfLabelShape myPureRefLabels;
0329 Standard_Boolean myColorMode;
0330 Standard_Boolean myNameMode;
0331 Standard_Boolean myLayerMode;
0332 Standard_Boolean myPropsMode;
0333 Standard_Boolean mySHUOMode;
0334 MoniTool_DataMapOfShapeTransient myMapCompMDGPR;
0335 Standard_Boolean myGDTMode;
0336 Standard_Boolean myMatMode;
0337 NCollection_Vector<Handle(StepRepr_RepresentationItem)> myGDTAnnotations;
0338 Handle(StepVisual_DraughtingModel) myGDTPresentationDM;
0339 Handle(StepVisual_HArray1OfPresentationStyleAssignment) myGDTPrsCurveStyle;
0340 Handle(StepRepr_ProductDefinitionShape) myGDTCommonPDS;
0341
0342 };
0343
0344 #endif