mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0025748: Parallel version of progress indicator
Progress indication mechanism is refactored to support incrementing progress within multithreaded algorithms. The class Message_ProgressIndicator is only an interface to the user application. It accumulates the progress provided by progress scopes. The counter is protected by mutex for thread-safety. The new class Message_ProgressScope replacing Message_ProgressSentry should be used to advance the progress. The scopes are nested to each other to reflect the nested nature of operations. The new class Message_ProgressRange should be used to pass the progress to sub-scopes. All OCCT algorithms involving progress indication have been updated to new API. Improvements in Draw_ProgressIndicator: - Separate console mode has been added in order to make possible to put the progress into std::cout instead or in addition to the draw interpreter, instead of trigger option "-tclOutput". - Treatment of Ctrl-Break signal has been added. Now any operation can be aborted by Ctrl-C or Ctrl-Break keystroke. Added new test case 'perf fclasses progr_par' for testing of parallel work of the progress.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <StepData_StepModel.hxx>
|
||||
#include <HeaderSection_FileSchema.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Message_ProgressScope.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
@@ -416,11 +417,12 @@ Standard_Integer STEPCAFControl_Reader::NbRootsForTransfer()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::TransferOneRoot(const Standard_Integer num,
|
||||
Handle(TDocStd_Document) &doc)
|
||||
Standard_Boolean STEPCAFControl_Reader::TransferOneRoot (const Standard_Integer num,
|
||||
Handle(TDocStd_Document) &doc,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
TDF_LabelSequence Lseq;
|
||||
return Transfer(myReader, num, doc, Lseq);
|
||||
return Transfer (myReader, num, doc, Lseq, Standard_False, theProgress);
|
||||
}
|
||||
|
||||
|
||||
@@ -429,10 +431,11 @@ Standard_Boolean STEPCAFControl_Reader::TransferOneRoot(const Standard_Integer n
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::Transfer(Handle(TDocStd_Document) &doc)
|
||||
Standard_Boolean STEPCAFControl_Reader::Transfer (Handle(TDocStd_Document) &doc,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
TDF_LabelSequence Lseq;
|
||||
return Transfer(myReader, 0, doc, Lseq);
|
||||
return Transfer (myReader, 0, doc, Lseq, Standard_False, theProgress);
|
||||
}
|
||||
|
||||
|
||||
@@ -441,11 +444,15 @@ Standard_Boolean STEPCAFControl_Reader::Transfer(Handle(TDocStd_Document) &doc)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::Perform(const Standard_CString filename,
|
||||
Handle(TDocStd_Document) &doc)
|
||||
Standard_Boolean STEPCAFControl_Reader::Perform (const Standard_CString filename,
|
||||
Handle(TDocStd_Document) &doc,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (ReadFile(filename) != IFSelect_RetDone) return Standard_False;
|
||||
return Transfer(doc);
|
||||
if (ReadFile (filename) != IFSelect_RetDone)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
return Transfer (doc, theProgress);
|
||||
}
|
||||
|
||||
|
||||
@@ -454,11 +461,15 @@ Standard_Boolean STEPCAFControl_Reader::Perform(const Standard_CString filename,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::Perform(const TCollection_AsciiString &filename,
|
||||
Handle(TDocStd_Document) &doc)
|
||||
Standard_Boolean STEPCAFControl_Reader::Perform (const TCollection_AsciiString &filename,
|
||||
Handle(TDocStd_Document) &doc,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (ReadFile(filename.ToCString()) != IFSelect_RetDone) return Standard_False;
|
||||
return Transfer(doc);
|
||||
if ( ReadFile (filename.ToCString()) != IFSelect_RetDone)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
return Transfer (doc, theProgress);
|
||||
}
|
||||
|
||||
|
||||
@@ -533,25 +544,34 @@ static void FillShapesMap(const TopoDS_Shape &S, TopTools_MapOfShape &map)
|
||||
//purpose : basic working method
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::Transfer(STEPControl_Reader &reader,
|
||||
const Standard_Integer nroot,
|
||||
Handle(TDocStd_Document) &doc,
|
||||
TDF_LabelSequence &Lseq,
|
||||
const Standard_Boolean asOne)
|
||||
Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
|
||||
const Standard_Integer nroot,
|
||||
Handle(TDocStd_Document) &doc,
|
||||
TDF_LabelSequence &Lseq,
|
||||
const Standard_Boolean asOne,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
reader.ClearShapes();
|
||||
Standard_Integer i;
|
||||
|
||||
// Read all shapes
|
||||
Standard_Integer num = reader.NbRootsForTransfer();
|
||||
if (num <= 0) return Standard_False;
|
||||
if (num <=0) return Standard_False;
|
||||
|
||||
Message_ProgressScope aPSRoot (theProgress, NULL, 2);
|
||||
|
||||
if (nroot) {
|
||||
if (nroot > num) return Standard_False;
|
||||
reader.TransferOneRoot(nroot);
|
||||
reader.TransferOneRoot (nroot, aPSRoot.Next());
|
||||
}
|
||||
else {
|
||||
for (i = 1; i <= num; i++) reader.TransferOneRoot(i);
|
||||
Message_ProgressScope aPS (aPSRoot.Next(), NULL, num);
|
||||
for (i = 1; i <= num && aPS.More(); i++)
|
||||
reader.TransferOneRoot (i, aPS.Next());
|
||||
}
|
||||
if (aPSRoot.UserBreak())
|
||||
return Standard_False;
|
||||
|
||||
num = reader.NbShapes();
|
||||
if (num <= 0) return Standard_False;
|
||||
|
||||
@@ -614,7 +634,10 @@ Standard_Boolean STEPCAFControl_Reader::Transfer(STEPControl_Reader &reader,
|
||||
// and fill map SDR -> extern file
|
||||
STEPConstruct_ExternRefs ExtRefs(reader.WS());
|
||||
ExtRefs.LoadExternRefs();
|
||||
for (i = 1; i <= ExtRefs.NbExternRefs(); i++) {
|
||||
Message_ProgressScope aPSE (aPSRoot.Next(), NULL, ExtRefs.NbExternRefs());
|
||||
for (i = 1; i <= ExtRefs.NbExternRefs() && aPSE.More(); i++)
|
||||
{
|
||||
Message_ProgressRange aRange = aPSE.Next();
|
||||
// check extern ref format
|
||||
Handle(TCollection_HAsciiString) format = ExtRefs.Format(i);
|
||||
if (!format.IsNull()) {
|
||||
@@ -668,9 +691,9 @@ Standard_Boolean STEPCAFControl_Reader::Transfer(STEPControl_Reader &reader,
|
||||
if (!PDFileMap.IsBound(PD)) continue; // this PD is not concerned by current transfer
|
||||
|
||||
// read extern file (or use existing data) and record its data
|
||||
Handle(STEPCAFControl_ExternFile) EF =
|
||||
ReadExternFile(filename, fullname.ToCString(), doc);
|
||||
PDFileMap.Bind(PD, EF);
|
||||
Handle(STEPCAFControl_ExternFile) EF =
|
||||
ReadExternFile (filename, fullname.ToCString(), doc, aRange);
|
||||
PDFileMap.Bind (PD, EF);
|
||||
}
|
||||
|
||||
// and insert them to the document
|
||||
@@ -835,9 +858,10 @@ TDF_Label STEPCAFControl_Reader::AddShape(const TopoDS_Shape &S,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(STEPCAFControl_ExternFile) STEPCAFControl_Reader::ReadExternFile(const Standard_CString file,
|
||||
const Standard_CString fullname,
|
||||
Handle(TDocStd_Document)& doc)
|
||||
Handle(STEPCAFControl_ExternFile) STEPCAFControl_Reader::ReadExternFile (const Standard_CString file,
|
||||
const Standard_CString fullname,
|
||||
Handle(TDocStd_Document)& doc,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
// if the file is already read, associate it with SDR
|
||||
if (myFiles.IsBound(file)) {
|
||||
@@ -864,8 +888,8 @@ Handle(STEPCAFControl_ExternFile) STEPCAFControl_Reader::ReadExternFile(const St
|
||||
// transfer in single-result mode
|
||||
if (EF->GetLoadStatus() == IFSelect_RetDone) {
|
||||
TDF_LabelSequence labels;
|
||||
EF->SetTransferStatus(Transfer(sr, 0, doc, labels, Standard_True));
|
||||
if (labels.Length() > 0) EF->SetLabel(labels.Value(1));
|
||||
EF->SetTransferStatus (Transfer (sr, 0, doc, labels, Standard_False, theProgress));
|
||||
if (labels.Length() > 0) EF->SetLabel (labels.Value(1));
|
||||
}
|
||||
|
||||
// add read file to dictionary
|
||||
|
@@ -89,18 +89,25 @@ public:
|
||||
//! Translates currently loaded STEP file into the document
|
||||
//! Returns True if succeeded, and False in case of fail
|
||||
//! Provided for use like single-file reader
|
||||
Standard_EXPORT Standard_Boolean TransferOneRoot (const Standard_Integer num, Handle(TDocStd_Document)& doc);
|
||||
Standard_EXPORT Standard_Boolean TransferOneRoot (const Standard_Integer num,
|
||||
Handle(TDocStd_Document)& doc,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Translates currently loaded STEP file into the document
|
||||
//! Returns True if succeeded, and False in case of fail
|
||||
//! Provided for use like single-file reader
|
||||
Standard_EXPORT Standard_Boolean Transfer (Handle(TDocStd_Document)& doc);
|
||||
Standard_EXPORT Standard_Boolean Transfer (Handle(TDocStd_Document)& doc,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
Standard_EXPORT Standard_Boolean Perform (const TCollection_AsciiString& filename, Handle(TDocStd_Document)& doc);
|
||||
Standard_EXPORT Standard_Boolean Perform (const TCollection_AsciiString& filename,
|
||||
Handle(TDocStd_Document)& doc,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Translate STEP file given by filename into the document
|
||||
//! Return True if succeeded, and False in case of fail
|
||||
Standard_EXPORT Standard_Boolean Perform (const Standard_CString filename, Handle(TDocStd_Document)& doc);
|
||||
Standard_EXPORT Standard_Boolean Perform (const Standard_CString filename,
|
||||
Handle(TDocStd_Document)& doc,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Returns data on external files
|
||||
//! Returns Null handle if no external files are read
|
||||
@@ -184,7 +191,12 @@ protected:
|
||||
//! Returns True if succeeded, and False in case of fail
|
||||
//! If asOne is True, in case of multiple results composes
|
||||
//! them into assembly. Fills sequence of produced labels
|
||||
Standard_EXPORT Standard_Boolean Transfer (STEPControl_Reader& rd, const Standard_Integer num, Handle(TDocStd_Document)& doc, TDF_LabelSequence& Lseq, const Standard_Boolean asOne = Standard_False);
|
||||
Standard_EXPORT Standard_Boolean Transfer (STEPControl_Reader& rd,
|
||||
const Standard_Integer num,
|
||||
Handle(TDocStd_Document)& doc,
|
||||
TDF_LabelSequence& Lseq,
|
||||
const Standard_Boolean asOne = Standard_False,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Add a shape to a document
|
||||
//! Depending on a case, this shape can be added as one, or
|
||||
@@ -194,7 +206,10 @@ protected:
|
||||
|
||||
//! Reads (or if returns already read) extern file with
|
||||
//! given name
|
||||
Standard_EXPORT Handle(STEPCAFControl_ExternFile) ReadExternFile (const Standard_CString file, const Standard_CString fullpath, Handle(TDocStd_Document)& doc);
|
||||
Standard_EXPORT Handle(STEPCAFControl_ExternFile) ReadExternFile (const Standard_CString file,
|
||||
const Standard_CString fullpath,
|
||||
Handle(TDocStd_Document)& doc,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Reads style assignments from STEP model and sets
|
||||
//! corresponding color assignments in the DECAF document
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Message_ProgressScope.hxx>
|
||||
#include <MoniTool_DataMapIteratorOfDataMapOfShapeTransient.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <Quantity_TypeOfColor.hxx>
|
||||
@@ -365,16 +366,17 @@ IFSelect_ReturnStatus STEPCAFControl_Writer::Write (const Standard_CString filen
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Writer::Transfer( const Handle(TDocStd_Document) &doc,
|
||||
const STEPControl_StepModelType mode,
|
||||
const Standard_CString multi )
|
||||
Standard_Boolean STEPCAFControl_Writer::Transfer(const Handle(TDocStd_Document) &doc,
|
||||
const STEPControl_StepModelType mode,
|
||||
const Standard_CString multi,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( doc->Main() );
|
||||
if ( STool.IsNull() ) return Standard_False;
|
||||
|
||||
TDF_LabelSequence labels;
|
||||
STool->GetFreeShapes ( labels );
|
||||
return Transfer ( myWriter, labels, mode, multi );
|
||||
return Transfer(myWriter, labels, mode, multi, Standard_False, theProgress);
|
||||
}
|
||||
|
||||
|
||||
@@ -383,13 +385,14 @@ Standard_Boolean STEPCAFControl_Writer::Transfer( const Handle(TDocStd_Document)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Writer::Transfer( const TDF_Label& L,
|
||||
const STEPControl_StepModelType mode,
|
||||
const Standard_CString multi )
|
||||
Standard_Boolean STEPCAFControl_Writer::Transfer(const TDF_Label& L,
|
||||
const STEPControl_StepModelType mode,
|
||||
const Standard_CString multi,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
TDF_LabelSequence labels;
|
||||
labels.Append ( L );
|
||||
return Transfer ( myWriter, labels, mode, multi );
|
||||
return Transfer(myWriter, labels, mode, multi, Standard_False, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -397,11 +400,12 @@ Standard_Boolean STEPCAFControl_Writer::Transfer( const TDF_Label& L,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Writer::Transfer( const TDF_LabelSequence& labels,
|
||||
const STEPControl_StepModelType mode,
|
||||
const Standard_CString multi )
|
||||
Standard_Boolean STEPCAFControl_Writer::Transfer(const TDF_LabelSequence& labels,
|
||||
const STEPControl_StepModelType mode,
|
||||
const Standard_CString multi,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
return Transfer( myWriter, labels, mode, multi );
|
||||
return Transfer(myWriter, labels, mode, multi, Standard_False, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -410,9 +414,10 @@ Standard_Boolean STEPCAFControl_Writer::Transfer( const TDF_LabelSequence& label
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc,
|
||||
const Standard_CString filename)
|
||||
const Standard_CString filename,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if ( ! Transfer ( doc ) ) return Standard_False;
|
||||
if (!Transfer(doc, STEPControl_AsIs, 0L, theProgress)) return Standard_False;
|
||||
return Write ( filename ) == IFSelect_RetDone;
|
||||
}
|
||||
|
||||
@@ -423,9 +428,10 @@ Standard_Boolean STEPCAFControl_Writer::Perform (const Handle(TDocStd_Document)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc,
|
||||
const TCollection_AsciiString &filename)
|
||||
const TCollection_AsciiString &filename,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if ( ! Transfer ( doc ) ) return Standard_False;
|
||||
if ( ! Transfer ( doc, STEPControl_AsIs, 0L, theProgress ) ) return Standard_False;
|
||||
return Write ( filename.ToCString() ) == IFSelect_RetDone;
|
||||
}
|
||||
|
||||
@@ -500,10 +506,11 @@ const STEPControl_Writer &STEPCAFControl_Writer::Writer () const
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
|
||||
const TDF_LabelSequence &labels,
|
||||
const STEPControl_StepModelType mode,
|
||||
const Standard_CString multi,
|
||||
const Standard_Boolean isExternFile)
|
||||
const TDF_LabelSequence &labels,
|
||||
const STEPControl_StepModelType mode,
|
||||
const Standard_CString multi,
|
||||
const Standard_Boolean isExternFile,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if ( labels.Length() <=0 ) return Standard_False;
|
||||
|
||||
@@ -513,7 +520,10 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
|
||||
// translate free top-level shapes of the DECAF document
|
||||
Standard_Integer ap = Interface_Static::IVal ("write.step.schema");
|
||||
TDF_LabelSequence sublabels;
|
||||
for ( Standard_Integer i=1; i <= labels.Length(); i++ ) {
|
||||
Message_ProgressScope aPS(theProgress, "Labels", labels.Length());
|
||||
for ( Standard_Integer i=1; i <= labels.Length() && aPS.More(); i++)
|
||||
{
|
||||
Message_ProgressRange aRange = aPS.Next();
|
||||
TDF_Label L = labels.Value(i);
|
||||
if ( myLabels.IsBound ( L ) ) continue; // already processed
|
||||
|
||||
@@ -576,12 +586,15 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
|
||||
if ( XCAFDoc_ShapeTool::IsAssembly ( L ) || XCAFDoc_ShapeTool::IsReference ( L ) )
|
||||
Actor->RegisterAssembly ( shape );
|
||||
|
||||
writer.Transfer(shape,mode,Standard_False);
|
||||
writer.Transfer(shape, mode, Standard_False, aRange);
|
||||
Actor->SetStdMode ( Standard_True ); // restore default behaviour
|
||||
}
|
||||
else {
|
||||
// translate final solids
|
||||
TopoDS_Shape Sass = TransferExternFiles ( L, mode, sublabels, multi );
|
||||
Message_ProgressScope aPS1 (aRange, NULL, 2);
|
||||
TopoDS_Shape Sass = TransferExternFiles(L, mode, sublabels, multi, aPS1.Next());
|
||||
if (aPS1.UserBreak())
|
||||
return Standard_False;
|
||||
|
||||
// translate main assembly structure
|
||||
/*
|
||||
@@ -603,11 +616,13 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
|
||||
*/
|
||||
Standard_Integer assemblymode = Interface_Static::IVal ("write.step.assembly");
|
||||
Interface_Static::SetCVal ("write.step.assembly", "On");
|
||||
writer.Transfer ( Sass, STEPControl_AsIs );
|
||||
writer.Transfer ( Sass, STEPControl_AsIs, Standard_True, aPS1.Next());
|
||||
Interface_Static::SetIVal ("write.step.assembly", assemblymode);
|
||||
Interface_Static::SetIVal ("write.step.schema", ap);
|
||||
}
|
||||
}
|
||||
if (aPS.UserBreak())
|
||||
return Standard_False;
|
||||
|
||||
writer.WS()->ComputeGraph(Standard_True );// added by skl 03.11.2003 since we use
|
||||
// writer.Transfer() wihtout compute graph
|
||||
@@ -716,9 +731,10 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape STEPCAFControl_Writer::TransferExternFiles (const TDF_Label &L,
|
||||
const STEPControl_StepModelType mode,
|
||||
TDF_LabelSequence &labels,
|
||||
const Standard_CString prefix)
|
||||
const STEPControl_StepModelType mode,
|
||||
TDF_LabelSequence &labels,
|
||||
const Standard_CString prefix,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
// if label already translated, just return the shape
|
||||
if ( myLabels.IsBound ( L ) ) {
|
||||
@@ -763,7 +779,7 @@ TopoDS_Shape STEPCAFControl_Writer::TransferExternFiles (const TDF_Label &L,
|
||||
Standard_Integer assemblymode = Interface_Static::IVal ("write.step.assembly");
|
||||
Interface_Static::SetCVal ("write.step.assembly", "Off");
|
||||
const Standard_CString multi = 0;
|
||||
EF->SetTransferStatus ( Transfer ( sw, Lseq, mode, multi, Standard_True ) );
|
||||
EF->SetTransferStatus ( Transfer ( sw, Lseq, mode, multi, Standard_True, theProgress) );
|
||||
Interface_Static::SetIVal ("write.step.assembly", assemblymode);
|
||||
myLabEF.Bind ( L, EF );
|
||||
myFiles.Bind ( name->ToCString(), EF );
|
||||
@@ -787,11 +803,12 @@ TopoDS_Shape STEPCAFControl_Writer::TransferExternFiles (const TDF_Label &L,
|
||||
XCAFDoc_ShapeTool::GetComponents ( L, comp, Standard_False );
|
||||
|
||||
labels.Append ( aCurL );
|
||||
for ( Standard_Integer k=1; k <= comp.Length(); k++ ) {
|
||||
Message_ProgressScope aPS(theProgress, NULL, comp.Length());
|
||||
for ( Standard_Integer k=1; k <= comp.Length() && aPS.More(); k++ ) {
|
||||
TDF_Label lab = comp(k);
|
||||
TDF_Label ref;
|
||||
if ( ! XCAFDoc_ShapeTool::GetReferredShape ( lab, ref ) ) continue;
|
||||
TopoDS_Shape Scomp = TransferExternFiles ( ref, mode, labels, prefix );
|
||||
TopoDS_Shape Scomp = TransferExternFiles(ref, mode, labels, prefix, aPS.Next());
|
||||
Scomp.Location ( XCAFDoc_ShapeTool::GetLocation ( lab ) );
|
||||
B.Add ( C, Scomp );
|
||||
}
|
||||
|
@@ -81,16 +81,26 @@ public:
|
||||
//! 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 Handle(TDocStd_Document)& doc,
|
||||
const STEPControl_StepModelType mode = STEPControl_AsIs,
|
||||
const Standard_CString multi = 0,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Method to transfer part of the document specified by label
|
||||
Standard_EXPORT Standard_Boolean Transfer (const TDF_Label& 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,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
Standard_EXPORT Standard_Boolean Perform (const Handle(TDocStd_Document)& doc, const TCollection_AsciiString& filename);
|
||||
Standard_EXPORT Standard_Boolean Perform (const Handle(TDocStd_Document)& doc,
|
||||
const TCollection_AsciiString& filename,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Transfers a document and writes it to a STEP file
|
||||
//! Returns True if translation is OK
|
||||
Standard_EXPORT Standard_Boolean Perform (const Handle(TDocStd_Document)& doc, const Standard_CString filename);
|
||||
Standard_EXPORT Standard_Boolean Perform (const Handle(TDocStd_Document)& doc,
|
||||
const Standard_CString filename,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Returns data on external files
|
||||
//! Returns Null handle if no external files are read
|
||||
@@ -150,12 +160,20 @@ public:
|
||||
|
||||
protected:
|
||||
//! Mehod to writing sequence of root assemblies or part of the file specified by use by one label
|
||||
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_LabelSequence& L,
|
||||
const STEPControl_StepModelType mode = STEPControl_AsIs,
|
||||
const Standard_CString multi = 0,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Transfers labels to a STEP model
|
||||
//! Returns True if translation is OK
|
||||
//! isExternFile setting from TransferExternFiles method
|
||||
Standard_EXPORT Standard_Boolean Transfer (STEPControl_Writer& wr, const TDF_LabelSequence& labels, const STEPControl_StepModelType mode = STEPControl_AsIs, const Standard_CString multi = 0, const Standard_Boolean isExternFile = Standard_False) ;
|
||||
Standard_EXPORT Standard_Boolean Transfer (STEPControl_Writer& wr,
|
||||
const TDF_LabelSequence& labels,
|
||||
const STEPControl_StepModelType mode = STEPControl_AsIs,
|
||||
const Standard_CString multi = 0,
|
||||
const Standard_Boolean isExternFile = Standard_False,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) ;
|
||||
|
||||
//! Parses assembly structure of label L, writes all the simple
|
||||
//! shapes each to its own file named by name of its label plus
|
||||
@@ -163,7 +181,11 @@ protected:
|
||||
//! Returns shape representing that assembly structure
|
||||
//! in the form of nested empty compounds (and a sequence of
|
||||
//! labels which are newly written nodes of this assembly)
|
||||
Standard_EXPORT TopoDS_Shape TransferExternFiles (const TDF_Label& L, const STEPControl_StepModelType mode, TDF_LabelSequence& Lseq, const Standard_CString prefix = "");
|
||||
Standard_EXPORT TopoDS_Shape TransferExternFiles (const TDF_Label& L,
|
||||
const STEPControl_StepModelType mode,
|
||||
TDF_LabelSequence& Lseq,
|
||||
const Standard_CString prefix = "",
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Write external references to STEP
|
||||
Standard_EXPORT Standard_Boolean WriteExternRefs (const Handle(XSControl_WorkSession)& WS, const TDF_LabelSequence& labels) const;
|
||||
|
Reference in New Issue
Block a user