diff --git a/src/IGESCAFControl/IGESCAFControl_Writer.cxx b/src/IGESCAFControl/IGESCAFControl_Writer.cxx index ee2c7ced39..4134fa96b8 100644 --- a/src/IGESCAFControl/IGESCAFControl_Writer.cxx +++ b/src/IGESCAFControl/IGESCAFControl_Writer.cxx @@ -13,7 +13,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - #include #include #include @@ -151,31 +150,19 @@ Standard_Boolean IGESCAFControl_Writer::Transfer (const Handle(TDocStd_Document) STool->GetFreeShapes ( labels ); return Transfer (labels); } - + //======================================================================= -//function : Perform +//function : Transfer //purpose : //======================================================================= -Standard_Boolean IGESCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc, - const Standard_CString filename) +Standard_Boolean IGESCAFControl_Writer::Transfer (const TDF_Label& label) { - if ( ! Transfer ( doc ) ) return Standard_False; - return Write ( filename ) == IFSelect_RetDone; + TDF_LabelSequence labels; + labels.Append( label ); + return Transfer( labels ); } - -//======================================================================= -//function : Perform -//purpose : -//======================================================================= -Standard_Boolean IGESCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc, - const TCollection_AsciiString &filename) -{ - if ( ! Transfer ( doc ) ) return Standard_False; - return Write ( filename.ToCString() ) == IFSelect_RetDone; -} - //======================================================================= //function : Transfer //purpose : @@ -210,6 +197,30 @@ Standard_Boolean IGESCAFControl_Writer::Transfer (const TDF_LabelSequence& label return Standard_True; } +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + +Standard_Boolean IGESCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc, + const Standard_CString filename) +{ + if ( ! Transfer ( doc ) ) return Standard_False; + return Write ( filename ) == IFSelect_RetDone; +} + +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + +Standard_Boolean IGESCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc, + const TCollection_AsciiString &filename) +{ + if ( ! Transfer ( doc ) ) return Standard_False; + return Write ( filename.ToCString() ) == IFSelect_RetDone; +} + //======================================================================= //function : WriteAttributes //purpose : diff --git a/src/IGESCAFControl/IGESCAFControl_Writer.hxx b/src/IGESCAFControl/IGESCAFControl_Writer.hxx index 0833f89488..ff725bc285 100644 --- a/src/IGESCAFControl/IGESCAFControl_Writer.hxx +++ b/src/IGESCAFControl/IGESCAFControl_Writer.hxx @@ -33,7 +33,6 @@ class TCollection_AsciiString; class TopoDS_Shape; class XCAFPrs_Style; - //! Provides a tool to write DECAF document to the //! IGES file. Besides transfer of shapes (including //! assemblies) provided by IGESControl, supports also @@ -71,7 +70,15 @@ public: //! Transfers a document to a IGES model //! Returns True if translation is OK Standard_EXPORT Standard_Boolean Transfer (const Handle(TDocStd_Document)& doc); - + + //! Transfers labels to a IGES model + //! Returns True if translation is OK + Standard_EXPORT Standard_Boolean Transfer (const TDF_LabelSequence& labels); + + //! Transfers label to a IGES model + //! Returns True if translation is OK + Standard_EXPORT Standard_Boolean Transfer (const TDF_Label& label); + Standard_EXPORT Standard_Boolean Perform (const Handle(TDocStd_Document)& doc, const TCollection_AsciiString& filename); //! Transfers a document and writes it to a IGES file @@ -97,12 +104,7 @@ public: protected: - - - //! Transfers labels to a IGES model - //! Returns True if translation is OK - Standard_EXPORT Standard_Boolean Transfer (const TDF_LabelSequence& labels); - + //! Reads colors from DECAF document and assigns them //! to corresponding IGES entities Standard_EXPORT Standard_Boolean WriteAttributes (const TDF_LabelSequence& labels); diff --git a/src/STEPCAFControl/STEPCAFControl_Writer.cxx b/src/STEPCAFControl/STEPCAFControl_Writer.cxx index a309e9fd0b..5ec6ceb772 100644 --- a/src/STEPCAFControl/STEPCAFControl_Writer.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Writer.cxx @@ -288,9 +288,9 @@ IFSelect_ReturnStatus STEPCAFControl_Writer::Write (const Standard_CString filen //purpose : //======================================================================= -Standard_Boolean STEPCAFControl_Writer::Transfer (const Handle(TDocStd_Document) &doc, +Standard_Boolean STEPCAFControl_Writer::Transfer( const Handle(TDocStd_Document) &doc, const STEPControl_StepModelType mode, - const Standard_CString multi) + const Standard_CString multi ) { Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( doc->Main() ); if ( STool.IsNull() ) return Standard_False; @@ -306,15 +306,26 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (const Handle(TDocStd_Document) //purpose : //======================================================================= -Standard_Boolean STEPCAFControl_Writer::Transfer (const TDF_Label &L, +Standard_Boolean STEPCAFControl_Writer::Transfer( const TDF_Label& L, const STEPControl_StepModelType mode, - const Standard_CString multi) + const Standard_CString multi ) { TDF_LabelSequence labels; labels.Append ( L ); return Transfer ( myWriter, labels, mode, multi ); } +//======================================================================= +//function : Transfer +//purpose : +//======================================================================= + +Standard_Boolean STEPCAFControl_Writer::Transfer( const TDF_LabelSequence& labels, + const STEPControl_StepModelType mode, + const Standard_CString multi ) +{ + return Transfer( myWriter, labels, mode, multi ); +} //======================================================================= //function : Perform diff --git a/src/STEPCAFControl/STEPCAFControl_Writer.hxx b/src/STEPCAFControl/STEPCAFControl_Writer.hxx index f74bab986f..915c38bfef 100644 --- a/src/STEPCAFControl/STEPCAFControl_Writer.hxx +++ b/src/STEPCAFControl/STEPCAFControl_Writer.hxx @@ -73,16 +73,16 @@ public: //! Provided for use like single-file writer Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString filename); - Standard_EXPORT Standard_Boolean Transfer (const Handle(TDocStd_Document)& doc, const STEPControl_StepModelType mode = STEPControl_AsIs, const Standard_CString multi = 0); - //! Transfers a document (or single label) to a STEP model //! The mode of translation of shape is AsIs //! If multi is not null pointer, it switches to multifile //! mode (with external refs), and string pointed by //! gives prefix for names of extern files (can be empty string) //! Returns True if translation is OK + Standard_EXPORT Standard_Boolean Transfer (const Handle(TDocStd_Document)& doc, const STEPControl_StepModelType mode = STEPControl_AsIs, const Standard_CString multi = 0); + Standard_EXPORT Standard_Boolean Transfer (const TDF_LabelSequence& L, const STEPControl_StepModelType mode = STEPControl_AsIs, const Standard_CString multi = 0); Standard_EXPORT Standard_Boolean Transfer (const TDF_Label& L, const STEPControl_StepModelType mode = STEPControl_AsIs, const Standard_CString multi = 0); - + Standard_EXPORT Standard_Boolean Perform (const Handle(TDocStd_Document)& doc, const TCollection_AsciiString& filename); //! Transfers a document and writes it to a STEP file