Added public methods for specified labels (shapes) transfer in IGES/STEP writers.
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
#include <IGESCAFControl.hxx>
#include <IGESCAFControl_Writer.hxx>
#include <IGESData_IGESEntity.hxx>
STool->GetFreeShapes ( labels );
return Transfer (labels);
}
-
-//=======================================================================
-//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
+//function : Transfer
//purpose :
//=======================================================================
-Standard_Boolean IGESCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc,
- const TCollection_AsciiString &filename)
+Standard_Boolean IGESCAFControl_Writer::Transfer (const TDF_Label& label)
{
- if ( ! Transfer ( doc ) ) return Standard_False;
- return Write ( filename.ToCString() ) == IFSelect_RetDone;
+ TDF_LabelSequence labels;
+ labels.Append( label );
+ return Transfer( labels );
}
-
+
//=======================================================================
//function : Transfer
//purpose :
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 :
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
//! 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
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);
//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;
//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
//! 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 <multi>
//! 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