File indexing completed on 2026-09-28 09:21:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _STEPCAFControl_Reader_HeaderFile
0017 #define _STEPCAFControl_Reader_HeaderFile
0018
0019 #include <STEPControl_Reader.hxx>
0020 #include <NCollection_LinearVector.hxx>
0021 #include <StepData_Factors.hxx>
0022 #include <IFSelect_ReturnStatus.hxx>
0023 #include <TDF_Label.hxx>
0024 #include <NCollection_Sequence.hxx>
0025 #include <TopoDS_Shape.hxx>
0026 #include <TopTools_ShapeMapHasher.hxx>
0027 #include <NCollection_Map.hxx>
0028 #include <StepBasic_ProductDefinition.hxx>
0029 #include <NCollection_DataMap.hxx>
0030 #include <STEPCAFControl_ExternFile.hxx>
0031 #include <Standard_Transient.hxx>
0032 #include <NCollection_HSequence.hxx>
0033 #include <XCAFDimTolObjects_DatumSingleModif.hxx>
0034 #include <XCAFDimTolObjects_DatumModifWithValue.hxx>
0035
0036 class XSControl_WorkSession;
0037 class TDataStd_NamedData;
0038 class TDocStd_Document;
0039 class STEPCAFControl_ExternFile;
0040 class TopoDS_Shape;
0041 class XCAFDoc_ShapeTool;
0042 class StepRepr_RepresentationItem;
0043 class Transfer_TransientProcess;
0044 class StepBasic_NamedUnit;
0045 class StepBasic_Product;
0046 class StepShape_ConnectedFaceSet;
0047 class StepShape_ShapeDefinitionRepresentation;
0048 class StepRepr_NextAssemblyUsageOccurrence;
0049 class StepRepr_PropertyDefinition;
0050 class STEPConstruct_Tool;
0051 class StepDimTol_Datum;
0052 class Transfer_Binder;
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 class STEPCAFControl_Reader
0066 {
0067 public:
0068 DEFINE_STANDARD_ALLOC
0069
0070 public:
0071
0072
0073
0074 Standard_EXPORT STEPCAFControl_Reader();
0075
0076
0077
0078 Standard_EXPORT STEPCAFControl_Reader(const occ::handle<XSControl_WorkSession>& WS,
0079 const bool scratch = true);
0080
0081
0082 Standard_EXPORT virtual ~STEPCAFControl_Reader();
0083
0084
0085
0086 Standard_EXPORT void Init(const occ::handle<XSControl_WorkSession>& WS,
0087 const bool scratch = true);
0088
0089
0090
0091
0092
0093 Standard_EXPORT IFSelect_ReturnStatus ReadFile(const char* const theFileName);
0094
0095
0096
0097
0098
0099
0100 Standard_EXPORT IFSelect_ReturnStatus ReadFile(const char* const theFileName,
0101 const DESTEP_Parameters& theParams);
0102
0103
0104
0105
0106
0107 Standard_EXPORT IFSelect_ReturnStatus ReadStream(const char* const theName,
0108 std::istream& theIStream);
0109
0110
0111
0112 Standard_EXPORT int NbRootsForTransfer();
0113
0114
0115
0116
0117 Standard_EXPORT bool TransferOneRoot(
0118 const int num,
0119 const occ::handle<TDocStd_Document>& doc,
0120 const Message_ProgressRange& theProgress = Message_ProgressRange());
0121
0122
0123
0124
0125 Standard_EXPORT bool Transfer(const occ::handle<TDocStd_Document>& doc,
0126 const Message_ProgressRange& theProgress = Message_ProgressRange());
0127
0128 Standard_EXPORT bool Perform(const TCollection_AsciiString& filename,
0129 const occ::handle<TDocStd_Document>& doc,
0130 const Message_ProgressRange& theProgress = Message_ProgressRange());
0131
0132 Standard_EXPORT bool Perform(const TCollection_AsciiString& filename,
0133 const occ::handle<TDocStd_Document>& doc,
0134 const DESTEP_Parameters& theParams,
0135 const Message_ProgressRange& theProgress = Message_ProgressRange());
0136
0137
0138
0139 Standard_EXPORT bool Perform(const char* const filename,
0140 const occ::handle<TDocStd_Document>& doc,
0141 const Message_ProgressRange& theProgress = Message_ProgressRange());
0142
0143
0144
0145 Standard_EXPORT bool Perform(const char* const filename,
0146 const occ::handle<TDocStd_Document>& doc,
0147 const DESTEP_Parameters& theParams,
0148 const Message_ProgressRange& theProgress = Message_ProgressRange());
0149
0150
0151
0152 Standard_EXPORT const NCollection_DataMap<TCollection_AsciiString,
0153 occ::handle<STEPCAFControl_ExternFile>>&
0154 ExternFiles() const;
0155
0156
0157
0158 Standard_EXPORT bool ExternFile(const char* const name,
0159 occ::handle<STEPCAFControl_ExternFile>& ef) const;
0160
0161
0162 Standard_EXPORT STEPControl_Reader& ChangeReader();
0163
0164
0165 Standard_EXPORT const STEPControl_Reader& Reader() const;
0166
0167
0168
0169 Standard_EXPORT static TDF_Label FindInstance(
0170 const occ::handle<StepRepr_NextAssemblyUsageOccurrence>& NAUO,
0171 const occ::handle<XCAFDoc_ShapeTool>& STool,
0172 const STEPConstruct_Tool& Tool,
0173 const NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher>& ShapeLabelMap);
0174
0175
0176 Standard_EXPORT void SetColorMode(const bool colormode);
0177
0178 Standard_EXPORT bool GetColorMode() const;
0179
0180
0181 Standard_EXPORT void SetNameMode(const bool namemode);
0182
0183 Standard_EXPORT bool GetNameMode() const;
0184
0185
0186 Standard_EXPORT void SetLayerMode(const bool layermode);
0187
0188 Standard_EXPORT bool GetLayerMode() const;
0189
0190
0191 Standard_EXPORT void SetPropsMode(const bool propsmode);
0192
0193 Standard_EXPORT bool GetPropsMode() const;
0194
0195
0196 Standard_EXPORT void SetMetaMode(const bool theMetaMode);
0197
0198 Standard_EXPORT bool GetMetaMode() const;
0199
0200
0201 Standard_EXPORT void SetProductMetaMode(const bool theProductMetaMode);
0202
0203 Standard_EXPORT bool GetProductMetaMode() const;
0204
0205
0206 Standard_EXPORT void SetSHUOMode(const bool shuomode);
0207
0208 Standard_EXPORT bool GetSHUOMode() const;
0209
0210
0211 Standard_EXPORT void SetGDTMode(const bool gdtmode);
0212
0213 Standard_EXPORT bool GetGDTMode() const;
0214
0215
0216 Standard_EXPORT void SetMatMode(const bool matmode);
0217
0218 Standard_EXPORT bool GetMatMode() const;
0219
0220
0221 Standard_EXPORT void SetViewMode(const bool viewmode);
0222
0223
0224 Standard_EXPORT bool GetViewMode() const;
0225
0226 const NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher>& GetShapeLabelMap()
0227 const
0228 {
0229 return myMap;
0230 }
0231
0232
0233
0234 Standard_EXPORT void SetShapeFixParameters(
0235 const XSAlgo_ShapeProcessor::ParameterMap& theParameters);
0236
0237
0238
0239
0240 Standard_EXPORT void SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters);
0241
0242
0243
0244
0245
0246
0247
0248 Standard_EXPORT void SetShapeFixParameters(
0249 const DE_ShapeFixParameters& theParameters,
0250 const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters = {});
0251
0252
0253
0254 Standard_EXPORT const XSAlgo_ShapeProcessor::ParameterMap& GetShapeFixParameters() const;
0255
0256
0257
0258 Standard_EXPORT void SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags);
0259
0260
0261
0262
0263 Standard_EXPORT const XSAlgo_ShapeProcessor::ProcessingFlags& GetShapeProcessFlags() const;
0264
0265 protected:
0266
0267
0268
0269
0270
0271
0272 Standard_EXPORT bool Transfer(STEPControl_Reader& rd,
0273 const int num,
0274 const occ::handle<TDocStd_Document>& doc,
0275 NCollection_Sequence<TDF_Label>& Lseq,
0276 const bool asOne = false,
0277 const Message_ProgressRange& theProgress = Message_ProgressRange());
0278
0279
0280
0281
0282
0283 Standard_EXPORT TDF_Label
0284 AddShape(const TopoDS_Shape& S,
0285 const occ::handle<XCAFDoc_ShapeTool>& STool,
0286 const NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>& NewShapesMap,
0287 const NCollection_DataMap<TopoDS_Shape,
0288 occ::handle<StepBasic_ProductDefinition>,
0289 TopTools_ShapeMapHasher>& ShapePDMap,
0290 const NCollection_DataMap<occ::handle<StepBasic_ProductDefinition>,
0291 occ::handle<STEPCAFControl_ExternFile>>& PDFileMap);
0292
0293
0294
0295 Standard_EXPORT occ::handle<STEPCAFControl_ExternFile> ReadExternFile(
0296 const char* const file,
0297 const char* const fullpath,
0298 const occ::handle<TDocStd_Document>& doc,
0299 const Message_ProgressRange& theProgress = Message_ProgressRange());
0300
0301
0302
0303 Standard_EXPORT bool ReadColors(
0304 const occ::handle<XSControl_WorkSession>& WS,
0305 const occ::handle<TDocStd_Document>& doc,
0306 const StepData_Factors& theLocalFactors = StepData_Factors()) const;
0307
0308
0309
0310 Standard_EXPORT bool ReadNames(
0311 const occ::handle<XSControl_WorkSession>& WS,
0312 const occ::handle<TDocStd_Document>& doc,
0313 const NCollection_DataMap<occ::handle<StepBasic_ProductDefinition>,
0314 occ::handle<STEPCAFControl_ExternFile>>& PDFileMap) const;
0315
0316
0317
0318
0319 Standard_EXPORT bool ReadValProps(
0320 const occ::handle<XSControl_WorkSession>& WS,
0321 const occ::handle<TDocStd_Document>& doc,
0322 const NCollection_DataMap<occ::handle<StepBasic_ProductDefinition>,
0323 occ::handle<STEPCAFControl_ExternFile>>& PDFileMap,
0324 const StepData_Factors& theLocalFactors = StepData_Factors()) const;
0325
0326
0327
0328 Standard_EXPORT bool ReadMetadata(
0329 const occ::handle<XSControl_WorkSession>& theWS,
0330 const occ::handle<TDocStd_Document>& theDoc,
0331 const StepData_Factors& theLocalFactors = StepData_Factors()) const;
0332
0333 Standard_EXPORT bool ReadProductMetadata(const occ::handle<XSControl_WorkSession>& theWS,
0334 const occ::handle<TDocStd_Document>& theDoc) const;
0335
0336
0337
0338 Standard_EXPORT bool ReadLayers(const occ::handle<XSControl_WorkSession>& WS,
0339 const occ::handle<TDocStd_Document>& doc) const;
0340
0341
0342
0343 Standard_EXPORT bool ReadSHUOs(
0344 const occ::handle<XSControl_WorkSession>& WS,
0345 const occ::handle<TDocStd_Document>& doc,
0346 const NCollection_DataMap<occ::handle<StepBasic_ProductDefinition>,
0347 occ::handle<STEPCAFControl_ExternFile>>& PDFileMap) const;
0348
0349
0350
0351 Standard_EXPORT bool ReadGDTs(const occ::handle<XSControl_WorkSession>& WS,
0352 const occ::handle<TDocStd_Document>& doc,
0353 const StepData_Factors& theLocalFactors = StepData_Factors());
0354
0355
0356
0357 Standard_EXPORT bool ReadMaterials(
0358 const occ::handle<XSControl_WorkSession>& WS,
0359 const occ::handle<TDocStd_Document>& doc,
0360 const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& SeqPDS,
0361 const StepData_Factors& theLocalFactors = StepData_Factors()) const;
0362
0363
0364 Standard_EXPORT bool ReadViews(
0365 const occ::handle<XSControl_WorkSession>& theWS,
0366 const occ::handle<TDocStd_Document>& theDoc,
0367 const StepData_Factors& theLocalFactors = StepData_Factors()) const;
0368
0369
0370
0371
0372 Standard_EXPORT TDF_Label
0373 SettleShapeData(const occ::handle<StepRepr_RepresentationItem>& theItem,
0374 const TDF_Label& theLab,
0375 const occ::handle<XCAFDoc_ShapeTool>& theShapeTool,
0376 const occ::handle<Transfer_TransientProcess>& theTP) const;
0377
0378
0379
0380
0381
0382 Standard_EXPORT void ExpandSubShapes(
0383 const occ::handle<XCAFDoc_ShapeTool>& theShapeTool,
0384 const NCollection_DataMap<TopoDS_Shape,
0385 occ::handle<StepBasic_ProductDefinition>,
0386 TopTools_ShapeMapHasher>& theShapePDMap) const;
0387
0388
0389
0390
0391 Standard_EXPORT void ExpandManifoldSolidBrep(
0392 TDF_Label& theLab,
0393 const occ::handle<StepRepr_RepresentationItem>& theItem,
0394 const occ::handle<Transfer_TransientProcess>& theTP,
0395 const occ::handle<XCAFDoc_ShapeTool>& theShapeTool) const;
0396
0397
0398
0399
0400 Standard_EXPORT void ExpandSBSM(TDF_Label& theLab,
0401 const occ::handle<StepRepr_RepresentationItem>& theItem,
0402 const occ::handle<Transfer_TransientProcess>& theTP,
0403 const occ::handle<XCAFDoc_ShapeTool>& theShapeTool) const;
0404
0405
0406
0407
0408 Standard_EXPORT void ExpandShell(const occ::handle<StepShape_ConnectedFaceSet>& theShell,
0409 TDF_Label& theLab,
0410 const occ::handle<Transfer_TransientProcess>& theTP,
0411 const occ::handle<XCAFDoc_ShapeTool>& theShapeTool) const;
0412
0413
0414 Standard_EXPORT virtual TCollection_ExtendedString convertName(
0415 const TCollection_AsciiString& theName) const;
0416
0417 private:
0418
0419
0420 bool setDatumToXCAF(
0421 const occ::handle<StepDimTol_Datum>& theDat,
0422 const TDF_Label theGDTL,
0423 const int thePositionCounter,
0424 const NCollection_Sequence<XCAFDimTolObjects_DatumSingleModif>& theXCAFModifiers,
0425 const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal,
0426 const double theModifValue,
0427 const occ::handle<TDocStd_Document>& theDoc,
0428 const occ::handle<XSControl_WorkSession>& theWS,
0429 const StepData_Factors& theLocalFactors = StepData_Factors());
0430
0431
0432 bool readDatumsAP242(const occ::handle<Standard_Transient>& theEnt,
0433 const TDF_Label theGDTL,
0434 const occ::handle<TDocStd_Document>& theDoc,
0435 const occ::handle<XSControl_WorkSession>& theWS,
0436 const StepData_Factors& theLocalFactors = StepData_Factors());
0437
0438
0439 TDF_Label createGDTObjectInXCAF(const occ::handle<Standard_Transient>& theEnt,
0440 const occ::handle<TDocStd_Document>& theDoc,
0441 const occ::handle<XSControl_WorkSession>& theWS,
0442 const StepData_Factors& theLocalFactors = StepData_Factors());
0443
0444
0445 void prepareUnits(const occ::handle<StepData_StepModel>& theModel,
0446 const occ::handle<TDocStd_Document>& theDoc,
0447 StepData_Factors& theLocalFactors) const;
0448
0449
0450 bool findReprItems(const occ::handle<XSControl_WorkSession>& theWS,
0451 const occ::handle<StepShape_ShapeDefinitionRepresentation>& theShDefRepr,
0452 NCollection_List<occ::handle<Transfer_Binder>>& theBinders) const;
0453
0454
0455 bool fillAttributes(const occ::handle<XSControl_WorkSession>& theWS,
0456 const occ::handle<StepRepr_PropertyDefinition>& thePropDef,
0457 const StepData_Factors& theLocalFactors,
0458 occ::handle<TDataStd_NamedData>& theAttr) const;
0459
0460
0461
0462
0463
0464 TDF_Label getShapeLabelFromProductDefinition(
0465 const occ::handle<Transfer_TransientProcess>& theTransferProcess,
0466 const occ::handle<StepBasic_ProductDefinition>& theProductDefinition) const;
0467
0468
0469
0470
0471 occ::handle<StepBasic_Product> getProductFromProductDefinition(
0472 const occ::handle<StepBasic_ProductDefinition>& theProductDefinition) const;
0473
0474
0475
0476
0477
0478 NCollection_LinearVector<occ::handle<StepRepr_PropertyDefinition>> collectPropertyDefinitions(
0479 const occ::handle<XSControl_WorkSession>& theWorkSession,
0480 const occ::handle<Standard_Transient>& theGeneralProperty) const;
0481
0482
0483
0484
0485
0486
0487 NCollection_LinearVector<TDF_Label> collectShapeLabels(
0488 const occ::handle<XSControl_WorkSession>& theWorkSession,
0489 const occ::handle<Transfer_TransientProcess>& theTransferProcess,
0490 const occ::handle<StepRepr_PropertyDefinition>& theSource) const;
0491
0492
0493
0494
0495
0496
0497 NCollection_LinearVector<occ::handle<StepRepr_PropertyDefinition>>
0498 collectRelatedPropertyDefinitions(
0499 const occ::handle<XSControl_WorkSession>& theWorkSession,
0500 const occ::handle<StepRepr_PropertyDefinition>& theProperty) const;
0501
0502
0503
0504
0505 occ::handle<TDataStd_NamedData> getNamedData(const TDF_Label& theLabel) const;
0506
0507
0508
0509
0510
0511
0512 void collectBinders(const occ::handle<XSControl_WorkSession>& theWorkSession,
0513 const occ::handle<Transfer_TransientProcess>& theTransientProcess,
0514 const occ::handle<StepRepr_PropertyDefinition>& theSource,
0515 NCollection_List<occ::handle<Transfer_Binder>>& theBinders) const;
0516
0517 private:
0518 STEPControl_Reader myReader;
0519 NCollection_DataMap<TCollection_AsciiString, occ::handle<STEPCAFControl_ExternFile>> myFiles;
0520 NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher> myMap;
0521 bool myColorMode;
0522 bool myNameMode;
0523 bool myLayerMode;
0524 bool myPropsMode;
0525 bool myMetaMode;
0526 bool myProductMetaMode;
0527 bool mySHUOMode;
0528 bool myGDTMode;
0529 bool myMatMode;
0530 bool myViewMode;
0531 NCollection_DataMap<occ::handle<Standard_Transient>, TDF_Label> myGDTMap;
0532 };
0533
0534 #endif