mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
0033301: Data Exchange, DE Wrapper - Replacing own XDEDRAW transfer commands to DE
Commit only for testing OCCT
This commit is contained in:
@@ -69,38 +69,6 @@ Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)thePath;
|
|
||||||
(void)theDocument;
|
|
||||||
(void)theProgress;
|
|
||||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
|
||||||
" " << GetVendor() << " doesn't support read operation";
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)thePath;
|
|
||||||
(void)theDocument;
|
|
||||||
(void)theProgress;
|
|
||||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
|
||||||
" " << GetVendor() << " doesn't support write operation";
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : Read
|
// function : Read
|
||||||
// purpose :
|
// purpose :
|
||||||
@@ -136,35 +104,3 @@ Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
" " << GetVendor() << " doesn't support write operation";
|
" " << GetVendor() << " doesn't support write operation";
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)thePath;
|
|
||||||
(void)theShape;
|
|
||||||
(void)theProgress;
|
|
||||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
|
||||||
" " << GetVendor() << " doesn't support read operation";
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)thePath;
|
|
||||||
(void)theShape;
|
|
||||||
(void)theProgress;
|
|
||||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
|
||||||
" " << GetVendor() << " doesn't support write operation";
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
@@ -77,24 +77,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theDocument document to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return True if Read was successful
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theDocument document to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return True if Write was successful
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
//! Reads a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the import CAD file
|
//! @param[in] thePath path to the import CAD file
|
||||||
//! @param[out] theShape shape to save result
|
//! @param[out] theShape shape to save result
|
||||||
@@ -117,24 +99,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theShape shape to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return True if Read was successful
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theShape shape to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return True if Write was successful
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Gets CAD format name of associated provider
|
//! Gets CAD format name of associated provider
|
||||||
|
@@ -31,7 +31,7 @@ namespace
|
|||||||
{
|
{
|
||||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
||||||
{
|
{
|
||||||
static const TCollection_AsciiString aScope ("global");
|
static const TCollection_AsciiString aScope("global");
|
||||||
return aScope;
|
return aScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,10 +109,6 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
|
|||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
if (theWS.IsNull())
|
|
||||||
{
|
|
||||||
return Read(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
Handle(DE_Provider) aProvider;
|
Handle(DE_Provider) aProvider;
|
||||||
if (!FindProvider(thePath, Standard_True, aProvider))
|
if (!FindProvider(thePath, Standard_True, aProvider))
|
||||||
{
|
{
|
||||||
@@ -134,10 +130,6 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
|
|||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
if (theWS.IsNull())
|
|
||||||
{
|
|
||||||
return Write(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
Handle(DE_Provider) aProvider;
|
Handle(DE_Provider) aProvider;
|
||||||
if (!FindProvider(thePath, Standard_False, aProvider))
|
if (!FindProvider(thePath, Standard_False, aProvider))
|
||||||
{
|
{
|
||||||
@@ -146,46 +138,6 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
|
|||||||
return aProvider->Write(thePath, theDocument, theWS, theProgress);
|
return aProvider->Write(thePath, theDocument, theWS, theProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
if (theDocument.IsNull())
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
Handle(DE_Provider) aProvider;
|
|
||||||
if (!FindProvider(thePath, Standard_True, aProvider))
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
return aProvider->Read(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
if (theDocument.IsNull())
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
Handle(DE_Provider) aProvider;
|
|
||||||
if (!FindProvider(thePath, Standard_False, aProvider))
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
return aProvider->Write(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : Read
|
// function : Read
|
||||||
// purpose :
|
// purpose :
|
||||||
@@ -195,10 +147,6 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
if (theWS.IsNull())
|
|
||||||
{
|
|
||||||
return Read(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
Handle(DE_Provider) aProvider;
|
Handle(DE_Provider) aProvider;
|
||||||
if (!FindProvider(thePath, Standard_True, aProvider))
|
if (!FindProvider(thePath, Standard_True, aProvider))
|
||||||
{
|
{
|
||||||
@@ -216,10 +164,6 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
if (theWS.IsNull())
|
|
||||||
{
|
|
||||||
return Write(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
Handle(DE_Provider) aProvider;
|
Handle(DE_Provider) aProvider;
|
||||||
if (!FindProvider(thePath, Standard_False, aProvider))
|
if (!FindProvider(thePath, Standard_False, aProvider))
|
||||||
{
|
{
|
||||||
@@ -228,39 +172,6 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
|
|||||||
return aProvider->Write(thePath, theShape, theWS, theProgress);
|
return aProvider->Write(thePath, theShape, theWS, theProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
|
|
||||||
Handle(DE_Provider) aProvider;
|
|
||||||
if (!FindProvider(thePath, Standard_True, aProvider))
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
return aProvider->Read(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
Handle(DE_Provider) aProvider;
|
|
||||||
if (!FindProvider(thePath, Standard_False, aProvider))
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
return aProvider->Write(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : Load
|
// function : Load
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@@ -94,24 +94,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theDocument document to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theDocument document to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
//! Reads a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the import CAD file
|
//! @param[in] thePath path to the import CAD file
|
||||||
//! @param[out] theShape shape to save result
|
//! @param[out] theShape shape to save result
|
||||||
@@ -134,24 +116,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theShape shape to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theShape shape to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Updates values according the resource file
|
//! Updates values according the resource file
|
||||||
|
@@ -51,38 +51,14 @@ bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Read(thePath, theDocument, theProgress);
|
if (theDocument.IsNull())
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theWS;
|
|
||||||
return Write(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
if(theDocument.IsNull())
|
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
|
Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
|
||||||
thePath << "\t: theDocument shouldn't be null";
|
thePath << "\t: theDocument shouldn't be null";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
if (!Read(thePath, aShape, theProgress))
|
if (!Read(thePath, aShape, theWS, theProgress))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -97,8 +73,10 @@ bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
const Handle(TDocStd_Document)& theDocument,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
(void)theWS;
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
TDF_LabelSequence aLabels;
|
TDF_LabelSequence aLabels;
|
||||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
|
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
|
||||||
@@ -126,7 +104,7 @@ bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
}
|
}
|
||||||
aShape = aComp;
|
aShape = aComp;
|
||||||
}
|
}
|
||||||
return Write(thePath, aShape, theProgress);
|
return Write(thePath, aShape, theWS, theProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -139,30 +117,6 @@ bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Read(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theWS;
|
|
||||||
return Write(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
bool isBinaryFormat = true;
|
bool isBinaryFormat = true;
|
||||||
{
|
{
|
||||||
// probe file header to recognize format
|
// probe file header to recognize format
|
||||||
@@ -214,8 +168,10 @@ bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
(void)theWS;
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(DEBRepCascade_ConfigurationNode)))
|
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(DEBRepCascade_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
|
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
|
||||||
@@ -272,7 +228,6 @@ bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,24 +64,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theDocument document to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theDocument document to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
//! Reads a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the import CAD file
|
//! @param[in] thePath path to the import CAD file
|
||||||
//! @param[out] theShape shape to save result
|
//! @param[out] theShape shape to save result
|
||||||
@@ -104,24 +86,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theShape shape to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theShape shape to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Gets CAD format name of associated provider
|
//! Gets CAD format name of associated provider
|
||||||
|
@@ -59,30 +59,6 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Read(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theWS;
|
|
||||||
return Write(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
if (theDocument.IsNull())
|
if (theDocument.IsNull())
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " <<
|
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " <<
|
||||||
@@ -141,8 +117,10 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
const Handle(TDocStd_Document)& theDocument,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
(void)theWS;
|
||||||
Handle(TDocStd_Application) anApp = new TDocStd_Application();
|
Handle(TDocStd_Application) anApp = new TDocStd_Application();
|
||||||
BinXCAFDrivers::DefineFormat(anApp);
|
BinXCAFDrivers::DefineFormat(anApp);
|
||||||
PCDM_StoreStatus aStatus = PCDM_SS_Doc_IsNull;
|
PCDM_StoreStatus aStatus = PCDM_SS_Doc_IsNull;
|
||||||
@@ -211,30 +189,6 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Read(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theWS;
|
|
||||||
return Write(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
|
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " << thePath
|
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " << thePath
|
||||||
@@ -245,7 +199,7 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
Handle(TDocStd_Application) anApp = new TDocStd_Application();
|
Handle(TDocStd_Application) anApp = new TDocStd_Application();
|
||||||
BinXCAFDrivers::DefineFormat(anApp);
|
BinXCAFDrivers::DefineFormat(anApp);
|
||||||
anApp->NewDocument("BinXCAF", aDocument);
|
anApp->NewDocument("BinXCAF", aDocument);
|
||||||
Read(thePath, aDocument, theProgress);
|
Read(thePath, aDocument, theWS, theProgress);
|
||||||
TDF_LabelSequence aLabels;
|
TDF_LabelSequence aLabels;
|
||||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(aDocument->Main());
|
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(aDocument->Main());
|
||||||
aSTool->GetFreeShapes(aLabels);
|
aSTool->GetFreeShapes(aLabels);
|
||||||
@@ -281,12 +235,14 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
(void)theWS;
|
||||||
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
|
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
|
||||||
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
|
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
|
||||||
aShTool->AddShape(theShape);
|
aShTool->AddShape(theShape);
|
||||||
return Write(thePath, aDoc, theProgress);
|
return Write(thePath, aDoc, theWS, theProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@@ -64,24 +64,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theDocument document to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theDocument document to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
//! Reads a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the import CAD file
|
//! @param[in] thePath path to the import CAD file
|
||||||
//! @param[out] theShape shape to save result
|
//! @param[out] theShape shape to save result
|
||||||
@@ -104,24 +86,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theShape shape to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theShape shape to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Gets CAD format name of associated provider
|
//! Gets CAD format name of associated provider
|
||||||
|
@@ -55,7 +55,8 @@ void IGESCAFControl_Provider::personizeWS(Handle(XSControl_WorkSession)& theWS)
|
|||||||
<< " Null work session, use internal temporary session";
|
<< " Null work session, use internal temporary session";
|
||||||
theWS = new XSControl_WorkSession();
|
theWS = new XSControl_WorkSession();
|
||||||
}
|
}
|
||||||
Handle(IGESControl_Controller) aCntrl = Handle(IGESControl_Controller)::DownCast(theWS->NormAdaptor());
|
Handle(IGESControl_Controller) aCntrl =
|
||||||
|
Handle(IGESControl_Controller)::DownCast(theWS->NormAdaptor());
|
||||||
if (aCntrl.IsNull())
|
if (aCntrl.IsNull())
|
||||||
{
|
{
|
||||||
theWS->SelectNorm("IGES");
|
theWS->SelectNorm("IGES");
|
||||||
@@ -68,44 +69,85 @@ void IGESCAFControl_Provider::personizeWS(Handle(XSControl_WorkSession)& theWS)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void IGESCAFControl_Provider::initStatic(const Handle(DE_ConfigurationNode)& theNode)
|
void IGESCAFControl_Provider::initStatic(const Handle(DE_ConfigurationNode)& theNode)
|
||||||
{
|
{
|
||||||
Handle(IGESCAFControl_ConfigurationNode) aNode = Handle(IGESCAFControl_ConfigurationNode)::DownCast(theNode);
|
Handle(IGESCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(IGESCAFControl_ConfigurationNode)::DownCast(theNode);
|
||||||
IGESData::Init();
|
IGESData::Init();
|
||||||
|
if (!myToUpdateStaticParameters)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Get previous values
|
// Get previous values
|
||||||
myOldValues.ReadBSplineContinuity = (IGESCAFControl_ConfigurationNode::ReadMode_BSplineContinuity)Interface_Static::IVal("read.iges.bspline.continuity");
|
myOldValues.ReadBSplineContinuity =
|
||||||
myOldValues.ReadPrecisionMode = (IGESCAFControl_ConfigurationNode::ReadMode_Precision)Interface_Static::IVal("read.precision.mode");
|
(IGESCAFControl_ConfigurationNode::ReadMode_BSplineContinuity)
|
||||||
myOldValues.ReadPrecisionVal = Interface_Static::RVal("read.precision.val");
|
Interface_Static::IVal("read.iges.bspline.continuity");
|
||||||
myOldValues.ReadMaxPrecisionMode = (IGESCAFControl_ConfigurationNode::ReadMode_MaxPrecision)Interface_Static::IVal("read.maxprecision.mode");
|
myOldValues.ReadPrecisionMode =
|
||||||
myOldValues.ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val");
|
(IGESCAFControl_ConfigurationNode::ReadMode_Precision)
|
||||||
myOldValues.ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1;
|
Interface_Static::IVal("read.precision.mode");
|
||||||
myOldValues.ReadSurfaceCurveMode = (IGESCAFControl_ConfigurationNode::ReadMode_SurfaceCurve)Interface_Static::IVal("read.surfacecurve.mode");
|
myOldValues.ReadPrecisionVal =
|
||||||
myOldValues.EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI;
|
Interface_Static::RVal("read.precision.val");
|
||||||
|
myOldValues.ReadMaxPrecisionMode =
|
||||||
|
(IGESCAFControl_ConfigurationNode::ReadMode_MaxPrecision)
|
||||||
|
Interface_Static::IVal("read.maxprecision.mode");
|
||||||
|
myOldValues.ReadMaxPrecisionVal =
|
||||||
|
Interface_Static::RVal("read.maxprecision.val");
|
||||||
|
myOldValues.ReadSameParamMode =
|
||||||
|
Interface_Static::IVal("read.stdsameparameter.mode") == 1;
|
||||||
|
myOldValues.ReadSurfaceCurveMode =
|
||||||
|
(IGESCAFControl_ConfigurationNode::ReadMode_SurfaceCurve)
|
||||||
|
Interface_Static::IVal("read.surfacecurve.mode");
|
||||||
|
myOldValues.EncodeRegAngle =
|
||||||
|
Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI;
|
||||||
|
|
||||||
myOldValues.ReadApproxd1 = Interface_Static::IVal("read.iges.bspline.approxd1.mode") == 1;
|
myOldValues.ReadApproxd1 =
|
||||||
myOldValues.ReadResourceName = Interface_Static::CVal("read.iges.resource.name");
|
Interface_Static::IVal("read.iges.bspline.approxd1.mode") == 1;
|
||||||
myOldValues.ReadSequence = Interface_Static::CVal("read.iges.sequence");
|
myOldValues.ReadResourceName =
|
||||||
myOldValues.ReadFaultyEntities = Interface_Static::IVal("read.iges.faulty.entities") == 1;
|
Interface_Static::CVal("read.iges.resource.name");
|
||||||
myOldValues.ReadOnlyVisible = Interface_Static::IVal("read.iges.onlyvisible") == 1;
|
myOldValues.ReadSequence =
|
||||||
|
Interface_Static::CVal("read.iges.sequence");
|
||||||
|
myOldValues.ReadFaultyEntities =
|
||||||
|
Interface_Static::IVal("read.iges.faulty.entities") == 1;
|
||||||
|
myOldValues.ReadOnlyVisible =
|
||||||
|
Interface_Static::IVal("read.iges.onlyvisible") == 1;
|
||||||
|
|
||||||
myOldValues.WriteBRepMode = (IGESCAFControl_ConfigurationNode::WriteMode_BRep)Interface_Static::IVal("write.iges.brep.mode");
|
myOldValues.WriteBRepMode =
|
||||||
myOldValues.WriteConvertSurfaceMode = (IGESCAFControl_ConfigurationNode::WriteMode_ConvertSurface)Interface_Static::IVal("write.convertsurface.mode");
|
(IGESCAFControl_ConfigurationNode::WriteMode_BRep)
|
||||||
myOldValues.WriteUnit = (UnitsMethods_LengthUnit)Interface_Static::IVal("write.iges.unit");
|
Interface_Static::IVal("write.iges.brep.mode");
|
||||||
myOldValues.WriteHeaderAuthor = Interface_Static::CVal("write.iges.header.author");
|
myOldValues.WriteConvertSurfaceMode =
|
||||||
myOldValues.WriteHeaderCompany = Interface_Static::CVal("write.iges.header.company");
|
(IGESCAFControl_ConfigurationNode::WriteMode_ConvertSurface)
|
||||||
myOldValues.WriteHeaderProduct = Interface_Static::CVal("write.iges.header.product");
|
Interface_Static::IVal("write.convertsurface.mode");
|
||||||
myOldValues.WriteHeaderReciever = Interface_Static::CVal("write.iges.header.receiver");
|
myOldValues.WriteUnit =
|
||||||
myOldValues.WriteResourceName = Interface_Static::CVal("write.iges.resource.name");
|
(UnitsMethods_LengthUnit)
|
||||||
myOldValues.WriteSequence = Interface_Static::CVal("write.iges.sequence");
|
Interface_Static::IVal("write.iges.unit");
|
||||||
myOldValues.WritePrecisionMode = (IGESCAFControl_ConfigurationNode::WriteMode_PrecisionMode)Interface_Static::IVal("write.precision.mode");
|
myOldValues.WriteHeaderAuthor =
|
||||||
myOldValues.WritePrecisionVal = Interface_Static::RVal("write.precision.val");
|
Interface_Static::CVal("write.iges.header.author");
|
||||||
myOldValues.WritePlaneMode = (IGESCAFControl_ConfigurationNode::WriteMode_PlaneMode)Interface_Static::IVal("write.iges.plane.mode");
|
myOldValues.WriteHeaderCompany =
|
||||||
myOldValues.WriteOffsetMode = Interface_Static::IVal("write.iges.offset.mode") == 1;
|
Interface_Static::CVal("write.iges.header.company");
|
||||||
|
myOldValues.WriteHeaderProduct =
|
||||||
|
Interface_Static::CVal("write.iges.header.product");
|
||||||
|
myOldValues.WriteHeaderReciever =
|
||||||
|
Interface_Static::CVal("write.iges.header.receiver");
|
||||||
|
myOldValues.WriteResourceName =
|
||||||
|
Interface_Static::CVal("write.iges.resource.name");
|
||||||
|
myOldValues.WriteSequence =
|
||||||
|
Interface_Static::CVal("write.iges.sequence");
|
||||||
|
myOldValues.WritePrecisionMode =
|
||||||
|
(IGESCAFControl_ConfigurationNode::WriteMode_PrecisionMode)
|
||||||
|
Interface_Static::IVal("write.precision.mode");
|
||||||
|
myOldValues.WritePrecisionVal =
|
||||||
|
Interface_Static::RVal("write.precision.val");
|
||||||
|
myOldValues.WritePlaneMode =
|
||||||
|
(IGESCAFControl_ConfigurationNode::WriteMode_PlaneMode)
|
||||||
|
Interface_Static::IVal("write.iges.plane.mode");
|
||||||
|
myOldValues.WriteOffsetMode =
|
||||||
|
Interface_Static::IVal("write.iges.offset.mode") == 1;
|
||||||
|
|
||||||
myOldLengthUnit = Interface_Static::IVal("xstep.cascade.unit");
|
myOldGlobalValues.LengthUnit = Interface_Static::IVal("xstep.cascade.unit");
|
||||||
|
|
||||||
// Set new values
|
// Set new values
|
||||||
UnitsMethods::SetCasCadeLengthUnit(aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
|
UnitsMethods::SetCasCadeLengthUnit(aNode->GlobalParameters.LengthUnit,
|
||||||
TCollection_AsciiString aStrUnit(UnitsMethods::DumpLengthUnit(aNode->GlobalParameters.LengthUnit));
|
UnitsMethods_LengthUnit_Millimeter);
|
||||||
|
TCollection_AsciiString aStrUnit(
|
||||||
|
UnitsMethods::DumpLengthUnit(aNode->GlobalParameters.LengthUnit));
|
||||||
aStrUnit.UpperCase();
|
aStrUnit.UpperCase();
|
||||||
Interface_Static::SetCVal("xstep.cascade.unit", aStrUnit.ToCString());
|
Interface_Static::SetCVal("xstep.cascade.unit", aStrUnit.ToCString());
|
||||||
setStatic(aNode->InternalParameters);
|
setStatic(aNode->InternalParameters);
|
||||||
@@ -117,34 +159,60 @@ void IGESCAFControl_Provider::initStatic(const Handle(DE_ConfigurationNode)& the
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void IGESCAFControl_Provider::setStatic(const IGESCAFControl_ConfigurationNode::IGESCAFControl_InternalSection theParameter)
|
void IGESCAFControl_Provider::setStatic(const IGESCAFControl_ConfigurationNode::IGESCAFControl_InternalSection theParameter)
|
||||||
{
|
{
|
||||||
Interface_Static::SetIVal("read.iges.bspline.continuity", theParameter.ReadBSplineContinuity);
|
Interface_Static::SetIVal("read.iges.bspline.continuity",
|
||||||
Interface_Static::SetIVal("read.precision.mode", theParameter.ReadPrecisionMode);
|
theParameter.ReadBSplineContinuity);
|
||||||
Interface_Static::SetRVal("read.precision.val", theParameter.ReadPrecisionVal);
|
Interface_Static::SetIVal("read.precision.mode",
|
||||||
Interface_Static::SetIVal("read.maxprecision.mode", theParameter.ReadMaxPrecisionMode);
|
theParameter.ReadPrecisionMode);
|
||||||
Interface_Static::SetRVal("read.maxprecision.val", theParameter.ReadMaxPrecisionVal);
|
Interface_Static::SetRVal("read.precision.val",
|
||||||
Interface_Static::SetIVal("read.stdsameparameter.mode", theParameter.ReadSameParamMode);
|
theParameter.ReadPrecisionVal);
|
||||||
Interface_Static::SetIVal("read.surfacecurve.mode", theParameter.ReadSurfaceCurveMode);
|
Interface_Static::SetIVal("read.maxprecision.mode",
|
||||||
Interface_Static::SetRVal("read.encoderegularity.angle", theParameter.EncodeRegAngle * M_PI / 180.0);
|
theParameter.ReadMaxPrecisionMode);
|
||||||
|
Interface_Static::SetRVal("read.maxprecision.val",
|
||||||
|
theParameter.ReadMaxPrecisionVal);
|
||||||
|
Interface_Static::SetIVal("read.stdsameparameter.mode",
|
||||||
|
theParameter.ReadSameParamMode);
|
||||||
|
Interface_Static::SetIVal("read.surfacecurve.mode",
|
||||||
|
theParameter.ReadSurfaceCurveMode);
|
||||||
|
Interface_Static::SetRVal("read.encoderegularity.angle",
|
||||||
|
theParameter.EncodeRegAngle * M_PI / 180.0);
|
||||||
|
|
||||||
Interface_Static::SetIVal("read.iges.bspline.approxd1.mode", theParameter.ReadApproxd1);
|
Interface_Static::SetIVal("read.iges.bspline.approxd1.mode",
|
||||||
Interface_Static::SetCVal("read.iges.resource.name", theParameter.ReadResourceName.ToCString());
|
theParameter.ReadApproxd1);
|
||||||
Interface_Static::SetCVal("read.iges.sequence", theParameter.ReadSequence.ToCString());
|
Interface_Static::SetCVal("read.iges.resource.name",
|
||||||
Interface_Static::SetIVal("read.iges.faulty.entities", theParameter.ReadFaultyEntities);
|
theParameter.ReadResourceName.ToCString());
|
||||||
Interface_Static::SetIVal("read.iges.onlyvisible", theParameter.ReadOnlyVisible);
|
Interface_Static::SetCVal("read.iges.sequence",
|
||||||
|
theParameter.ReadSequence.ToCString());
|
||||||
|
Interface_Static::SetIVal("read.iges.faulty.entities",
|
||||||
|
theParameter.ReadFaultyEntities);
|
||||||
|
Interface_Static::SetIVal("read.iges.onlyvisible",
|
||||||
|
theParameter.ReadOnlyVisible);
|
||||||
|
|
||||||
Interface_Static::SetIVal("write.iges.brep.mode", theParameter.WriteBRepMode);
|
Interface_Static::SetIVal("write.iges.brep.mode",
|
||||||
Interface_Static::SetIVal("write.convertsurface.mode", theParameter.WriteConvertSurfaceMode);
|
theParameter.WriteBRepMode);
|
||||||
Interface_Static::SetIVal("write.iges.unit", theParameter.WriteUnit);
|
Interface_Static::SetIVal("write.convertsurface.mode",
|
||||||
Interface_Static::SetCVal("write.iges.header.author", theParameter.WriteHeaderAuthor.ToCString());
|
theParameter.WriteConvertSurfaceMode);
|
||||||
Interface_Static::SetCVal("write.iges.header.company", theParameter.WriteHeaderCompany.ToCString());
|
Interface_Static::SetIVal("write.iges.unit",
|
||||||
Interface_Static::SetCVal("write.iges.header.product", theParameter.WriteHeaderProduct.ToCString());
|
theParameter.WriteUnit);
|
||||||
Interface_Static::SetCVal("write.iges.header.receiver", theParameter.WriteHeaderReciever.ToCString());
|
Interface_Static::SetCVal("write.iges.header.author",
|
||||||
Interface_Static::SetCVal("write.iges.resource.name", theParameter.WriteResourceName.ToCString());
|
theParameter.WriteHeaderAuthor.ToCString());
|
||||||
Interface_Static::SetCVal("write.iges.sequence", theParameter.WriteSequence.ToCString());
|
Interface_Static::SetCVal("write.iges.header.company",
|
||||||
Interface_Static::SetIVal("write.precision.mode", theParameter.WritePrecisionMode);
|
theParameter.WriteHeaderCompany.ToCString());
|
||||||
Interface_Static::SetRVal("write.precision.val", theParameter.WritePrecisionVal);
|
Interface_Static::SetCVal("write.iges.header.product",
|
||||||
Interface_Static::SetIVal("write.iges.plane.mode", theParameter.WritePlaneMode);
|
theParameter.WriteHeaderProduct.ToCString());
|
||||||
Interface_Static::SetIVal("write.iges.offset.mode", theParameter.WriteOffsetMode);
|
Interface_Static::SetCVal("write.iges.header.receiver",
|
||||||
|
theParameter.WriteHeaderReciever.ToCString());
|
||||||
|
Interface_Static::SetCVal("write.iges.resource.name",
|
||||||
|
theParameter.WriteResourceName.ToCString());
|
||||||
|
Interface_Static::SetCVal("write.iges.sequence",
|
||||||
|
theParameter.WriteSequence.ToCString());
|
||||||
|
Interface_Static::SetIVal("write.precision.mode",
|
||||||
|
theParameter.WritePrecisionMode);
|
||||||
|
Interface_Static::SetRVal("write.precision.val",
|
||||||
|
theParameter.WritePrecisionVal);
|
||||||
|
Interface_Static::SetIVal("write.iges.plane.mode",
|
||||||
|
theParameter.WritePlaneMode);
|
||||||
|
Interface_Static::SetIVal("write.iges.offset.mode",
|
||||||
|
theParameter.WriteOffsetMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -153,8 +221,12 @@ void IGESCAFControl_Provider::setStatic(const IGESCAFControl_ConfigurationNode::
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void IGESCAFControl_Provider::resetStatic()
|
void IGESCAFControl_Provider::resetStatic()
|
||||||
{
|
{
|
||||||
Interface_Static::SetIVal("xstep.cascade.unit", myOldLengthUnit);
|
if (!myToUpdateStaticParameters)
|
||||||
UnitsMethods::SetCasCadeLengthUnit(myOldLengthUnit);
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Interface_Static::SetIVal("xstep.cascade.unit", myOldGlobalValues.LengthUnit);
|
||||||
|
UnitsMethods::SetCasCadeLengthUnit(myOldGlobalValues.LengthUnit);
|
||||||
setStatic(myOldValues);
|
setStatic(myOldValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,44 +241,64 @@ bool IGESCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
{
|
{
|
||||||
if (theDocument.IsNull())
|
if (theDocument.IsNull())
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: IGESCAFControl_Provider : "
|
||||||
thePath << "\t: theDocument shouldn't be null";
|
<< "Null document";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!GetNode()->IsKind(STANDARD_TYPE(IGESCAFControl_ConfigurationNode)))
|
if (!GetNode()->IsKind(STANDARD_TYPE(IGESCAFControl_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: IGESCAFControl_Provider : "
|
||||||
thePath << "\t: Incorrect or empty Configuration Node";
|
<< "Incorrect or empty Configuration Node";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Handle(IGESCAFControl_ConfigurationNode) aNode = Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
|
Handle(IGESCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
|
||||||
initStatic(aNode);
|
initStatic(aNode);
|
||||||
|
|
||||||
personizeWS(theWS);
|
personizeWS(theWS);
|
||||||
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
|
XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
|
||||||
IGESCAFControl_Reader aReader;
|
aNode->GlobalParameters.LengthUnit,
|
||||||
aReader.SetWS(theWS);
|
UnitsMethods_LengthUnit_Millimeter);
|
||||||
|
const Standard_Boolean toUseLoaded = thePath == ".";
|
||||||
|
TCollection_AsciiString aFile;
|
||||||
|
if (toUseLoaded)
|
||||||
|
{
|
||||||
|
aFile = theWS->LoadedFile();
|
||||||
|
Message::SendInfo() << "Model taken from the IGES session : "
|
||||||
|
<< aFile;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aFile = thePath;
|
||||||
|
Message::SendInfo() << "File IGES to read : "
|
||||||
|
<< aFile;
|
||||||
|
}
|
||||||
|
IGESCAFControl_Reader aReader(theWS, !toUseLoaded);
|
||||||
aReader.SetReadVisible(aNode->InternalParameters.ReadOnlyVisible);
|
aReader.SetReadVisible(aNode->InternalParameters.ReadOnlyVisible);
|
||||||
|
|
||||||
aReader.SetColorMode(aNode->InternalParameters.ReadColor);
|
aReader.SetColorMode(aNode->InternalParameters.ReadColor);
|
||||||
aReader.SetNameMode(aNode->InternalParameters.ReadName);
|
aReader.SetNameMode(aNode->InternalParameters.ReadName);
|
||||||
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
|
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
|
||||||
|
|
||||||
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
|
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
|
||||||
|
if (!toUseLoaded)
|
||||||
|
{
|
||||||
aReadStat = aReader.ReadFile(thePath.ToCString());
|
aReadStat = aReader.ReadFile(thePath.ToCString());
|
||||||
|
}
|
||||||
|
else if (theWS->NbStartingEntities() > 0)
|
||||||
|
{
|
||||||
|
aReadStat = IFSelect_RetDone;
|
||||||
|
}
|
||||||
if (aReadStat != IFSelect_RetDone)
|
if (aReadStat != IFSelect_RetDone)
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: IGESCAFControl_Provider : ["
|
||||||
thePath << "\t: abandon, no model loaded";
|
<< aFile << "] : abandon, no model loaded";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aReader.Transfer(theDocument, theProgress))
|
if (!aReader.Transfer(theDocument, theProgress))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: IGESCAFControl_Provider : [" <<
|
||||||
thePath << "\t: Cannot read any relevant data from the IGES file";
|
aFile << "] : Cannot read any relevant data from the IGES file";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -225,62 +317,48 @@ bool IGESCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
{
|
{
|
||||||
if (!GetNode()->IsKind(STANDARD_TYPE(IGESCAFControl_ConfigurationNode)))
|
if (!GetNode()->IsKind(STANDARD_TYPE(IGESCAFControl_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: IGESCAFControl_Provider : "
|
||||||
thePath << "\t: Incorrect or empty Configuration Node";
|
<< "Incorrect or empty Configuration Node";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Handle(IGESCAFControl_ConfigurationNode) aNode = Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
|
Handle(IGESCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
|
||||||
initStatic(aNode);
|
initStatic(aNode);
|
||||||
|
|
||||||
personizeWS(theWS);
|
personizeWS(theWS);
|
||||||
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter);
|
XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
|
||||||
IGESCAFControl_Writer aWriter(theWS);
|
aNode->InternalParameters.WriteUnit,
|
||||||
|
UnitsMethods_LengthUnit_Millimeter);
|
||||||
|
IGESCAFControl_Writer aWriter(theWS, Standard_True);
|
||||||
aWriter.SetColorMode(aNode->InternalParameters.WriteColor);
|
aWriter.SetColorMode(aNode->InternalParameters.WriteColor);
|
||||||
aWriter.SetNameMode(aNode->InternalParameters.WriteName);
|
aWriter.SetNameMode(aNode->InternalParameters.WriteName);
|
||||||
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
|
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
|
||||||
|
|
||||||
if (!aWriter.Transfer(theDocument, theProgress))
|
if (!aWriter.Transfer(theDocument, theProgress))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: IGESCAFControl_Provider : "
|
||||||
thePath << "\t: The document cannot be translated or gives no result";
|
<< "The document cannot be translated or gives no result";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (thePath == ".")
|
||||||
|
{
|
||||||
|
resetStatic();
|
||||||
|
Message::SendInfo() << "Document has been translated into the session";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!aWriter.Write(thePath.ToCString()))
|
if (!aWriter.Write(thePath.ToCString()))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: IGESCAFControl_Provider : [" <<
|
||||||
thePath << "\t: Write failed";
|
thePath << "] : Write failed";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Message::SendInfo() << "IGES file [" << thePath << "] Successfully written";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool IGESCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
Handle(XSControl_WorkSession) aWS = new XSControl_WorkSession();
|
|
||||||
return Read(thePath, theDocument, aWS, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool IGESCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
Handle(XSControl_WorkSession) aWS = new XSControl_WorkSession();
|
|
||||||
return Write(thePath, theDocument, aWS, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : Read
|
// function : Read
|
||||||
// purpose :
|
// purpose :
|
||||||
@@ -293,11 +371,12 @@ bool IGESCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
(void)theProgress;
|
(void)theProgress;
|
||||||
if (!GetNode()->IsKind(STANDARD_TYPE(IGESCAFControl_ConfigurationNode)))
|
if (!GetNode()->IsKind(STANDARD_TYPE(IGESCAFControl_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: IGESCAFControl_Provider : "
|
||||||
thePath << "\t: Incorrect or empty Configuration Node";
|
<< "Incorrect or empty Configuration Node";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Handle(IGESCAFControl_ConfigurationNode) aNode = Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
|
Handle(IGESCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
|
||||||
initStatic(aNode);
|
initStatic(aNode);
|
||||||
personizeWS(theWS);
|
personizeWS(theWS);
|
||||||
IGESControl_Reader aReader;
|
IGESControl_Reader aReader;
|
||||||
@@ -307,15 +386,15 @@ bool IGESCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
aReadStat = aReader.ReadFile(thePath.ToCString());
|
aReadStat = aReader.ReadFile(thePath.ToCString());
|
||||||
if (aReadStat != IFSelect_RetDone)
|
if (aReadStat != IFSelect_RetDone)
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: IGESCAFControl_Provider : [" <<
|
||||||
thePath << "\t: Could not read file, no model loaded";
|
thePath << "] : Could not read file, no model loaded";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (aReader.TransferRoots() <= 0)
|
if (aReader.TransferRoots() <= 0)
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: IGESCAFControl_Provider : [" <<
|
||||||
thePath << "\t: Cannot read any relevant data from the IGES file";
|
thePath << "] : Cannot read any relevant data from the IGES file";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -337,27 +416,31 @@ bool IGESCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
(void)theProgress;
|
(void)theProgress;
|
||||||
if (!GetNode()->IsKind(STANDARD_TYPE(IGESCAFControl_ConfigurationNode)))
|
if (!GetNode()->IsKind(STANDARD_TYPE(IGESCAFControl_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: IGESCAFControl_Provider : "
|
||||||
thePath << "\t: Incorrect or empty Configuration Node";
|
<< "Incorrect or empty Configuration Node";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Handle(IGESCAFControl_ConfigurationNode) aNode = Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
|
Handle(IGESCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
|
||||||
initStatic(aNode);
|
initStatic(aNode);
|
||||||
TCollection_AsciiString aUnit(UnitsMethods::DumpLengthUnit(aNode->InternalParameters.WriteUnit));
|
TCollection_AsciiString aUnit(
|
||||||
|
UnitsMethods::DumpLengthUnit(aNode->InternalParameters.WriteUnit));
|
||||||
aUnit.UpperCase();
|
aUnit.UpperCase();
|
||||||
IGESControl_Writer aWriter(aUnit.ToCString(),
|
IGESControl_Writer aWriter(aUnit.ToCString(),
|
||||||
aNode->InternalParameters.WriteBRepMode);
|
aNode->InternalParameters.WriteBRepMode);
|
||||||
Standard_Boolean aIsOk = aWriter.AddShape(theShape);
|
Standard_Boolean aIsOk = aWriter.AddShape(theShape);
|
||||||
if (!aIsOk)
|
if (!aIsOk)
|
||||||
{
|
{
|
||||||
Message::SendFail() << "IGESCAFControl_Provider: Shape not written";
|
Message::SendFail() << "Error: IGESCAFControl_Provider : "
|
||||||
|
<< "Can't translate shape to IGES model";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(aWriter.Write(thePath.ToCString())))
|
if (!(aWriter.Write(thePath.ToCString())))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "IGESCAFControl_Provider: Error on writing file " << thePath;
|
Message::SendFail() << "Error: IGESCAFControl_Provider : "
|
||||||
|
<< "Can't write IGES file" << thePath;
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -365,30 +448,6 @@ bool IGESCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool IGESCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
Handle(XSControl_WorkSession) aWS = new XSControl_WorkSession();
|
|
||||||
return Read(thePath, theShape, aWS, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool IGESCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
Handle(XSControl_WorkSession) aWS = new XSControl_WorkSession();
|
|
||||||
return Write(thePath, theShape, aWS, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : GetFormat
|
// function : GetFormat
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#define _IGESCAFControl_Provider_HeaderFile
|
#define _IGESCAFControl_Provider_HeaderFile
|
||||||
|
|
||||||
#include <DE_Provider.hxx>
|
#include <DE_Provider.hxx>
|
||||||
|
#include <DE_ConfigurationNode.hxx>
|
||||||
#include <IGESCAFControl_ConfigurationNode.hxx>
|
#include <IGESCAFControl_ConfigurationNode.hxx>
|
||||||
|
|
||||||
//! The class to transfer IGES files.
|
//! The class to transfer IGES files.
|
||||||
@@ -65,23 +66,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theDocument document to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theDocument document to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
//! Reads a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the import CAD file
|
//! @param[in] thePath path to the import CAD file
|
||||||
@@ -105,24 +89,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theShape shape to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theShape shape to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Gets CAD format name of associated provider
|
//! Gets CAD format name of associated provider
|
||||||
@@ -133,6 +99,14 @@ public:
|
|||||||
//! @return provider's vendor name
|
//! @return provider's vendor name
|
||||||
Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE;
|
Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Sets parameter to update static parameter, that true by default
|
||||||
|
void SetToUpdateStaticParameters(const bool theToUpdate) { myToUpdateStaticParameters = theToUpdate; }
|
||||||
|
|
||||||
|
//! Gets parameter to update static parameter, that true by default
|
||||||
|
bool ToUpdateStaticParameters() const { return myToUpdateStaticParameters; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! Personizes work session with current format.
|
//! Personizes work session with current format.
|
||||||
@@ -149,8 +123,11 @@ private:
|
|||||||
//! Reset used interface static variables
|
//! Reset used interface static variables
|
||||||
void resetStatic();
|
void resetStatic();
|
||||||
|
|
||||||
IGESCAFControl_ConfigurationNode::IGESCAFControl_InternalSection myOldValues;
|
private:
|
||||||
int myOldLengthUnit = 1;
|
|
||||||
|
bool myToUpdateStaticParameters = true; //!< Flag to updating static parameters
|
||||||
|
IGESCAFControl_ConfigurationNode::IGESCAFControl_InternalSection myOldValues; //!< Container to save previous static parameters
|
||||||
|
IGESCAFControl_ConfigurationNode::DE_SectionGlobal myOldGlobalValues; //!< Container to save previous static parameters
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -73,30 +73,6 @@ bool RWGltf_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Read(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWGltf_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theWS;
|
|
||||||
return Write(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWGltf_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
if (theDocument.IsNull())
|
if (theDocument.IsNull())
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the RWGltf_Provider during reading the file " <<
|
Message::SendFail() << "Error in the RWGltf_Provider during reading the file " <<
|
||||||
@@ -129,8 +105,10 @@ bool RWGltf_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool RWGltf_Provider::Write(const TCollection_AsciiString& thePath,
|
bool RWGltf_Provider::Write(const TCollection_AsciiString& thePath,
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
const Handle(TDocStd_Document)& theDocument,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
(void)theWS;
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
|
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the RWGltf_Provider during writing the file " <<
|
Message::SendFail() << "Error in the RWGltf_Provider during writing the file " <<
|
||||||
@@ -184,30 +162,6 @@ bool RWGltf_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Read(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWGltf_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theWS;
|
|
||||||
return Write(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWGltf_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
|
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the RWGltf_Provider during reading the file " <<
|
Message::SendFail() << "Error in the RWGltf_Provider during reading the file " <<
|
||||||
@@ -232,12 +186,14 @@ bool RWGltf_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool RWGltf_Provider::Write(const TCollection_AsciiString& thePath,
|
bool RWGltf_Provider::Write(const TCollection_AsciiString& thePath,
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
(void)theWS;
|
||||||
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
|
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
|
||||||
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
|
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
|
||||||
aShTool->AddShape(theShape);
|
aShTool->AddShape(theShape);
|
||||||
return Write(thePath, aDoc, theProgress);
|
return Write(thePath, aDoc, theWS, theProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@@ -66,24 +66,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theDocument document to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theDocument document to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
//! Reads a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the import CAD file
|
//! @param[in] thePath path to the import CAD file
|
||||||
//! @param[out] theShape shape to save result
|
//! @param[out] theShape shape to save result
|
||||||
@@ -106,24 +88,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theShape shape to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theShape shape to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Gets CAD format name of associated provider
|
//! Gets CAD format name of associated provider
|
||||||
|
@@ -49,30 +49,6 @@ bool RWObj_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Read(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theWS;
|
|
||||||
return Write(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWObj_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
if (theDocument.IsNull())
|
if (theDocument.IsNull())
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the RWObj_Provider during reading the file " <<
|
Message::SendFail() << "Error in the RWObj_Provider during reading the file " <<
|
||||||
@@ -110,8 +86,10 @@ bool RWObj_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
|
bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
const Handle(TDocStd_Document)& theDocument,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
(void)theWS;
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
|
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the RWObj_ConfigurationNode during writing the file " <<
|
Message::SendFail() << "Error in the RWObj_ConfigurationNode during writing the file " <<
|
||||||
@@ -156,30 +134,6 @@ bool RWObj_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Read(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theWS;
|
|
||||||
return Write(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWObj_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
|
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the RWObj_ConfigurationNode during writing the file " <<
|
Message::SendFail() << "Error in the RWObj_ConfigurationNode during writing the file " <<
|
||||||
@@ -219,12 +173,14 @@ bool RWObj_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
|
bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
(void)theWS;
|
||||||
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
|
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
|
||||||
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
|
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
|
||||||
aShTool->AddShape(theShape);
|
aShTool->AddShape(theShape);
|
||||||
return Write(thePath, aDoc, theProgress);
|
return Write(thePath, aDoc, theWS, theProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@@ -64,24 +64,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theDocument document to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theDocument document to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
//! Reads a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the import CAD file
|
//! @param[in] thePath path to the import CAD file
|
||||||
//! @param[out] theShape shape to save result
|
//! @param[out] theShape shape to save result
|
||||||
@@ -104,24 +86,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theShape shape to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theShape shape to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Gets CAD format name of associated provider
|
//! Gets CAD format name of associated provider
|
||||||
|
@@ -52,17 +52,6 @@ bool RWPly_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Write(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWPly_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWPly_ConfigurationNode)))
|
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWPly_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the RWPly_Provider during writing the file " <<
|
Message::SendFail() << "Error in the RWPly_Provider during writing the file " <<
|
||||||
@@ -120,21 +109,10 @@ bool RWPly_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Write(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWPly_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
|
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
|
||||||
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
|
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
|
||||||
aShTool->AddShape(theShape);
|
aShTool->AddShape(theShape);
|
||||||
return Write(thePath, aDoc, theProgress);
|
return Write(thePath, aDoc, theWS, theProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@@ -53,15 +53,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theDocument document to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
//! Writes a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the export CAD file
|
//! @param[in] thePath path to the export CAD file
|
||||||
//! @param[out] theShape shape to export
|
//! @param[out] theShape shape to export
|
||||||
@@ -73,15 +64,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theShape shape to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Gets CAD format name of associated provider
|
//! Gets CAD format name of associated provider
|
||||||
|
@@ -51,30 +51,6 @@ bool RWStl_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Read(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theWS;
|
|
||||||
return Write(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWStl_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
if (theDocument.IsNull())
|
if (theDocument.IsNull())
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the RWStl_Provider during reading the file " <<
|
Message::SendFail() << "Error in the RWStl_Provider during reading the file " <<
|
||||||
@@ -82,7 +58,7 @@ bool RWStl_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
if (!Read(thePath, aShape, theProgress))
|
if (!Read(thePath, aShape, theWS, theProgress))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -97,8 +73,10 @@ bool RWStl_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
|
bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
const Handle(TDocStd_Document)& theDocument,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
(void)theWS;
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
TDF_LabelSequence aLabels;
|
TDF_LabelSequence aLabels;
|
||||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
|
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
|
||||||
@@ -126,7 +104,7 @@ bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
}
|
}
|
||||||
aShape = aComp;
|
aShape = aComp;
|
||||||
}
|
}
|
||||||
return Write(thePath, aShape, theProgress);
|
return Write(thePath, aShape, theWS, theProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -139,30 +117,6 @@ bool RWStl_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Read(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theWS;
|
|
||||||
return Write(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool RWStl_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
Message::SendWarning() << "OCCT Stl reader does not support model scaling according to custom length unit";
|
Message::SendWarning() << "OCCT Stl reader does not support model scaling according to custom length unit";
|
||||||
if (!GetNode()->IsKind(STANDARD_TYPE(RWStl_ConfigurationNode)))
|
if (!GetNode()->IsKind(STANDARD_TYPE(RWStl_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
@@ -172,7 +126,7 @@ bool RWStl_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
}
|
}
|
||||||
Handle(RWStl_ConfigurationNode) aNode = Handle(RWStl_ConfigurationNode)::DownCast(GetNode());
|
Handle(RWStl_ConfigurationNode) aNode = Handle(RWStl_ConfigurationNode)::DownCast(GetNode());
|
||||||
double aMergeAngle = aNode->InternalParameters.ReadMergeAngle * M_PI / 180.0;
|
double aMergeAngle = aNode->InternalParameters.ReadMergeAngle * M_PI / 180.0;
|
||||||
if(aMergeAngle != M_PI_2)
|
if (aMergeAngle != M_PI_2)
|
||||||
{
|
{
|
||||||
if (aMergeAngle < 0.0 || aMergeAngle > M_PI_2)
|
if (aMergeAngle < 0.0 || aMergeAngle > M_PI_2)
|
||||||
{
|
{
|
||||||
@@ -210,8 +164,10 @@ bool RWStl_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
|
bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
(void)theWS;
|
||||||
Message::SendWarning() << "OCCT Stl writer does not support model scaling according to custom length unit";
|
Message::SendWarning() << "OCCT Stl writer does not support model scaling according to custom length unit";
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWStl_ConfigurationNode)))
|
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWStl_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
|
@@ -64,24 +64,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theDocument document to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theDocument document to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
//! Reads a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the import CAD file
|
//! @param[in] thePath path to the import CAD file
|
||||||
//! @param[out] theShape shape to save result
|
//! @param[out] theShape shape to save result
|
||||||
@@ -104,24 +86,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theShape shape to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theShape shape to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Gets CAD format name of associated provider
|
//! Gets CAD format name of associated provider
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
#include <DE_ConfigurationNode.hxx>
|
#include <DE_ConfigurationNode.hxx>
|
||||||
#include <STEPControl_StepModelType.hxx>
|
#include <STEPControl_StepModelType.hxx>
|
||||||
#include <Resource_FormatType.hxx>
|
#include <Resource_FormatType.hxx>
|
||||||
|
#include <TColStd_SequenceOfAsciiString.hxx>
|
||||||
#include <UnitsMethods_LengthUnit.hxx>
|
#include <UnitsMethods_LengthUnit.hxx>
|
||||||
|
|
||||||
//! The purpose of this class is to configure the transfer process for STEP format
|
//! The purpose of this class is to configure the transfer process for STEP format
|
||||||
@@ -218,7 +219,9 @@ public:
|
|||||||
bool WriteSurfaceCurMode = true; //<! Indicates whether parametric curves (curves in parametric space of surface) should be written into the STEP file
|
bool WriteSurfaceCurMode = true; //<! Indicates whether parametric curves (curves in parametric space of surface) should be written into the STEP file
|
||||||
UnitsMethods_LengthUnit WriteUnit = UnitsMethods_LengthUnit_Millimeter; //<! Defines a unit in which the STEP file should be written
|
UnitsMethods_LengthUnit WriteUnit = UnitsMethods_LengthUnit_Millimeter; //<! Defines a unit in which the STEP file should be written
|
||||||
TCollection_AsciiString WriteResourceName = "STEP"; //<! Defines the name of the resource file to write
|
TCollection_AsciiString WriteResourceName = "STEP"; //<! Defines the name of the resource file to write
|
||||||
|
TCollection_AsciiString WriteMultiPrefix; //<! Defines prefix for names of external files, if empty do not make multifile
|
||||||
TCollection_AsciiString WriteSequence = "ToSTEP"; //<! Defines the name of the sequence of operators to write
|
TCollection_AsciiString WriteSequence = "ToSTEP"; //<! Defines the name of the sequence of operators to write
|
||||||
|
TColStd_SequenceOfAsciiString WriteLabels; //<! Defines list of shape labels to export, if empty import full document
|
||||||
WriteMode_VertexMode WriteVertexMode = WriteMode_VertexMode_OneCompound; //<! Indicates which of free vertices writing mode is switch on
|
WriteMode_VertexMode WriteVertexMode = WriteMode_VertexMode_OneCompound; //<! Indicates which of free vertices writing mode is switch on
|
||||||
bool WriteSubshapeNames = false; //<! Indicates whether to write sub-shape names to 'Name' attributes of STEP Representation Items
|
bool WriteSubshapeNames = false; //<! Indicates whether to write sub-shape names to 'Name' attributes of STEP Representation Items
|
||||||
bool WriteColor = true; //<! ColorMode is used to indicate write Colors or not
|
bool WriteColor = true; //<! ColorMode is used to indicate write Colors or not
|
||||||
|
@@ -22,6 +22,9 @@
|
|||||||
#include <STEPCAFControl_Controller.hxx>
|
#include <STEPCAFControl_Controller.hxx>
|
||||||
#include <STEPCAFControl_Reader.hxx>
|
#include <STEPCAFControl_Reader.hxx>
|
||||||
#include <STEPCAFControl_Writer.hxx>
|
#include <STEPCAFControl_Writer.hxx>
|
||||||
|
#include <TDocStd_Document.hxx>
|
||||||
|
#include <TDataStd_Name.hxx>
|
||||||
|
#include <TDF_Tool.hxx>
|
||||||
#include <XCAFDoc_DocumentTool.hxx>
|
#include <XCAFDoc_DocumentTool.hxx>
|
||||||
#include <XSControl_WorkSession.hxx>
|
#include <XSControl_WorkSession.hxx>
|
||||||
#include <UnitsMethods.hxx>
|
#include <UnitsMethods.hxx>
|
||||||
@@ -55,7 +58,8 @@ void STEPCAFControl_Provider::personizeWS(Handle(XSControl_WorkSession)& theWS)
|
|||||||
<< " Null work session, use internal temporary session";
|
<< " Null work session, use internal temporary session";
|
||||||
theWS = new XSControl_WorkSession();
|
theWS = new XSControl_WorkSession();
|
||||||
}
|
}
|
||||||
Handle(STEPControl_Controller) aCntrl = Handle(STEPControl_Controller)::DownCast(theWS->NormAdaptor());
|
Handle(STEPControl_Controller) aCntrl =
|
||||||
|
Handle(STEPControl_Controller)::DownCast(theWS->NormAdaptor());
|
||||||
if (aCntrl.IsNull())
|
if (aCntrl.IsNull())
|
||||||
{
|
{
|
||||||
theWS->SelectNorm("STEP");
|
theWS->SelectNorm("STEP");
|
||||||
@@ -68,49 +72,104 @@ void STEPCAFControl_Provider::personizeWS(Handle(XSControl_WorkSession)& theWS)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void STEPCAFControl_Provider::initStatic(const Handle(DE_ConfigurationNode)& theNode)
|
void STEPCAFControl_Provider::initStatic(const Handle(DE_ConfigurationNode)& theNode)
|
||||||
{
|
{
|
||||||
Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(theNode);
|
Handle(STEPCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode)::DownCast(theNode);
|
||||||
STEPCAFControl_Controller::Init();
|
STEPCAFControl_Controller::Init();
|
||||||
|
if (!myToUpdateStaticParameters)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Get previous values
|
// Get previous values
|
||||||
myOldValues.ReadBSplineContinuity = (STEPCAFControl_ConfigurationNode::ReadMode_BSplineContinuity)Interface_Static::IVal("read.iges.bspline.continuity");
|
myOldValues.ReadBSplineContinuity =
|
||||||
myOldValues.ReadPrecisionMode = (STEPCAFControl_ConfigurationNode::ReadMode_Precision)Interface_Static::IVal("read.precision.mode");
|
(STEPCAFControl_ConfigurationNode::ReadMode_BSplineContinuity)
|
||||||
myOldValues.ReadPrecisionVal = Interface_Static::RVal("read.precision.val");
|
Interface_Static::IVal("read.iges.bspline.continuity");
|
||||||
myOldValues.ReadMaxPrecisionMode = (STEPCAFControl_ConfigurationNode::ReadMode_MaxPrecision)Interface_Static::IVal("read.maxprecision.mode");
|
myOldValues.ReadPrecisionMode =
|
||||||
myOldValues.ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val");
|
(STEPCAFControl_ConfigurationNode::ReadMode_Precision)
|
||||||
myOldValues.ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1;
|
Interface_Static::IVal("read.precision.mode");
|
||||||
myOldValues.ReadSurfaceCurveMode = (STEPCAFControl_ConfigurationNode::ReadMode_SurfaceCurve)Interface_Static::IVal("read.surfacecurve.mode");
|
myOldValues.ReadPrecisionVal =
|
||||||
myOldValues.EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI;
|
Interface_Static::RVal("read.precision.val");
|
||||||
myOldValues.AngleUnit = (STEPCAFControl_ConfigurationNode::AngleUnitMode)Interface_Static::IVal("step.angleunit.mode");
|
myOldValues.ReadMaxPrecisionMode =
|
||||||
|
(STEPCAFControl_ConfigurationNode::ReadMode_MaxPrecision)
|
||||||
|
Interface_Static::IVal("read.maxprecision.mode");
|
||||||
|
myOldValues.ReadMaxPrecisionVal =
|
||||||
|
Interface_Static::RVal("read.maxprecision.val");
|
||||||
|
myOldValues.ReadSameParamMode =
|
||||||
|
Interface_Static::IVal("read.stdsameparameter.mode") == 1;
|
||||||
|
myOldValues.ReadSurfaceCurveMode =
|
||||||
|
(STEPCAFControl_ConfigurationNode::ReadMode_SurfaceCurve)
|
||||||
|
Interface_Static::IVal("read.surfacecurve.mode");
|
||||||
|
myOldValues.EncodeRegAngle =
|
||||||
|
Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI;
|
||||||
|
myOldValues.AngleUnit =
|
||||||
|
(STEPCAFControl_ConfigurationNode::AngleUnitMode)
|
||||||
|
Interface_Static::IVal("step.angleunit.mode");
|
||||||
|
|
||||||
myOldValues.ReadResourceName = Interface_Static::CVal("read.step.resource.name");
|
myOldValues.ReadResourceName =
|
||||||
myOldValues.ReadSequence = Interface_Static::CVal("read.step.sequence");
|
Interface_Static::CVal("read.step.resource.name");
|
||||||
myOldValues.ReadProductMode = Interface_Static::IVal("read.step.product.mode") == 1;
|
myOldValues.ReadSequence =
|
||||||
myOldValues.ReadProductContext = (STEPCAFControl_ConfigurationNode::ReadMode_ProductContext)Interface_Static::IVal("read.step.product.context");
|
Interface_Static::CVal("read.step.sequence");
|
||||||
myOldValues.ReadShapeRepr = (STEPCAFControl_ConfigurationNode::ReadMode_ShapeRepr)Interface_Static::IVal("read.step.shape.repr");
|
myOldValues.ReadProductMode =
|
||||||
myOldValues.ReadTessellated = (STEPCAFControl_ConfigurationNode::RWMode_Tessellated)Interface_Static::IVal("read.step.tessellated");
|
Interface_Static::IVal("read.step.product.mode") == 1;
|
||||||
myOldValues.ReadAssemblyLevel = (STEPCAFControl_ConfigurationNode::ReadMode_AssemblyLevel)Interface_Static::IVal("read.step.assembly.level");
|
myOldValues.ReadProductContext =
|
||||||
myOldValues.ReadRelationship = Interface_Static::IVal("read.step.shape.relationship") == 1;
|
(STEPCAFControl_ConfigurationNode::ReadMode_ProductContext)
|
||||||
myOldValues.ReadShapeAspect = Interface_Static::IVal("read.step.shape.aspect") == 1;
|
Interface_Static::IVal("read.step.product.context");
|
||||||
myOldValues.ReadConstrRelation = Interface_Static::IVal("read.step.constructivegeom.relationship") == 1;
|
myOldValues.ReadShapeRepr =
|
||||||
myOldValues.ReadSubshapeNames = Interface_Static::IVal("read.stepcaf.subshapes.name") == 1;
|
(STEPCAFControl_ConfigurationNode::ReadMode_ShapeRepr)
|
||||||
myOldValues.ReadCodePage = (Resource_FormatType)Interface_Static::IVal("read.step.codepage");
|
Interface_Static::IVal("read.step.shape.repr");
|
||||||
myOldValues.ReadNonmanifold = Interface_Static::IVal("read.step.nonmanifold") == 1;
|
myOldValues.ReadTessellated =
|
||||||
myOldValues.ReadIdeas = Interface_Static::IVal("read.step.ideas") == 1;
|
(STEPCAFControl_ConfigurationNode::RWMode_Tessellated)
|
||||||
myOldValues.ReadAllShapes = Interface_Static::IVal("read.step.all.shapes") == 1;
|
Interface_Static::IVal("read.step.tessellated");
|
||||||
myOldValues.ReadRootTransformation = Interface_Static::IVal("read.step.root.transformation") == 1;
|
myOldValues.ReadAssemblyLevel =
|
||||||
|
(STEPCAFControl_ConfigurationNode::ReadMode_AssemblyLevel)
|
||||||
|
Interface_Static::IVal("read.step.assembly.level");
|
||||||
|
myOldValues.ReadRelationship =
|
||||||
|
Interface_Static::IVal("read.step.shape.relationship") == 1;
|
||||||
|
myOldValues.ReadShapeAspect =
|
||||||
|
Interface_Static::IVal("read.step.shape.aspect") == 1;
|
||||||
|
myOldValues.ReadConstrRelation =
|
||||||
|
Interface_Static::IVal("read.step.constructivegeom.relationship") == 1;
|
||||||
|
myOldValues.ReadSubshapeNames =
|
||||||
|
Interface_Static::IVal("read.stepcaf.subshapes.name") == 1;
|
||||||
|
myOldValues.ReadCodePage =
|
||||||
|
(Resource_FormatType)Interface_Static::IVal("read.step.codepage");
|
||||||
|
myOldValues.ReadNonmanifold =
|
||||||
|
Interface_Static::IVal("read.step.nonmanifold") == 1;
|
||||||
|
myOldValues.ReadIdeas =
|
||||||
|
Interface_Static::IVal("read.step.ideas") == 1;
|
||||||
|
myOldValues.ReadAllShapes =
|
||||||
|
Interface_Static::IVal("read.step.all.shapes") == 1;
|
||||||
|
myOldValues.ReadRootTransformation =
|
||||||
|
Interface_Static::IVal("read.step.root.transformation") == 1;
|
||||||
|
|
||||||
myOldValues.WritePrecisionMode = (STEPCAFControl_ConfigurationNode::WriteMode_PrecisionMode)Interface_Static::IVal("write.precision.mode");
|
myOldValues.WritePrecisionMode =
|
||||||
myOldValues.WritePrecisionVal = Interface_Static::RVal("write.precision.val");
|
(STEPCAFControl_ConfigurationNode::WriteMode_PrecisionMode)
|
||||||
myOldValues.WriteAssembly = (STEPCAFControl_ConfigurationNode::WriteMode_Assembly)Interface_Static::IVal("write.step.assembly");
|
Interface_Static::IVal("write.precision.mode");
|
||||||
myOldValues.WriteSchema = (STEPCAFControl_ConfigurationNode::WriteMode_StepSchema)Interface_Static::IVal("write.step.schema");
|
myOldValues.WritePrecisionVal =
|
||||||
myOldValues.WriteTessellated = (STEPCAFControl_ConfigurationNode::RWMode_Tessellated)Interface_Static::IVal("write.step.tessellated");
|
Interface_Static::RVal("write.precision.val");
|
||||||
myOldValues.WriteProductName = Interface_Static::CVal("write.step.product.name");
|
myOldValues.WriteAssembly =
|
||||||
myOldValues.WriteSurfaceCurMode = Interface_Static::IVal("write.surfacecurve.mode") == 1;
|
(STEPCAFControl_ConfigurationNode::WriteMode_Assembly)
|
||||||
myOldValues.WriteUnit = (UnitsMethods_LengthUnit)Interface_Static::IVal("write.step.unit");
|
Interface_Static::IVal("write.step.assembly");
|
||||||
myOldValues.WriteResourceName = Interface_Static::CVal("write.resource.name");
|
myOldValues.WriteSchema =
|
||||||
myOldValues.WriteSequence = Interface_Static::CVal("write.step.sequence");
|
(STEPCAFControl_ConfigurationNode::WriteMode_StepSchema)
|
||||||
myOldValues.WriteVertexMode = (STEPCAFControl_ConfigurationNode::WriteMode_VertexMode)Interface_Static::IVal("write.step.vertex.mode");
|
Interface_Static::IVal("write.step.schema");
|
||||||
myOldValues.WriteSubshapeNames = Interface_Static::IVal("write.stepcaf.subshapes.name") == 1;
|
myOldValues.WriteTessellated =
|
||||||
|
(STEPCAFControl_ConfigurationNode::RWMode_Tessellated)
|
||||||
|
Interface_Static::IVal("write.step.tessellated");
|
||||||
|
myOldValues.WriteProductName =
|
||||||
|
Interface_Static::CVal("write.step.product.name");
|
||||||
|
myOldValues.WriteSurfaceCurMode =
|
||||||
|
Interface_Static::IVal("write.surfacecurve.mode") == 1;
|
||||||
|
myOldValues.WriteUnit =
|
||||||
|
(UnitsMethods_LengthUnit)Interface_Static::IVal("write.step.unit");
|
||||||
|
myOldValues.WriteResourceName =
|
||||||
|
Interface_Static::CVal("write.resource.name");
|
||||||
|
myOldValues.WriteSequence =
|
||||||
|
Interface_Static::CVal("write.step.sequence");
|
||||||
|
myOldValues.WriteVertexMode =
|
||||||
|
(STEPCAFControl_ConfigurationNode::WriteMode_VertexMode)
|
||||||
|
Interface_Static::IVal("write.step.vertex.mode");
|
||||||
|
myOldValues.WriteSubshapeNames =
|
||||||
|
Interface_Static::IVal("write.stepcaf.subshapes.name") == 1;
|
||||||
|
|
||||||
// Set new values
|
// Set new values
|
||||||
setStatic(aNode->InternalParameters);
|
setStatic(aNode->InternalParameters);
|
||||||
@@ -122,45 +181,82 @@ void STEPCAFControl_Provider::initStatic(const Handle(DE_ConfigurationNode)& the
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void STEPCAFControl_Provider::setStatic(const STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection theParameter)
|
void STEPCAFControl_Provider::setStatic(const STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection theParameter)
|
||||||
{
|
{
|
||||||
Interface_Static::SetIVal("read.iges.bspline.continuity", theParameter.ReadBSplineContinuity);
|
Interface_Static::SetIVal("read.iges.bspline.continuity",
|
||||||
Interface_Static::SetIVal("read.precision.mode", theParameter.ReadPrecisionMode);
|
theParameter.ReadBSplineContinuity);
|
||||||
Interface_Static::SetRVal("read.precision.val", theParameter.ReadPrecisionVal);
|
Interface_Static::SetIVal("read.precision.mode",
|
||||||
Interface_Static::SetIVal("read.maxprecision.mode", theParameter.ReadMaxPrecisionMode);
|
theParameter.ReadPrecisionMode);
|
||||||
Interface_Static::SetRVal("read.maxprecision.val", theParameter.ReadMaxPrecisionVal);
|
Interface_Static::SetRVal("read.precision.val",
|
||||||
Interface_Static::SetIVal("read.stdsameparameter.mode", theParameter.ReadSameParamMode);
|
theParameter.ReadPrecisionVal);
|
||||||
Interface_Static::SetIVal("read.surfacecurve.mode", theParameter.ReadSurfaceCurveMode);
|
Interface_Static::SetIVal("read.maxprecision.mode",
|
||||||
Interface_Static::SetRVal("read.encoderegularity.angle", theParameter.EncodeRegAngle * M_PI / 180.0);
|
theParameter.ReadMaxPrecisionMode);
|
||||||
Interface_Static::SetIVal("step.angleunit.mode", theParameter.AngleUnit);
|
Interface_Static::SetRVal("read.maxprecision.val",
|
||||||
|
theParameter.ReadMaxPrecisionVal);
|
||||||
|
Interface_Static::SetIVal("read.stdsameparameter.mode",
|
||||||
|
theParameter.ReadSameParamMode);
|
||||||
|
Interface_Static::SetIVal("read.surfacecurve.mode",
|
||||||
|
theParameter.ReadSurfaceCurveMode);
|
||||||
|
Interface_Static::SetRVal("read.encoderegularity.angle",
|
||||||
|
theParameter.EncodeRegAngle * M_PI / 180.0);
|
||||||
|
Interface_Static::SetIVal("step.angleunit.mode",
|
||||||
|
theParameter.AngleUnit);
|
||||||
|
|
||||||
Interface_Static::SetCVal("read.step.resource.name", theParameter.ReadResourceName.ToCString());
|
Interface_Static::SetCVal("read.step.resource.name",
|
||||||
Interface_Static::SetCVal("read.step.sequence", theParameter.ReadSequence.ToCString());
|
theParameter.ReadResourceName.ToCString());
|
||||||
Interface_Static::SetIVal("read.step.product.mode", theParameter.ReadProductMode);
|
Interface_Static::SetCVal("read.step.sequence",
|
||||||
Interface_Static::SetIVal("read.step.product.context", theParameter.ReadProductContext);
|
theParameter.ReadSequence.ToCString());
|
||||||
Interface_Static::SetIVal("read.step.shape.repr", theParameter.ReadShapeRepr);
|
Interface_Static::SetIVal("read.step.product.mode",
|
||||||
Interface_Static::SetIVal("read.step.tessellated", theParameter.ReadTessellated);
|
theParameter.ReadProductMode);
|
||||||
Interface_Static::SetIVal("read.step.assembly.level", theParameter.ReadAssemblyLevel);
|
Interface_Static::SetIVal("read.step.product.context",
|
||||||
Interface_Static::SetIVal("read.step.shape.relationship", theParameter.ReadRelationship);
|
theParameter.ReadProductContext);
|
||||||
Interface_Static::SetIVal("read.step.shape.aspect", theParameter.ReadShapeAspect);
|
Interface_Static::SetIVal("read.step.shape.repr",
|
||||||
Interface_Static::SetIVal("read.step.constructivegeom.relationship", theParameter.ReadConstrRelation);
|
theParameter.ReadShapeRepr);
|
||||||
Interface_Static::SetIVal("read.stepcaf.subshapes.name", theParameter.ReadSubshapeNames);
|
Interface_Static::SetIVal("read.step.tessellated",
|
||||||
Interface_Static::SetIVal("read.step.codepage", theParameter.ReadCodePage);
|
theParameter.ReadTessellated);
|
||||||
Interface_Static::SetIVal("read.step.nonmanifold", theParameter.ReadNonmanifold);
|
Interface_Static::SetIVal("read.step.assembly.level",
|
||||||
Interface_Static::SetIVal("read.step.ideas", theParameter.ReadIdeas);
|
theParameter.ReadAssemblyLevel);
|
||||||
Interface_Static::SetIVal("read.step.all.shapes", theParameter.ReadAllShapes);
|
Interface_Static::SetIVal("read.step.shape.relationship",
|
||||||
Interface_Static::SetIVal("read.step.root.transformation", theParameter.ReadRootTransformation);
|
theParameter.ReadRelationship);
|
||||||
|
Interface_Static::SetIVal("read.step.shape.aspect",
|
||||||
|
theParameter.ReadShapeAspect);
|
||||||
|
Interface_Static::SetIVal("read.step.constructivegeom.relationship",
|
||||||
|
theParameter.ReadConstrRelation);
|
||||||
|
Interface_Static::SetIVal("read.stepcaf.subshapes.name",
|
||||||
|
theParameter.ReadSubshapeNames);
|
||||||
|
Interface_Static::SetIVal("read.step.codepage",
|
||||||
|
theParameter.ReadCodePage);
|
||||||
|
Interface_Static::SetIVal("read.step.nonmanifold",
|
||||||
|
theParameter.ReadNonmanifold);
|
||||||
|
Interface_Static::SetIVal("read.step.ideas",
|
||||||
|
theParameter.ReadIdeas);
|
||||||
|
Interface_Static::SetIVal("read.step.all.shapes",
|
||||||
|
theParameter.ReadAllShapes);
|
||||||
|
Interface_Static::SetIVal("read.step.root.transformation",
|
||||||
|
theParameter.ReadRootTransformation);
|
||||||
|
|
||||||
Interface_Static::SetIVal("write.precision.mode", theParameter.WritePrecisionMode);
|
Interface_Static::SetIVal("write.precision.mode",
|
||||||
Interface_Static::SetRVal("write.precision.val", theParameter.WritePrecisionVal);
|
theParameter.WritePrecisionMode);
|
||||||
Interface_Static::SetIVal("write.step.assembly", theParameter.WriteAssembly);
|
Interface_Static::SetRVal("write.precision.val",
|
||||||
Interface_Static::SetIVal("write.step.schema", theParameter.WriteSchema);
|
theParameter.WritePrecisionVal);
|
||||||
Interface_Static::SetIVal("write.step.tessellated", theParameter.WriteTessellated);
|
Interface_Static::SetIVal("write.step.assembly",
|
||||||
Interface_Static::SetCVal("write.step.product.name", theParameter.WriteProductName.ToCString());
|
theParameter.WriteAssembly);
|
||||||
Interface_Static::SetIVal("write.surfacecurve.mode", theParameter.WriteSurfaceCurMode);
|
Interface_Static::SetIVal("write.step.schema",
|
||||||
Interface_Static::SetIVal("write.step.unit", theParameter.WriteUnit);
|
theParameter.WriteSchema);
|
||||||
Interface_Static::SetCVal("write.resource.name", theParameter.WriteResourceName.ToCString());
|
Interface_Static::SetIVal("write.step.tessellated",
|
||||||
Interface_Static::SetCVal("write.step.sequence", theParameter.WriteSequence.ToCString());
|
theParameter.WriteTessellated);
|
||||||
Interface_Static::SetIVal("write.step.vertex.mode", theParameter.WriteVertexMode);
|
Interface_Static::SetCVal("write.step.product.name",
|
||||||
Interface_Static::SetIVal("write.stepcaf.subshapes.name", theParameter.WriteSubshapeNames);
|
theParameter.WriteProductName.ToCString());
|
||||||
|
Interface_Static::SetIVal("write.surfacecurve.mode",
|
||||||
|
theParameter.WriteSurfaceCurMode);
|
||||||
|
Interface_Static::SetIVal("write.step.unit",
|
||||||
|
theParameter.WriteUnit);
|
||||||
|
Interface_Static::SetCVal("write.resource.name",
|
||||||
|
theParameter.WriteResourceName.ToCString());
|
||||||
|
Interface_Static::SetCVal("write.step.sequence",
|
||||||
|
theParameter.WriteSequence.ToCString());
|
||||||
|
Interface_Static::SetIVal("write.step.vertex.mode",
|
||||||
|
theParameter.WriteVertexMode);
|
||||||
|
Interface_Static::SetIVal("write.stepcaf.subshapes.name",
|
||||||
|
theParameter.WriteSubshapeNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -169,6 +265,10 @@ void STEPCAFControl_Provider::setStatic(const STEPCAFControl_ConfigurationNode::
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void STEPCAFControl_Provider::resetStatic()
|
void STEPCAFControl_Provider::resetStatic()
|
||||||
{
|
{
|
||||||
|
if (!myToUpdateStaticParameters)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
setStatic(myOldValues);
|
setStatic(myOldValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,42 +283,122 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
{
|
{
|
||||||
if (theDocument.IsNull())
|
if (theDocument.IsNull())
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
thePath << "\t: theDocument shouldn't be null";
|
<< "Null document";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
|
if (GetNode().IsNull() ||
|
||||||
|
!GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
thePath << "\t: Incorrect or empty Configuration Node";
|
<< "Incorrect or empty Configuration Node";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
|
Handle(STEPCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
|
||||||
initStatic(aNode);
|
initStatic(aNode);
|
||||||
|
|
||||||
personizeWS(theWS);
|
personizeWS(theWS);
|
||||||
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
|
XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
|
||||||
STEPCAFControl_Reader aReader;
|
aNode->GlobalParameters.LengthUnit,
|
||||||
aReader.Init(theWS);
|
UnitsMethods_LengthUnit_Millimeter);
|
||||||
|
const Standard_Boolean toUseLoaded = thePath == ".";
|
||||||
|
TCollection_AsciiString aFile;
|
||||||
|
if (toUseLoaded)
|
||||||
|
{
|
||||||
|
aFile = theWS->LoadedFile();
|
||||||
|
Message::SendInfo() << "Model taken from the STEP session : "
|
||||||
|
<< aFile;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aFile = thePath;
|
||||||
|
Message::SendInfo() << "File STEP to read : "
|
||||||
|
<< aFile;
|
||||||
|
}
|
||||||
|
STEPCAFControl_Reader aReader(theWS, !toUseLoaded);
|
||||||
aReader.SetColorMode(aNode->InternalParameters.ReadColor);
|
aReader.SetColorMode(aNode->InternalParameters.ReadColor);
|
||||||
aReader.SetNameMode(aNode->InternalParameters.ReadName);
|
aReader.SetNameMode(aNode->InternalParameters.ReadName);
|
||||||
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
|
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
|
||||||
aReader.SetPropsMode(aNode->InternalParameters.ReadProps);
|
aReader.SetPropsMode(aNode->InternalParameters.ReadProps);
|
||||||
|
|
||||||
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
|
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
|
||||||
|
if (!toUseLoaded)
|
||||||
|
{
|
||||||
aReadStat = aReader.ReadFile(thePath.ToCString());
|
aReadStat = aReader.ReadFile(thePath.ToCString());
|
||||||
|
}
|
||||||
|
else if (theWS->NbStartingEntities() > 0)
|
||||||
|
{
|
||||||
|
aReadStat = IFSelect_RetDone;
|
||||||
|
}
|
||||||
if (aReadStat != IFSelect_RetDone)
|
if (aReadStat != IFSelect_RetDone)
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: STEPCAFControl_Provider : ["
|
||||||
thePath << "\t: abandon";
|
<< aFile << "] : abandon, no model loaded";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aReader.Transfer(theDocument, theProgress))
|
if (!aReader.Transfer(theDocument, theProgress))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: STEPCAFControl_Provider : [" <<
|
||||||
thePath << "\t: Cannot read any relevant data from the STEP file";
|
aFile << "] : Cannot read any relevant data from the IGES file";
|
||||||
|
resetStatic();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
resetStatic();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : Read
|
||||||
|
// purpose :
|
||||||
|
//=======================================================================
|
||||||
|
bool STEPCAFControl_Provider::Read(std::istream& theIStream,
|
||||||
|
const Handle(TDocStd_Document)& theDocument,
|
||||||
|
const TCollection_AsciiString theName,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
|
const Message_ProgressRange& theProgress)
|
||||||
|
{
|
||||||
|
if (theDocument.IsNull())
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "Null document";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (GetNode().IsNull() ||
|
||||||
|
!GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "Incorrect or empty Configuration Node";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
|
||||||
|
initStatic(aNode);
|
||||||
|
|
||||||
|
personizeWS(theWS);
|
||||||
|
XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
|
||||||
|
aNode->GlobalParameters.LengthUnit,
|
||||||
|
UnitsMethods_LengthUnit_Millimeter);
|
||||||
|
Message::SendInfo() << "Model taken from the STEP stream";
|
||||||
|
STEPCAFControl_Reader aReader(theWS);
|
||||||
|
aReader.SetColorMode(aNode->InternalParameters.ReadColor);
|
||||||
|
aReader.SetNameMode(aNode->InternalParameters.ReadName);
|
||||||
|
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
|
||||||
|
aReader.SetPropsMode(aNode->InternalParameters.ReadProps);
|
||||||
|
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
|
||||||
|
aReadStat = aReader.ReadStream(theName.ToCString(), theIStream);
|
||||||
|
if (aReadStat != IFSelect_RetDone)
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "Abandon, no model loaded via stream";
|
||||||
|
resetStatic();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!aReader.Transfer(theDocument, theProgress))
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "Cannot read any relevant data from the IGES file";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -235,84 +415,188 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
|
if (GetNode().IsNull() ||
|
||||||
|
!GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
thePath << "\t: Incorrect or empty Configuration Node";
|
<< "Incorrect or empty Configuration Node";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
|
Handle(STEPCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
|
||||||
initStatic(aNode);
|
initStatic(aNode);
|
||||||
|
|
||||||
XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
|
XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
|
||||||
UnitsMethods::GetLengthUnitScale(aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter),
|
UnitsMethods::GetLengthUnitScale(
|
||||||
|
aNode->InternalParameters.WriteUnit,
|
||||||
|
UnitsMethods_LengthUnit_Millimeter),
|
||||||
UnitsMethods_LengthUnit_Millimeter);
|
UnitsMethods_LengthUnit_Millimeter);
|
||||||
personizeWS(theWS);
|
personizeWS(theWS);
|
||||||
STEPCAFControl_Writer aWriter;
|
STEPCAFControl_Writer aWriter(theWS, Standard_True);
|
||||||
aWriter.Init(theWS);
|
STEPControl_StepModelType aMode =
|
||||||
STEPControl_StepModelType aMode = static_cast<STEPControl_StepModelType>(aNode->InternalParameters.WriteModelType);
|
static_cast<STEPControl_StepModelType>(aNode->InternalParameters.WriteModelType);
|
||||||
aWriter.SetColorMode(aNode->InternalParameters.WriteColor);
|
aWriter.SetColorMode(aNode->InternalParameters.WriteColor);
|
||||||
aWriter.SetNameMode(aNode->InternalParameters.WriteName);
|
aWriter.SetNameMode(aNode->InternalParameters.WriteName);
|
||||||
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
|
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
|
||||||
aWriter.SetPropsMode(aNode->InternalParameters.WriteProps);
|
aWriter.SetPropsMode(aNode->InternalParameters.WriteProps);
|
||||||
|
|
||||||
|
TDF_LabelSequence aLabels;
|
||||||
|
TCollection_AsciiString aLabelsString;
|
||||||
|
for (TColStd_SequenceOfAsciiString::Iterator anIter(aNode->InternalParameters.WriteLabels);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
|
{
|
||||||
|
const TCollection_AsciiString& aValue = anIter.Value();
|
||||||
TDF_Label aLabel;
|
TDF_Label aLabel;
|
||||||
|
TDF_Tool::Label(theDocument->Main().Data(), aValue, aLabel, Standard_False);
|
||||||
if (!aWriter.Transfer(theDocument, aMode, 0, theProgress))
|
if (aLabel.IsNull())
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
|
Message::SendFail() << "Error: No label for entry '" << aValue << "'";
|
||||||
thePath << "\t: The document cannot be translated or gives no result";
|
return false;
|
||||||
|
}
|
||||||
|
if (!aLabelsString.IsEmpty())
|
||||||
|
{
|
||||||
|
aLabelsString += " ";
|
||||||
|
}
|
||||||
|
aLabelsString += aValue;
|
||||||
|
aLabels.Append(aLabel);
|
||||||
|
}
|
||||||
|
TCollection_ExtendedString aDocName;
|
||||||
|
Handle(TDataStd_Name) aNameAttr;
|
||||||
|
if (theDocument->GetData()->Root().FindAttribute(TDataStd_Name::GetID(), aNameAttr))
|
||||||
|
{
|
||||||
|
aDocName = aNameAttr->Get();
|
||||||
|
}
|
||||||
|
Standard_Boolean aTransferStatus = Standard_True;
|
||||||
|
Standard_CString aMultiFilePrefix = !aNode->InternalParameters.WriteMultiPrefix.IsEmpty() ?
|
||||||
|
aNode->InternalParameters.WriteMultiPrefix.ToCString() : nullptr;
|
||||||
|
Message::SendInfo() << "Writing STEP file "
|
||||||
|
<< thePath;
|
||||||
|
if (aLabels.IsEmpty())
|
||||||
|
{
|
||||||
|
Message::SendInfo() << "Translating labels "
|
||||||
|
<< aLabelsString << " of document " << aDocName << " to STEP";
|
||||||
|
aTransferStatus = aWriter.Transfer(theDocument, aMode, aMultiFilePrefix, theProgress);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Message::SendInfo() << "Translating document "
|
||||||
|
<< aDocName << " to STEP";
|
||||||
|
aTransferStatus = aWriter.Transfer(aLabels, aMode, aMultiFilePrefix, theProgress);
|
||||||
|
}
|
||||||
|
if (!aTransferStatus)
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "The document cannot be translated or gives no result";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
IFSelect_ReturnStatus aStatus = aWriter.Write(thePath.ToCString());
|
if (thePath == ".")
|
||||||
switch (aStatus)
|
|
||||||
{
|
{
|
||||||
case IFSelect_RetVoid:
|
|
||||||
{
|
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
|
|
||||||
thePath << "\t: No file written";
|
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;;
|
Message::SendInfo() << "Document has been translated into the session";
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
case IFSelect_RetDone:
|
if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
|
||||||
{
|
{
|
||||||
break;
|
Message::SendFail() << "Error: STEPCAFControl_Provider : [" <<
|
||||||
}
|
thePath << "] : Write failed";
|
||||||
default:
|
|
||||||
{
|
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
|
|
||||||
thePath << "\t: Error on writing file";
|
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
Message::SendInfo() << "STEP file [" << thePath << "] Successfully written";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
Handle(XSControl_WorkSession) aWS = new XSControl_WorkSession();
|
|
||||||
return Read(thePath, theDocument, aWS, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : Write
|
// function : Write
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
bool STEPCAFControl_Provider::Write(std::ostream& theOStream,
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
const Handle(TDocStd_Document)& theDocument,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
Handle(XSControl_WorkSession) aWS = new XSControl_WorkSession();
|
if (GetNode().IsNull() ||
|
||||||
return Write(thePath, theDocument, aWS, theProgress);
|
!GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "Incorrect or empty Configuration Node";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
|
||||||
|
initStatic(aNode);
|
||||||
|
XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
|
||||||
|
UnitsMethods::GetLengthUnitScale(
|
||||||
|
aNode->InternalParameters.WriteUnit,
|
||||||
|
UnitsMethods_LengthUnit_Millimeter),
|
||||||
|
UnitsMethods_LengthUnit_Millimeter);
|
||||||
|
personizeWS(theWS);
|
||||||
|
STEPCAFControl_Writer aWriter(theWS, Standard_True);
|
||||||
|
STEPControl_StepModelType aMode =
|
||||||
|
static_cast<STEPControl_StepModelType>(aNode->InternalParameters.WriteModelType);
|
||||||
|
aWriter.SetColorMode(aNode->InternalParameters.WriteColor);
|
||||||
|
aWriter.SetNameMode(aNode->InternalParameters.WriteName);
|
||||||
|
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
|
||||||
|
aWriter.SetPropsMode(aNode->InternalParameters.WriteProps);
|
||||||
|
TDF_LabelSequence aLabels;
|
||||||
|
TCollection_AsciiString aLabelsString;
|
||||||
|
for (TColStd_SequenceOfAsciiString::Iterator anIter(aNode->InternalParameters.WriteLabels);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
|
{
|
||||||
|
const TCollection_AsciiString& aValue = anIter.Value();
|
||||||
|
TDF_Label aLabel;
|
||||||
|
TDF_Tool::Label(theDocument->Main().Data(), aValue, aLabel, Standard_False);
|
||||||
|
if (aLabel.IsNull())
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: No label for entry '" << aValue << "'";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!aLabelsString.IsEmpty())
|
||||||
|
{
|
||||||
|
aLabelsString += " ";
|
||||||
|
}
|
||||||
|
aLabelsString += aValue;
|
||||||
|
aLabels.Append(aLabel);
|
||||||
|
}
|
||||||
|
TCollection_ExtendedString aDocName;
|
||||||
|
Handle(TDataStd_Name) aNameAttr;
|
||||||
|
if (theDocument->GetData()->Root().FindAttribute(TDataStd_Name::GetID(), aNameAttr))
|
||||||
|
{
|
||||||
|
aDocName = aNameAttr->Get();
|
||||||
|
}
|
||||||
|
Standard_Boolean aTransferStatus = Standard_True;
|
||||||
|
Standard_CString aMultiFilePrefix = !aNode->InternalParameters.WriteMultiPrefix.IsEmpty() ?
|
||||||
|
aNode->InternalParameters.WriteMultiPrefix.ToCString() : nullptr;
|
||||||
|
Message::SendInfo() << "Writing STEP file to stream";
|
||||||
|
if (aLabels.IsEmpty())
|
||||||
|
{
|
||||||
|
Message::SendInfo() << "Translating labels "
|
||||||
|
<< aLabelsString << " of document " << aDocName << " to STEP";
|
||||||
|
aTransferStatus = aWriter.Transfer(theDocument, aMode, aMultiFilePrefix, theProgress);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Message::SendInfo() << "Translating document "
|
||||||
|
<< aDocName << " to STEP";
|
||||||
|
aTransferStatus = aWriter.Transfer(aLabels, aMode, aMultiFilePrefix, theProgress);
|
||||||
|
}
|
||||||
|
if (!aTransferStatus)
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "The document cannot be translated or gives no result";
|
||||||
|
resetStatic();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (aWriter.WriteStream(theOStream) != IFSelect_RetDone)
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : Write to stream failed";
|
||||||
|
resetStatic();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Message::SendInfo() << "STEP file to stream successfully written";
|
||||||
|
resetStatic();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -325,23 +609,22 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theProgress;
|
(void)theProgress;
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
|
if (GetNode().IsNull() ||
|
||||||
|
!GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
thePath << "\t: Incorrect or empty Configuration Node";
|
<< "Incorrect or empty Configuration Node";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
|
Handle(STEPCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
|
||||||
initStatic(aNode);
|
initStatic(aNode);
|
||||||
personizeWS(theWS);
|
personizeWS(theWS);
|
||||||
STEPControl_Reader aReader;
|
STEPControl_Reader aReader(theWS);
|
||||||
aReader.SetWS(theWS);
|
if (aReader.ReadFile(thePath.ToCString()) != IFSelect_RetDone)
|
||||||
IFSelect_ReturnStatus aReadstat = IFSelect_RetVoid;
|
|
||||||
aReadstat = aReader.ReadFile(thePath.ToCString());
|
|
||||||
if (aReadstat != IFSelect_RetDone)
|
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: STEPCAFControl_Provider : ["
|
||||||
thePath << "\t: abandon, no model loaded";
|
<< thePath << "] : abandon, no model loaded";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -349,8 +632,52 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
aModel->SetLocalLengthUnit(aNode->GlobalParameters.LengthUnit);
|
aModel->SetLocalLengthUnit(aNode->GlobalParameters.LengthUnit);
|
||||||
if (aReader.TransferRoots() <= 0)
|
if (aReader.TransferRoots() <= 0)
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: STEPCAFControl_Provider : [" <<
|
||||||
thePath << "\t:Cannot read any relevant data from the STEP file";
|
thePath << "] : Cannot read any relevant data from the STEP file";
|
||||||
|
resetStatic();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
theShape = aReader.OneShape();
|
||||||
|
resetStatic();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : Read
|
||||||
|
// purpose :
|
||||||
|
//=======================================================================
|
||||||
|
bool STEPCAFControl_Provider::Read(std::istream& theIStream,
|
||||||
|
TopoDS_Shape& theShape,
|
||||||
|
const TCollection_AsciiString theName,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
|
const Message_ProgressRange& theProgress)
|
||||||
|
{
|
||||||
|
(void)theProgress;
|
||||||
|
if (GetNode().IsNull() ||
|
||||||
|
!GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "Incorrect or empty Configuration Node";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
|
||||||
|
initStatic(aNode);
|
||||||
|
personizeWS(theWS);
|
||||||
|
STEPControl_Reader aReader(theWS);
|
||||||
|
if (aReader.ReadStream(theName.ToCString(), theIStream) != IFSelect_RetDone)
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "Abandon, no model loaded from STEP stream";
|
||||||
|
resetStatic();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(aReader.Model());
|
||||||
|
aModel->SetLocalLengthUnit(aNode->GlobalParameters.LengthUnit);
|
||||||
|
if (aReader.TransferRoots() <= 0)
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "Cannot read any relevant data from the STEP stream";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -368,32 +695,36 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
|
if (GetNode().IsNull() ||
|
||||||
|
!GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
thePath << "\t: Incorrect or empty Configuration Node";
|
<< "Incorrect or empty Configuration Node";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
|
Handle(STEPCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
|
||||||
initStatic(aNode);
|
initStatic(aNode);
|
||||||
|
|
||||||
personizeWS(theWS);
|
personizeWS(theWS);
|
||||||
STEPControl_Writer aWriter;
|
STEPControl_Writer aWriter(theWS, Standard_True);
|
||||||
aWriter.SetWS(theWS);
|
|
||||||
IFSelect_ReturnStatus aWritestat = IFSelect_RetVoid;
|
|
||||||
Handle(StepData_StepModel) aModel = aWriter.Model();
|
Handle(StepData_StepModel) aModel = aWriter.Model();
|
||||||
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter));
|
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(
|
||||||
aWritestat = aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress);
|
aNode->InternalParameters.WriteUnit,
|
||||||
|
UnitsMethods_LengthUnit_Millimeter));
|
||||||
|
IFSelect_ReturnStatus aWritestat =
|
||||||
|
aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress);
|
||||||
if (aWritestat != IFSelect_RetDone)
|
if (aWritestat != IFSelect_RetDone)
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
thePath << "\t: abandon, no model loaded";
|
<< "Can't translate shape to STEP model";
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
|
if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
|
||||||
{
|
{
|
||||||
Message::SendFail() << "STEPCAFControl_Provider: Error on writing file";
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "Can't write STEP file " << thePath;
|
||||||
resetStatic();
|
resetStatic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -401,28 +732,50 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
Handle(XSControl_WorkSession) aWS = new XSControl_WorkSession();
|
|
||||||
return Read(thePath, theShape, aWS, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : Write
|
// function : Write
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
bool STEPCAFControl_Provider::Write(std::ostream& theOStream,
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
Handle(XSControl_WorkSession) aWS = new XSControl_WorkSession();
|
if (GetNode().IsNull() ||
|
||||||
return Write(thePath, theShape, aWS, theProgress);
|
!GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "Incorrect or empty Configuration Node";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode) aNode =
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
|
||||||
|
initStatic(aNode);
|
||||||
|
|
||||||
|
personizeWS(theWS);
|
||||||
|
STEPControl_Writer aWriter(theWS, Standard_True);
|
||||||
|
Handle(StepData_StepModel) aModel = aWriter.Model();
|
||||||
|
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(
|
||||||
|
aNode->InternalParameters.WriteUnit,
|
||||||
|
UnitsMethods_LengthUnit_Millimeter));
|
||||||
|
IFSelect_ReturnStatus aWritestat =
|
||||||
|
aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress);
|
||||||
|
if (aWritestat != IFSelect_RetDone)
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "Can't translate shape to STEP model";
|
||||||
|
resetStatic();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (aWriter.WriteStream(theOStream) != IFSelect_RetDone)
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: STEPCAFControl_Provider : "
|
||||||
|
<< "Can't write STEP to stream";
|
||||||
|
resetStatic();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
resetStatic();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@@ -54,35 +54,41 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theDocument document to export
|
|
||||||
//! @param[in] theWS current work session
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
//! Reads a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the import CAD file
|
//! @param[in] theIStream stream to import STEP data
|
||||||
//! @param[out] theDocument document to save result
|
//! @param[out] theDocument document to save result
|
||||||
|
//! @paramp[in] theName name of step file, can be empty
|
||||||
|
//! @param[in] theWS current work session
|
||||||
//! @param theProgress[in] progress indicator
|
//! @param theProgress[in] progress indicator
|
||||||
//! @return true if Read operation has ended correctly
|
//! @return true if Read operation has ended correctly
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
Standard_EXPORT virtual bool Read(std::istream& theIStream,
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
const Handle(TDocStd_Document)& theDocument,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const TCollection_AsciiString theName,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
|
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
//! Writes a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the export CAD file
|
//! @param[in] thePath path to the export CAD file
|
||||||
//! @param[out] theDocument document to export
|
//! @param[out] theDocument document to export
|
||||||
|
//! @param[in] theWS current work session
|
||||||
//! @param theProgress[in] progress indicator
|
//! @param theProgress[in] progress indicator
|
||||||
//! @return true if Write operation has ended correctly
|
//! @return true if Write operation has ended correctly
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
const Handle(TDocStd_Document)& theDocument,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Writes a CAD file, according internal configuration
|
||||||
|
//! @param[in] theOStream stream to export STEP data
|
||||||
|
//! @param[out] theDocument document to export
|
||||||
|
//! @param[in] theWS current work session
|
||||||
|
//! @param theProgress[in] progress indicator
|
||||||
|
//! @return true if Write operation has ended correctly
|
||||||
|
Standard_EXPORT virtual bool Write(std::ostream& theOStream,
|
||||||
|
const Handle(TDocStd_Document)& theDocument,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
|
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
//! Reads a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the import CAD file
|
//! @param[in] thePath path to the import CAD file
|
||||||
//! @param[out] theShape shape to save result
|
//! @param[out] theShape shape to save result
|
||||||
@@ -94,6 +100,19 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Reads a CAD file, according internal configuration
|
||||||
|
//! @param[in] theIStream stream to the step file
|
||||||
|
//! @param[out] theShape shape to save result
|
||||||
|
//! @paramp[in] theName name of step file, can be empty
|
||||||
|
//! @param[in] theWS current work session
|
||||||
|
//! @param theProgress[in] progress indicator
|
||||||
|
//! @return true if Read operation has ended correctly
|
||||||
|
Standard_EXPORT virtual bool Read(std::istream& theIStream,
|
||||||
|
TopoDS_Shape& theShape,
|
||||||
|
const TCollection_AsciiString theName,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
|
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
//! Writes a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the export CAD file
|
//! @param[in] thePath path to the export CAD file
|
||||||
//! @param[out] theShape shape to export
|
//! @param[out] theShape shape to export
|
||||||
@@ -105,23 +124,16 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theShape shape to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
//! Writes a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the export CAD file
|
//! @param[in] theOStream stream to export STEP data
|
||||||
//! @param[out] theShape shape to export
|
//! @param[out] theShape shape to export
|
||||||
|
//! @param[in] theWS current work session
|
||||||
//! @param theProgress[in] progress indicator
|
//! @param theProgress[in] progress indicator
|
||||||
//! @return true if Write operation has ended correctly
|
//! @return true if Write operation has ended correctly
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
Standard_EXPORT virtual bool Write(std::ostream& theOStream,
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
|
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -133,6 +145,14 @@ public:
|
|||||||
//! @return provider's vendor name
|
//! @return provider's vendor name
|
||||||
Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE;
|
Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Sets parameter to update static parameter, that true by default
|
||||||
|
void SetToUpdateStaticParameters(const bool theToUpdate) { myToUpdateStaticParameters = theToUpdate; }
|
||||||
|
|
||||||
|
//! Gets parameter to update static parameter, that true by default
|
||||||
|
bool ToUpdateStaticParameters() const { return myToUpdateStaticParameters; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! Personizes work session with current format.
|
//! Personizes work session with current format.
|
||||||
@@ -149,7 +169,10 @@ private:
|
|||||||
//! Reset used interface static variables
|
//! Reset used interface static variables
|
||||||
void resetStatic();
|
void resetStatic();
|
||||||
|
|
||||||
STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection myOldValues;
|
private:
|
||||||
|
|
||||||
|
bool myToUpdateStaticParameters = true; //!< Flag to updating static parameters
|
||||||
|
STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection myOldValues; //!< Container to save previous static parameters
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -51,30 +51,6 @@ bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Read(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool Vrml_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theWS;
|
|
||||||
return Write(thePath, theDocument, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
if (theDocument.IsNull())
|
if (theDocument.IsNull())
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Error in the Vrml_Provider during reading the file " <<
|
Message::SendFail() << "Error in the Vrml_Provider during reading the file " <<
|
||||||
@@ -118,8 +94,10 @@ bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool Vrml_Provider::Write(const TCollection_AsciiString& thePath,
|
bool Vrml_Provider::Write(const TCollection_AsciiString& thePath,
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
const Handle(TDocStd_Document)& theDocument,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
(void)theWS;
|
||||||
(void)theProgress;
|
(void)theProgress;
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(Vrml_ConfigurationNode)))
|
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(Vrml_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
@@ -152,30 +130,6 @@ bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
(void)theWS;
|
(void)theWS;
|
||||||
return Read(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Write
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool Vrml_Provider::Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
Handle(XSControl_WorkSession)& theWS,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theWS;
|
|
||||||
return Write(thePath, theShape, theProgress);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : Read
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
(void)theProgress;
|
(void)theProgress;
|
||||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(Vrml_ConfigurationNode)))
|
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(Vrml_ConfigurationNode)))
|
||||||
{
|
{
|
||||||
@@ -271,12 +225,14 @@ bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool Vrml_Provider::Write(const TCollection_AsciiString& thePath,
|
bool Vrml_Provider::Write(const TCollection_AsciiString& thePath,
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
(void)theWS;
|
||||||
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
|
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
|
||||||
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
|
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
|
||||||
aShTool->AddShape(theShape);
|
aShTool->AddShape(theShape);
|
||||||
return Write(thePath, aDoc, theProgress);
|
return Write(thePath, aDoc, theWS, theProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@@ -64,24 +64,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theDocument document to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theDocument document to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const Handle(TDocStd_Document)& theDocument,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
//! Reads a CAD file, according internal configuration
|
||||||
//! @param[in] thePath path to the import CAD file
|
//! @param[in] thePath path to the import CAD file
|
||||||
//! @param[out] theShape shape to save result
|
//! @param[out] theShape shape to save result
|
||||||
@@ -104,24 +86,6 @@ public:
|
|||||||
Handle(XSControl_WorkSession)& theWS,
|
Handle(XSControl_WorkSession)& theWS,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Reads a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the import CAD file
|
|
||||||
//! @param[out] theShape shape to save result
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Read operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
|
||||||
TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Writes a CAD file, according internal configuration
|
|
||||||
//! @param[in] thePath path to the export CAD file
|
|
||||||
//! @param[out] theShape shape to export
|
|
||||||
//! @param theProgress[in] progress indicator
|
|
||||||
//! @return true if Write operation has ended correctly
|
|
||||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
|
||||||
const TopoDS_Shape& theShape,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Gets CAD format name of associated provider
|
//! Gets CAD format name of associated provider
|
||||||
|
@@ -22,16 +22,20 @@
|
|||||||
#include <Draw_ProgressIndicator.hxx>
|
#include <Draw_ProgressIndicator.hxx>
|
||||||
#include <Message.hxx>
|
#include <Message.hxx>
|
||||||
#include <IFSelect_SessionPilot.hxx>
|
#include <IFSelect_SessionPilot.hxx>
|
||||||
#include <IGESCAFControl_Reader.hxx>
|
#include <IGESCAFControl_ConfigurationNode.hxx>
|
||||||
#include <IGESCAFControl_Writer.hxx>
|
#include <IGESCAFControl_Provider.hxx>
|
||||||
#include <IGESControl_Controller.hxx>
|
//#include <IGESCAFControl_Reader.hxx>
|
||||||
|
//#include <IGESCAFControl_Writer.hxx>
|
||||||
|
//#include <IGESControl_Controller.hxx>
|
||||||
#include <Interface_Macros.hxx>
|
#include <Interface_Macros.hxx>
|
||||||
#include <OSD_OpenFile.hxx>
|
#include <OSD_OpenFile.hxx>
|
||||||
#include <OSD_Path.hxx>
|
#include <OSD_Path.hxx>
|
||||||
#include <STEPCAFControl_ExternFile.hxx>
|
#include <STEPCAFControl_ConfigurationNode.hxx>
|
||||||
#include <STEPCAFControl_Reader.hxx>
|
#include <STEPCAFControl_Provider.hxx>
|
||||||
#include <STEPCAFControl_Writer.hxx>
|
//#include <STEPCAFControl_ExternFile.hxx>
|
||||||
#include <STEPControl_Controller.hxx>
|
//#include <STEPCAFControl_Reader.hxx>
|
||||||
|
//#include <STEPCAFControl_Writer.hxx>
|
||||||
|
//#include <STEPControl_Controller.hxx>
|
||||||
#include <TDF_Data.hxx>
|
#include <TDF_Data.hxx>
|
||||||
#include <TDocStd_Application.hxx>
|
#include <TDocStd_Application.hxx>
|
||||||
#include <TDocStd_Document.hxx>
|
#include <TDocStd_Document.hxx>
|
||||||
@@ -86,44 +90,44 @@ static bool parseCoordinateSystem(const char* theArg,
|
|||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Standard_Boolean ClearDicWS()
|
//static Standard_Boolean ClearDicWS()
|
||||||
{
|
//{
|
||||||
thedictws.Clear();
|
// thedictws.Clear();
|
||||||
return Standard_True;
|
// return Standard_True;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
static void AddWS(TCollection_AsciiString filename,
|
//static void AddWS(TCollection_AsciiString filename,
|
||||||
const Handle(XSControl_WorkSession)& WS)
|
// const Handle(XSControl_WorkSession)& WS)
|
||||||
{
|
//{
|
||||||
WS->SetVars(new XSDRAW_Vars); // support of DRAW variables
|
// WS->SetVars(new XSDRAW_Vars); // support of DRAW variables
|
||||||
thedictws.Bind(filename, WS);
|
// thedictws.Bind(filename, WS);
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
static Standard_Boolean FillDicWS(NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>& dicFile)
|
//static Standard_Boolean FillDicWS(NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>& dicFile)
|
||||||
{
|
//{
|
||||||
ClearDicWS();
|
//ClearDicWS();
|
||||||
if (dicFile.IsEmpty())
|
//if (dicFile.IsEmpty())
|
||||||
{
|
//{
|
||||||
return Standard_False;
|
// return Standard_False;
|
||||||
}
|
//}
|
||||||
Handle(STEPCAFControl_ExternFile) EF;
|
//Handle(STEPCAFControl_ExternFile) EF;
|
||||||
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>::Iterator DicEFIt(dicFile);
|
//NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>::Iterator DicEFIt(dicFile);
|
||||||
for (; DicEFIt.More(); DicEFIt.Next())
|
//for (; DicEFIt.More(); DicEFIt.Next())
|
||||||
{
|
//{
|
||||||
TCollection_AsciiString filename = DicEFIt.Key();
|
// TCollection_AsciiString filename = DicEFIt.Key();
|
||||||
EF = DicEFIt.Value();
|
// EF = DicEFIt.Value();
|
||||||
AddWS(filename, EF->GetWS());
|
// AddWS(filename, EF->GetWS());
|
||||||
}
|
//}
|
||||||
return Standard_True;
|
// return Standard_True;
|
||||||
}
|
//}
|
||||||
|
|
||||||
static Standard_Boolean SetCurrentWS(TCollection_AsciiString filename)
|
static Standard_Boolean SetCurrentWS(TCollection_AsciiString filename)
|
||||||
{
|
{
|
||||||
if (!thedictws.IsBound(filename)) return Standard_False;
|
//if (!thedictws.IsBound(filename)) return Standard_False;
|
||||||
Handle(XSControl_WorkSession) CurrentWS =
|
//Handle(XSControl_WorkSession) CurrentWS =
|
||||||
Handle(XSControl_WorkSession)::DownCast(thedictws.ChangeFind(filename));
|
// Handle(XSControl_WorkSession)::DownCast(thedictws.ChangeFind(filename));
|
||||||
XSDRAW::Pilot()->SetSession(CurrentWS);
|
//XSDRAW::Pilot()->SetSession(CurrentWS);
|
||||||
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
@@ -227,20 +231,10 @@ static Standard_Integer ReadIges(Draw_Interpretor& di, Standard_Integer argc, co
|
|||||||
di << "Use: " << argv[0] << " Doc filename [mode]: read IGES file to a document\n";
|
di << "Use: " << argv[0] << " Doc filename [mode]: read IGES file to a document\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Handle(IGESCAFControl_ConfigurationNode) aNode =
|
||||||
DeclareAndCast(IGESControl_Controller, ctl, XSDRAW::Controller());
|
new IGESCAFControl_ConfigurationNode();
|
||||||
if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
|
|
||||||
|
|
||||||
TCollection_AsciiString fnom, rnom;
|
|
||||||
Standard_Boolean modfic = XSDRAW::FileAndVar(argv[2], argv[1], "IGES", fnom, rnom);
|
|
||||||
if (modfic) di << " File IGES to read : " << fnom.ToCString() << "\n";
|
|
||||||
else di << " Model taken from the session : " << fnom.ToCString() << "\n";
|
|
||||||
// di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom<<"\n";
|
|
||||||
|
|
||||||
IGESCAFControl_Reader reader(XSDRAW::Session(), modfic);
|
|
||||||
Standard_Integer onlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
|
Standard_Integer onlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
|
||||||
reader.SetReadVisible(onlyvisible == 1);
|
aNode->InternalParameters.ReadOnlyVisible = onlyvisible == 1;
|
||||||
|
|
||||||
if (argc == 4)
|
if (argc == 4)
|
||||||
{
|
{
|
||||||
Standard_Boolean mode = Standard_True;
|
Standard_Boolean mode = Standard_True;
|
||||||
@@ -249,39 +243,11 @@ static Standard_Integer ReadIges(Draw_Interpretor& di, Standard_Integer argc, co
|
|||||||
{
|
{
|
||||||
case '-': mode = Standard_False; break;
|
case '-': mode = Standard_False; break;
|
||||||
case '+': mode = Standard_True; break;
|
case '+': mode = Standard_True; break;
|
||||||
case 'c': reader.SetColorMode(mode); break;
|
case 'c': aNode->InternalParameters.ReadColor = mode; break;
|
||||||
case 'n': reader.SetNameMode(mode); break;
|
case 'n': aNode->InternalParameters.ReadName = mode; break;
|
||||||
case 'l': reader.SetLayerMode(mode); break;
|
case 'l': aNode->InternalParameters.ReadLayer = mode; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di);
|
|
||||||
Message_ProgressScope aRootScope(aProgress->Start(), "IGES import", modfic ? 2 : 1);
|
|
||||||
|
|
||||||
IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
|
|
||||||
if (modfic)
|
|
||||||
{
|
|
||||||
Message_ProgressScope aReadScope(aRootScope.Next(), "File reading", 1);
|
|
||||||
aReadScope.Show();
|
|
||||||
readstat = reader.ReadFile(fnom.ToCString());
|
|
||||||
}
|
|
||||||
else if (XSDRAW::Session()->NbStartingEntities() > 0)
|
|
||||||
{
|
|
||||||
readstat = IFSelect_RetDone;
|
|
||||||
}
|
|
||||||
if (readstat != IFSelect_RetDone)
|
|
||||||
{
|
|
||||||
if (modfic)
|
|
||||||
{
|
|
||||||
di << "Could not read file " << fnom.ToCString() << " , abandon\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
di << "No model loaded\n";
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(TDocStd_Document) doc;
|
Handle(TDocStd_Document) doc;
|
||||||
if (!DDocStd::GetDocument(argv[1], doc, Standard_False))
|
if (!DDocStd::GetDocument(argv[1], doc, Standard_False))
|
||||||
{
|
{
|
||||||
@@ -290,18 +256,18 @@ static Standard_Integer ReadIges(Draw_Interpretor& di, Standard_Integer argc, co
|
|||||||
TDataStd_Name::Set(doc->GetData()->Root(), argv[1]);
|
TDataStd_Name::Set(doc->GetData()->Root(), argv[1]);
|
||||||
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(doc);
|
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(doc);
|
||||||
Draw::Set(argv[1], DD);
|
Draw::Set(argv[1], DD);
|
||||||
// di << "Document saved with name " << argv[1];
|
|
||||||
}
|
}
|
||||||
if (!reader.Transfer(doc, aRootScope.Next()))
|
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di);
|
||||||
|
Handle(IGESCAFControl_Provider) aProvider =
|
||||||
|
new IGESCAFControl_Provider(aNode);
|
||||||
|
aProvider->SetToUpdateStaticParameters(false);
|
||||||
|
Handle(XSControl_WorkSession) aWS = XSDRAW::Session();
|
||||||
|
if (!aProvider->Read(argv[2], doc, aWS, aProgress->Start()))
|
||||||
{
|
{
|
||||||
di << "Cannot read any relevant data from the IGES file\n";
|
di << "Error: Can't read IGES file\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Message::SendInfo() << "Document saved with name " << argv[1];
|
||||||
// Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(doc);
|
|
||||||
// Draw::Set(argv[1],DD);
|
|
||||||
di << "Document saved with name " << argv[1];
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +283,8 @@ static Standard_Integer WriteIges(Draw_Interpretor& di, Standard_Integer argc, c
|
|||||||
di << "Use: " << argv[0] << " Doc filename [mode]: write document to IGES file\n";
|
di << "Use: " << argv[0] << " Doc filename [mode]: write document to IGES file\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Handle(IGESCAFControl_ConfigurationNode) aNode =
|
||||||
|
new IGESCAFControl_ConfigurationNode();
|
||||||
Handle(TDocStd_Document) Doc;
|
Handle(TDocStd_Document) Doc;
|
||||||
DDocStd::GetDocument(argv[1], Doc);
|
DDocStd::GetDocument(argv[1], Doc);
|
||||||
if (Doc.IsNull())
|
if (Doc.IsNull())
|
||||||
@@ -325,19 +292,6 @@ static Standard_Integer WriteIges(Draw_Interpretor& di, Standard_Integer argc, c
|
|||||||
di << argv[1] << " is not a document\n";
|
di << argv[1] << " is not a document\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSDRAW::SetNorm("IGES");
|
|
||||||
|
|
||||||
TCollection_AsciiString fnom, rnom;
|
|
||||||
const Standard_Boolean modfic = XSDRAW::FileAndVar(argv[2], argv[1], "IGES", fnom, rnom);
|
|
||||||
|
|
||||||
// IGESControl_Writer ICW (Interface_Static::CVal("write.iges.unit"),
|
|
||||||
// Interface_Static::IVal("write.iges.brep.mode"));
|
|
||||||
|
|
||||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di);
|
|
||||||
Message_ProgressScope aRootScope(aProgress->Start(), "IGES export", modfic ? 2 : 1);
|
|
||||||
|
|
||||||
IGESCAFControl_Writer writer(XSDRAW::Session(), Standard_True);
|
|
||||||
if (argc == 4)
|
if (argc == 4)
|
||||||
{
|
{
|
||||||
Standard_Boolean mode = Standard_True;
|
Standard_Boolean mode = Standard_True;
|
||||||
@@ -346,30 +300,21 @@ static Standard_Integer WriteIges(Draw_Interpretor& di, Standard_Integer argc, c
|
|||||||
{
|
{
|
||||||
case '-': mode = Standard_False; break;
|
case '-': mode = Standard_False; break;
|
||||||
case '+': mode = Standard_True; break;
|
case '+': mode = Standard_True; break;
|
||||||
case 'c': writer.SetColorMode(mode); break;
|
case 'c': aNode->InternalParameters.WriteColor = mode; break;
|
||||||
case 'n': writer.SetNameMode(mode); break;
|
case 'n': aNode->InternalParameters.WriteName = mode; break;
|
||||||
case 'l': writer.SetLayerMode(mode); break;
|
case 'l': aNode->InternalParameters.WriteLayer = mode; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writer.Transfer(Doc, aRootScope.Next());
|
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di);
|
||||||
|
Handle(IGESCAFControl_Provider) aProvider =
|
||||||
if (modfic)
|
new IGESCAFControl_Provider(aNode);
|
||||||
|
aProvider->SetToUpdateStaticParameters(false);
|
||||||
|
Handle(XSControl_WorkSession) aWS = XSDRAW::Session();
|
||||||
|
const TCollection_AsciiString aPath = argv[2];
|
||||||
|
if (!aProvider->Write(aPath, Doc, aWS, aProgress->Start()))
|
||||||
{
|
{
|
||||||
Message_ProgressScope aWriteScope(aRootScope.Next(), "File writing", 1);
|
di << "Error: Can't write IGES file\n";
|
||||||
aWriteScope.Show();
|
return 1;
|
||||||
di << "Writing IGES model to file " << argv[2] << "\n";
|
|
||||||
if (writer.Write(argv[2]))
|
|
||||||
{
|
|
||||||
di << " Write OK\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
di << " Write failed\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
di << "Document has been translated into the session";
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -380,11 +325,6 @@ static Standard_Integer WriteIges(Draw_Interpretor& di, Standard_Integer argc, c
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
static Standard_Integer ReadStep(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
static Standard_Integer ReadStep(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||||
{
|
{
|
||||||
DeclareAndCast(STEPControl_Controller, ctl, XSDRAW::Controller());
|
|
||||||
if (ctl.IsNull())
|
|
||||||
{
|
|
||||||
XSDRAW::SetNorm ("STEP");
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_CString aDocName = NULL;
|
Standard_CString aDocName = NULL;
|
||||||
TCollection_AsciiString aFilePath, aModeStr;
|
TCollection_AsciiString aFilePath, aModeStr;
|
||||||
@@ -411,101 +351,73 @@ static Standard_Integer ReadStep(Draw_Interpretor& di, Standard_Integer argc, co
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Syntax error at '" << argv[anArgIter] << "'";
|
di << "Syntax error at '" << argv[anArgIter] << "'";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Handle(STEPCAFControl_ConfigurationNode) aNode =
|
||||||
TCollection_AsciiString aFileName, anOldVarName;
|
new STEPCAFControl_ConfigurationNode();
|
||||||
Standard_Boolean isFileMode = XSDRAW::FileAndVar (aFilePath.ToCString(), aDocName, "STEP", aFileName, anOldVarName);
|
|
||||||
if (isFileMode) di << " File STEP to read : " << aFileName << "\n";
|
|
||||||
else di << " Model taken from the session : " << aFileName << "\n";
|
|
||||||
// di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom<<"\n";
|
|
||||||
|
|
||||||
STEPCAFControl_Reader aReader (XSDRAW::Session(), isFileMode);
|
|
||||||
if (!aModeStr.IsEmpty())
|
if (!aModeStr.IsEmpty())
|
||||||
{
|
{
|
||||||
Standard_Boolean aMode = Standard_True;
|
Standard_Boolean aMode = Standard_True;
|
||||||
for (Standard_Integer i = 1; aModeStr.Value (i); ++i)
|
for (Standard_Integer i = 1; aModeStr.Value (i); ++i)
|
||||||
{
|
{
|
||||||
switch (aModeStr.Value (i))
|
switch (aModeStr.Value(i))
|
||||||
{
|
{
|
||||||
case '-' : aMode = Standard_False; break;
|
case '-': aMode = Standard_False; break;
|
||||||
case '+' : aMode = Standard_True; break;
|
case '+': aMode = Standard_True; break;
|
||||||
case 'c' : aReader.SetColorMode (aMode); break;
|
case 'c': aNode->InternalParameters.WriteColor = aMode; break;
|
||||||
case 'n' : aReader.SetNameMode (aMode); break;
|
case 'n': aNode->InternalParameters.WriteName = aMode; break;
|
||||||
case 'l' : aReader.SetLayerMode (aMode); break;
|
case 'l': aNode->InternalParameters.WriteLayer = aMode; break;
|
||||||
case 'v' : aReader.SetPropsMode (aMode); break;
|
case 'v': aNode->InternalParameters.WriteProps = aMode; break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Message::SendFail() << "Syntax error at '" << aModeStr << "'\n";
|
di << "Syntax error at '" << aModeStr << "'\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
|
|
||||||
Message_ProgressScope aRootScope (aProgress->Start(), "STEP import", isFileMode ? 2 : 1);
|
|
||||||
|
|
||||||
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
|
|
||||||
if (isFileMode)
|
|
||||||
{
|
|
||||||
Message_ProgressScope aReadScope (aRootScope.Next(), "File reading", 1);
|
|
||||||
aReadScope.Show();
|
|
||||||
if (toTestStream)
|
|
||||||
{
|
|
||||||
std::ifstream aStream;
|
|
||||||
OSD_OpenStream (aStream, aFileName.ToCString(), std::ios::in | std::ios::binary);
|
|
||||||
TCollection_AsciiString aFolder, aFileNameShort;
|
|
||||||
OSD_Path::FolderAndFileFromPath (aFileName, aFolder, aFileNameShort);
|
|
||||||
aReadStat = aReader.ReadStream (aFileNameShort.ToCString(), aStream);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aReadStat = aReader.ReadFile (aFileName.ToCString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (XSDRAW::Session()->NbStartingEntities() > 0)
|
|
||||||
{
|
|
||||||
aReadStat = IFSelect_RetDone;
|
|
||||||
}
|
|
||||||
if (aReadStat != IFSelect_RetDone)
|
|
||||||
{
|
|
||||||
if (isFileMode)
|
|
||||||
{
|
|
||||||
di << "Could not read file " << aFileName << " , abandon\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
di << "No model loaded\n";
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(TDocStd_Document) aDoc;
|
Handle(TDocStd_Document) aDoc;
|
||||||
if (!DDocStd::GetDocument (aDocName, aDoc, Standard_False))
|
if (!DDocStd::GetDocument(aDocName, aDoc, Standard_False))
|
||||||
{
|
{
|
||||||
Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
|
Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
|
||||||
anApp->NewDocument("BinXCAF", aDoc);
|
anApp->NewDocument("BinXCAF", aDoc);
|
||||||
TDataStd_Name::Set (aDoc->GetData()->Root(), aDocName);
|
TDataStd_Name::Set(aDoc->GetData()->Root(), aDocName);
|
||||||
Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument (aDoc);
|
Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument(aDoc);
|
||||||
Draw::Set (aDocName, aDrawDoc);
|
Draw::Set(aDocName, aDrawDoc);
|
||||||
// di << "Document saved with name " << aDocName;
|
|
||||||
}
|
}
|
||||||
if (!aReader.Transfer (aDoc, aRootScope.Next()))
|
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
|
||||||
|
Handle(STEPCAFControl_Provider) aProvider =
|
||||||
|
new STEPCAFControl_Provider(aNode);
|
||||||
|
aProvider->SetToUpdateStaticParameters(false);
|
||||||
|
Standard_Boolean aReadStat = Standard_False;
|
||||||
|
Handle(XSControl_WorkSession) aWS = XSDRAW::Session();
|
||||||
|
if (toTestStream)
|
||||||
|
{
|
||||||
|
std::ifstream aStream;
|
||||||
|
OSD_OpenStream (aStream, aFilePath.ToCString(), std::ios::in | std::ios::binary);
|
||||||
|
TCollection_AsciiString aFolder, aFileNameShort;
|
||||||
|
OSD_Path::FolderAndFileFromPath (aFilePath, aFolder, aFileNameShort);
|
||||||
|
aReadStat =
|
||||||
|
aProvider->Read(aStream, aDoc, aFilePath, aWS, aProgress->Start());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aReadStat =
|
||||||
|
aProvider->Read(aFilePath, aDoc, aWS, aProgress->Start());
|
||||||
|
}
|
||||||
|
if (!aReadStat)
|
||||||
{
|
{
|
||||||
di << "Cannot read any relevant data from the STEP file\n";
|
di << "Cannot read any relevant data from the STEP file\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument (aDoc);
|
Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument (aDoc);
|
||||||
Draw::Set (aDocName, aDrawDoc);
|
Draw::Set (aDocName, aDrawDoc);
|
||||||
di << "Document saved with name " << aDocName;
|
Message::SendInfo() << "Document saved with name " << aDocName;
|
||||||
|
//NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> aDicFile = aReader.ExternFiles();
|
||||||
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> aDicFile = aReader.ExternFiles();
|
//FillDicWS (aDicFile);
|
||||||
FillDicWS (aDicFile);
|
//AddWS (aFileName, XSDRAW::Session());
|
||||||
AddWS (aFileName, XSDRAW::Session());
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,22 +427,15 @@ static Standard_Integer ReadStep(Draw_Interpretor& di, Standard_Integer argc, co
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
static Standard_Integer WriteStep(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
static Standard_Integer WriteStep(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||||
{
|
{
|
||||||
DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller());
|
|
||||||
if (ctl.IsNull())
|
|
||||||
{
|
|
||||||
XSDRAW::SetNorm ("STEP");
|
|
||||||
}
|
|
||||||
STEPCAFControl_Writer aWriter (XSDRAW::Session(), Standard_True);
|
|
||||||
|
|
||||||
Handle(TDocStd_Document) aDoc;
|
Handle(TDocStd_Document) aDoc;
|
||||||
TCollection_AsciiString aDocName, aFilePath;
|
TCollection_AsciiString aDocName, aFilePath;
|
||||||
STEPControl_StepModelType aMode = STEPControl_AsIs;
|
Handle(STEPCAFControl_ConfigurationNode) aNode =
|
||||||
|
new STEPCAFControl_ConfigurationNode();
|
||||||
bool hasModeArg = false, toTestStream = false;
|
bool hasModeArg = false, toTestStream = false;
|
||||||
TCollection_AsciiString aMultiFilePrefix, aLabelName;
|
|
||||||
TDF_Label aLabel;
|
TDF_Label aLabel;
|
||||||
for (Standard_Integer anArgIter = 1; anArgIter < argc; ++anArgIter)
|
for (Standard_Integer anArgIter = 1; anArgIter < argc; ++anArgIter)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString anArgCase (argv[anArgIter]);
|
TCollection_AsciiString anArgCase(argv[anArgIter]);
|
||||||
anArgCase.LowerCase();
|
anArgCase.LowerCase();
|
||||||
if (anArgCase == "-stream")
|
if (anArgCase == "-stream")
|
||||||
{
|
{
|
||||||
@@ -539,7 +444,7 @@ static Standard_Integer WriteStep(Draw_Interpretor& di, Standard_Integer argc, c
|
|||||||
else if (aDocName.IsEmpty())
|
else if (aDocName.IsEmpty())
|
||||||
{
|
{
|
||||||
Standard_CString aDocNameStr = argv[anArgIter];
|
Standard_CString aDocNameStr = argv[anArgIter];
|
||||||
DDocStd::GetDocument (aDocNameStr, aDoc);
|
DDocStd::GetDocument(aDocNameStr, aDoc);
|
||||||
if (aDoc.IsNull())
|
if (aDoc.IsNull())
|
||||||
{
|
{
|
||||||
di << "Syntax error: '" << argv[anArgIter] << "' is not a document";
|
di << "Syntax error: '" << argv[anArgIter] << "' is not a document";
|
||||||
@@ -554,52 +459,57 @@ static Standard_Integer WriteStep(Draw_Interpretor& di, Standard_Integer argc, c
|
|||||||
else if (!hasModeArg)
|
else if (!hasModeArg)
|
||||||
{
|
{
|
||||||
hasModeArg = true;
|
hasModeArg = true;
|
||||||
switch (anArgCase.Value (1))
|
switch (anArgCase.Value(1))
|
||||||
{
|
{
|
||||||
case 'a':
|
case 'a':
|
||||||
case '0': aMode = STEPControl_AsIs; break;
|
case '0': aNode->InternalParameters.WriteModelType = STEPControl_AsIs; break;
|
||||||
case 'f':
|
case 'f':
|
||||||
case '1': aMode = STEPControl_FacetedBrep; break;
|
case '1': aNode->InternalParameters.WriteModelType = STEPControl_FacetedBrep; break;
|
||||||
case 's':
|
case 's':
|
||||||
case '2': aMode = STEPControl_ShellBasedSurfaceModel; break;
|
case '2': aNode->InternalParameters.WriteModelType = STEPControl_ShellBasedSurfaceModel; break;
|
||||||
case 'm':
|
case 'm':
|
||||||
case '3': aMode = STEPControl_ManifoldSolidBrep; break;
|
case '3': aNode->InternalParameters.WriteModelType = STEPControl_ManifoldSolidBrep; break;
|
||||||
case 'w':
|
case 'w':
|
||||||
case '4': aMode = STEPControl_GeometricCurveSet; break;
|
case '4': aNode->InternalParameters.WriteModelType = STEPControl_GeometricCurveSet; break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
di << "Syntax error: mode '" << argv[anArgIter] << "' is incorrect [give fsmw]";
|
di << "Syntax error: mode '" << anArgCase.Value(1) << "' is incorrect [give fsmw]";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Standard_Boolean wrmode = Standard_True;
|
Standard_Boolean wrmode = Standard_True;
|
||||||
for (Standard_Integer i = 1; i <= anArgCase.Length(); ++i)
|
for (Standard_Integer i = 1; i <= anArgCase.Length(); ++i)
|
||||||
{
|
{
|
||||||
switch (anArgCase.Value (i))
|
switch (anArgCase.Value(i))
|
||||||
{
|
{
|
||||||
case '-' : wrmode = Standard_False; break;
|
case '-': wrmode = Standard_False; break;
|
||||||
case '+' : wrmode = Standard_True; break;
|
case '+': wrmode = Standard_True; break;
|
||||||
case 'c' : aWriter.SetColorMode (wrmode); break;
|
case 'c': aNode->InternalParameters.WriteColor = wrmode; break;
|
||||||
case 'n' : aWriter.SetNameMode (wrmode); break;
|
case 'n': aNode->InternalParameters.WriteName = wrmode; break;
|
||||||
case 'l' : aWriter.SetLayerMode (wrmode); break;
|
case 'l': aNode->InternalParameters.WriteLayer = wrmode; break;
|
||||||
case 'v' : aWriter.SetPropsMode (wrmode); break;
|
case 'v': aNode->InternalParameters.WriteProps = wrmode; break;
|
||||||
}
|
default:
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (aMultiFilePrefix.IsEmpty()
|
|
||||||
&& anArgCase.Search (":") == -1)
|
|
||||||
{
|
{
|
||||||
aMultiFilePrefix = argv[anArgIter];
|
di << "Syntax error at '" << anArgCase.Value(i) << "'\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (aNode->InternalParameters.WriteMultiPrefix.IsEmpty()
|
||||||
|
&& anArgCase.Search(":") == -1)
|
||||||
|
{
|
||||||
|
aNode->InternalParameters.WriteMultiPrefix = argv[anArgIter];
|
||||||
}
|
}
|
||||||
else if (aLabel.IsNull())
|
else if (aLabel.IsNull())
|
||||||
{
|
{
|
||||||
if (!DDF::FindLabel (aDoc->Main().Data(), argv[anArgIter], aLabel)
|
if (!DDF::FindLabel(aDoc->Main().Data(), argv[anArgIter], aLabel)
|
||||||
|| aLabel.IsNull())
|
|| aLabel.IsNull())
|
||||||
{
|
{
|
||||||
di << "Syntax error: No label for entry '" << argv[anArgIter] << "'";
|
di << "Syntax error: No label for entry '" << argv[anArgIter] << "'";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
aLabelName = argv[anArgIter];
|
aNode->InternalParameters.WriteLabels.Append(argv[anArgIter]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -612,84 +522,34 @@ static Standard_Integer WriteStep(Draw_Interpretor& di, Standard_Integer argc, c
|
|||||||
di << "Syntax error: wrong number of arguments";
|
di << "Syntax error: wrong number of arguments";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di);
|
||||||
TCollection_AsciiString aFileName, anOldVarName;
|
Handle(STEPCAFControl_Provider) aProvider =
|
||||||
const Standard_Boolean isFileMode = XSDRAW::FileAndVar (aFilePath.ToCString(), aDocName.ToCString(), "STEP", aFileName, anOldVarName);
|
new STEPCAFControl_Provider(aNode);
|
||||||
|
aProvider->SetToUpdateStaticParameters(false);
|
||||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
|
Standard_Boolean aReadStat = Standard_False;
|
||||||
Message_ProgressScope aRootScope (aProgress->Start(), "STEP export", isFileMode ? 2 : 1);
|
Handle(XSControl_WorkSession) aWS = XSDRAW::Session();
|
||||||
if (!aLabel.IsNull())
|
|
||||||
{
|
|
||||||
di << "Translating label " << aLabelName << " of document " << aDocName << " to STEP\n";
|
|
||||||
if (!aWriter.Transfer (aLabel, aMode,
|
|
||||||
!aMultiFilePrefix.IsEmpty() ? aMultiFilePrefix.ToCString() : NULL,
|
|
||||||
aRootScope.Next()))
|
|
||||||
{
|
|
||||||
di << "Error: the label of document cannot be translated or gives no result";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
di << "Translating document " << aDocName << " to STEP\n";
|
|
||||||
if (!aWriter.Transfer (aDoc, aMode,
|
|
||||||
!aMultiFilePrefix.IsEmpty() ? aMultiFilePrefix.ToCString() : NULL,
|
|
||||||
aRootScope.Next()))
|
|
||||||
{
|
|
||||||
di << "Error: The document cannot be translated or gives no result\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isFileMode)
|
|
||||||
{
|
|
||||||
di << "Document has been translated into the session";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Message_ProgressScope aWriteScope (aRootScope.Next(), "File writing", 1);
|
|
||||||
aWriteScope.Show();
|
|
||||||
di << "Writing STEP file " << aFilePath << "\n";
|
|
||||||
|
|
||||||
IFSelect_ReturnStatus aStat = IFSelect_RetVoid;
|
|
||||||
if (toTestStream)
|
if (toTestStream)
|
||||||
{
|
{
|
||||||
std::ofstream aStream;
|
std::ofstream aStream;
|
||||||
OSD_OpenStream (aStream, aFilePath, std::ios::out | std::ios::binary);
|
OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary);
|
||||||
aStat = aWriter.WriteStream (aStream);
|
TCollection_AsciiString aFolder, aFileNameShort;
|
||||||
aStream.close();
|
OSD_Path::FolderAndFileFromPath(aFilePath, aFolder, aFileNameShort);
|
||||||
if (!aStream.good()
|
aReadStat =
|
||||||
&& aStat == IFSelect_RetDone)
|
aProvider->Write(aStream, aDoc, aWS, aProgress->Start());
|
||||||
{
|
|
||||||
aStat = IFSelect_RetFail;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aStat = aWriter.Write (aFilePath.ToCString());
|
aReadStat =
|
||||||
|
aProvider->Write(aFilePath, aDoc, aWS, aProgress->Start());
|
||||||
}
|
}
|
||||||
|
if (!aReadStat)
|
||||||
switch (aStat)
|
|
||||||
{
|
{
|
||||||
case IFSelect_RetVoid:
|
di << "Cannot write any relevant data to the STEP file\n";
|
||||||
{
|
return 1;
|
||||||
di << "Error: no file written";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IFSelect_RetDone:
|
|
||||||
{
|
|
||||||
di << "File " << aFilePath << " written\n";
|
|
||||||
|
|
||||||
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> aDicFile = aWriter.ExternFiles();
|
|
||||||
FillDicWS (aDicFile);
|
|
||||||
AddWS (aFilePath, XSDRAW::Session());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
di << "Error on writing file";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
//NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> aDicFile = aWriter.ExternFiles();
|
||||||
|
//FillDicWS(aDicFile);
|
||||||
|
//AddWS(aFilePath, XSDRAW::Session());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1228,7 +1088,8 @@ static Standard_Integer ReadFile(Draw_Interpretor& theDI,
|
|||||||
if (aStat)
|
if (aStat)
|
||||||
{
|
{
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
aStat = isNoDoc ? aConf->Read(aFilePath, aShape) : aConf->Read(aFilePath, aDoc);
|
Handle(XSControl_WorkSession) aWS = XSDRAW::Session();
|
||||||
|
aStat = isNoDoc ? aConf->Read(aFilePath, aShape, aWS) : aConf->Read(aFilePath, aDoc, aWS);
|
||||||
if(isNoDoc && aStat)
|
if(isNoDoc && aStat)
|
||||||
{
|
{
|
||||||
DBRep::Set(aDocShapeName.ToCString(), aShape);
|
DBRep::Set(aDocShapeName.ToCString(), aShape);
|
||||||
@@ -1304,6 +1165,7 @@ static Standard_Integer WriteFile(Draw_Interpretor& theDI,
|
|||||||
{
|
{
|
||||||
aStat = aConf->Load(aConfString);
|
aStat = aConf->Load(aConfString);
|
||||||
}
|
}
|
||||||
|
Handle(XSControl_WorkSession) aWS = XSDRAW::Session();
|
||||||
if (aStat)
|
if (aStat)
|
||||||
{
|
{
|
||||||
if(isNoDoc)
|
if(isNoDoc)
|
||||||
@@ -1314,11 +1176,11 @@ static Standard_Integer WriteFile(Draw_Interpretor& theDI,
|
|||||||
Message::SendFail() << "Error: incorrect shape";
|
Message::SendFail() << "Error: incorrect shape";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
aStat = aConf->Write(aFilePath, aShape);
|
aStat = aConf->Write(aFilePath, aShape, aWS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aStat = aConf->Write(aFilePath, aDoc);
|
aStat = aConf->Write(aFilePath, aDoc, aWS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!aStat)
|
if (!aStat)
|
||||||
|
Reference in New Issue
Block a user