1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
dpasukhi
56afc045ca 0033331: Data Exchange, Step Import - Unsupported Representation Items
Fixed problem with iteration on Null RI
Implemented new RI 3 types
2023-02-20 12:36:57 +00:00
67 changed files with 3675 additions and 3140 deletions

View File

@@ -295,18 +295,6 @@ TCollection_AsciiString DE_ConfigurationContext::StringVal(const TCollection_Asc
return GetString(theParam, aVal, theScope) ? aVal : theDefValue;
}
//=======================================================================
//function : StringSeqVal
//purpose :
//=======================================================================
TColStd_ListOfAsciiString DE_ConfigurationContext::StringSeqVal(const TCollection_AsciiString& theParam,
const TColStd_ListOfAsciiString& theDefValue,
const TCollection_AsciiString& theScope) const
{
TColStd_ListOfAsciiString aVal;
return GetStringSeq(theParam, aVal, theScope) ? aVal : theDefValue;
}
//=======================================================================
//function : GetReal
//purpose :

View File

@@ -139,15 +139,6 @@ public:
const TCollection_AsciiString& theDefValue,
const TCollection_AsciiString& theScope = "") const;
//! Gets value of parameter as being of specific type
//! @param[in] theParam complex parameter name
//! @param[in] theDefValue value by default if param is not found or has wrong type
//! @param[in] theScope base parameter name
//! @return specific type value
Standard_EXPORT TColStd_ListOfAsciiString StringSeqVal(const TCollection_AsciiString& theParam,
const TColStd_ListOfAsciiString& theDefValue,
const TCollection_AsciiString& theScope = "") const;
//! Gets internal resource map
//! @return map with resource value
Standard_EXPORT const DE_ResourceMap& GetInternalMap() const { return myResource; }

View File

@@ -114,15 +114,6 @@ bool DE_ConfigurationNode::IsExportSupported() const
return false;
}
//=======================================================================
// function : IsExportSupported
// purpose :
//=======================================================================
bool DE_ConfigurationNode::IsStreamSupported() const
{
return false;
}
//=======================================================================
// function : CheckForSupport
// purpose :

View File

@@ -102,10 +102,6 @@ public:
//! @return Standard_True if export is support
Standard_EXPORT virtual bool IsExportSupported() const;
//! Checks the stream for import/export supporting
//! @return Standard_True if stream is support
Standard_EXPORT virtual bool IsStreamSupported() const;
//! Gets CAD format name of associated provider
//! @return provider CAD format
Standard_EXPORT virtual TCollection_AsciiString GetFormat() const = 0;
@@ -132,11 +128,17 @@ public:
//! Gets the provider loading status
//! @return Standard_True if the load is correct
Standard_Boolean IsEnabled() const { return myIsEnabled; }
Standard_Boolean IsEnabled() const
{
return myIsEnabled;
}
//! Sets the provider loading status
//! @param[in] theIsLoaded input load status
void SetEnabled(const Standard_Boolean theIsLoaded) { myIsEnabled = theIsLoaded; }
void SetEnabled(const Standard_Boolean theIsLoaded)
{
myIsEnabled = theIsLoaded;
}
public:

View File

@@ -47,27 +47,7 @@ Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
(void)theWS;
(void)theProgress;
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " doesn't support read operation";
return Standard_False;
}
//=======================================================================
// function : Read
// purpose :
//=======================================================================
bool DE_Provider::Read(std::istream& theIStream,
const Handle(TDocStd_Document)& theDocument,
const TCollection_AsciiString theName,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
(void)theIStream;
(void)theDocument;
(void)theName;
(void)theWS;
(void)theProgress;
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " doesn't support stream read operation";
" " << GetVendor() <<" doesn't support read operation";
return Standard_False;
}
@@ -89,21 +69,35 @@ Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
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 :
//=======================================================================
bool DE_Provider::Write(std::ostream& theOStream,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress)
{
(void)theOStream;
(void)thePath;
(void)theDocument;
(void)theWS;
(void)theProgress;
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " doesn't support stream write operation";
" " << GetVendor() << " doesn't support write operation";
return Standard_False;
}
@@ -125,26 +119,6 @@ Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
return Standard_False;
}
//=======================================================================
// function : Read
// purpose :
//=======================================================================
bool DE_Provider::Read(std::istream& theIStream,
TopoDS_Shape& theShape,
const TCollection_AsciiString theName,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
(void)theIStream;
(void)theShape;
(void)theName;
(void)theWS;
(void)theProgress;
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " doesn't support stream read operation";
return Standard_False;
}
//=======================================================================
// function : Write
// purpose :
@@ -163,20 +137,34 @@ Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
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 :
//=======================================================================
bool DE_Provider::Write(std::ostream& theOStream,
const TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress)
{
(void)theOStream;
(void)thePath;
(void)theShape;
(void)theWS;
(void)theProgress;
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " doesn't support stream write operation";
" " << GetVendor() << " doesn't support write operation";
return Standard_False;
}

View File

@@ -61,23 +61,10 @@ public:
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return True if Read was successful
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Reads a CAD file, according internal configuration
//! @param[in] theIStream stream to import CAD data
//! @param[out] theDocument document to save result
//! @paramp[in] theName name of CAD 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,
const Handle(TDocStd_Document)& theDocument,
const TCollection_AsciiString theName,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Writes a CAD file, according internal configuration
//! @param[in] thePath path to the export CAD file
@@ -85,21 +72,28 @@ public:
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return True if Write was successful
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_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
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] theOStream stream to export CAD data
//! @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(std::ostream& theOStream,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! @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
//! @param[in] thePath path to the import CAD file
@@ -107,23 +101,10 @@ public:
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return True if Read was successful
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Reads a CAD file, according internal configuration
//! @param[in] theIStream stream to the CAD file
//! @param[out] theShape shape to save result
//! @paramp[in] theName name of CAD 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());
Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Writes a CAD file, according internal configuration
//! @param[in] thePath path to the export CAD file
@@ -131,21 +112,28 @@ public:
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return True if Write was successful
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
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] theOStream stream to export CAD data
//! @param[in] thePath path to the export CAD file
//! @param[out] theShape shape 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 TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! @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:
@@ -159,11 +147,17 @@ public:
//! Gets internal configuration node
//! @return configuration node object
Handle(DE_ConfigurationNode) GetNode() const { return myNode; }
Handle(DE_ConfigurationNode) GetNode() const
{
return myNode;
}
//! Sets internal configuration node
//! @param[in] theNode configuration node to set
void SetNode(const Handle(DE_ConfigurationNode)& theNode) { myNode = theNode; }
void SetNode(const Handle(DE_ConfigurationNode)& theNode)
{
myNode = theNode;
}
private:

View File

@@ -31,7 +31,7 @@ namespace
{
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
{
static const TCollection_AsciiString aScope("global");
static const TCollection_AsciiString aScope ("global");
return aScope;
}
@@ -109,6 +109,10 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
{
return Standard_False;
}
if (theWS.IsNull())
{
return Read(thePath, theDocument, theProgress);
}
Handle(DE_Provider) aProvider;
if (!FindProvider(thePath, Standard_True, aProvider))
{
@@ -130,6 +134,10 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
{
return Standard_False;
}
if (theWS.IsNull())
{
return Write(thePath, theDocument, theProgress);
}
Handle(DE_Provider) aProvider;
if (!FindProvider(thePath, Standard_False, aProvider))
{
@@ -138,6 +146,46 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
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
// purpose :
@@ -147,6 +195,10 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
if (theWS.IsNull())
{
return Read(thePath, theShape, theProgress);
}
Handle(DE_Provider) aProvider;
if (!FindProvider(thePath, Standard_True, aProvider))
{
@@ -164,6 +216,10 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
if (theWS.IsNull())
{
return Write(thePath, theShape, theProgress);
}
Handle(DE_Provider) aProvider;
if (!FindProvider(thePath, Standard_False, aProvider))
{
@@ -172,6 +228,39 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
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
// purpose :

View File

@@ -94,6 +94,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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
//! @param[in] thePath path to the import CAD file
//! @param[out] theShape shape to save result
@@ -116,6 +134,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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:
//! Updates values according the resource file

View File

@@ -51,21 +51,7 @@ bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
if (theDocument.IsNull())
{
Message::SendFail() << "Error: DEBRepCascade_Provider : "
<< "Null document";
return false;
}
TopoDS_Shape aShape;
if (!Read(thePath, aShape, theWS, theProgress))
{
return false;
}
Handle(XCAFDoc_ShapeTool) aShTool =
XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aShTool->AddShape(aShape);
return true;
return Read(thePath, theDocument, theProgress);
}
//=======================================================================
@@ -78,15 +64,49 @@ bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
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 " <<
thePath << "\t: theDocument shouldn't be null";
return false;
}
TopoDS_Shape aShape;
if (!Read(thePath, aShape, theProgress))
{
return false;
}
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aShTool->AddShape(aShape);
return true;
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress)
{
TopoDS_Shape aShape;
TDF_LabelSequence aLabels;
Handle(XCAFDoc_ShapeTool) aSTool =
XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aSTool->GetFreeShapes(aLabels);
if (aLabels.Length() <= 0)
{
Message::SendFail() << "Error: DEBRepCascade_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
thePath << "\t: Document contain no shapes";
return false;
}
@@ -106,7 +126,7 @@ bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
}
aShape = aComp;
}
return Write(thePath, aShape, theWS, theProgress);
return Write(thePath, aShape, theProgress);
}
//=======================================================================
@@ -119,45 +139,7 @@ bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
bool isBinaryFormat = true;
{
// probe file header to recognize format
const Handle(OSD_FileSystem)& aFileSystem =
OSD_FileSystem::DefaultFileSystem();
std::shared_ptr<std::istream> aFile =
aFileSystem->OpenIStream(thePath, std::ios::in | std::ios::binary);
if (aFile.get() == NULL)
{
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
<< thePath << "] : Cannot open the file";
return false;
}
char aStringBuf[255] = {};
aFile->read(aStringBuf, 255);
if (aFile->fail())
{
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
<< thePath << "] : Cannot open the file";
return false;
}
isBinaryFormat = !(::strncmp(aStringBuf, "DBRep_DrawableShape", 19) == 0);
}
Standard_Boolean aReadStatus = Standard_True;
if (isBinaryFormat)
{
aReadStatus = BinTools::Read(theShape, thePath.ToCString(), theProgress);
}
else
{
aReadStatus =
BRepTools::Read(theShape, thePath.ToCString(), BRep_Builder(), theProgress);
}
if (!aReadStatus)
{
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
<< thePath << "] : Cannot read data from the file";
}
return aReadStatus;
return Read(thePath, theShape, theProgress);
}
//=======================================================================
@@ -170,72 +152,127 @@ bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(DEBRepCascade_ConfigurationNode)))
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;
{
Message::SendFail() << "Error: DEBRepCascade_Provider : "
<< "Incorrect or empty Configuration Node";
return false;
}
Handle(DEBRepCascade_ConfigurationNode) aNode =
Handle(DEBRepCascade_ConfigurationNode)::DownCast(GetNode());
if (aNode->InternalParameters.WriteBinary)
{
if (aNode->InternalParameters.WriteVersionBin >
static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_UPPER) ||
aNode->InternalParameters.WriteVersionBin <
static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_LOWER))
// probe file header to recognize format
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
std::shared_ptr<std::istream> aFile = aFileSystem->OpenIStream(thePath, std::ios::in | std::ios::binary);
if (aFile.get() == NULL)
{
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
<< thePath << "] : Unknown format version";
return false;
}
if (aNode->InternalParameters.WriteNormals &&
aNode->InternalParameters.WriteVersionBin < BinTools_FormatVersion_VERSION_4)
{
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
<< thePath << "] : Vertex normals require binary format version 4 or later";
Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
thePath << "\t: Cannot read the file";
return false;
}
if (!BinTools::Write(theShape, thePath.ToCString(),
aNode->InternalParameters.WriteTriangles,
aNode->InternalParameters.WriteNormals,
aNode->InternalParameters.WriteVersionBin, theProgress))
char aStringBuf[255] = {};
aFile->read(aStringBuf, 255);
if (aFile->fail())
{
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
<< thePath << "] : Cannot write the file";
Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
thePath << "\t: Cannot read the file";
return false;
}
isBinaryFormat = !(::strncmp(aStringBuf, "DBRep_DrawableShape", 19) == 0);
}
if (isBinaryFormat)
{
if (!BinTools::Read(theShape, thePath.ToCString(), theProgress))
{
Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
thePath << "\t: Cannot read from the file";
return false;
}
}
else
{
if (aNode->InternalParameters.WriteVersionAscii >
static_cast<TopTools_FormatVersion>(TopTools_FormatVersion_UPPER) ||
aNode->InternalParameters.WriteVersionAscii <
static_cast<TopTools_FormatVersion>(TopTools_FormatVersion_LOWER))
if (!BRepTools::Read(theShape, thePath.ToCString(), BRep_Builder(), theProgress))
{
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
<< thePath << "] : Unknown format version";
Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
thePath << "\t: Cannot read from the file";
return false;
}
}
return true;
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress)
{
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(DEBRepCascade_ConfigurationNode)))
{
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(DEBRepCascade_ConfigurationNode) aNode = Handle(DEBRepCascade_ConfigurationNode)::DownCast(GetNode());
if (aNode->InternalParameters.WriteBinary)
{
if (aNode->InternalParameters.WriteVersionBin > static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_UPPER) ||
aNode->InternalParameters.WriteVersionBin < static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_LOWER))
{
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
thePath << "\t: Unknown format version";
return false;
}
if (aNode->InternalParameters.WriteNormals &&
aNode->InternalParameters.WriteVersionBin < BinTools_FormatVersion_VERSION_4)
{
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
thePath << "\t: Vertex normals require binary format version 4 or later";
return false;
}
if (!BinTools::Write(theShape, thePath.ToCString(), aNode->InternalParameters.WriteTriangles,
aNode->InternalParameters.WriteNormals, aNode->InternalParameters.WriteVersionBin, theProgress))
{
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
thePath << "\t: Cannot write the file";
return false;
}
}
else
{
if (aNode->InternalParameters.WriteVersionAscii > static_cast<TopTools_FormatVersion>(TopTools_FormatVersion_UPPER) ||
aNode->InternalParameters.WriteVersionAscii < static_cast<TopTools_FormatVersion>(TopTools_FormatVersion_LOWER))
{
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
thePath << "\t: Unknown format version";
return false;
}
if (aNode->InternalParameters.WriteNormals &&
aNode->InternalParameters.WriteVersionAscii < TopTools_FormatVersion_VERSION_3)
{
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
<< thePath << "] : Vertex normals require ascii format version 3 or later";
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
thePath << "\t: Error: vertex normals require ascii format version 3 or later";
return false;
}
if (!BRepTools::Write(theShape, thePath.ToCString(),
aNode->InternalParameters.WriteTriangles,
aNode->InternalParameters.WriteNormals,
aNode->InternalParameters.WriteVersionAscii, theProgress))
if (!BRepTools::Write(theShape, thePath.ToCString(), aNode->InternalParameters.WriteTriangles,
aNode->InternalParameters.WriteNormals, aNode->InternalParameters.WriteVersionAscii, theProgress))
{
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
<< thePath << "] : Cannot write the file";
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
thePath << "\t: Cannot write the file";
return false;
}
}
return true;
}

View File

@@ -64,6 +64,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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
//! @param[in] thePath path to the import CAD file
//! @param[out] theShape shape to save result
@@ -86,6 +104,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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:
//! Gets CAD format name of associated provider

View File

@@ -59,21 +59,43 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(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())
{
Message::SendFail() << "Error: DEXCAFCascade_Provider : "
<< "Null document";
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " <<
thePath << "\t: theDocument shouldn't be null";
return false;
}
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
{
Message::SendFail() << "Error: DEXCAFCascade_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " << thePath
<< "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(DEXCAFCascade_ConfigurationNode) aNode =
Handle(DEXCAFCascade_ConfigurationNode)::DownCast(GetNode());
Handle(DEXCAFCascade_ConfigurationNode) aNode = Handle(DEXCAFCascade_ConfigurationNode)::DownCast(GetNode());
Handle(TDocStd_Document) aDocument;
Handle(TDocStd_Application) anApp = new TDocStd_Application();
BinDrivers::DefineFormat(anApp);
@@ -86,15 +108,12 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
XmlLDrivers::DefineFormat(anApp);
XmlTObjDrivers::DefineFormat(anApp);
XmlXCAFDrivers::DefineFormat(anApp);
Handle(PCDM_ReaderFilter) aFilter =
new PCDM_ReaderFilter(aNode->InternalParameters.ReadAppendMode);
for (TColStd_ListOfAsciiString::Iterator anIt(aNode->InternalParameters.ReadSkipValues);
anIt.More(); anIt.Next())
Handle(PCDM_ReaderFilter) aFilter = new PCDM_ReaderFilter(aNode->InternalParameters.ReadAppendMode);
for (TColStd_ListOfAsciiString::Iterator anIt(aNode->InternalParameters.ReadSkipValues); anIt.More(); anIt.Next())
{
aFilter->AddSkipped(anIt.Value());
}
for (TColStd_ListOfAsciiString::Iterator anIt(aNode->InternalParameters.ReadValues);
anIt.More(); anIt.Next())
for (TColStd_ListOfAsciiString::Iterator anIt(aNode->InternalParameters.ReadValues); anIt.More(); anIt.Next())
{
if (anIt.Value().StartsWith("0"))
{
@@ -108,8 +127,8 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
if (anApp->Open(thePath, aDocument, aFilter, theProgress) != PCDM_RS_OK)
{
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
thePath << "] : Cannot open XDE document";
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file : " << thePath
<< "\t: Cannot open XDE document";
return false;
}
theDocument->SetData(aDocument->GetData());
@@ -122,10 +141,8 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
//=======================================================================
bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
(void)theWS;
Handle(TDocStd_Application) anApp = new TDocStd_Application();
BinXCAFDrivers::DefineFormat(anApp);
PCDM_StoreStatus aStatus = PCDM_SS_Doc_IsNull;
@@ -135,50 +152,50 @@ bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
}
else if (!theDocument->IsSaved())
{
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
thePath << "] : Storage error : Document has never been saved";
Message::SendFail() << "Storage error in the DEXCAFCascade_Provider during writing the file " <<
thePath << "\t: Storage error : this document has never been saved";
return false;
}
else
{
aStatus = anApp->Save(theDocument, theProgress);
}
switch (aStatus)
{
case PCDM_SS_OK:
return true;
case PCDM_SS_DriverFailure:
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
thePath << "] : Storage error : driver failure";
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
<< "\t: Storage error : driver failure";
break;
case PCDM_SS_WriteFailure:
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
thePath << "] : Storage error : write failure";
Message::SendFail() << "Error in the DEXCAFCascade_Provider during the writing the file : " << thePath
<< "\t: Storage error : write failure";
break;
case PCDM_SS_Failure:
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
thePath << "] : Storage error : general failure";
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
<< "\t: Storage error : general failure";
break;
case PCDM_SS_Doc_IsNull:
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
thePath << "] : Storage error : document is NULL";
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
<< "\t: Storage error :: document is NULL";
break;
case PCDM_SS_No_Obj:
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
thePath << "] : Storage error : no object";
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
<< "\t: Storage error : no object";
break;
case PCDM_SS_Info_Section_Error:
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
thePath << "] : Storage error : section error";
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
<< "\t: Storage error : section error";
break;
case PCDM_SS_UserBreak:
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
thePath << "] : Storage error : user break";
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
<< "\t: Storage error : user break";
break;
case PCDM_SS_UnrecognizedFormat:
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
thePath << "] : Storage error : unrecognized document storage format : "
<< theDocument->StorageFormat();
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
<< "\t: Storage error : unrecognized document storage format : " << theDocument->StorageFormat();
break;
}
return false;
@@ -194,25 +211,48 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
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)))
{
Message::SendFail() << "Error: DEXCAFCascade_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " << thePath
<< "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(TDocStd_Document) aDocument;
Handle(TDocStd_Application) anApp = new TDocStd_Application();
BinXCAFDrivers::DefineFormat(anApp);
anApp->NewDocument("BinXCAF", aDocument);
Read(thePath, aDocument, theWS, theProgress);
Read(thePath, aDocument, theProgress);
TDF_LabelSequence aLabels;
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(aDocument->Main());
aSTool->GetFreeShapes(aLabels);
if (aLabels.Length() <= 0)
{
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
thePath << "] : Storage error : Document contain no shapes";
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file : " << thePath
<< "\t: Document contain no shapes";
return false;
}
@@ -241,14 +281,12 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
//=======================================================================
bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
(void)theWS;
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
aShTool->AddShape(theShape);
return Write(thePath, aDoc, theWS, theProgress);
return Write(thePath, aDoc, theProgress);
}
//=======================================================================

View File

@@ -64,6 +64,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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
//! @param[in] thePath path to the import CAD file
//! @param[out] theShape shape to save result
@@ -86,6 +104,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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:
//! Gets CAD format name of associated provider

View File

@@ -13,217 +13,19 @@
#include <IGESCAFControl_Provider.hxx>
#include <BinXCAFDrivers.hxx>
#include <IGESCAFControl_ConfigurationNode.hxx>
#include <IGESCAFControl_Reader.hxx>
#include <IGESCAFControl_Writer.hxx>
#include <IGESControl_Controller.hxx>
#include <IGESData.hxx>
#include <IGESData_IGESModel.hxx>
#include <Interface_Static.hxx>
#include <Message.hxx>
#include <UnitsMethods.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XSControl_WorkSession.hxx>
#include <UnitsMethods.hxx>
IMPLEMENT_STANDARD_RTTIEXT(IGESCAFControl_Provider, DE_Provider)
namespace
{
//! Special class to handle static parameters.
//! Initialize all parameters in the begin of life
//! and reset changed parameters in the end of life
class IGESCAFControl_ParameterController
{
public:
IGESCAFControl_ParameterController(const Handle(IGESCAFControl_ConfigurationNode)& theNode,
const Standard_Boolean theUpdateStatic);
~IGESCAFControl_ParameterController();
protected:
void setStatic(const IGESCAFControl_ConfigurationNode::IGESCAFControl_InternalSection theParameter);
private:
bool myToUpdateStaticParameters; //!< 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 global parameters
};
//=======================================================================
// function : IGESCAFControl_ParameterController
// purpose :
//=======================================================================
IGESCAFControl_ParameterController::IGESCAFControl_ParameterController(const Handle(IGESCAFControl_ConfigurationNode)& theNode,
const Standard_Boolean theUpdateStatic)
: myToUpdateStaticParameters(theUpdateStatic)
{
IGESControl_Controller::Init();
IGESData::Init();
if (!myToUpdateStaticParameters)
{
return;
}
// Get previous values
myOldValues.ReadBSplineContinuity =
(IGESCAFControl_ConfigurationNode::ReadMode_BSplineContinuity)
Interface_Static::IVal("read.iges.bspline.continuity");
myOldValues.ReadPrecisionMode =
(IGESCAFControl_ConfigurationNode::ReadMode_Precision)
Interface_Static::IVal("read.precision.mode");
myOldValues.ReadPrecisionVal =
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.ReadResourceName =
Interface_Static::CVal("read.iges.resource.name");
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.WriteConvertSurfaceMode =
(IGESCAFControl_ConfigurationNode::WriteMode_ConvertSurface)
Interface_Static::IVal("write.convertsurface.mode");
myOldValues.WriteUnit =
(UnitsMethods_LengthUnit)
Interface_Static::IVal("write.iges.unit");
myOldValues.WriteHeaderAuthor =
Interface_Static::CVal("write.iges.header.author");
myOldValues.WriteHeaderCompany =
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;
myOldGlobalValues.LengthUnit = 0.001 *
UnitsMethods::GetLengthFactorValue(Interface_Static::IVal("xstep.cascade.unit"));
// Set new values
TCollection_AsciiString aStrUnit(
UnitsMethods::DumpLengthUnit(theNode->GlobalParameters.LengthUnit));
aStrUnit.UpperCase();
Interface_Static::SetCVal("xstep.cascade.unit", aStrUnit.ToCString());
UnitsMethods::SetCasCadeLengthUnit(theNode->GlobalParameters.LengthUnit);
setStatic(theNode->InternalParameters);
}
//=======================================================================
// function : ~IGESCAFControl_ParameterController
// purpose :
//=======================================================================
IGESCAFControl_ParameterController::~IGESCAFControl_ParameterController()
{
if (!myToUpdateStaticParameters)
{
return;
}
// Set new values
TCollection_AsciiString aStrUnit(
UnitsMethods::DumpLengthUnit(myOldGlobalValues.LengthUnit,
UnitsMethods_LengthUnit_Meter));
aStrUnit.UpperCase();
Interface_Static::SetCVal("xstep.cascade.unit", aStrUnit.ToCString());
setStatic(myOldValues);
}
//=======================================================================
// function : setStatic
// purpose :
//=======================================================================
void IGESCAFControl_ParameterController::setStatic(const IGESCAFControl_ConfigurationNode::IGESCAFControl_InternalSection theParameter)
{
Interface_Static::SetIVal("read.iges.bspline.continuity",
theParameter.ReadBSplineContinuity);
Interface_Static::SetIVal("read.precision.mode",
theParameter.ReadPrecisionMode);
Interface_Static::SetRVal("read.precision.val",
theParameter.ReadPrecisionVal);
Interface_Static::SetIVal("read.maxprecision.mode",
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::SetCVal("read.iges.resource.name",
theParameter.ReadResourceName.ToCString());
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.convertsurface.mode",
theParameter.WriteConvertSurfaceMode);
Interface_Static::SetIVal("write.iges.unit",
theParameter.WriteUnit);
Interface_Static::SetCVal("write.iges.header.author",
theParameter.WriteHeaderAuthor.ToCString());
Interface_Static::SetCVal("write.iges.header.company",
theParameter.WriteHeaderCompany.ToCString());
Interface_Static::SetCVal("write.iges.header.product",
theParameter.WriteHeaderProduct.ToCString());
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);
}
}
//=======================================================================
// function : IGESCAFControl_Provider
// purpose :
@@ -240,23 +42,99 @@ IGESCAFControl_Provider::IGESCAFControl_Provider(const Handle(DE_ConfigurationNo
{}
//=======================================================================
// function : STEPCAFControl_Provider
// function : initStatic
// purpose :
//=======================================================================
void IGESCAFControl_Provider::personizeWS(Handle(XSControl_WorkSession)& theWS)
void IGESCAFControl_Provider::initStatic(const Handle(DE_ConfigurationNode)& theNode)
{
if (theWS.IsNull())
{
Message::SendWarning() << "Warning: IGESCAFControl_Provider :"
<< " Null work session, use internal temporary session";
theWS = new XSControl_WorkSession();
}
Handle(IGESControl_Controller) aCntrl =
Handle(IGESControl_Controller)::DownCast(theWS->NormAdaptor());
if (aCntrl.IsNull())
{
theWS->SelectNorm("IGES");
}
Handle(IGESCAFControl_ConfigurationNode) aNode = Handle(IGESCAFControl_ConfigurationNode)::DownCast(theNode);
IGESData::Init();
// Get previous values
myOldValues.ReadBSplineContinuity = (IGESCAFControl_ConfigurationNode::ReadMode_BSplineContinuity)Interface_Static::IVal("read.iges.bspline.continuity");
myOldValues.ReadPrecisionMode = (IGESCAFControl_ConfigurationNode::ReadMode_Precision)Interface_Static::IVal("read.precision.mode");
myOldValues.ReadPrecisionVal = 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.ReadResourceName = Interface_Static::CVal("read.iges.resource.name");
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.WriteConvertSurfaceMode = (IGESCAFControl_ConfigurationNode::WriteMode_ConvertSurface)Interface_Static::IVal("write.convertsurface.mode");
myOldValues.WriteUnit = (UnitsMethods_LengthUnit)Interface_Static::IVal("write.iges.unit");
myOldValues.WriteHeaderAuthor = Interface_Static::CVal("write.iges.header.author");
myOldValues.WriteHeaderCompany = 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");
// Set new values
UnitsMethods::SetCasCadeLengthUnit(aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
TCollection_AsciiString aStrUnit(UnitsMethods::DumpLengthUnit(aNode->GlobalParameters.LengthUnit));
aStrUnit.UpperCase();
Interface_Static::SetCVal("xstep.cascade.unit", aStrUnit.ToCString());
setStatic(aNode->InternalParameters);
}
//=======================================================================
// function : setStatic
// purpose :
//=======================================================================
void IGESCAFControl_Provider::setStatic(const IGESCAFControl_ConfigurationNode::IGESCAFControl_InternalSection theParameter)
{
Interface_Static::SetIVal("read.iges.bspline.continuity", theParameter.ReadBSplineContinuity);
Interface_Static::SetIVal("read.precision.mode", theParameter.ReadPrecisionMode);
Interface_Static::SetRVal("read.precision.val", theParameter.ReadPrecisionVal);
Interface_Static::SetIVal("read.maxprecision.mode", 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::SetCVal("read.iges.resource.name", theParameter.ReadResourceName.ToCString());
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.convertsurface.mode", theParameter.WriteConvertSurfaceMode);
Interface_Static::SetIVal("write.iges.unit", theParameter.WriteUnit);
Interface_Static::SetCVal("write.iges.header.author", theParameter.WriteHeaderAuthor.ToCString());
Interface_Static::SetCVal("write.iges.header.company", theParameter.WriteHeaderCompany.ToCString());
Interface_Static::SetCVal("write.iges.header.product", theParameter.WriteHeaderProduct.ToCString());
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);
}
//=======================================================================
// function : resetStatic
// purpose :
//=======================================================================
void IGESCAFControl_Provider::resetStatic()
{
Interface_Static::SetIVal("xstep.cascade.unit", myOldLengthUnit);
UnitsMethods::SetCasCadeLengthUnit(myOldLengthUnit);
setStatic(myOldValues);
}
//=======================================================================
@@ -270,70 +148,50 @@ bool IGESCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
{
if (theDocument.IsNull())
{
Message::SendFail() << "Error: IGESCAFControl_Provider : "
<< "Null document";
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
thePath << "\t: theDocument shouldn't be null";
return false;
}
if (!GetNode()->IsKind(STANDARD_TYPE(IGESCAFControl_ConfigurationNode)))
{
Message::SendFail() << "Error: IGESCAFControl_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(IGESCAFControl_ConfigurationNode) aNode =
Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
IGESCAFControl_ParameterController aParamController(aNode, myToUpdateStaticParameters);
personizeWS(theWS);
XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
aNode->GlobalParameters.LengthUnit,
UnitsMethods_LengthUnit_Millimeter);
const Standard_Boolean toUseLoaded = thePath == ".";
TCollection_AsciiString aFile;
if (toUseLoaded)
Handle(IGESCAFControl_ConfigurationNode) aNode = Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
initStatic(aNode);
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
IGESCAFControl_Reader aReader;
if (!theWS.IsNull())
{
aFile = theWS->LoadedFile();
Message::SendInfo() << "Model taken from the IGES session : "
<< aFile;
aReader.SetWS(theWS);
}
else
{
aFile = thePath;
Message::SendInfo() << "File IGES to read : "
<< aFile;
}
IGESCAFControl_Reader aReader(theWS, !toUseLoaded);
aReader.SetReadVisible(aNode->InternalParameters.ReadOnlyVisible);
aReader.SetColorMode(aNode->InternalParameters.ReadColor);
aReader.SetNameMode(aNode->InternalParameters.ReadName);
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
Handle(IGESData_IGESModel) aModel = aReader.IGESModel();
if (aModel.IsNull())
{
aModel = Handle(IGESData_IGESModel)::DownCast(theWS->NewModel());
}
aModel->ClearHeader();
aModel->ChangeGlobalSection().SetCascadeUnit(aNode->GlobalParameters.LengthUnit);
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
if (!toUseLoaded)
{
aReadStat = aReader.ReadFile(thePath.ToCString());
}
else if (theWS->NbStartingEntities() > 0)
{
aReadStat = IFSelect_RetDone;
}
aReadStat = aReader.ReadFile(thePath.ToCString());
if (aReadStat != IFSelect_RetDone)
{
Message::SendFail() << "Error: IGESCAFControl_Provider : ["
<< aFile << "] : abandon, no model loaded";
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
thePath << "\t: abandon, no model loaded";
resetStatic();
return false;
}
if (!aReader.Transfer(theDocument, theProgress))
{
Message::SendFail() << "Error: IGESCAFControl_Provider : [" <<
aFile << "] : Cannot read any relevant data from the IGES file";
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
thePath << "\t: Cannot read any relevant data from the IGES file";
resetStatic();
return false;
}
resetStatic();
return true;
}
@@ -348,35 +206,18 @@ bool IGESCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
{
if (!GetNode()->IsKind(STANDARD_TYPE(IGESCAFControl_ConfigurationNode)))
{
Message::SendFail() << "Error: IGESCAFControl_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(IGESCAFControl_ConfigurationNode) aNode =
Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
IGESCAFControl_ParameterController aParamController(aNode, myToUpdateStaticParameters);
personizeWS(theWS);
TCollection_AsciiString aUnit(
UnitsMethods::DumpLengthUnit(aNode->InternalParameters.WriteUnit));
aUnit.UpperCase();
Handle(IGESCAFControl_ConfigurationNode) aNode = Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
initStatic(aNode);
IGESCAFControl_Writer aWriter(theWS, Standard_True);
if (aNode->InternalParameters.WriteUnit > UnitsMethods_LengthUnit_Undefined &&
aNode->InternalParameters.WriteUnit <= UnitsMethods_LengthUnit_Microinch)
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter);
IGESCAFControl_Writer aWriter;
if (!theWS.IsNull())
{
Handle(IGESData_IGESModel) aModel = aWriter.Model();
IGESData_GlobalSection aGSesction = aModel->GlobalSection();
Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString(
IGESData_BasicEditor::UnitFlagName(aNode->InternalParameters.WriteUnit));
if (aGSesction.UnitFlag() == 3)
{
aGSesction.SetUnitName(aName);
}
else if (aGSesction.UnitFlag() > 0)
{
aGSesction.SetUnitFlag(aNode->InternalParameters.WriteUnit);
}
aModel->SetGlobalSection(aGSesction);
aWriter = IGESCAFControl_Writer(theWS);
}
aWriter.SetColorMode(aNode->InternalParameters.WriteColor);
aWriter.SetNameMode(aNode->InternalParameters.WriteName);
@@ -384,25 +225,46 @@ bool IGESCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
if (!aWriter.Transfer(theDocument, theProgress))
{
Message::SendFail() << "Error: IGESCAFControl_Provider : "
<< "The document cannot be translated or gives no result";
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
thePath << "\t: The document cannot be translated or gives no result";
resetStatic();
return false;
}
if (thePath == ".")
{
Message::SendInfo() << "Document has been translated into the session";
return true;
}
if (!aWriter.Write(thePath.ToCString()))
{
Message::SendFail() << "Error: IGESCAFControl_Provider : [" <<
thePath << "] : Write failed";
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
thePath << "\t: Write failed";
resetStatic();
return false;
}
Message::SendInfo() << "IGES file [" << thePath << "] Successfully written";
resetStatic();
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;
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;
return Write(thePath, theDocument, aWS, theProgress);
}
//=======================================================================
// function : Read
// purpose :
@@ -415,39 +277,36 @@ bool IGESCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
(void)theProgress;
if (!GetNode()->IsKind(STANDARD_TYPE(IGESCAFControl_ConfigurationNode)))
{
Message::SendFail() << "Error: IGESCAFControl_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(IGESCAFControl_ConfigurationNode) aNode =
Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
IGESCAFControl_ParameterController aParamController(aNode, myToUpdateStaticParameters);
personizeWS(theWS);
Handle(IGESCAFControl_ConfigurationNode) aNode = Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
initStatic(aNode);
IGESControl_Reader aReader;
aReader.SetWS(theWS);
Handle(IGESData_IGESModel) aModel = aReader.IGESModel();
if (aModel.IsNull())
if (!theWS.IsNull())
{
aModel = Handle(IGESData_IGESModel)::DownCast(theWS->NewModel());
aReader.SetWS(theWS);
}
aModel->ClearHeader();
aModel->ChangeGlobalSection().SetCascadeUnit(aNode->GlobalParameters.LengthUnit);
aReader.SetReadVisible(aNode->InternalParameters.ReadOnlyVisible);
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
aReadStat = aReader.ReadFile(thePath.ToCString());
if (aReadStat != IFSelect_RetDone)
{
Message::SendFail() << "Error: IGESCAFControl_Provider : [" <<
thePath << "] : Could not read file, no model loaded";
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
thePath << "\t: Could not read file, no model loaded";
resetStatic();
return false;
}
if (aReader.TransferRoots() <= 0)
{
Message::SendFail() << "Error: IGESCAFControl_Provider : [" <<
thePath << "] : Cannot read any relevant data from the IGES file";
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
thePath << "\t: Cannot read any relevant data from the IGES file";
resetStatic();
return false;
}
theShape = aReader.OneShape();
resetStatic();
return true;
}
@@ -464,36 +323,58 @@ bool IGESCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
(void)theProgress;
if (!GetNode()->IsKind(STANDARD_TYPE(IGESCAFControl_ConfigurationNode)))
{
Message::SendFail() << "Error: IGESCAFControl_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the IGESCAFControl_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(IGESCAFControl_ConfigurationNode) aNode =
Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
IGESCAFControl_ParameterController aParamController(aNode, myToUpdateStaticParameters);
personizeWS(theWS);
TCollection_AsciiString aUnit(
UnitsMethods::DumpLengthUnit(aNode->InternalParameters.WriteUnit));
Handle(IGESCAFControl_ConfigurationNode) aNode = Handle(IGESCAFControl_ConfigurationNode)::DownCast(GetNode());
initStatic(aNode);
TCollection_AsciiString aUnit(UnitsMethods::DumpLengthUnit(aNode->InternalParameters.WriteUnit));
aUnit.UpperCase();
IGESControl_Writer aWriter(aUnit.ToCString(),
aNode->InternalParameters.WriteBRepMode);
Standard_Boolean aIsOk = aWriter.AddShape(theShape);
if (!aIsOk)
{
Message::SendFail() << "Error: IGESCAFControl_Provider : "
<< "Can't translate shape to IGES model";
Message::SendFail() << "IGESCAFControl_Provider: Shape not written";
resetStatic();
return false;
}
if (!(aWriter.Write(thePath.ToCString())))
{
Message::SendFail() << "Error: IGESCAFControl_Provider : "
<< "Can't write IGES file" << thePath;
Message::SendFail() << "IGESCAFControl_Provider: Error on writing file " << thePath;
resetStatic();
return false;
}
resetStatic();
return true;
}
//=======================================================================
// function : Read
// purpose :
//=======================================================================
bool IGESCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress)
{
Handle(XSControl_WorkSession) aWS;
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;
return Write(thePath, theShape, aWS, theProgress);
}
//=======================================================================
// function : GetFormat
// purpose :

View File

@@ -15,7 +15,6 @@
#define _IGESCAFControl_Provider_HeaderFile
#include <DE_Provider.hxx>
#include <DE_ConfigurationNode.hxx>
#include <IGESCAFControl_ConfigurationNode.hxx>
//! The class to transfer IGES files.
@@ -66,6 +65,23 @@ public:
Handle(XSControl_WorkSession)& theWS,
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
//! @param[in] thePath path to the import CAD file
@@ -89,6 +105,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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:
//! Gets CAD format name of associated provider
@@ -99,24 +133,19 @@ public:
//! @return provider's vendor name
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:
//! Personizes work session with current format.
//! Creates new temporary session if current session is null
//! @param[in] theWS current work session
void personizeWS(Handle(XSControl_WorkSession)& theWS);
//! Initialize static variables
void initStatic(const Handle(DE_ConfigurationNode)& theNode);
private:
//! Initialize static variables
void setStatic(const IGESCAFControl_ConfigurationNode::IGESCAFControl_InternalSection theParameter);
bool myToUpdateStaticParameters = true; //!< Flag to updating static parameters
//! Reset used interface static variables
void resetStatic();
IGESCAFControl_ConfigurationNode::IGESCAFControl_InternalSection myOldValues;
int myOldLengthUnit = 1;
};

View File

@@ -53,43 +53,43 @@ bool RWGltf_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
{
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
InternalParameters.FileLengthUnit =
InternalParameters.FileLengthUnit =
theResource->RealVal("file.length.unit", InternalParameters.FileLengthUnit, aScope);
InternalParameters.SystemCS = (RWMesh_CoordinateSystem)
(theResource->IntegerVal("system.cs", (int)InternalParameters.SystemCS, aScope) % 2);
InternalParameters.FileCS = (RWMesh_CoordinateSystem)
(theResource->IntegerVal("file.cs", (int)InternalParameters.SystemCS, aScope) % 2);
InternalParameters.ReadSinglePrecision =
InternalParameters.ReadSinglePrecision =
theResource->BooleanVal("read.single.precision", InternalParameters.ReadSinglePrecision, aScope);
InternalParameters.ReadCreateShapes =
InternalParameters.ReadCreateShapes =
theResource->BooleanVal("read.create.shapes", InternalParameters.ReadCreateShapes, aScope);
InternalParameters.ReadRootPrefix =
InternalParameters.ReadRootPrefix =
theResource->StringVal("read.root.prefix", InternalParameters.ReadRootPrefix, aScope);
InternalParameters.ReadFillDoc =
InternalParameters.ReadFillDoc =
theResource->BooleanVal("read.fill.doc", InternalParameters.ReadFillDoc, aScope);
InternalParameters.ReadFillIncomplete =
InternalParameters.ReadFillIncomplete =
theResource->BooleanVal("read.fill.incomplete", InternalParameters.ReadFillIncomplete, aScope);
InternalParameters.ReadMemoryLimitMiB =
InternalParameters.ReadMemoryLimitMiB =
theResource->IntegerVal("read.memory.limit.mib", InternalParameters.ReadMemoryLimitMiB, aScope);
InternalParameters.ReadParallel =
InternalParameters.ReadParallel =
theResource->BooleanVal("read.parallel", InternalParameters.ReadParallel, aScope);
InternalParameters.ReadSkipEmptyNodes =
InternalParameters.ReadSkipEmptyNodes =
theResource->BooleanVal("read.skip.empty.nodes", InternalParameters.ReadSkipEmptyNodes, aScope);
InternalParameters.ReadLoadAllScenes =
InternalParameters.ReadLoadAllScenes =
theResource->BooleanVal("read.load.all.scenes", InternalParameters.ReadLoadAllScenes, aScope);
InternalParameters.ReadUseMeshNameAsFallback =
InternalParameters.ReadUseMeshNameAsFallback =
theResource->BooleanVal("read.use.mesh.name.as.fallback", InternalParameters.ReadUseMeshNameAsFallback, aScope);
InternalParameters.ReadSkipLateDataLoading =
InternalParameters.ReadSkipLateDataLoading =
theResource->BooleanVal("read.skip.late.data.loading", InternalParameters.ReadSkipLateDataLoading, aScope);
InternalParameters.ReadKeepLateData =
InternalParameters.ReadKeepLateData =
theResource->BooleanVal("read.keep.late.data", InternalParameters.ReadKeepLateData, aScope);
InternalParameters.ReadPrintDebugMessages =
InternalParameters.ReadPrintDebugMessages =
theResource->BooleanVal("read.print.debug.message", InternalParameters.ReadPrintDebugMessages, aScope);
InternalParameters.WriteComment =
InternalParameters.WriteComment =
theResource->StringVal("write.comment", InternalParameters.WriteComment, aScope);
InternalParameters.WriteAuthor =
InternalParameters.WriteAuthor =
theResource->StringVal("write.author", InternalParameters.WriteAuthor, aScope);
InternalParameters.WriteTrsfFormat = (RWGltf_WriterTrsfFormat)
@@ -98,43 +98,14 @@ bool RWGltf_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
(theResource->IntegerVal("write.node.name.format", InternalParameters.WriteNodeNameFormat, aScope) % (RWMesh_NameFormat_ProductAndInstanceAndOcaf + 1));
InternalParameters.WriteMeshNameFormat = (RWMesh_NameFormat)
(theResource->IntegerVal("write.mesh.name.format", InternalParameters.WriteMeshNameFormat, aScope) % (RWMesh_NameFormat_ProductAndInstanceAndOcaf + 1));
// Draco parameters
InternalParameters.WriteDracoParameters.DracoCompression =
theResource->BooleanVal("write.draco.compression",
InternalParameters.WriteDracoParameters.DracoCompression, aScope);
InternalParameters.WriteDracoParameters.CompressionLevel =
theResource->IntegerVal("write.draco.level",
InternalParameters.WriteDracoParameters.CompressionLevel, aScope);
InternalParameters.WriteDracoParameters.QuantizePositionBits =
theResource->IntegerVal("write.draco.position.bits",
InternalParameters.WriteDracoParameters.QuantizePositionBits, aScope);
InternalParameters.WriteDracoParameters.QuantizeNormalBits =
theResource->IntegerVal("write.draco.normal.bits",
InternalParameters.WriteDracoParameters.QuantizeNormalBits, aScope);
InternalParameters.WriteDracoParameters.QuantizeTexcoordBits =
theResource->IntegerVal("write.draco.texture.bits",
InternalParameters.WriteDracoParameters.QuantizeTexcoordBits, aScope);
InternalParameters.WriteDracoParameters.QuantizeColorBits =
theResource->IntegerVal("write.draco.color.bits",
InternalParameters.WriteDracoParameters.QuantizeColorBits, aScope);
InternalParameters.WriteDracoParameters.QuantizeGenericBits =
theResource->IntegerVal("write.draco.generic.bits",
InternalParameters.WriteDracoParameters.QuantizeGenericBits, aScope);
InternalParameters.WriteDracoParameters.UnifiedQuantization =
theResource->BooleanVal("write.draco.unified.quantization",
InternalParameters.WriteDracoParameters.UnifiedQuantization, aScope);
InternalParameters.WriteForcedUVExport =
InternalParameters.WriteForcedUVExport =
theResource->BooleanVal("write.forced.uv.export", InternalParameters.WriteForcedUVExport, aScope);
InternalParameters.WriteEmbedTexturesInGlb =
InternalParameters.WriteEmbedTexturesInGlb =
theResource->BooleanVal("write.embed.textures.in.glb", InternalParameters.WriteEmbedTexturesInGlb, aScope);
InternalParameters.WriteMergeFaces =
InternalParameters.WriteMergeFaces =
theResource->BooleanVal("write.merge.faces", InternalParameters.WriteMergeFaces, aScope);
InternalParameters.WriteSplitIndices16 =
InternalParameters.WriteSplitIndices16 =
theResource->BooleanVal("write.split.indices16", InternalParameters.WriteSplitIndices16, aScope);
InternalParameters.WriteParallel =
theResource->BooleanVal("write.parallel", InternalParameters.WriteParallel, aScope);
return true;
}
@@ -287,63 +258,6 @@ TCollection_AsciiString RWGltf_ConfigurationNode::Save() const
aResult += aScope + "write.mesh.name.format :\t " + InternalParameters.WriteMeshNameFormat + "\n";
aResult += "!\n";
// Draco parameters
aResult += "!\n";
aResult += "!Flag to use Draco compression. If it is TRUE, compression is used\n";
aResult += "!Default value: 0(false). Available values: 0(false), 1(true)\n";
aResult += aScope + "write.draco.compression :\t " +
InternalParameters.WriteDracoParameters.DracoCompression + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Draco compression level\n";
aResult += "!Default value: 7. Available values: [0-10]\n";
aResult += aScope + "write.draco.level :\t " +
InternalParameters.WriteDracoParameters.CompressionLevel + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Quantization bits for position attribute\n";
aResult += "!Default value: 14. Available values: any positive value\n";
aResult += aScope + "write.draco.position.bits :\t " +
InternalParameters.WriteDracoParameters.QuantizePositionBits + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Quantization bits for normal attribute\n";
aResult += "!Default value: 10. Available values: any positive value\n";
aResult += aScope + "write.draco.normal.bits :\t " +
InternalParameters.WriteDracoParameters.QuantizeNormalBits + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Quantization bits for texture coordinate attribute\n";
aResult += "!Default value: 12. Available values: any positive value\n";
aResult += aScope + "write.draco.texture.bits :\t " +
InternalParameters.WriteDracoParameters.QuantizeTexcoordBits + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Quantization bits for color attributes\n";
aResult += "!Default value: 8. Available values: any positive value\n";
aResult += aScope + "write.draco.color.bits :\t " +
InternalParameters.WriteDracoParameters.QuantizeColorBits + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Quantization bits for skinning and custom attributes\n";
aResult += "!Default value: 12. Available values: any positive value\n";
aResult += aScope + "write.draco.generic.bits :\t " +
InternalParameters.WriteDracoParameters.QuantizeGenericBits + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Quantize positions of all primitives using the same quantization grid\n";
aResult += "!Default value: 0(false). Available values: 0(false), 1(true)\n";
aResult += aScope + "write.draco.unified.quantization :\t " +
InternalParameters.WriteDracoParameters.UnifiedQuantization + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Export UV coordinates even if there are no mapped texture\n";
aResult += "!Default value: 0(false). Available values: 0(false), 1(true)\n";
@@ -368,12 +282,6 @@ TCollection_AsciiString RWGltf_ConfigurationNode::Save() const
aResult += aScope + "write.split.indices16 :\t " + InternalParameters.WriteSplitIndices16 + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Flag to use multithreading\n";
aResult += "!Default value: 0(false). Available values: 0(false), 1(true)\n";
aResult += aScope + "write.parallel :\t " + InternalParameters.WriteParallel + "\n";
aResult += "!\n";
aResult += "!*****************************************************************************\n";
return aResult;
}

View File

@@ -16,7 +16,6 @@
#include <DE_ConfigurationNode.hxx>
#include <RWMesh_CoordinateSystem.hxx>
#include <RWGltf_DracoParameters.hxx>
#include <RWGltf_WriterTrsfFormat.hxx>
#include <RWMesh_NameFormat.hxx>
@@ -108,12 +107,10 @@ public:
RWGltf_WriterTrsfFormat WriteTrsfFormat = RWGltf_WriterTrsfFormat_Compact; //!< Transformation format to write into glTF file
RWMesh_NameFormat WriteNodeNameFormat = RWMesh_NameFormat_InstanceOrProduct; //!< Name format for exporting Nodes
RWMesh_NameFormat WriteMeshNameFormat = RWMesh_NameFormat_Product; //!< Name format for exporting Meshes
RWGltf_DracoParameters WriteDracoParameters; //!< Defines draco compression parameters
bool WriteForcedUVExport = false; //!< Export UV coordinates even if there are no mapped texture
bool WriteEmbedTexturesInGlb = true; //!< Flag to write image textures into GLB file
bool WriteMergeFaces = false; //!< Flag to merge faces within a single part
bool WriteSplitIndices16 = false; //!< Flag to prefer keeping 16-bit indexes while merging face
bool WriteParallel = false; //!< Flag to use multithreading
} InternalParameters;
};

View File

@@ -20,14 +20,13 @@
#include <XCAFDoc_ShapeTool.hxx>
#include <XCAFDoc_DocumentTool.hxx>
namespace
namespace
{
//=======================================================================
// function : SetReaderParameters
// purpose :
//=======================================================================
static void SetReaderParameters(RWGltf_CafReader& theReader,
const Handle(RWGltf_ConfigurationNode) theNode)
static void SetReaderParameters(RWGltf_CafReader& theReader, const Handle(RWGltf_ConfigurationNode) theNode)
{
theReader.SetDoublePrecision(!theNode->InternalParameters.ReadSinglePrecision);
theReader.SetSystemLengthUnit(theNode->GlobalParameters.LengthUnit / 1000);
@@ -74,36 +73,7 @@ bool RWGltf_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
if (theDocument.IsNull())
{
Message::SendFail() << "Error: RWGltf_Provider : "
<< "Null document";
return false;
}
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
{
Message::SendFail() << "Error: RWGltf_Provider : "
<< "Incorrect or empty Configuration Node";
return false;
}
Handle(RWGltf_ConfigurationNode) aNode =
Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
RWGltf_CafReader aReader;
aReader.SetDocument(theDocument);
SetReaderParameters(aReader, aNode);
XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
aNode->GlobalParameters.LengthUnit,
UnitsMethods_LengthUnit_Millimeter);
if (!aReader.Perform(thePath, theProgress))
{
Message::SendFail() << "Error: RWGltf_Provider : [" <<
thePath << "] : Cannot read any relevant data from the GLTF file";
return false;
}
myExternalFiles = aReader.ExternalFiles();
myMetadata = aReader.Metadata();
return true;
return Read(thePath, theDocument, theProgress);
}
//=======================================================================
@@ -116,15 +86,58 @@ bool RWGltf_Provider::Write(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
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())
{
Message::SendFail() << "Error: RWGltf_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the RWGltf_Provider during reading the file " <<
thePath << "\t: theDocument shouldn't be null";
return false;
}
Handle(RWGltf_ConfigurationNode) aNode =
Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
if (GetNode().IsNull() || (!GetNode().IsNull() && !GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode))))
{
Message::SendFail() << "Error in the RWGltf_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(RWGltf_ConfigurationNode) aNode = Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
RWGltf_CafReader aReader;
aReader.SetDocument(theDocument);
SetReaderParameters(aReader, aNode);
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
if (!aReader.Perform(thePath, theProgress))
{
Message::SendFail() << "Error in the RWGltf_Provider during reading the file " << thePath;
return false;
}
return true;
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool RWGltf_Provider::Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress)
{
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
{
Message::SendFail() << "Error in the RWGltf_Provider during writing the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(RWGltf_ConfigurationNode) aNode = Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
RWMesh_CoordinateSystemConverter aConverter;
aConverter.SetInputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
@@ -146,19 +159,16 @@ bool RWGltf_Provider::Write(const TCollection_AsciiString& thePath,
anExt.LowerCase();
RWGltf_CafWriter aWriter(thePath, anExt.EndsWith(".glb"));
aWriter.SetCoordinateSystemConverter(aConverter);
aWriter.SetCompressionParameters(aNode->InternalParameters.WriteDracoParameters);
aWriter.SetTransformationFormat(aNode->InternalParameters.WriteTrsfFormat);
aWriter.SetNodeNameFormat(aNode->InternalParameters.WriteNodeNameFormat);
aWriter.SetMeshNameFormat(aNode->InternalParameters.WriteMeshNameFormat);
aWriter.SetForcedUVExport(aNode->InternalParameters.WriteForcedUVExport);
aWriter.SetToEmbedTexturesInGlb(aNode->InternalParameters.WriteEmbedTexturesInGlb);
aWriter.SetMergeFaces(aNode->InternalParameters.WriteMergeFaces);
aWriter.SetParallel(aNode->InternalParameters.WriteParallel);
aWriter.SetSplitIndices16(aNode->InternalParameters.WriteSplitIndices16);
if (!aWriter.Perform(theDocument, aFileInfo, theProgress))
{
Message::SendFail() << "Error: RWGltf_Provider : [" <<
thePath << "] : Cannot write any relevant data to the GLTF file";
Message::SendFail() << "Error in the RWGltf_Provider during writing the file " << thePath;
return false;
}
return true;
@@ -174,27 +184,7 @@ bool RWGltf_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
{
Message::SendFail() << "Error: RWGltf_Provider : "
<< "Incorrect or empty Configuration Node";
return false;
}
Handle(RWGltf_ConfigurationNode) aNode =
Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
RWGltf_CafReader aReader;
SetReaderParameters(aReader, aNode);
if (!aReader.Perform(thePath, theProgress))
{
Message::SendFail() << "Error: RWGltf_Provider : [" <<
thePath << "] : Cannot read any relevant data from the GLTF file";
return false;
}
theShape = aReader.SingleShape();
myExternalFiles = aReader.ExternalFiles();
myMetadata = aReader.Metadata();
return true;
return Read(thePath, theShape, theProgress);
}
//=======================================================================
@@ -207,10 +197,47 @@ bool RWGltf_Provider::Write(const TCollection_AsciiString& thePath,
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)))
{
Message::SendFail() << "Error in the RWGltf_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(RWGltf_ConfigurationNode) aNode = Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
RWGltf_CafReader aReader;
SetReaderParameters(aReader, aNode);
if (!aReader.Perform(thePath, theProgress))
{
Message::SendFail() << "Error in the RWGltf_Provider during reading the file " << thePath;
return false;
}
theShape = aReader.SingleShape();
return true;
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool RWGltf_Provider::Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress)
{
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
aShTool->AddShape(theShape);
return Write(thePath, aDoc, theWS, theProgress);
return Write(thePath, aDoc, theProgress);
}
//=======================================================================

View File

@@ -66,6 +66,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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
//! @param[in] thePath path to the import CAD file
//! @param[out] theShape shape to save result
@@ -88,6 +106,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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:
//! Gets CAD format name of associated provider
@@ -98,18 +134,6 @@ public:
//! @return provider's vendor name
Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE;
public:
//!
const TColStd_IndexedDataMapOfStringString& GetMetadata() const { return myMetadata; }
//!
const NCollection_IndexedMap<TCollection_AsciiString>& GetExternalFiles() const { return myExternalFiles; }
private:
TColStd_IndexedDataMapOfStringString myMetadata; //!<
NCollection_IndexedMap<TCollection_AsciiString> myExternalFiles; //!<
};
#endif // _RWGltf_Provider_HeaderFile

View File

@@ -63,8 +63,6 @@ bool RWObj_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRes
theResource->BooleanVal("read.single.precision", InternalParameters.ReadSinglePrecision, aScope);
InternalParameters.ReadCreateShapes =
theResource->BooleanVal("read.create.shapes", InternalParameters.ReadCreateShapes, aScope);
InternalParameters.ReadCreateSingle =
theResource->BooleanVal("read.create.single", InternalParameters.ReadCreateSingle, aScope);
InternalParameters.ReadRootPrefix =
theResource->StringVal("read.root.prefix", InternalParameters.ReadRootPrefix, aScope);
InternalParameters.ReadFillDoc =
@@ -125,17 +123,11 @@ TCollection_AsciiString RWObj_ConfigurationNode::Save() const
aResult += "!\n";
aResult += "!\n";
aResult += "!Flag for create shapes in shape reading case\n";
aResult += "!Flag for create a single triangulation\n";
aResult += "!Default value: 0(false). Available values: 0(false), 1(true)\n";
aResult += aScope + "read.create.shapes :\t " + InternalParameters.ReadCreateShapes + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Flag for create shapes in shape reading case\n";
aResult += "!Default value: 0(false). Available values: 0(false), 1(true)\n";
aResult += aScope + "read.create.single :\t " + InternalParameters.ReadCreateSingle + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Root folder for generating root labels names\n";
aResult += "!Default value: ""(empty). Available values: <path>\n";

View File

@@ -87,8 +87,7 @@ public:
RWMesh_CoordinateSystem FileCS = RWMesh_CoordinateSystem_Yup; //!< File origin coordinate system to perform conversion during read
// Reading
bool ReadSinglePrecision = false; //!< Flag for reading vertex data with single or double floating point precision
bool ReadCreateShapes = false; //!< Flag for create shapes in shape reading case
bool ReadCreateSingle = false; //!< Flag for create a single triangulation in shape reading case
bool ReadCreateShapes = false; //!< Flag for create a single triangulation
TCollection_AsciiString ReadRootPrefix; //!< Root folder for generating root labels names
bool ReadFillDoc = true; //!< Flag for fill document from shape sequence
bool ReadFillIncomplete = true; //!< Flag for fill the document with partially retrieved data even if reader has failed with error

View File

@@ -49,38 +49,7 @@ bool RWObj_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
if (theDocument.IsNull())
{
Message::SendFail() << "Error: RWObj_Provider : "
<< "Null document";
return false;
}
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
{
Message::SendFail() << "Error: RWObj_Provider : "
<< "Incorrect or empty Configuration Node";
return false;
}
Handle(RWObj_ConfigurationNode) aNode =
Handle(RWObj_ConfigurationNode)::DownCast(GetNode());
RWObj_CafReader aReader;
aReader.SetSinglePrecision(aNode->InternalParameters.ReadSinglePrecision);
aReader.SetSystemLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
aReader.SetSystemCoordinateSystem(aNode->InternalParameters.SystemCS);
aReader.SetFileLengthUnit(aNode->InternalParameters.FileLengthUnit);
aReader.SetFileCoordinateSystem(aNode->InternalParameters.FileCS);
aReader.SetDocument(theDocument);
aReader.SetRootPrefix(aNode->InternalParameters.ReadRootPrefix);
aReader.SetMemoryLimitMiB(aNode->InternalParameters.ReadMemoryLimitMiB);
if (!aReader.Perform(thePath, theProgress))
{
Message::SendFail() << "Error: RWObj_Provider : [" <<
thePath << "] : Cannot read any relevant data from the Obj file";
return false;
}
myExternalFiles = aReader.ExternalFiles();
return true;
return Read(thePath, theDocument, theProgress);
}
//=======================================================================
@@ -93,15 +62,63 @@ bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
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())
{
Message::SendFail() << "Error: RWObj_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the RWObj_Provider during reading the file " <<
thePath << "\t: theDocument shouldn't be null";
return false;
}
Handle(RWObj_ConfigurationNode) aNode =
Handle(RWObj_ConfigurationNode)::DownCast(GetNode());
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
{
Message::SendFail() << "Error in the RWObj_ConfigurationNode during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(RWObj_ConfigurationNode) aNode = Handle(RWObj_ConfigurationNode)::DownCast(GetNode());
RWObj_CafReader aReader;
aReader.SetSinglePrecision(aNode->InternalParameters.ReadSinglePrecision);
aReader.SetSystemLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
aReader.SetSystemCoordinateSystem(aNode->InternalParameters.SystemCS);
aReader.SetFileLengthUnit(aNode->InternalParameters.FileLengthUnit);
aReader.SetFileCoordinateSystem(aNode->InternalParameters.FileCS);
aReader.SetDocument(theDocument);
aReader.SetRootPrefix(aNode->InternalParameters.ReadRootPrefix);
aReader.SetMemoryLimitMiB(aNode->InternalParameters.ReadMemoryLimitMiB);
if (!aReader.Perform(thePath, theProgress))
{
Message::SendFail() << "Error in the RWObj_ConfigurationNode during reading the file " << thePath;
return false;
}
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
return true;
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress)
{
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
{
Message::SendFail() << "Error in the RWObj_ConfigurationNode during writing the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(RWObj_ConfigurationNode) aNode = Handle(RWObj_ConfigurationNode)::DownCast(GetNode());
TColStd_IndexedDataMapOfStringString aFileInfo;
if (!aNode->InternalParameters.WriteAuthor.IsEmpty())
@@ -112,6 +129,7 @@ bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
{
aFileInfo.Add("Comments", aNode->InternalParameters.WriteComment);
}
RWMesh_CoordinateSystemConverter aConverter;
aConverter.SetInputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
aConverter.SetInputCoordinateSystem(aNode->InternalParameters.SystemCS);
@@ -122,8 +140,7 @@ bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
aWriter.SetCoordinateSystemConverter(aConverter);
if (!aWriter.Perform(theDocument, aFileInfo, theProgress))
{
Message::SendFail() << "Error: RWObj_Provider : [" <<
thePath << "] : Cannot write any relevant data to the Obj file";
Message::SendFail() << "Error in the RWObj_ConfigurationNode during writing the file " << thePath;
return false;
}
return true;
@@ -139,61 +156,7 @@ bool RWObj_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
{
Message::SendFail() << "Error: RWObj_Provider : "
<< "Incorrect or empty Configuration Node";
return false;
}
Handle(RWObj_ConfigurationNode) aNode =
Handle(RWObj_ConfigurationNode)::DownCast(GetNode());
if (aNode->InternalParameters.ReadCreateSingle)
{
RWMesh_CoordinateSystemConverter aConverter;
aConverter.SetOutputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
aConverter.SetOutputCoordinateSystem(aNode->InternalParameters.SystemCS);
aConverter.SetInputLengthUnit(aNode->InternalParameters.FileLengthUnit);
aConverter.SetInputCoordinateSystem(aNode->InternalParameters.FileCS);
RWObj_TriangulationReader aSimpleReader;
aSimpleReader.SetTransformation(aConverter);
aSimpleReader.SetSinglePrecision(aNode->InternalParameters.ReadSinglePrecision);
aSimpleReader.SetCreateShapes(aNode->InternalParameters.ReadCreateShapes);
aSimpleReader.SetSinglePrecision(aNode->InternalParameters.ReadSinglePrecision);
aSimpleReader.SetMemoryLimit(aNode->InternalParameters.ReadMemoryLimitMiB);
if (!aSimpleReader.Read(thePath, theProgress))
{
Message::SendFail() << "Error: RWObj_Provider : [" <<
thePath << "] : Cannot read any relevant data from the Obj file";
return false;
}
Handle(Poly_Triangulation) aTriangulation = aSimpleReader.GetTriangulation();
TopoDS_Face aFace;
BRep_Builder aBuiler;
aBuiler.MakeFace(aFace);
aBuiler.UpdateFace(aFace, aTriangulation);
theShape = aFace;
myExternalFiles = aSimpleReader.ExternalFiles();
return true;
}
RWObj_CafReader aReader;
aReader.SetSinglePrecision(aNode->InternalParameters.ReadSinglePrecision);
aReader.SetSystemLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
aReader.SetSystemCoordinateSystem(aNode->InternalParameters.SystemCS);
aReader.SetFileLengthUnit(aNode->InternalParameters.FileLengthUnit);
aReader.SetFileCoordinateSystem(aNode->InternalParameters.FileCS);
aReader.SetRootPrefix(aNode->InternalParameters.ReadRootPrefix);
aReader.SetMemoryLimitMiB(aNode->InternalParameters.ReadMemoryLimitMiB);
if (!aReader.Perform(thePath, theProgress))
{
Message::SendFail() << "Error: RWObj_Provider : [" <<
thePath << "] : Cannot read any relevant data from the Obj file";
return false;
}
theShape = aReader.SingleShape();
myExternalFiles = aReader.ExternalFiles();
return true;
return Read(thePath, theShape, theProgress);
}
//=======================================================================
@@ -206,11 +169,62 @@ bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
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)))
{
Message::SendFail() << "Error in the RWObj_ConfigurationNode during writing the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(RWObj_ConfigurationNode) aNode = Handle(RWObj_ConfigurationNode)::DownCast(GetNode());
RWMesh_CoordinateSystemConverter aConverter;
aConverter.SetOutputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
aConverter.SetOutputCoordinateSystem(aNode->InternalParameters.SystemCS);
aConverter.SetInputLengthUnit(aNode->InternalParameters.FileLengthUnit);
aConverter.SetInputCoordinateSystem(aNode->InternalParameters.FileCS);
RWObj_TriangulationReader aSimpleReader;
aSimpleReader.SetTransformation(aConverter);
aSimpleReader.SetSinglePrecision(aNode->InternalParameters.ReadSinglePrecision);
aSimpleReader.SetCreateShapes(aNode->InternalParameters.ReadCreateShapes);
aSimpleReader.SetSinglePrecision(aNode->InternalParameters.ReadSinglePrecision);
aSimpleReader.SetMemoryLimit(aNode->InternalParameters.ReadMemoryLimitMiB);
if (!aSimpleReader.Read(thePath, theProgress))
{
Message::SendFail() << "Error in the RWObj_ConfigurationNode during reading the file " << thePath;
return false;
}
Handle(Poly_Triangulation) aTriangulation = aSimpleReader.GetTriangulation();
TopoDS_Face aFace;
BRep_Builder aBuiler;
aBuiler.MakeFace(aFace);
aBuiler.UpdateFace(aFace, aTriangulation);
theShape = aFace;
return true;
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool RWObj_Provider::Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress)
{
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);
return Write(thePath, aDoc, theWS, theProgress);
return Write(thePath, aDoc, theProgress);
}
//=======================================================================

View File

@@ -16,8 +16,6 @@
#include <DE_Provider.hxx>
#include <NCollection_IndexedMap.hxx>
//! The class to transfer OBJ files.
//! Reads and Writes any OBJ files into/from OCCT.
//! Each operation needs configuration node.
@@ -66,6 +64,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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
//! @param[in] thePath path to the import CAD file
//! @param[out] theShape shape to save result
@@ -88,6 +104,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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:
//! Gets CAD format name of associated provider
@@ -97,15 +131,6 @@ public:
//! Gets provider's vendor name of associated provider
//! @return provider's vendor name
Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE;
public:
//!
const NCollection_IndexedMap<TCollection_AsciiString>& GetExternalFiles() const { return myExternalFiles; }
private:
NCollection_IndexedMap<TCollection_AsciiString> myExternalFiles; //!<
};
#endif // _RWObj_Provider_HeaderFile

View File

@@ -52,24 +52,33 @@ bool RWPly_Provider::Write(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(RWPly_ConfigurationNode)))
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)))
{
Message::SendFail() << "Error: RWPly_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the RWPly_Provider during writing the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(RWPly_ConfigurationNode) aNode =
Handle(RWPly_ConfigurationNode)::DownCast(GetNode());
Handle(RWPly_ConfigurationNode) aNode = Handle(RWPly_ConfigurationNode)::DownCast(GetNode());
TDF_LabelSequence aRootLabels;
Handle(XCAFDoc_ShapeTool) aShapeTool =
XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aShapeTool->GetFreeShapes(aRootLabels);
if (aRootLabels.IsEmpty())
{
return Standard_True;
}
TColStd_IndexedDataMapOfStringString aFileInfo;
if (!aNode->InternalParameters.WriteAuthor.IsEmpty())
{
@@ -93,8 +102,8 @@ bool RWPly_Provider::Write(const TCollection_AsciiString& thePath,
aPlyCtx.SetFaceId(aNode->InternalParameters.WriteFaceId);
if (!aPlyCtx.Perform(theDocument, aFileInfo, theProgress))
{
Message::SendFail() << "Error: RWObj_Provider : [" <<
thePath << "] : Cannot write any relevant data to the Ply file";
Message::SendFail() << "Error in the RWPly_Provider during writing the file "
<< thePath << "\t: Cannot perform the document";
return false;
}
@@ -111,10 +120,21 @@ bool RWPly_Provider::Write(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(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(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
aShTool->AddShape(theShape);
return Write(thePath, aDoc, theWS, theProgress);
return Write(thePath, aDoc, theProgress);
}
//=======================================================================

View File

@@ -53,6 +53,15 @@ public:
Handle(XSControl_WorkSession)& theWS,
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
//! @param[in] thePath path to the export CAD file
//! @param[out] theShape shape to export
@@ -64,6 +73,15 @@ public:
Handle(XSControl_WorkSession)& theWS,
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:
//! Gets CAD format name of associated provider

View File

@@ -445,6 +445,7 @@
#include <RWStepVisual_RWFillAreaStyle.hxx>
#include <RWStepVisual_RWFillAreaStyleColour.hxx>
#include <RWStepVisual_RWInvisibility.hxx>
#include <RWStepVisual_RWLeaderDirectedCallout.hxx>
#include <RWStepVisual_RWMechanicalDesignGeometricPresentationArea.hxx>
#include <RWStepVisual_RWMechanicalDesignGeometricPresentationRepresentation.hxx>
#include <RWStepVisual_RWOverRidingStyledItem.hxx>
@@ -910,6 +911,10 @@
#include <StepShape_Vertex.hxx>
#include <StepShape_VertexLoop.hxx>
#include <StepShape_VertexPoint.hxx>
#include <StepVisual_AnnotationCurveOccurrence.hxx>
#include <StepVisual_AnnotationCurveOccurrenceAndGeomReprItem.hxx>
#include <StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem.hxx>
#include <StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem.hxx>
#include <StepVisual_AnnotationText.hxx>
#include <StepVisual_AnnotationTextOccurrence.hxx>
#include <StepVisual_AreaInSet.hxx>
@@ -934,6 +939,7 @@
#include <StepVisual_FillAreaStyle.hxx>
#include <StepVisual_FillAreaStyleColour.hxx>
#include <StepVisual_Invisibility.hxx>
#include <StepVisual_LeaderDirectedCallout.hxx>
#include <StepVisual_MechanicalDesignGeometricPresentationArea.hxx>
#include <StepVisual_MechanicalDesignGeometricPresentationRepresentation.hxx>
#include <StepVisual_OverRidingStyledItem.hxx>
@@ -1148,6 +1154,9 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_GeneralModule,StepData_GeneralModule)
#include <RWStepDimTol_RWGeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol.hxx>
#include <RWStepDimTol_RWGeoTolAndGeoTolWthMaxTol.hxx>
#include <RWStepVisual_RWAnnotationCurveOccurrence.hxx>
#include <RWStepVisual_RWAnnotationCurveOccurrenceAndGeomReprItem.hxx>
#include <RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem.hxx>
#include <RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem.hxx>
#include <RWStepVisual_RWAnnotationOccurrence.hxx>
#include <RWStepVisual_RWAnnotationPlane.hxx>
#include <RWStepVisual_RWDraughtingCallout.hxx>
@@ -1216,8 +1225,6 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_GeneralModule,StepData_GeneralModule)
#include <RWStepVisual_RWCameraModelD3MultiClipping.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx>
#include <StepVisual_AnnotationCurveOccurrenceAndGeomReprItem.hxx>
#include <RWStepVisual_RWAnnotationCurveOccurrenceAndGeomReprItem.hxx>
// Added for kinematics implementation
#include <RWStepKinematics_RWActuatedKinPairAndOrderKinPair.hxx>
@@ -5867,6 +5874,27 @@ void RWStepAP214_GeneralModule::FillSharedCase(const Standard_Integer CN,
aTool.Share(anEnt, iter);
}
break;
case 820:
{
DeclareAndCast(StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem, anEnt, ent);
RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem aTool;
aTool.Share(anEnt, iter);
}
break;
case 821:
{
DeclareAndCast(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem, anEnt, ent);
RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem aTool;
aTool.Share(anEnt, iter);
}
break;
case 824:
{
DeclareAndCast(StepVisual_LeaderDirectedCallout, anEnt, ent);
RWStepVisual_RWLeaderDirectedCallout aTool;
aTool.Share(anEnt, iter);
}
break;
default : break;
}
}
@@ -8173,7 +8201,15 @@ Standard_Boolean RWStepAP214_GeneralModule::NewVoid
case 818:
ent = new StepVisual_CubicBezierTriangulatedFace;
break;
case 820:
ent = new StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem;
break;
case 821:
ent = new StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem;
break;
case 824:
ent = new StepVisual_LeaderDirectedCallout;
break;
default:
return Standard_False;
}
@@ -8870,6 +8906,9 @@ Standard_Integer RWStepAP214_GeneralModule::CategoryNumber
case 816: return cataux;
case 817: return cataux;
case 818: return cataux;
case 820: return catdr;
case 821: return catdr;
case 824: return cataux;
default : break;
}
return 0;

View File

@@ -194,6 +194,7 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
#include <StepGeom_Hyperbola.hxx>
#include <StepGeom_IntersectionCurve.hxx>
#include <StepVisual_Invisibility.hxx>
#include <StepVisual_LeaderDirectedCallout.hxx>
#include <StepBasic_LengthMeasureWithUnit.hxx>
#include <StepBasic_LengthUnit.hxx>
#include <StepGeom_Line.hxx>
@@ -626,6 +627,7 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
#include <RWStepGeom_RWHyperbola.hxx>
#include <RWStepGeom_RWIntersectionCurve.hxx>
#include <RWStepVisual_RWInvisibility.hxx>
#include <RWStepVisual_RWLeaderDirectedCallout.hxx>
#include <RWStepBasic_RWLengthMeasureWithUnit.hxx>
#include <RWStepBasic_RWLengthUnit.hxx>
#include <RWStepGeom_RWLine.hxx>
@@ -1360,6 +1362,9 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
#include <RWStepDimTol_RWGeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol.hxx>
#include <RWStepDimTol_RWGeoTolAndGeoTolWthMaxTol.hxx>
#include <RWStepVisual_RWAnnotationCurveOccurrence.hxx>
#include <RWStepVisual_RWAnnotationCurveOccurrenceAndGeomReprItem.hxx>
#include <RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem.hxx>
#include <RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem.hxx>
#include <RWStepVisual_RWAnnotationOccurrence.hxx>
#include <RWStepVisual_RWAnnotationPlane.hxx>
#include <RWStepVisual_RWDraughtingCallout.hxx>
@@ -1410,6 +1415,9 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
#include <StepDimTol_GeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol.hxx>
#include <StepDimTol_GeoTolAndGeoTolWthMaxTol.hxx>
#include <StepVisual_AnnotationCurveOccurrence.hxx>
#include <StepVisual_AnnotationCurveOccurrenceAndGeomReprItem.hxx>
#include <StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem.hxx>
#include <StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem.hxx>
#include <StepVisual_AnnotationPlane.hxx>
#include <StepVisual_DraughtingCallout.hxx>
@@ -1442,8 +1450,6 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
#include <RWStepVisual_RWCameraModelD3MultiClipping.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx>
#include <StepVisual_AnnotationCurveOccurrenceAndGeomReprItem.hxx>
#include <RWStepVisual_RWAnnotationCurveOccurrenceAndGeomReprItem.hxx>
#include <RWStepVisual_RWSurfaceStyleTransparent.hxx>
#include <RWStepVisual_RWSurfaceStyleReflectanceAmbient.hxx>
@@ -1766,8 +1772,11 @@ static TCollection_AsciiString Reco_HalfSpaceSolid ("HALF_SPACE_SOLID");
static TCollection_AsciiString Reco_Hyperbola ("HYPERBOLA");
static TCollection_AsciiString Reco_IntersectionCurve ("INTERSECTION_CURVE");
static TCollection_AsciiString Reco_Invisibility ("INVISIBILITY");
static TCollection_AsciiString Reco_LeaderCurve ("LEADER_CURVE");
static TCollection_AsciiString Reco_LeaderTerminator ("LEADER_TERMINATOR");
static TCollection_AsciiString Reco_LengthMeasureWithUnit ("LENGTH_MEASURE_WITH_UNIT");
static TCollection_AsciiString Reco_LengthUnit ("LENGTH_UNIT");
static TCollection_AsciiString Reco_LeaderDirectedCallout ("LEADER_DIRECTED_CALLOUT");
static TCollection_AsciiString Reco_Line ("LINE");
static TCollection_AsciiString Reco_LocalTime ("LOCAL_TIME");
static TCollection_AsciiString Reco_Loop ("LOOP");
@@ -2350,6 +2359,8 @@ static TCollection_AsciiString Reco_ComplexTriangulatedSurfaceSet("COMPLEX_TRIAN
static TCollection_AsciiString Reco_CubicBezierTessellatedEdge("CUBIC_BEZIER_TESSELLATED_EDGE");
static TCollection_AsciiString Reco_CubicBezierTriangulatedFace("CUBIC_BEZIER_TRIANGULATED_FACE");
// -- Definition of the libraries --
static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> typenums;
@@ -3105,6 +3116,9 @@ RWStepAP214_ReadWriteModule::RWStepAP214_ReadWriteModule ()
typenums.Bind(Reco_ComplexTriangulatedSurfaceSet, 816);
typenums.Bind(Reco_CubicBezierTessellatedEdge, 817);
typenums.Bind(Reco_CubicBezierTriangulatedFace, 818);
typenums.Bind(Reco_LeaderCurve, 822);
typenums.Bind(Reco_LeaderTerminator, 823);
typenums.Bind(Reco_LeaderDirectedCallout, 824);
// SHORT NAMES
@@ -3744,6 +3758,17 @@ Standard_Integer RWStepAP214_ReadWriteModule::CaseStep
(types(8).IsEqual(StepType(247)))) {
return 800;
}
else if ((types(1).IsEqual(StepType(7))) &&
(types(2).IsEqual(StepType(10))) &&
(types(3).IsEqual(StepType(106))) &&
(types(4).IsEqual(StepType(144))) &&
(types(5).IsEqual(StepType(823))) &&
(types(6).IsEqual(StepType(247))) &&
(types(7).IsEqual(StepType(270))) &&
(types(8).IsEqual(StepType(294))))
{
return 821;
}
}
else if (NbComp == 7) {
if ((types(1).IsEqual(StepType(48))) &&
@@ -3836,6 +3861,16 @@ Standard_Integer RWStepAP214_ReadWriteModule::CaseStep
(types(7).IsEqual(StepType(271)))) {
return 323;
}
else if ((types(1).IsEqual(StepType(4))) &&
(types(2).IsEqual(StepType(7))) &&
(types(3).IsEqual(StepType(106))) &&
(types(4).IsEqual(StepType(144))) &&
(types(5).IsEqual(StepType(822))) &&
(types(6).IsEqual(StepType(247))) &&
(types(7).IsEqual(StepType(270))))
{
return 820;
}
}
// Added by FMA
else if (NbComp == 6) {
@@ -4334,6 +4369,10 @@ Standard_Boolean RWStepAP214_ReadWriteModule::IsComplex
return Standard_True;
case 719:
return Standard_True;
case 820:
return Standard_True;
case 821:
return Standard_True;
default:
return Standard_False;
}
@@ -5092,6 +5131,9 @@ const TCollection_AsciiString& RWStepAP214_ReadWriteModule::StepType
case 816: return Reco_ComplexTriangulatedSurfaceSet;
case 817: return Reco_CubicBezierTessellatedEdge;
case 818: return Reco_CubicBezierTriangulatedFace;
case 822: return Reco_LeaderCurve;
case 823: return Reco_LeaderTerminator;
case 824: return Reco_LeaderDirectedCallout;
default : return PasReco;
}
}
@@ -5429,7 +5471,24 @@ Standard_Boolean RWStepAP214_ReadWriteModule::ComplexType(const Standard_Integer
types.Append(StepType(709));
types.Append(StepType(708));
break;
default: return Standard_False;
case 820:
types.Append(StepType(4));
types.Append(StepType(7));
types.Append(StepType(106));
types.Append(StepType(144));
types.Append(StepType(822));
types.Append(StepType(247));
types.Append(StepType(270));
break;
case 821:
types.Append(StepType(4));
types.Append(StepType(10));
types.Append(StepType(106));
types.Append(StepType(144));
types.Append(StepType(823));
types.Append(StepType(247));
types.Append(StepType(270));
break;
}
return Standard_True;
}
@@ -10694,7 +10753,28 @@ void RWStepAP214_ReadWriteModule::ReadStep(const Standard_Integer CN,
aTool.ReadStep(data, num, ach, anEnt);
}
break;
default:
case 820:
{
DeclareAndCast(StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem, anEnt, ent);
RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem aTool;
aTool.ReadStep(data, num, ach, anEnt);
}
break;
case 821:
{
DeclareAndCast(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem, anEnt, ent);
RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem aTool;
aTool.ReadStep(data, num, ach, anEnt);
}
break;
case 824:
{
DeclareAndCast(StepVisual_LeaderDirectedCallout, anEnt, ent);
RWStepVisual_RWLeaderDirectedCallout aTool;
aTool.ReadStep(data, num, ach, anEnt);
}
break;
default:
ach->AddFail("Type Mismatch when reading - Entity");
}
return;
@@ -16238,6 +16318,27 @@ void RWStepAP214_ReadWriteModule::WriteStep(const Standard_Integer CN,
aTool.WriteStep(SW, anEnt);
}
break;
case 820:
{
DeclareAndCast(StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem, anEnt, ent);
RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem aTool;
aTool.WriteStep(SW, anEnt);
}
break;
case 821:
{
DeclareAndCast(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem, anEnt, ent);
RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem aTool;
aTool.WriteStep(SW, anEnt);
}
break;
case 824:
{
DeclareAndCast(StepVisual_LeaderDirectedCallout, anEnt, ent);
RWStepVisual_RWLeaderDirectedCallout aTool;
aTool.WriteStep(SW, anEnt);
}
break;
default:
return;
}

View File

@@ -6,6 +6,10 @@ RWStepVisual_RWAnnotationFillArea.cxx
RWStepVisual_RWAnnotationFillArea.hxx
RWStepVisual_RWAnnotationFillAreaOccurrence.cxx
RWStepVisual_RWAnnotationFillAreaOccurrence.hxx
RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem.cxx
RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem.hxx
RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem.cxx
RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem.hxx
RWStepVisual_RWAnnotationOccurrence.cxx
RWStepVisual_RWAnnotationOccurrence.hxx
RWStepVisual_RWAnnotationPlane.cxx
@@ -68,6 +72,8 @@ RWStepVisual_RWFillAreaStyleColour.cxx
RWStepVisual_RWFillAreaStyleColour.hxx
RWStepVisual_RWInvisibility.cxx
RWStepVisual_RWInvisibility.hxx
RWStepVisual_RWLeaderDirectedCallout.cxx
RWStepVisual_RWLeaderDirectedCallout.hxx
RWStepVisual_RWMechanicalDesignGeometricPresentationArea.cxx
RWStepVisual_RWMechanicalDesignGeometricPresentationArea.hxx
RWStepVisual_RWMechanicalDesignGeometricPresentationRepresentation.cxx

View File

@@ -0,0 +1,110 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem.hxx>
#include <Interface_Check.hxx>
#include <Interface_EntityIterator.hxx>
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include <StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem.hxx>
//=======================================================================
//function : ReadStep
//purpose :
//=======================================================================
void RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem::ReadStep(
const Handle(StepData_StepReaderData)& theData,
const Standard_Integer theNum,
Handle(Interface_Check)& theCheck,
const Handle(StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem)& theEntity) const
{
Standard_Integer aNum = 0;
theData->NamedForComplex("REPRESENTATION_ITEM", "RPRITM", theNum, aNum, theCheck);
// Inherited field : name
Handle(TCollection_HAsciiString) aName;
theData->ReadString(aNum, 1, "name", theCheck, aName);
theData->NamedForComplex("STYLED_ITEM", "STYITM", theNum, aNum, theCheck);
// Inherited field : styles
Handle(StepVisual_HArray1OfPresentationStyleAssignment) aStyles;
Handle(StepVisual_PresentationStyleAssignment) anEnt;
Standard_Integer aSubNum = 0;
if (theData->ReadSubList(aNum, 1, "styles", theCheck, aSubNum))
{
Standard_Integer aNbParams = theData->NbParams(aSubNum);
aStyles = new StepVisual_HArray1OfPresentationStyleAssignment(1, aNbParams);
for (Standard_Integer aParamInd = 1; aParamInd <= aNbParams; aParamInd++)
{
if (theData->ReadEntity(aSubNum, aParamInd, "presentation_style_assignment", theCheck,
STANDARD_TYPE(StepVisual_PresentationStyleAssignment), anEnt))
{
aStyles->SetValue(aParamInd, anEnt);
}
}
}
// Inherited field : item
Handle(Standard_Transient) aItem;
theData->ReadEntity(aNum, 2, "item", theCheck, STANDARD_TYPE(Standard_Transient), aItem);
// Initialization of the read entity
theEntity->Init(aName, aStyles, aItem);
}
//=======================================================================
//function : WriteStep
//purpose :
//=======================================================================
void RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem::WriteStep(
StepData_StepWriter& theSW,
const Handle(StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem)& theEntity) const
{
theSW.StartEntity("ANNOTATION_CURVE_OCCURRENCE");
theSW.StartEntity("ANNOTATION_OCCURRENCE");
theSW.StartEntity("DRAUGHTING_ANNOTATION_OCCURRENCE");
theSW.StartEntity("GEOMETRIC_REPRESENTATION_ITEM");
theSW.StartEntity("LEADER_CURVE");
theSW.StartEntity("REPRESENTATION_ITEM");
//Inherited field : name
theSW.Send(theEntity->Name());
theSW.StartEntity("STYLED_ITEM");
// Inherited field : styles
theSW.OpenSub();
for (StepVisual_HArray1OfPresentationStyleAssignment::Iterator anIter(theEntity->Styles()->Array1());
anIter.More(); anIter.Next())
{
theSW.Send(anIter.Value());
}
theSW.CloseSub();
// Inherited field : item
theSW.Send(theEntity->Item());
}
//=======================================================================
//function : Share
//purpose :
//=======================================================================
void RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem::Share(
const Handle(StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem)& theEntity,
Interface_EntityIterator& theIter) const
{
for (StepVisual_HArray1OfPresentationStyleAssignment::Iterator anIter(theEntity->Styles()->Array1());
anIter.More(); anIter.Next())
{
theIter.GetOneItem(anIter.Value());
}
theIter.GetOneItem(theEntity->Item());
}

View File

@@ -0,0 +1,46 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem_HeaderFile
#define _RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
class StepData_StepReaderData;
class Interface_Check;
class StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem;
class StepData_StepWriter;
class Interface_EntityIterator;
//! Read & Write Module for StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem
class RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem
{
DEFINE_STANDARD_ALLOC
public:
RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem() {};
Standard_EXPORT void ReadStep(const Handle(StepData_StepReaderData)& theData,
const Standard_Integer theNum,
Handle(Interface_Check)& theCheck,
const Handle(StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem)& theEntity) const;
Standard_EXPORT void WriteStep(StepData_StepWriter& theSW,
const Handle(StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem)& theEntity) const;
Standard_EXPORT void Share(const Handle(StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem)& theEntity,
Interface_EntityIterator& theIter) const;
};
#endif // _RWStepVisual_RWAnnotationLeaderCurveOccurrenceAndGeomReprItem_HeaderFile

View File

@@ -0,0 +1,119 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem.hxx>
#include <Interface_Check.hxx>
#include <Interface_EntityIterator.hxx>
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include <StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem.hxx>
//=======================================================================
//function : ReadStep
//purpose :
//=======================================================================
void RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem::ReadStep(
const Handle(StepData_StepReaderData)& theData,
const Standard_Integer theNum,
Handle(Interface_Check)& theCheck,
const Handle(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem)& theEntity) const
{
Standard_Integer aNum = 0;
theData->NamedForComplex("REPRESENTATION_ITEM", "RPRITM", theNum, aNum, theCheck);
// Inherited field : name
Handle(TCollection_HAsciiString) aName;
theData->ReadString(aNum, 1, "name", theCheck, aName);
theData->NamedForComplex("STYLED_ITEM", "STYITM", theNum, aNum, theCheck);
// Inherited field : styles
Handle(StepVisual_HArray1OfPresentationStyleAssignment) aStyles;
Handle(StepVisual_PresentationStyleAssignment) anEnt;
Standard_Integer aSubNum = 0;
if (theData->ReadSubList(aNum, 1, "styles", theCheck, aSubNum))
{
Standard_Integer aNbParams = theData->NbParams(aSubNum);
aStyles = new StepVisual_HArray1OfPresentationStyleAssignment(1, aNbParams);
for (Standard_Integer aParamInd = 1; aParamInd <= aNbParams; aParamInd++)
{
if (theData->ReadEntity(aSubNum, aParamInd, "presentation_style_assignment", theCheck,
STANDARD_TYPE(StepVisual_PresentationStyleAssignment), anEnt))
{
aStyles->SetValue(aParamInd, anEnt);
}
}
}
// Inherited field : item
Handle(Standard_Transient) aItem;
theData->ReadEntity(aNum, 2, "item", theCheck, STANDARD_TYPE(Standard_Transient), aItem);
theData->NamedForComplex("TERMINATOR_SYMBOL", "STYITM", theNum, aNum, theCheck);
Handle(StepVisual_AnnotationCurveOccurrence) aTermonator;
theData->ReadEntity(aNum, 1, "annotated_curve", theCheck, STANDARD_TYPE(StepVisual_AnnotationCurveOccurrence), aTermonator);
// Initialization of the read entity
theEntity->Init(aName, aStyles, aItem, aTermonator);
}
//=======================================================================
//function : WriteStep
//purpose :
//=======================================================================
void RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem::WriteStep(
StepData_StepWriter& theSW,
const Handle(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem)& theEntity) const
{
theSW.StartEntity("ANNOTATION_CURVE_OCCURRENCE");
theSW.StartEntity("ANNOTATION_SYMBOL_OCCURRENCE");
theSW.StartEntity("DRAUGHTING_ANNOTATION_OCCURRENCE");
theSW.StartEntity("GEOMETRIC_REPRESENTATION_ITEM");
theSW.StartEntity("LEADER_TERMINATOR");
theSW.StartEntity("REPRESENTATION_ITEM");
//Inherited field : name
theSW.Send(theEntity->Name());
theSW.StartEntity("STYLED_ITEM");
// Inherited field : styles
theSW.OpenSub();
for (StepVisual_HArray1OfPresentationStyleAssignment::Iterator anIter(theEntity->Styles()->Array1());
anIter.More(); anIter.Next())
{
theSW.Send(anIter.Value());
}
theSW.CloseSub();
// Inherited field : item
theSW.Send(theEntity->Item());
theSW.StartEntity("TERMINATOR_SYMBOL");
theSW.Send(theEntity->Terminator());
}
//=======================================================================
//function : Share
//purpose :
//=======================================================================
void RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem::Share(
const Handle(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem)& theEntity,
Interface_EntityIterator& theIter) const
{
for (StepVisual_HArray1OfPresentationStyleAssignment::Iterator anIter(theEntity->Styles()->Array1());
anIter.More(); anIter.Next())
{
theIter.GetOneItem(anIter.Value());
}
theIter.GetOneItem(theEntity->Item());
theIter.GetOneItem(theEntity->Terminator());
}

View File

@@ -0,0 +1,46 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem_HeaderFile
#define _RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
class StepData_StepReaderData;
class Interface_Check;
class StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem;
class StepData_StepWriter;
class Interface_EntityIterator;
//! Read & Write Module for StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem
class RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem
{
DEFINE_STANDARD_ALLOC
public:
RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem() {};
Standard_EXPORT void ReadStep(const Handle(StepData_StepReaderData)& theData,
const Standard_Integer theNum,
Handle(Interface_Check)& theCheck,
const Handle(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem)& theEntity) const;
Standard_EXPORT void WriteStep(StepData_StepWriter& theSW,
const Handle(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem)& theEntity) const;
Standard_EXPORT void Share(const Handle(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem)& theEntity,
Interface_EntityIterator& theIter) const;
};
#endif // _RWStepVisual_RWAnnotationLeaderTerminatorOccurrenceAndGeomReprItem_HeaderFile

View File

@@ -0,0 +1,99 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <RWStepVisual_RWLeaderDirectedCallout.hxx>
#include <Interface_Check.hxx>
#include <Interface_EntityIterator.hxx>
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include <StepVisual_LeaderDirectedCallout.hxx>
//=======================================================================
//function : RWStepVisual_RWLeaderDirectedCallout
//purpose :
//=======================================================================
RWStepVisual_RWLeaderDirectedCallout::RWStepVisual_RWLeaderDirectedCallout() {}
//=======================================================================
//function : ReadStep
//purpose :
//=======================================================================
void RWStepVisual_RWLeaderDirectedCallout::ReadStep(const Handle(StepData_StepReaderData)& theData,
const Standard_Integer theNum,
Handle(Interface_Check)& theCheck,
const Handle(StepVisual_LeaderDirectedCallout)& theEnitity) const
{
if (!theData->CheckNbParams(theNum, 2, theCheck, "draughting_callout"))
{
return;
}
// Inherited field : name
Handle(TCollection_HAsciiString) aName;
theData->ReadString(theNum, 1, "name", theCheck, aName);
// Own field: contents
Handle(StepVisual_HArray1OfDraughtingCalloutElement) aContents;
StepVisual_DraughtingCalloutElement anEnt;
Standard_Integer aNbSub;
if (theData->ReadSubList(theNum, 2, "contents", theCheck, aNbSub))
{
Standard_Integer aNbElements = theData->NbParams(aNbSub);
aContents = new StepVisual_HArray1OfDraughtingCalloutElement(1, aNbElements);
for (Standard_Integer anInd = 1; anInd <= aNbElements; anInd++)
{
if (theData->ReadEntity(aNbSub, anInd, "content", theCheck, anEnt))
{
aContents->SetValue(anInd, anEnt);
}
}
}
// Initialisation of the read entity
theEnitity->Init(aName, aContents);
}
//=======================================================================
//function : WriteStep
//purpose :
//=======================================================================
void RWStepVisual_RWLeaderDirectedCallout::WriteStep(StepData_StepWriter& theSW,
const Handle(StepVisual_LeaderDirectedCallout)& theEnitity) const
{
// Inherited field: name
theSW.Send(theEnitity->Name());
// Own field: contents
theSW.OpenSub();
for (Standard_Integer anInd = 1; anInd <= theEnitity->NbContents(); anInd++)
{
theSW.Send(theEnitity->ContentsValue(anInd).Value());
}
theSW.CloseSub();
}
//=======================================================================
//function : Share
//purpose :
//=======================================================================
void RWStepVisual_RWLeaderDirectedCallout::Share(const Handle(StepVisual_LeaderDirectedCallout)& theEnitity,
Interface_EntityIterator& theIter) const
{
// Own field: contents
const Standard_Integer aNb = theEnitity->NbContents();
for (Standard_Integer anInd = 1; anInd <= aNb; anInd++)
{
theIter.AddItem(theEnitity->ContentsValue(anInd).Value());
}
}

View File

@@ -0,0 +1,46 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _RWStepVisual_RWLeaderDirectedCallout_HeaderFile
#define _RWStepVisual_RWLeaderDirectedCallout_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
class Interface_EntityIterator;
class StepData_StepReaderData;
class Interface_Check;
class StepVisual_LeaderDirectedCallout;
class StepData_StepWriter;
//! Read & Write Module for LeaderDirectedCallout
class RWStepVisual_RWLeaderDirectedCallout
{
DEFINE_STANDARD_ALLOC
public:
Standard_EXPORT RWStepVisual_RWLeaderDirectedCallout();
Standard_EXPORT void ReadStep(const Handle(StepData_StepReaderData)& theData,
const Standard_Integer theNum,
Handle(Interface_Check)& theCheck,
const Handle(StepVisual_LeaderDirectedCallout)& theEntity) const;
Standard_EXPORT void WriteStep(StepData_StepWriter& SW,
const Handle(StepVisual_LeaderDirectedCallout)& theEntity) const;
Standard_EXPORT void Share(const Handle(StepVisual_LeaderDirectedCallout)& theEntity,
Interface_EntityIterator& theIter) const;
};
#endif // _RWStepVisual_RWLeaderDirectedCallout_HeaderFile

View File

@@ -56,8 +56,8 @@ bool RWStl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRes
InternalParameters.ReadMergeAngle =
theResource->RealVal("read.merge.angle", InternalParameters.ReadMergeAngle, aScope);
InternalParameters.ReadShapeType = (ReadMode_ShapeType)
theResource->IntegerVal("read.brep", InternalParameters.ReadShapeType, aScope);
InternalParameters.ReadBRep =
theResource->BooleanVal("read.brep", InternalParameters.ReadBRep, aScope);
InternalParameters.WriteAscii =
theResource->BooleanVal("write.ascii", InternalParameters.WriteAscii, aScope);
return true;
@@ -85,9 +85,9 @@ TCollection_AsciiString RWStl_ConfigurationNode::Save() const
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines result type of transferred shape\n";
aResult += "!Default value: 1(SingleMesh). Available values: 0(MultiMesh), 1(SingleMesh), 2(CompShape)\n";
aResult += aScope + "read.brep :\t " + InternalParameters.ReadShapeType + "\n";
aResult += "!Setting up Boundary Representation flag\n";
aResult += "!Default value: false. Available values: \"on\", \"off\"\n";
aResult += aScope + "read.brep :\t " + InternalParameters.ReadBRep + "\n";
aResult += "!\n";
aResult += "!\n";

View File

@@ -84,17 +84,11 @@ public:
Standard_EXPORT virtual bool CheckContent(const Handle(NCollection_Buffer)& theBuffer) const Standard_OVERRIDE;
public:
enum ReadMode_ShapeType
{
ReadMode_ShapeType_MultiMesh = 0,
ReadMode_ShapeType_SingleMesh,
ReadMode_ShapeType_CompShape,
};
struct RWStl_InternalSection
{
// Read
double ReadMergeAngle = 90.; //!< Input merge angle value
ReadMode_ShapeType ReadShapeType = ReadMode_ShapeType_SingleMesh; //!< Defines result type of transferred shape
bool ReadBRep = false; //!< Setting up Boundary Representation flag
// Write
bool WriteAscii = true; //!< Setting up writing mode (Ascii or Binary)

View File

@@ -51,21 +51,7 @@ bool RWStl_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
if (theDocument.IsNull())
{
Message::SendFail() << "Error: RWStl_Provider : "
<< "Null document";
return false;
}
TopoDS_Shape aShape;
if (!Read(thePath, aShape, theWS, theProgress))
{
return false;
}
Handle(XCAFDoc_ShapeTool) aShapeTool =
XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aShapeTool->AddShape(aShape);
return true;
return Read(thePath, theDocument, theProgress);
}
//=======================================================================
@@ -78,15 +64,49 @@ bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
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())
{
Message::SendFail() << "Error in the RWStl_Provider during reading the file " <<
thePath << "\t: theDocument shouldn't be null";
return false;
}
TopoDS_Shape aShape;
if (!Read(thePath, aShape, theProgress))
{
return false;
}
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aShapeTool->AddShape(aShape);
return true;
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress)
{
TopoDS_Shape aShape;
TDF_LabelSequence aLabels;
Handle(XCAFDoc_ShapeTool) aSTool =
XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aSTool->GetFreeShapes(aLabels);
if (aLabels.Length() <= 0)
{
Message::SendFail() << "Error: RWStl_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the RWStl_Provider during writing the file " <<
thePath << "\t: Document contain no shapes";
return false;
}
@@ -106,7 +126,7 @@ bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
}
aShape = aComp;
}
return Write(thePath, aShape, theWS, theProgress);
return Write(thePath, aShape, theProgress);
}
//=======================================================================
@@ -119,87 +139,7 @@ bool RWStl_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
Message::SendWarning()
<< "OCCT Stl reader does not support model scaling according to custom length unit";
if (!GetNode()->IsKind(STANDARD_TYPE(RWStl_ConfigurationNode)))
{
Message::SendFail() << "Error: RWStl_Provider : "
<< "Incorrect or empty Configuration Node";
return false;
}
Handle(RWStl_ConfigurationNode) aNode =
Handle(RWStl_ConfigurationNode)::DownCast(GetNode());
double aMergeAngle = aNode->InternalParameters.ReadMergeAngle * M_PI / 180.0;
if (aMergeAngle < 0.0 || aMergeAngle > M_PI_2)
{
Message::SendFail() << "Error: RWStl_Provider : ["
<< aMergeAngle << "] The merge angle is out of the valid range";
return false;
}
switch (aNode->InternalParameters.ReadShapeType)
{
case(RWStl_ConfigurationNode::ReadMode_ShapeType_MultiMesh):
{
NCollection_Sequence<Handle(Poly_Triangulation)> aTriangList;
// Read STL file to the triangulation list.
RWStl::ReadFile(thePath.ToCString(), aMergeAngle, aTriangList, theProgress);
BRep_Builder aB;
if (aTriangList.Size() == 1)
{
TopoDS_Face aFace;
aB.MakeFace(aFace);
aB.UpdateFace(aFace, aTriangList.First());
theShape = aFace;
}
else
{
TopoDS_Compound aCmp;
for (NCollection_Sequence<Handle(Poly_Triangulation)>::Iterator anIt(aTriangList);
anIt.More(); anIt.Next())
{
if (aCmp.IsNull())
{
aB.MakeCompound(aCmp);
}
TopoDS_Face aFace;
aB.MakeFace(aFace, anIt.Value());
aB.Add(aCmp, aFace);
}
theShape = aCmp;
}
break;
}
case(RWStl_ConfigurationNode::ReadMode_ShapeType_SingleMesh):
{
// Read STL file to the triangulation.
Handle(Poly_Triangulation) aTriangulation =
RWStl::ReadFile(thePath.ToCString(), aMergeAngle, theProgress);
if (!aTriangulation.IsNull())
{
TopoDS_Face aFace;
BRep_Builder aB;
aB.MakeFace(aFace);
aB.UpdateFace(aFace, aTriangulation);
theShape = aFace;
}
break;
}
case(RWStl_ConfigurationNode::ReadMode_ShapeType_CompShape):
{
Standard_DISABLE_DEPRECATION_WARNINGS
StlAPI::Read(theShape, thePath.ToCString());
Standard_ENABLE_DEPRECATION_WARNINGS
break;
}
}
if (theShape.IsNull())
{
Message::SendFail() << "Error: RWStl_Provider : [" <<
thePath << "] : Cannot read any relevant data from the STL file";
return false;
}
return true;
return Read(thePath, theShape, theProgress);
}
//=======================================================================
@@ -212,24 +152,81 @@ bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theWS;
Message::SendWarning() <<
"OCCT Stl writer does not support model scaling according to custom length unit";
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(RWStl_ConfigurationNode)))
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";
if (!GetNode()->IsKind(STANDARD_TYPE(RWStl_ConfigurationNode)))
{
Message::SendFail() << "Error: RWStl_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the RWStl_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return true;
}
Handle(RWStl_ConfigurationNode) aNode = Handle(RWStl_ConfigurationNode)::DownCast(GetNode());
double aMergeAngle = aNode->InternalParameters.ReadMergeAngle * M_PI / 180.0;
if(aMergeAngle != M_PI_2)
{
if (aMergeAngle < 0.0 || aMergeAngle > M_PI_2)
{
Message::SendFail() << "Error in the RWStl_Provider during reading the file " <<
thePath << "\t: The merge angle is out of the valid range";
return false;
}
}
if (!aNode->InternalParameters.ReadBRep)
{
Handle(Poly_Triangulation) aTriangulation = RWStl::ReadFile(thePath.ToCString(), aMergeAngle, theProgress);
TopoDS_Face aFace;
BRep_Builder aB;
aB.MakeFace(aFace);
aB.UpdateFace(aFace, aTriangulation);
theShape = aFace;
}
else
{
Standard_DISABLE_DEPRECATION_WARNINGS
if (!StlAPI::Read(theShape, thePath.ToCString()))
{
Message::SendFail() << "Error in the RWStl_Provider during reading the file " << thePath;
return false;
}
Standard_ENABLE_DEPRECATION_WARNINGS
}
return true;
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool RWStl_Provider::Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress)
{
Message::SendWarning() << "OCCT Stl writer does not support model scaling according to custom length unit";
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWStl_ConfigurationNode)))
{
Message::SendFail() << "Error in the RWStl_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(RWStl_ConfigurationNode) aNode =
Handle(RWStl_ConfigurationNode)::DownCast(GetNode());
Handle(RWStl_ConfigurationNode) aNode = Handle(RWStl_ConfigurationNode)::DownCast(GetNode());
StlAPI_Writer aWriter;
aWriter.ASCIIMode() = aNode->InternalParameters.WriteAscii;
if (!aWriter.Write(theShape, thePath.ToCString(), theProgress))
{
Message::SendFail() << "Error: RWStl_Provider : [" <<
thePath << "] : Mesh writing has been failed";
Message::SendFail() << "Error in the RWStl_Provider during reading the file " <<
thePath << "\t: Mesh writing has been failed";
return false;
}
return true;

View File

@@ -64,6 +64,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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
//! @param[in] thePath path to the import CAD file
//! @param[out] theShape shape to save result
@@ -86,6 +104,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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:
//! Gets CAD format name of associated provider

View File

@@ -131,12 +131,8 @@ bool STEPCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext
theResource->IntegerVal("write.unit", InternalParameters.WriteUnit, aScope);
InternalParameters.WriteResourceName =
theResource->StringVal("write.resource.name", InternalParameters.WriteResourceName, aScope);
InternalParameters.WriteMultiPrefix =
theResource->StringVal("write.multi.prefix", InternalParameters.WriteMultiPrefix, aScope);
InternalParameters.WriteSequence =
theResource->StringVal("write.sequence", InternalParameters.WriteSequence, aScope);
InternalParameters.WriteLabels =
theResource->StringSeqVal("write.labels", InternalParameters.WriteLabels, aScope);
InternalParameters.WriteVertexMode = (WriteMode_VertexMode)
theResource->IntegerVal("write.vertex.mode", InternalParameters.WriteVertexMode, aScope);
InternalParameters.WriteSubshapeNames =
@@ -431,30 +427,12 @@ TCollection_AsciiString STEPCAFControl_ConfigurationNode::Save() const
aResult += aScope + "write.resource.name :\t " + InternalParameters.WriteResourceName + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines prefix for names of external files, if empty do not make multifile\n";
aResult += "!Default value: empty. Available values: <string>\n";
aResult += aScope + "write.multi.prefix :\t " + InternalParameters.WriteMultiPrefix + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines name of the sequence of operators\n";
aResult += "!Default value: \"ToSTEP\". Available values: <string>\n";
aResult += aScope + "write.sequence :\t " + InternalParameters.WriteSequence + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines list of shape labels to export, if empty import full document\n";
aResult += "!Default value: empty. Available values: sequense of label entries\n";
aResult += aScope + "write.labels :\t ";
for (TColStd_ListOfAsciiString::Iterator anIter(InternalParameters.WriteLabels);
anIter.More(); anIter.Next())
{
aResult += anIter.Value();
aResult += " ";
}
aResult += "\n!\n";
aResult += "!\n";
aResult += "!This parameter indicates which of free vertices writing mode is switch on\n";
aResult += "!Default value: 0(\"One Compound\"). Available values: 0(\"One Compound\"), 1(\"Signle Vertex\")\n";
@@ -539,15 +517,6 @@ bool STEPCAFControl_ConfigurationNode::IsExportSupported() const
return true;
}
//=======================================================================
// function : IsExportSupported
// purpose :
//=======================================================================
bool STEPCAFControl_ConfigurationNode::IsStreamSupported() const
{
return true;
}
//=======================================================================
// function : GetFormat
// purpose :

View File

@@ -17,7 +17,6 @@
#include <DE_ConfigurationNode.hxx>
#include <STEPControl_StepModelType.hxx>
#include <Resource_FormatType.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
#include <UnitsMethods_LengthUnit.hxx>
//! The purpose of this class is to configure the transfer process for STEP format
@@ -70,10 +69,6 @@ public:
//! @return true if export is supported
Standard_EXPORT virtual bool IsExportSupported() const Standard_OVERRIDE;
//! Checks the stream for import/export supporting
//! @return Standard_True if stream is support
Standard_EXPORT virtual bool IsStreamSupported() const Standard_OVERRIDE;
//! Gets CAD format name of associated provider
//! @return provider CAD format
Standard_EXPORT virtual TCollection_AsciiString GetFormat() const Standard_OVERRIDE;
@@ -223,9 +218,7 @@ public:
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
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
TColStd_ListOfAsciiString 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
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

View File

@@ -13,256 +13,19 @@
#include <STEPCAFControl_Provider.hxx>
#include <BinXCAFDrivers.hxx>
#include <Interface_Static.hxx>
#include <Message.hxx>
#include <StepData_StepModel.hxx>
#include <STEPCAFControl_ConfigurationNode.hxx>
#include <STEPCAFControl_Controller.hxx>
#include <STEPCAFControl_Reader.hxx>
#include <STEPCAFControl_Writer.hxx>
#include <STEPControl_ActorWrite.hxx>
#include <STEPControl_Controller.hxx>
#include <StepData_StepModel.hxx>
#include <TDataStd_Name.hxx>
#include <TDF_Tool.hxx>
#include <TDocStd_Document.hxx>
#include <UnitsMethods.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XSControl_WorkSession.hxx>
#include <UnitsMethods.hxx>
IMPLEMENT_STANDARD_RTTIEXT(STEPCAFControl_Provider, DE_Provider)
namespace
{
//! Special class to handle static parameters.
//! Initialize all parameters in the begin of life
//! and reset changed parameters in the end of life
class STEPCAFControl_ParameterController
{
public:
STEPCAFControl_ParameterController(const Handle(STEPCAFControl_ConfigurationNode)& theNode,
const Standard_Boolean theUpdateStatic);
~STEPCAFControl_ParameterController();
protected:
void setStatic(const STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection theParameter);
private:
bool myToUpdateStaticParameters; //!< Flag to updating static parameters
STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection myOldValues; //!< Container to save previous static parameters
};
//=======================================================================
// function : STEPCAFControl_ParameterController
// purpose :
//=======================================================================
STEPCAFControl_ParameterController::STEPCAFControl_ParameterController(const Handle(STEPCAFControl_ConfigurationNode)& theNode,
const Standard_Boolean theUpdateStatic)
: myToUpdateStaticParameters(theUpdateStatic)
{
STEPCAFControl_Controller::Init();
STEPControl_Controller::Init();
if (!myToUpdateStaticParameters)
{
return;
}
// Get previous values
myOldValues.ReadBSplineContinuity =
(STEPCAFControl_ConfigurationNode::ReadMode_BSplineContinuity)
Interface_Static::IVal("read.iges.bspline.continuity");
myOldValues.ReadPrecisionMode =
(STEPCAFControl_ConfigurationNode::ReadMode_Precision)
Interface_Static::IVal("read.precision.mode");
myOldValues.ReadPrecisionVal =
Interface_Static::RVal("read.precision.val");
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.ReadSequence =
Interface_Static::CVal("read.step.sequence");
myOldValues.ReadProductMode =
Interface_Static::IVal("read.step.product.mode") == 1;
myOldValues.ReadProductContext =
(STEPCAFControl_ConfigurationNode::ReadMode_ProductContext)
Interface_Static::IVal("read.step.product.context");
myOldValues.ReadShapeRepr =
(STEPCAFControl_ConfigurationNode::ReadMode_ShapeRepr)
Interface_Static::IVal("read.step.shape.repr");
myOldValues.ReadTessellated =
(STEPCAFControl_ConfigurationNode::RWMode_Tessellated)
Interface_Static::IVal("read.step.tessellated");
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.WritePrecisionVal =
Interface_Static::RVal("write.precision.val");
myOldValues.WriteAssembly =
(STEPCAFControl_ConfigurationNode::WriteMode_Assembly)
Interface_Static::IVal("write.step.assembly");
myOldValues.WriteSchema =
(STEPCAFControl_ConfigurationNode::WriteMode_StepSchema)
Interface_Static::IVal("write.step.schema");
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
setStatic(theNode->InternalParameters);
}
//=======================================================================
// function : ~STEPCAFControl_ParameterController
// purpose :
//=======================================================================
STEPCAFControl_ParameterController::~STEPCAFControl_ParameterController()
{
if (!myToUpdateStaticParameters)
{
return;
}
setStatic(myOldValues);
}
//=======================================================================
// function : setStatic
// purpose :
//=======================================================================
void STEPCAFControl_ParameterController::setStatic(const STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection theParameter)
{
Interface_Static::SetIVal("read.iges.bspline.continuity",
theParameter.ReadBSplineContinuity);
Interface_Static::SetIVal("read.precision.mode",
theParameter.ReadPrecisionMode);
Interface_Static::SetRVal("read.precision.val",
theParameter.ReadPrecisionVal);
Interface_Static::SetIVal("read.maxprecision.mode",
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("step.angleunit.mode",
theParameter.AngleUnit);
Interface_Static::SetCVal("read.step.resource.name",
theParameter.ReadResourceName.ToCString());
Interface_Static::SetCVal("read.step.sequence",
theParameter.ReadSequence.ToCString());
Interface_Static::SetIVal("read.step.product.mode",
theParameter.ReadProductMode);
Interface_Static::SetIVal("read.step.product.context",
theParameter.ReadProductContext);
Interface_Static::SetIVal("read.step.shape.repr",
theParameter.ReadShapeRepr);
Interface_Static::SetIVal("read.step.tessellated",
theParameter.ReadTessellated);
Interface_Static::SetIVal("read.step.assembly.level",
theParameter.ReadAssemblyLevel);
Interface_Static::SetIVal("read.step.shape.relationship",
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::SetRVal("write.precision.val",
theParameter.WritePrecisionVal);
Interface_Static::SetIVal("write.step.assembly",
theParameter.WriteAssembly);
Interface_Static::SetIVal("write.step.schema",
theParameter.WriteSchema);
Interface_Static::SetIVal("write.step.tessellated",
theParameter.WriteTessellated);
Interface_Static::SetCVal("write.step.product.name",
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);
}
}
//=======================================================================
// function : STEPCAFControl_Provider
// purpose :
@@ -279,23 +42,113 @@ STEPCAFControl_Provider::STEPCAFControl_Provider(const Handle(DE_ConfigurationNo
{}
//=======================================================================
// function : personizeWS
// function : initStatic
// purpose :
//=======================================================================
void STEPCAFControl_Provider::personizeWS(Handle(XSControl_WorkSession)& theWS)
void STEPCAFControl_Provider::initStatic(const Handle(DE_ConfigurationNode)& theNode)
{
if (theWS.IsNull())
{
Message::SendWarning() << "Warning: STEPCAFControl_Provider :"
<< " Null work session, use internal temporary session";
theWS = new XSControl_WorkSession();
}
Handle(STEPControl_Controller) aCntrl =
Handle(STEPControl_Controller)::DownCast(theWS->NormAdaptor());
if (aCntrl.IsNull())
{
theWS->SelectNorm("STEP");
}
Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(theNode);
STEPCAFControl_Controller::Init();
// Get previous values
myOldValues.ReadBSplineContinuity = (STEPCAFControl_ConfigurationNode::ReadMode_BSplineContinuity)Interface_Static::IVal("read.iges.bspline.continuity");
myOldValues.ReadPrecisionMode = (STEPCAFControl_ConfigurationNode::ReadMode_Precision)Interface_Static::IVal("read.precision.mode");
myOldValues.ReadPrecisionVal = Interface_Static::RVal("read.precision.val");
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.ReadSequence = Interface_Static::CVal("read.step.sequence");
myOldValues.ReadProductMode = Interface_Static::IVal("read.step.product.mode") == 1;
myOldValues.ReadProductContext = (STEPCAFControl_ConfigurationNode::ReadMode_ProductContext)Interface_Static::IVal("read.step.product.context");
myOldValues.ReadShapeRepr = (STEPCAFControl_ConfigurationNode::ReadMode_ShapeRepr)Interface_Static::IVal("read.step.shape.repr");
myOldValues.ReadTessellated = (STEPCAFControl_ConfigurationNode::RWMode_Tessellated)Interface_Static::IVal("read.step.tessellated");
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.WritePrecisionVal = Interface_Static::RVal("write.precision.val");
myOldValues.WriteAssembly = (STEPCAFControl_ConfigurationNode::WriteMode_Assembly)Interface_Static::IVal("write.step.assembly");
myOldValues.WriteSchema = (STEPCAFControl_ConfigurationNode::WriteMode_StepSchema)Interface_Static::IVal("write.step.schema");
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
setStatic(aNode->InternalParameters);
}
//=======================================================================
// function : setStatic
// purpose :
//=======================================================================
void STEPCAFControl_Provider::setStatic(const STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection theParameter)
{
Interface_Static::SetIVal("read.iges.bspline.continuity", theParameter.ReadBSplineContinuity);
Interface_Static::SetIVal("read.precision.mode", theParameter.ReadPrecisionMode);
Interface_Static::SetRVal("read.precision.val", theParameter.ReadPrecisionVal);
Interface_Static::SetIVal("read.maxprecision.mode", 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("step.angleunit.mode", theParameter.AngleUnit);
Interface_Static::SetCVal("read.step.resource.name", theParameter.ReadResourceName.ToCString());
Interface_Static::SetCVal("read.step.sequence", theParameter.ReadSequence.ToCString());
Interface_Static::SetIVal("read.step.product.mode", theParameter.ReadProductMode);
Interface_Static::SetIVal("read.step.product.context", theParameter.ReadProductContext);
Interface_Static::SetIVal("read.step.shape.repr", theParameter.ReadShapeRepr);
Interface_Static::SetIVal("read.step.tessellated", theParameter.ReadTessellated);
Interface_Static::SetIVal("read.step.assembly.level", theParameter.ReadAssemblyLevel);
Interface_Static::SetIVal("read.step.shape.relationship", 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::SetRVal("write.precision.val", theParameter.WritePrecisionVal);
Interface_Static::SetIVal("write.step.assembly", theParameter.WriteAssembly);
Interface_Static::SetIVal("write.step.schema", theParameter.WriteSchema);
Interface_Static::SetIVal("write.step.tessellated", theParameter.WriteTessellated);
Interface_Static::SetCVal("write.step.product.name", 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);
}
//=======================================================================
// function : resetStatic
// purpose :
//=======================================================================
void STEPCAFControl_Provider::resetStatic()
{
setStatic(myOldValues);
}
//=======================================================================
@@ -309,120 +162,48 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
{
if (theDocument.IsNull())
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Null document";
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: theDocument shouldn't be null";
return false;
}
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(STEPCAFControl_ConfigurationNode) aNode =
Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
STEPCAFControl_ParameterController aParamController(aNode, myToUpdateStaticParameters);
personizeWS(theWS);
XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
aNode->GlobalParameters.LengthUnit,
UnitsMethods_LengthUnit_Millimeter);
const Standard_Boolean toUseLoaded = thePath == ".";
TCollection_AsciiString aFile;
if (toUseLoaded)
Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
initStatic(aNode);
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
STEPCAFControl_Reader aReader;
if (!theWS.IsNull())
{
aFile = theWS->LoadedFile();
Message::SendInfo() << "Model taken from the STEP session : "
<< aFile;
aReader.Init(theWS);
}
else
{
aFile = thePath;
Message::SendInfo() << "File STEP to read : "
<< aFile;
}
STEPCAFControl_Reader aReader(theWS, !toUseLoaded);
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;
if (!toUseLoaded)
{
aReadStat = aReader.ReadFile(thePath.ToCString());
}
else if (theWS->NbStartingEntities() > 0)
{
aReadStat = IFSelect_RetDone;
}
aReadStat = aReader.ReadFile(thePath.ToCString());
if (aReadStat != IFSelect_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : ["
<< aFile << "] : abandon, no model loaded";
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: abandon";
resetStatic();
return false;
}
if (!aReader.Transfer(theDocument, theProgress))
{
Message::SendFail() << "Error: STEPCAFControl_Provider : [" <<
aFile << "] : Cannot read any relevant data from the STEP file";
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: Cannot read any relevant data from the STEP file";
resetStatic();
return false;
}
myProcessedExtFiles = aReader.ExternFiles();
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());
STEPCAFControl_ParameterController aParamController(aNode, myToUpdateStaticParameters);
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";
return false;
}
if (!aReader.Transfer(theDocument, theProgress))
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Cannot read any relevant data from the STEP file";
return false;
}
myProcessedExtFiles = aReader.ExternFiles();
resetStatic();
return true;
}
@@ -435,176 +216,86 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
Handle(XSControl_WorkSession)& theWS,
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: STEPCAFControl_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(STEPCAFControl_ConfigurationNode) aNode =
Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
STEPCAFControl_ParameterController aParamController(aNode, myToUpdateStaticParameters);
personizeWS(theWS);
XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
aNode->GlobalParameters.LengthUnit,
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);
STEPCAFControl_Writer aWriter(theWS, Standard_True);
STEPControl_StepModelType aMode =
static_cast<STEPControl_StepModelType>(aNode->InternalParameters.WriteModelType);
STEPCAFControl_Writer aWriter;
if (!theWS.IsNull())
{
aWriter.Init(theWS);
}
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_ListOfAsciiString::Iterator anIter(aNode->InternalParameters.WriteLabels);
anIter.More(); anIter.Next())
TDF_Label aLabel;
if (!aWriter.Transfer(theDocument, aMode, 0, theProgress))
{
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 in the STEPCAFControl_Provider during writing the file " <<
thePath << "\t: The document cannot be translated or gives no result";
resetStatic();
return false;
}
IFSelect_ReturnStatus aStatus = aWriter.Write(thePath.ToCString());
switch (aStatus)
{
case IFSelect_RetVoid:
{
Message::SendFail() << "Error: No label for entry '" << aValue << "'";
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
thePath << "\t: No file written";
resetStatic();
return false;;
}
case IFSelect_RetDone:
{
break;
}
default:
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
thePath << "\t: Error on writing file";
resetStatic();
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";
return false;
}
if (thePath == ".")
{
Message::SendInfo() << "Document has been translated into the session";
return true;
}
if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : [" <<
thePath << "] : Write failed";
return false;
}
Message::SendInfo() << "STEP file [" << thePath << "] Successfully written";
myProcessedExtFiles = aWriter.ExternFiles();
resetStatic();
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;
return Read(thePath, theDocument, aWS, theProgress);
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool STEPCAFControl_Provider::Write(std::ostream& theOStream,
bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& 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());
STEPCAFControl_ParameterController aParamController(aNode, myToUpdateStaticParameters);
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_ListOfAsciiString::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";
return false;
}
if (aWriter.WriteStream(theOStream) != IFSelect_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : Write to stream failed";
return false;
}
Message::SendInfo() << "STEP file to stream successfully written";
myProcessedExtFiles = aWriter.ExternFiles();
return true;
Handle(XSControl_WorkSession) aWS;
return Write(thePath, theDocument, aWS, theProgress);
}
//=======================================================================
@@ -617,74 +308,39 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(void)theProgress;
if (GetNode().IsNull() ||
!GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(STEPCAFControl_ConfigurationNode) aNode =
Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
STEPCAFControl_ParameterController aParamController(aNode, myToUpdateStaticParameters);
personizeWS(theWS);
STEPControl_Reader aReader(theWS);
if (aReader.ReadFile(thePath.ToCString()) != IFSelect_RetDone)
Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
initStatic(aNode);
STEPControl_Reader aReader;
if(!theWS.IsNull())
{
Message::SendFail() << "Error: STEPCAFControl_Provider : ["
<< thePath << "] : abandon, no model loaded";
aReader.SetWS(theWS);
}
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 " <<
thePath << "\t: abandon, no model loaded";
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 : [" <<
thePath << "] : Cannot read any relevant data from the STEP file";
return false;
}
theShape = aReader.OneShape();
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());
STEPCAFControl_ParameterController aParamController(aNode, myToUpdateStaticParameters);
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";
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";
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t:Cannot read any relevant data from the STEP file";
resetStatic();
return false;
}
theShape = aReader.OneShape();
resetStatic();
return true;
}
@@ -697,94 +353,63 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
Handle(XSControl_WorkSession)& theWS,
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: STEPCAFControl_Provider : "
<< "Incorrect or empty Configuration Node";
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(STEPCAFControl_ConfigurationNode) aNode =
Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
STEPCAFControl_ParameterController aParamController(aNode, myToUpdateStaticParameters);
personizeWS(theWS);
STEPControl_Writer aWriter(theWS, Standard_True);
Handle(StepData_StepModel) aModel = aWriter.Model();
Standard_Integer aNbEntities = (aModel.IsNull() ? 0 : aModel->NbEntities());
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(
aNode->InternalParameters.WriteUnit,
UnitsMethods_LengthUnit_Millimeter));
IFSelect_ReturnStatus aWritestat =
aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress);
if (aNbEntities > 0)
Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
initStatic(aNode);
STEPControl_Writer aWriter;
if(!theWS.IsNull())
{
Message::SendTrace() << "STEPCAFControl_Provider : Model not empty before transferring";
aWriter.SetWS(theWS);
}
IFSelect_ReturnStatus aWritestat = IFSelect_RetVoid;
Handle(StepData_StepModel) aModel = aWriter.Model();
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter));
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";
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: abandon, no model loaded";
resetStatic();
return false;
}
if (thePath == ".")
{
Message::SendInfo() << "Step model has been translated into the session";
return true;
}
if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Can't write STEP file " << thePath;
Message::SendFail() << "STEPCAFControl_Provider: Error on writing file";
resetStatic();
return false;
}
resetStatic();
return true;
}
//=======================================================================
// function : Read
// purpose :
//=======================================================================
bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress)
{
Handle(XSControl_WorkSession) aWS;
return Read(thePath, theShape, aWS, theProgress);
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool STEPCAFControl_Provider::Write(std::ostream& theOStream,
bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& 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());
STEPCAFControl_ParameterController aParamController(aNode, myToUpdateStaticParameters);
personizeWS(theWS);
STEPControl_Writer aWriter(theWS, Standard_True);
Handle(StepData_StepModel) aModel = aWriter.Model();
Standard_Integer aNbEntities = (aModel.IsNull() ? 0 : aModel->NbEntities());
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(
aNode->InternalParameters.WriteUnit,
UnitsMethods_LengthUnit_Millimeter));
IFSelect_ReturnStatus aWritestat =
aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress);
if (aNbEntities > 0)
{
Message::SendTrace() << "STEPCAFControl_Provider : Model not empty before transferring";
}
if (aWritestat != IFSelect_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Can't translate shape to STEP model";
return false;
}
if (aWriter.WriteStream(theOStream) != IFSelect_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Can't write STEP to stream";
return false;
}
return true;
Handle(XSControl_WorkSession) aWS;
return Write(thePath, theShape, aWS, theProgress);
}
//=======================================================================

View File

@@ -16,7 +16,6 @@
#include <DE_Provider.hxx>
#include <STEPCAFControl_ConfigurationNode.hxx>
#include <STEPCAFControl_ExternFile.hxx>
//! The class to transfer STEP files.
//! Reads and Writes any STEP files into/from OCCT.
@@ -55,19 +54,6 @@ public:
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
//! Reads a CAD file, according internal configuration
//! @param[in] theIStream stream to import STEP data
//! @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
//! @return true if Read operation has ended correctly
Standard_EXPORT virtual bool Read(std::istream& theIStream,
const Handle(TDocStd_Document)& theDocument,
const TCollection_AsciiString theName,
Handle(XSControl_WorkSession)& theWS,
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
@@ -79,16 +65,23 @@ public:
Handle(XSControl_WorkSession)& theWS,
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] theOStream stream to export STEP data
//! @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(std::ostream& theOStream,
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
//! Reads a CAD file, according internal configuration
//! @param[in] thePath path to the import CAD file
@@ -101,19 +94,6 @@ public:
Handle(XSControl_WorkSession)& theWS,
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
//! @param[in] thePath path to the export CAD file
//! @param[out] theShape shape to export
@@ -125,16 +105,23 @@ public:
Handle(XSControl_WorkSession)& theWS,
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] theOStream stream to export STEP data
//! @param[in] thePath path to the export CAD file
//! @param[out] theShape shape 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,
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
public:
@@ -146,34 +133,18 @@ public:
//! @return provider's vendor name
Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE;
public:
private:
//! Sets parameter to update static parameter, that true by default
void SetToUpdateStaticParameters(const bool theToUpdate) { myToUpdateStaticParameters = theToUpdate; }
//! Initialize static variables
void initStatic(const Handle(DE_ConfigurationNode)& theNode);
//! Gets parameter to update static parameter, that true by default
bool ToUpdateStaticParameters() const { return myToUpdateStaticParameters; }
//! Initialize static variables
void setStatic(const STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection theParameter);
public:
//! Reset used interface static variables
void resetStatic();
//! Gets external files used in the last read or write process.
//! Processed only on multifile setting up
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> GetExternalFiles() const
{
return myProcessedExtFiles;
}
private:
//! Personizes work session with current format.
//! Creates new temporary session if current session is null
//! @param[in] theWS current work session
void personizeWS(Handle(XSControl_WorkSession)& theWS);
private:
bool myToUpdateStaticParameters = true; //!< Flag to updating static parameters
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> myProcessedExtFiles; //!< External files from the last operation
STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection myOldValues;
};

View File

@@ -4692,9 +4692,16 @@ void collectRepresentationItems(const Interface_Graph& theGraph,
const Handle(StepShape_ShapeRepresentation)& theRepresentation,
NCollection_Sequence<Handle(StepRepr_RepresentationItem)>& theItems)
{
Handle(StepRepr_HArray1OfRepresentationItem) aReprItems = theRepresentation->Items();
for (Standard_Integer itemIt = aReprItems->Lower(); itemIt <= aReprItems->Upper(); itemIt++)
theItems.Append(aReprItems->Value(itemIt));
for(StepRepr_HArray1OfRepresentationItem::Iterator anIter(theRepresentation->Items()->Array1());
anIter.More(); anIter.Next())
{
const Handle(StepRepr_RepresentationItem)& anReprItem = anIter.Value();
if (anReprItem.IsNull())
{
continue;
}
theItems.Append(anReprItem);
}
Interface_EntityIterator entIt = theGraph.TypedSharings(theRepresentation, STANDARD_TYPE(StepRepr_RepresentationRelationship));
for (entIt.Start(); entIt.More(); entIt.Next())

View File

@@ -163,6 +163,7 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI
#include <StepGeom_Hyperbola.hxx>
#include <StepGeom_IntersectionCurve.hxx>
#include <StepVisual_Invisibility.hxx>
#include <StepVisual_LeaderDirectedCallout.hxx>
#include <StepBasic_LengthUnit.hxx>
#include <StepGeom_Line.hxx>
#include <StepBasic_LocalTime.hxx>
@@ -663,6 +664,8 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI
#include <StepVisual_CameraModelD3MultiClipping.hxx>
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
#include <StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem.hxx>
#include <StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem.hxx>
#include <StepVisual_AnnotationCurveOccurrenceAndGeomReprItem.hxx>
// Added for kinematics implementation
@@ -1558,6 +1561,9 @@ StepAP214_Protocol::StepAP214_Protocol ()
types.Bind(STANDARD_TYPE(StepVisual_ComplexTriangulatedSurfaceSet), 816);
types.Bind(STANDARD_TYPE(StepVisual_CubicBezierTessellatedEdge), 817);
types.Bind(STANDARD_TYPE(StepVisual_CubicBezierTriangulatedFace), 818);
types.Bind(STANDARD_TYPE(StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem), 820);
types.Bind(STANDARD_TYPE(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem), 821);
types.Bind(STANDARD_TYPE(StepVisual_LeaderDirectedCallout), 824);
}

View File

@@ -1,310 +0,0 @@
StepVisual_AnnotationCurveOccurrence.cxx
StepVisual_AnnotationCurveOccurrence.hxx
StepVisual_AnnotationCurveOccurrenceAndGeomReprItem.cxx
StepVisual_AnnotationCurveOccurrenceAndGeomReprItem.hxx
StepVisual_AnnotationFillArea.cxx
StepVisual_AnnotationFillArea.hxx
StepVisual_AnnotationFillAreaOccurrence.cxx
StepVisual_AnnotationFillAreaOccurrence.hxx
StepVisual_AnnotationOccurrence.cxx
StepVisual_AnnotationOccurrence.hxx
StepVisual_AnnotationPlane.cxx
StepVisual_AnnotationPlane.hxx
StepVisual_AnnotationPlaneElement.cxx
StepVisual_AnnotationPlaneElement.hxx
StepVisual_AnnotationText.cxx
StepVisual_AnnotationText.hxx
StepVisual_AnnotationTextOccurrence.cxx
StepVisual_AnnotationTextOccurrence.hxx
StepVisual_AreaInSet.cxx
StepVisual_AreaInSet.hxx
StepVisual_AreaOrView.cxx
StepVisual_AreaOrView.hxx
StepVisual_Array1OfAnnotationPlaneElement.hxx
StepVisual_Array1OfBoxCharacteristicSelect.hxx
StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect.hxx
StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect.hxx
StepVisual_Array1OfCurveStyleFontPattern.hxx
StepVisual_Array1OfDirectionCountSelect.hxx
StepVisual_Array1OfDraughtingCalloutElement.hxx
StepVisual_Array1OfFillStyleSelect.hxx
StepVisual_Array1OfInvisibleItem.hxx
StepVisual_Array1OfLayeredItem.hxx
StepVisual_Array1OfPresentationStyleAssignment.hxx
StepVisual_Array1OfPresentationStyleSelect.hxx
StepVisual_Array1OfRenderingPropertiesSelect.hxx
StepVisual_Array1OfStyleContextSelect.hxx
StepVisual_Array1OfSurfaceStyleElementSelect.hxx
StepVisual_Array1OfTextOrCharacter.hxx
StepVisual_BackgroundColour.cxx
StepVisual_BackgroundColour.hxx
StepVisual_BoxCharacteristicSelect.cxx
StepVisual_BoxCharacteristicSelect.hxx
StepVisual_CameraImage.cxx
StepVisual_CameraImage.hxx
StepVisual_CameraImage2dWithScale.cxx
StepVisual_CameraImage2dWithScale.hxx
StepVisual_CameraImage3dWithScale.cxx
StepVisual_CameraImage3dWithScale.hxx
StepVisual_CameraModel.cxx
StepVisual_CameraModel.hxx
StepVisual_CameraModelD2.cxx
StepVisual_CameraModelD2.hxx
StepVisual_CameraModelD3.cxx
StepVisual_CameraModelD3.hxx
StepVisual_CameraModelD3MultiClipping.cxx
StepVisual_CameraModelD3MultiClipping.hxx
StepVisual_CameraModelD3MultiClippingInterectionSelect.cxx
StepVisual_CameraModelD3MultiClippingInterectionSelect.hxx
StepVisual_CameraModelD3MultiClippingIntersection.cxx
StepVisual_CameraModelD3MultiClippingIntersection.hxx
StepVisual_CameraModelD3MultiClippingUnion.cxx
StepVisual_CameraModelD3MultiClippingUnion.hxx
StepVisual_CameraModelD3MultiClippingUnionSelect.cxx
StepVisual_CameraModelD3MultiClippingUnionSelect.hxx
StepVisual_CameraUsage.cxx
StepVisual_CameraUsage.hxx
StepVisual_CentralOrParallel.hxx
StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel.cxx
StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel.hxx
StepVisual_Colour.cxx
StepVisual_Colour.hxx
StepVisual_ColourRgb.cxx
StepVisual_ColourRgb.hxx
StepVisual_ColourSpecification.cxx
StepVisual_ColourSpecification.hxx
StepVisual_CompositeText.cxx
StepVisual_CompositeText.hxx
StepVisual_CompositeTextWithExtent.cxx
StepVisual_CompositeTextWithExtent.hxx
StepVisual_ContextDependentInvisibility.cxx
StepVisual_ContextDependentInvisibility.hxx
StepVisual_ContextDependentOverRidingStyledItem.cxx
StepVisual_ContextDependentOverRidingStyledItem.hxx
StepVisual_CurveStyle.cxx
StepVisual_CurveStyle.hxx
StepVisual_CurveStyleFont.cxx
StepVisual_CurveStyleFont.hxx
StepVisual_CurveStyleFontPattern.cxx
StepVisual_CurveStyleFontPattern.hxx
StepVisual_CurveStyleFontSelect.cxx
StepVisual_CurveStyleFontSelect.hxx
StepVisual_DirectionCountSelect.cxx
StepVisual_DirectionCountSelect.hxx
StepVisual_DraughtingAnnotationOccurrence.cxx
StepVisual_DraughtingAnnotationOccurrence.hxx
StepVisual_DraughtingCallout.cxx
StepVisual_DraughtingCallout.hxx
StepVisual_DraughtingCalloutElement.cxx
StepVisual_DraughtingCalloutElement.hxx
StepVisual_DraughtingModel.cxx
StepVisual_DraughtingModel.hxx
StepVisual_DraughtingPreDefinedColour.cxx
StepVisual_DraughtingPreDefinedColour.hxx
StepVisual_DraughtingPreDefinedCurveFont.cxx
StepVisual_DraughtingPreDefinedCurveFont.hxx
StepVisual_ExternallyDefinedCurveFont.cxx
StepVisual_ExternallyDefinedCurveFont.hxx
StepVisual_ExternallyDefinedTextFont.cxx
StepVisual_ExternallyDefinedTextFont.hxx
StepVisual_FillAreaStyle.cxx
StepVisual_FillAreaStyle.hxx
StepVisual_FillAreaStyleColour.cxx
StepVisual_FillAreaStyleColour.hxx
StepVisual_FillStyleSelect.cxx
StepVisual_FillStyleSelect.hxx
StepVisual_FontSelect.cxx
StepVisual_FontSelect.hxx
StepVisual_HArray1OfAnnotationPlaneElement.hxx
StepVisual_HArray1OfBoxCharacteristicSelect.hxx
StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx
StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect.hxx
StepVisual_HArray1OfCurveStyleFontPattern.hxx
StepVisual_HArray1OfDirectionCountSelect.hxx
StepVisual_HArray1OfDraughtingCalloutElement.hxx
StepVisual_HArray1OfFillStyleSelect.hxx
StepVisual_HArray1OfInvisibleItem.hxx
StepVisual_HArray1OfLayeredItem.hxx
StepVisual_HArray1OfPresentationStyleAssignment.hxx
StepVisual_HArray1OfPresentationStyleSelect.hxx
StepVisual_HArray1OfRenderingPropertiesSelect.hxx
StepVisual_HArray1OfStyleContextSelect.hxx
StepVisual_HArray1OfSurfaceStyleElementSelect.hxx
StepVisual_HArray1OfTextOrCharacter.hxx
StepVisual_Invisibility.cxx
StepVisual_Invisibility.hxx
StepVisual_InvisibilityContext.cxx
StepVisual_InvisibilityContext.hxx
StepVisual_InvisibleItem.cxx
StepVisual_InvisibleItem.hxx
StepVisual_LayeredItem.cxx
StepVisual_LayeredItem.hxx
StepVisual_MarkerMember.cxx
StepVisual_MarkerMember.hxx
StepVisual_MarkerSelect.cxx
StepVisual_MarkerSelect.hxx
StepVisual_MarkerType.hxx
StepVisual_MechanicalDesignGeometricPresentationArea.cxx
StepVisual_MechanicalDesignGeometricPresentationArea.hxx
StepVisual_MechanicalDesignGeometricPresentationRepresentation.cxx
StepVisual_MechanicalDesignGeometricPresentationRepresentation.hxx
StepVisual_NullStyle.hxx
StepVisual_NullStyleMember.cxx
StepVisual_NullStyleMember.hxx
StepVisual_OverRidingStyledItem.cxx
StepVisual_OverRidingStyledItem.hxx
StepVisual_PlanarBox.cxx
StepVisual_PlanarBox.hxx
StepVisual_PlanarExtent.cxx
StepVisual_PlanarExtent.hxx
StepVisual_PointStyle.cxx
StepVisual_PointStyle.hxx
StepVisual_PreDefinedColour.cxx
StepVisual_PreDefinedColour.hxx
StepVisual_PreDefinedCurveFont.cxx
StepVisual_PreDefinedCurveFont.hxx
StepVisual_PreDefinedItem.cxx
StepVisual_PreDefinedItem.hxx
StepVisual_PreDefinedTextFont.cxx
StepVisual_PreDefinedTextFont.hxx
StepVisual_PresentationArea.cxx
StepVisual_PresentationArea.hxx
StepVisual_PresentationLayerAssignment.cxx
StepVisual_PresentationLayerAssignment.hxx
StepVisual_PresentationLayerUsage.cxx
StepVisual_PresentationLayerUsage.hxx
StepVisual_PresentationRepresentation.cxx
StepVisual_PresentationRepresentation.hxx
StepVisual_PresentationRepresentationSelect.cxx
StepVisual_PresentationRepresentationSelect.hxx
StepVisual_PresentationSet.cxx
StepVisual_PresentationSet.hxx
StepVisual_PresentationSize.cxx
StepVisual_PresentationSize.hxx
StepVisual_PresentationSizeAssignmentSelect.cxx
StepVisual_PresentationSizeAssignmentSelect.hxx
StepVisual_PresentationStyleAssignment.cxx
StepVisual_PresentationStyleAssignment.hxx
StepVisual_PresentationStyleByContext.cxx
StepVisual_PresentationStyleByContext.hxx
StepVisual_PresentationStyleSelect.cxx
StepVisual_PresentationStyleSelect.hxx
StepVisual_PresentationView.cxx
StepVisual_PresentationView.hxx
StepVisual_PresentedItem.cxx
StepVisual_PresentedItem.hxx
StepVisual_PresentedItemRepresentation.cxx
StepVisual_PresentedItemRepresentation.hxx
StepVisual_RenderingPropertiesSelect.cxx
StepVisual_RenderingPropertiesSelect.hxx
StepVisual_RepositionedTessellatedGeometricSet.hxx
StepVisual_RepositionedTessellatedGeometricSet.cxx
StepVisual_RepositionedTessellatedItem.hxx
StepVisual_RepositionedTessellatedItem.cxx
StepVisual_ShadingSurfaceMethod.hxx
StepVisual_StyleContextSelect.cxx
StepVisual_StyleContextSelect.hxx
StepVisual_StyledItem.cxx
StepVisual_StyledItem.hxx
StepVisual_StyledItemTarget.cxx
StepVisual_StyledItemTarget.hxx
StepVisual_SurfaceSide.hxx
StepVisual_SurfaceSideStyle.cxx
StepVisual_SurfaceSideStyle.hxx
StepVisual_SurfaceStyleBoundary.cxx
StepVisual_SurfaceStyleBoundary.hxx
StepVisual_SurfaceStyleControlGrid.cxx
StepVisual_SurfaceStyleControlGrid.hxx
StepVisual_SurfaceStyleElementSelect.cxx
StepVisual_SurfaceStyleElementSelect.hxx
StepVisual_SurfaceStyleFillArea.cxx
StepVisual_SurfaceStyleFillArea.hxx
StepVisual_SurfaceStyleParameterLine.cxx
StepVisual_SurfaceStyleParameterLine.hxx
StepVisual_SurfaceStyleReflectanceAmbient.cxx
StepVisual_SurfaceStyleReflectanceAmbient.hxx
StepVisual_SurfaceStyleRendering.cxx
StepVisual_SurfaceStyleRendering.hxx
StepVisual_SurfaceStyleRenderingWithProperties.cxx
StepVisual_SurfaceStyleRenderingWithProperties.hxx
StepVisual_SurfaceStyleSegmentationCurve.cxx
StepVisual_SurfaceStyleSegmentationCurve.hxx
StepVisual_SurfaceStyleSilhouette.cxx
StepVisual_SurfaceStyleSilhouette.hxx
StepVisual_SurfaceStyleTransparent.cxx
StepVisual_SurfaceStyleTransparent.hxx
StepVisual_SurfaceStyleUsage.cxx
StepVisual_SurfaceStyleUsage.hxx
StepVisual_Template.cxx
StepVisual_Template.hxx
StepVisual_TemplateInstance.cxx
StepVisual_TemplateInstance.hxx
StepVisual_TextLiteral.cxx
StepVisual_TextLiteral.hxx
StepVisual_TextOrCharacter.cxx
StepVisual_TextOrCharacter.hxx
StepVisual_TextPath.hxx
StepVisual_TextStyle.cxx
StepVisual_TextStyle.hxx
StepVisual_TextStyleForDefinedFont.cxx
StepVisual_TextStyleForDefinedFont.hxx
StepVisual_TextStyleWithBoxCharacteristics.cxx
StepVisual_TextStyleWithBoxCharacteristics.hxx
StepVisual_ViewVolume.cxx
StepVisual_ViewVolume.hxx
StepVisual_TessellatedAnnotationOccurrence.hxx
StepVisual_TessellatedAnnotationOccurrence.cxx
StepVisual_TessellatedItem.hxx
StepVisual_TessellatedItem.cxx
StepVisual_TessellatedGeometricSet.hxx
StepVisual_TessellatedGeometricSet.cxx
StepVisual_TessellatedCurveSet.hxx
StepVisual_TessellatedCurveSet.cxx
StepVisual_CoordinatesList.hxx
StepVisual_CoordinatesList.cxx
StepVisual_Array1OfTessellatedEdgeOrVertex.hxx
StepVisual_Array1OfTessellatedStructuredItem.hxx
StepVisual_ComplexTriangulatedFace.cxx
StepVisual_ComplexTriangulatedFace.hxx
StepVisual_ComplexTriangulatedSurfaceSet.cxx
StepVisual_ComplexTriangulatedSurfaceSet.hxx
StepVisual_CubicBezierTessellatedEdge.cxx
StepVisual_CubicBezierTessellatedEdge.hxx
StepVisual_CubicBezierTriangulatedFace.cxx
StepVisual_CubicBezierTriangulatedFace.hxx
StepVisual_EdgeOrCurve.cxx
StepVisual_EdgeOrCurve.hxx
StepVisual_FaceOrSurface.cxx
StepVisual_FaceOrSurface.hxx
StepVisual_HArray1OfTessellatedEdgeOrVertex.hxx
StepVisual_HArray1OfTessellatedStructuredItem.hxx
StepVisual_PathOrCompositeCurve.cxx
StepVisual_PathOrCompositeCurve.hxx
StepVisual_TessellatedConnectingEdge.cxx
StepVisual_TessellatedConnectingEdge.hxx
StepVisual_TessellatedEdge.cxx
StepVisual_TessellatedEdge.hxx
StepVisual_TessellatedEdgeOrVertex.cxx
StepVisual_TessellatedEdgeOrVertex.hxx
StepVisual_TessellatedFace.cxx
StepVisual_TessellatedFace.hxx
StepVisual_TessellatedPointSet.cxx
StepVisual_TessellatedPointSet.hxx
StepVisual_TessellatedShapeRepresentation.cxx
StepVisual_TessellatedShapeRepresentation.hxx
StepVisual_TessellatedShapeRepresentationWithAccuracyParameters.cxx
StepVisual_TessellatedShapeRepresentationWithAccuracyParameters.hxx
StepVisual_TessellatedShell.cxx
StepVisual_TessellatedShell.hxx
StepVisual_TessellatedSolid.cxx
StepVisual_TessellatedSolid.hxx
StepVisual_TessellatedStructuredItem.cxx
StepVisual_TessellatedStructuredItem.hxx
StepVisual_TessellatedSurfaceSet.cxx
StepVisual_TessellatedSurfaceSet.hxx
StepVisual_TessellatedVertex.cxx
StepVisual_TessellatedVertex.hxx
StepVisual_TessellatedWire.cxx
StepVisual_TessellatedWire.hxx
StepVisual_TriangulatedFace.cxx
StepVisual_TriangulatedFace.hxx

View File

@@ -0,0 +1,22 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem.hxx>
IMPLEMENT_STANDARD_RTTIEXT(StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem, StepVisual_AnnotationCurveOccurrence)
//=======================================================================
//function : StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem
//purpose :
//=======================================================================
StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem::StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem() {}

View File

@@ -0,0 +1,34 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem_HeaderFile
#define _StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem_HeaderFile
#include <Standard.hxx>
#include <StepVisual_AnnotationCurveOccurrence.hxx>
//! Added for Dimensional Tolerances
//! Complex STEP entity AnnotationOccurrence & AnnotationOccurrence
//! & DraughtingAnnotationOccurrence & GeometricRepresentationItem
//! & LeaderCurve & RepresentationItem & StyledItem
class StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem : public StepVisual_AnnotationCurveOccurrence
{
public:
Standard_EXPORT StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem();
DEFINE_STANDARD_RTTIEXT(StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem, StepVisual_AnnotationCurveOccurrence)
};
#endif // _StepVisual_AnnotationLeaderCurveOccurrenceAndGeomReprItem_HeaderFile

View File

@@ -0,0 +1,35 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem.hxx>
IMPLEMENT_STANDARD_RTTIEXT(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem, StepVisual_AnnotationCurveOccurrence)
//=======================================================================
//function : StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem
//purpose :
//=======================================================================
StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem::StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem() {}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem::Init(const Handle(TCollection_HAsciiString)& theName,
const Handle(StepVisual_HArray1OfPresentationStyleAssignment)& theStyles,
const Handle(Standard_Transient)& theItem,
const Handle(StepVisual_AnnotationCurveOccurrence)& theAnnotatedTerminator)
{
StepVisual_StyledItem::Init(theName, theStyles, theItem);
myAnnotatedTerminator = theAnnotatedTerminator;
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem.hxx>
IMPLEMENT_STANDARD_RTTIEXT(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem, StepVisual_AnnotationOccurrence)
//=======================================================================
//function : StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem
//purpose :
//=======================================================================
StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem::StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem() {}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem::Init(const Handle(TCollection_HAsciiString)& theName,
const Handle(StepVisual_HArray1OfPresentationStyleAssignment)& theStyles,
const Handle(Standard_Transient)& theItem,
const Handle(StepVisual_AnnotationCurveOccurrence)& theAnnotatedTerminator)
{
StepVisual_StyledItem::Init(theName, theStyles, theItem);
myAnnotatedTerminator = theAnnotatedTerminator;
}

View File

@@ -0,0 +1,46 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem_HeaderFile
#define _StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem_HeaderFile
#include <Standard.hxx>
#include <StepVisual_AnnotationCurveOccurrence.hxx>
//! Added for Dimensional Tolerances
//! Complex STEP entity AnnotationOccurrence & AnnotationSymbolOccurrence
//! & DraughtingAnnotationOccurrence & GeometricRepresentationItem
//! & LeaderTerminator & RepresentationItem & StyledItem
class StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem : public StepVisual_AnnotationOccurrence
{
public:
Standard_EXPORT StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem();
Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& theName,
const Handle(StepVisual_HArray1OfPresentationStyleAssignment)& theStyles,
const Handle(Standard_Transient)& theItem,
const Handle(StepVisual_AnnotationCurveOccurrence)& theAnnotatedTerminator);
const Handle(StepVisual_AnnotationCurveOccurrence)& Terminator() const { return myAnnotatedTerminator; }
void SetTerminator(const Handle(StepVisual_AnnotationCurveOccurrence)& theAnnotatedTerminator) { myAnnotatedTerminator = theAnnotatedTerminator; }
DEFINE_STANDARD_RTTIEXT(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem, StepVisual_AnnotationOccurrence)
private:
Handle(StepVisual_AnnotationCurveOccurrence) myAnnotatedTerminator;
};
#endif // _StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem_HeaderFile

View File

@@ -14,9 +14,11 @@
// commercial license or contractual agreement.
#include <StepVisual_DraughtingCalloutElement.hxx>
#include <Interface_Macros.hxx>
#include <StepVisual_AnnotationCurveOccurrence.hxx>
#include <StepVisual_AnnotationFillAreaOccurrence.hxx>
#include <StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem.hxx>
#include <StepVisual_AnnotationTextOccurrence.hxx>
#include <StepVisual_TessellatedAnnotationOccurrence.hxx>
@@ -24,14 +26,12 @@
//function : StepVisual_DraughtingCalloutElement
//purpose :
//=======================================================================
StepVisual_DraughtingCalloutElement::StepVisual_DraughtingCalloutElement () { }
StepVisual_DraughtingCalloutElement::StepVisual_DraughtingCalloutElement() {}
//=======================================================================
//function : CaseNum
//purpose :
//purpose :
//=======================================================================
Standard_Integer StepVisual_DraughtingCalloutElement::CaseNum(const Handle(Standard_Transient)& ent) const
{
if (ent.IsNull()) return 0;
@@ -39,17 +39,51 @@ Standard_Integer StepVisual_DraughtingCalloutElement::CaseNum(const Handle(Stand
if (ent->IsKind(STANDARD_TYPE(StepVisual_AnnotationTextOccurrence))) return 2;
if (ent->IsKind(STANDARD_TYPE(StepVisual_TessellatedAnnotationOccurrence))) return 3;
if (ent->IsKind(STANDARD_TYPE(StepVisual_AnnotationFillAreaOccurrence))) return 4;
if (ent->IsKind(STANDARD_TYPE(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem))) return 5;
return 0;
}
//=======================================================================
//function : AnnotationCurveOccurrence
//purpose :
//=======================================================================
Handle(StepVisual_AnnotationCurveOccurrence) StepVisual_DraughtingCalloutElement::AnnotationCurveOccurrence() const
{ return GetCasted(StepVisual_AnnotationCurveOccurrence,Value()); }
{
return GetCasted(StepVisual_AnnotationCurveOccurrence, Value());
}
//=======================================================================
//function : TessellatedAnnotationOccurrence
//purpose :
//=======================================================================
Handle(StepVisual_TessellatedAnnotationOccurrence) StepVisual_DraughtingCalloutElement::TessellatedAnnotationOccurrence() const
{ return GetCasted(StepVisual_TessellatedAnnotationOccurrence,Value()); }
{
return GetCasted(StepVisual_TessellatedAnnotationOccurrence, Value());
}
//=======================================================================
//function : AnnotationTextOccurrence
//purpose :
//=======================================================================
Handle(StepVisual_AnnotationTextOccurrence) StepVisual_DraughtingCalloutElement::AnnotationTextOccurrence() const
{ return GetCasted(StepVisual_AnnotationTextOccurrence, Value()); }
{
return GetCasted(StepVisual_AnnotationTextOccurrence, Value());
}
//=======================================================================
//function : AnnotationFillAreaOccurrence
//purpose :
//=======================================================================
Handle(StepVisual_AnnotationFillAreaOccurrence) StepVisual_DraughtingCalloutElement::AnnotationFillAreaOccurrence() const
{ return GetCasted(StepVisual_AnnotationFillAreaOccurrence, Value()); }
{
return GetCasted(StepVisual_AnnotationFillAreaOccurrence, Value());
}
//=======================================================================
//function : AnnotationLeaderTerminatorOccurrence
//purpose :
//=======================================================================
Handle(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem) StepVisual_DraughtingCalloutElement::AnnotationLeaderTerminatorOccurrence() const
{
return GetCasted(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem, Value());
}

View File

@@ -25,6 +25,7 @@
class Standard_Transient;
class StepVisual_AnnotationCurveOccurrence;
class StepVisual_AnnotationFillAreaOccurrence;
class StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem;
class StepVisual_AnnotationTextOccurrence;
class StepVisual_TessellatedAnnotationOccurrence;
@@ -42,6 +43,7 @@ public:
//! 2 -> AnnotationTextOccurrence
//! 3 -> TessellatedAnnotationOccurrence
//! 4 -> AnnotationFillAreaOccurrence
//! 5 -> AnnotationLeaderTerminatorOccurrence
//! 0 else
Standard_EXPORT Standard_Integer CaseNum (const Handle(Standard_Transient)& ent) const;
@@ -56,5 +58,9 @@ public:
//! returns Value as a AnnotationFillAreaOccurrence
Standard_EXPORT Handle(StepVisual_AnnotationFillAreaOccurrence) AnnotationFillAreaOccurrence() const;
//! returns Value as a AnnotationLeaderTerminatorOccurrence
Standard_EXPORT Handle(StepVisual_AnnotationLeaderTerminatorOccurrenceAndGeomReprItem) AnnotationLeaderTerminatorOccurrence() const;
};
#endif // StepVisual_DraughtingCalloutElement

View File

@@ -0,0 +1,22 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StepVisual_LeaderDirectedCallout.hxx>
IMPLEMENT_STANDARD_RTTIEXT(StepVisual_LeaderDirectedCallout, StepVisual_DraughtingCallout)
//=======================================================================
//function : StepVisual_LeaderDirectedCallout
//purpose :
//=======================================================================
StepVisual_LeaderDirectedCallout::StepVisual_LeaderDirectedCallout () {}

View File

@@ -0,0 +1,28 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StepVisual_LeaderDirectedCallout_HeaderFile
#define _StepVisual_LeaderDirectedCallout_HeaderFile
#include <StepVisual_DraughtingCallout.hxx>
class StepVisual_LeaderDirectedCallout : public StepVisual_DraughtingCallout
{
public:
//! Returns a LeaderDirectedCallout
Standard_EXPORT StepVisual_LeaderDirectedCallout();
DEFINE_STANDARD_RTTIEXT(StepVisual_LeaderDirectedCallout, StepVisual_DraughtingCallout)
};
#endif // _StepVisual_LeaderDirectedCallout_HeaderFile

View File

@@ -51,6 +51,30 @@ bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(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())
{
Message::SendFail() << "Error in the Vrml_Provider during reading the file " <<
@@ -94,10 +118,8 @@ bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
//=======================================================================
bool Vrml_Provider::Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
(void)theWS;
(void)theProgress;
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(Vrml_ConfigurationNode)))
{
@@ -130,6 +152,30 @@ bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
(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;
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(Vrml_ConfigurationNode)))
{
@@ -225,13 +271,12 @@ bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
//=======================================================================
bool Vrml_Provider::Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
aShTool->AddShape(theShape);
return Write(thePath, aDoc, theWS, theProgress);
return Write(thePath, aDoc, theProgress);
}
//=======================================================================

View File

@@ -64,6 +64,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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
//! @param[in] thePath path to the import CAD file
//! @param[out] theShape shape to save result
@@ -86,6 +104,24 @@ public:
Handle(XSControl_WorkSession)& theWS,
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:
//! Gets CAD format name of associated provider

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

14
tests/bugs/step/bug33331 Normal file
View File

@@ -0,0 +1,14 @@
puts "===================================="
puts "0033331: Data Exchange, Step Import - Unsupported Representation Items"
puts "===================================="
puts ""
pload DCAF
Close D -silent
param "read.stepcaf.subshapes.name" 1
ReadStep D [locate_data_file bug33331.stp]
param "read.stepcaf.subshapes.name" 0
Close D

View File

@@ -1,6 +1,6 @@
# !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR00000 ALL: Error: First - file was not read - exception "
puts "TODO CR00000 ALL: Error : Here is reading problem"
puts "TODO CR00000 ALL: Error: STEPCAFControl_Provider"
puts "TODO CR23096 ALL: Error: First - file was not read - exception "
puts "TODO CR23096 ALL: Error : Here is reading problem"
set filename tr9_r0301-pe-adjusted.stp

View File

@@ -1,7 +1,6 @@
# !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR00000 ALL: Error: First - file was not read - exception "
puts "TODO CR00000 ALL: Error : Here is reading problem"
puts "TODO CR00000 ALL: Error: STEPCAFControl_Provider"
puts "TODO CR23096 ALL: Error: First - file was not read - exception "
puts "TODO CR23096 ALL: Error : Here is reading problem"
set filename buc60990.stp

View File

@@ -2,7 +2,9 @@ puts "========"
puts "0030691: test glTF reader on standard sample models"
puts "========"
set anAssetInfo [ReadGltf D [locate_data_file bug30691_DamagedHelmet.gltf] -assetInfo]
ReadGltf D [locate_data_file bug30691_DamagedHelmet.gltf]
set anAssetInfo [ReadGltf [locate_data_file bug30691_DamagedHelmet.gltf] -assetInfo]
if { "$anAssetInfo" != "generator: Khronos Blender glTF 2.0 exporter" } { puts "Error: unexpected asset info" }
XGetOneShape s D

View File

@@ -49,12 +49,7 @@ set fd [open ${imagedir}/${casename}_zero_ascii_dos.stl w]
fconfigure $fd -translation crlf
puts $fd "solid \nendsolid"
close $fd
puts "REQUIRED ALL: Error: RWStl_Provider :"
catch {
if {[readstl res_zero_ascii_dos ${imagedir}/${casename}_zero_ascii_dos.stl -brep]} {
puts "Error: empty file should be marked as invalid input file"
}
}
readstl res_zero_ascii_dos ${imagedir}/${casename}_zero_ascii_dos.stl -brep
puts "\n#======================================================================"
puts "# Ascii file with no facets, LF"
@@ -63,11 +58,7 @@ set fd [open ${imagedir}/${casename}_zero_ascii_unix.stl w]
fconfigure $fd -translation lf
puts $fd "solid \nendsolid"
close $fd
catch {
if {[readstl res_zero_ascii_unix ${imagedir}/${casename}_zero_ascii_unix.stl -brep] != 1} {
puts "Error: empty file should be marked as invalid input file"
}
}
readstl res_zero_ascii_unix ${imagedir}/${casename}_zero_ascii_unix.stl -brep
puts "\n#======================================================================"
puts "# Binary file with single facet"
@@ -88,11 +79,7 @@ set fd [open ${imagedir}/${casename}_zero_binary.stl w]
fconfigure $fd -translation binary
puts -nonewline $fd "stl [string repeat { } 76][binary format i 0]"
close $fd
catch {
if {[readstl res_zero_binary ${imagedir}/${casename}_zero_binary.stl -brep] != 1} {
puts "Error: empty file should be marked as invalid input file"
}
}
readstl res_zero_binary ${imagedir}/${casename}_zero_binary.stl -brep
puts "\n#======================================================================"
puts "# Empty file"
@@ -100,9 +87,5 @@ puts "#======================================================================"
puts "REQUIRED ALL: Error: premature end of file"
set fd [open ${imagedir}/${casename}_empty.stl w]
close $fd
catch {
if {[readstl res_empty ${imagedir}/${casename}_empty.stl -brep] != 1} {
puts "Error: empty file should be marked as invalid input file"
}
}
readstl res_empty ${imagedir}/${casename}_empty.stl -brep

View File

@@ -53,9 +53,7 @@ provider.STEP.OCC.write.product.name :
provider.STEP.OCC.write.surfacecurve.mode : 1
provider.STEP.OCC.write.unit : 2
provider.STEP.OCC.write.resource.name : STEP
provider.STEP.OCC.write.multi.prefix :
provider.STEP.OCC.write.sequence : ToSTEP
provider.STEP.OCC.write.labels :
provider.STEP.OCC.write.vertex.mode : 0
provider.STEP.OCC.write.stepcaf.subshapes.name : 0
provider.STEP.OCC.write.color : 1
@@ -70,14 +68,13 @@ provider.VRML.OCC.read.fill.incomplete : 1
provider.VRML.OCC.writer.version : 2
provider.VRML.OCC.write.representation.type : 1
provider.STL.OCC.read.merge.angle : 90
provider.STL.OCC.read.brep : 1
provider.STL.OCC.read.brep : 0
provider.STL.OCC.write.ascii : 1
provider.OBJ.OCC.file.length.unit : 1
provider.OBJ.OCC.system.cs : 0
provider.OBJ.OCC.file.cs : 1
provider.OBJ.OCC.read.single.precision : 0
provider.OBJ.OCC.read.create.shapes : 0
provider.OBJ.OCC.read.create.single : 0
provider.OBJ.OCC.read.root.prefix :
provider.OBJ.OCC.read.fill.doc : 1
provider.OBJ.OCC.read.fill.incomplete : 1
@@ -105,19 +102,10 @@ provider.GLTF.OCC.write.author :
provider.GLTF.OCC.write.trsf.format : 0
provider.GLTF.OCC.write.node.name.format : 3
provider.GLTF.OCC.write.mesh.name.format : 1
provider.GLTF.OCC.write.draco.compression : 0
provider.GLTF.OCC.write.draco.level : 7
provider.GLTF.OCC.write.draco.position.bits : 14
provider.GLTF.OCC.write.draco.normal.bits : 10
provider.GLTF.OCC.write.draco.texture.bits : 12
provider.GLTF.OCC.write.draco.color.bits : 8
provider.GLTF.OCC.write.draco.generic.bits : 12
provider.GLTF.OCC.write.draco.unified.quantization : 0
provider.GLTF.OCC.write.forced.uv.export : 0
provider.GLTF.OCC.write.embed.textures.in.glb : 1
provider.GLTF.OCC.write.merge.faces : 0
provider.GLTF.OCC.write.split.indices16 : 0
provider.GLTF.OCC.write.parallel : 0
provider.BREP.OCC.write.binary : 1
provider.BREP.OCC.write.version.binary : 4
provider.BREP.OCC.write.version.ascii : 3

View File

@@ -53,9 +53,7 @@ provider.STEP.OCC.write.product.name :
provider.STEP.OCC.write.surfacecurve.mode : 1
provider.STEP.OCC.write.unit : 2
provider.STEP.OCC.write.resource.name : STEP
provider.STEP.OCC.write.multi.prefix :
provider.STEP.OCC.write.sequence : ToSTEP
provider.STEP.OCC.write.labels :
provider.STEP.OCC.write.vertex.mode : 0
provider.STEP.OCC.write.stepcaf.subshapes.name : 0
provider.STEP.OCC.write.color : 1

View File

@@ -96,7 +96,7 @@ if [catch {ReadFile D7 $write_path -conf "global.general.length.unit : 0.0254 "}
}
XGetOneShape S7 D7
array set areas {0 11995.4 1 0.0119954 2 11979.2 3 11979.2 4 11979.2 5 0.0119792 6 11979.2 7 18.5678}
array set areas {0 11995.4 1 0.0119954 2 47916.8 3 11979.2 4 0.0479168 5 0.0119792 6 47916.8 7 18.5678}
array set results {0 S0 1 S1 2 S2 3 S3 4 S4 5 S5 6 S6 7 S7}
for { set anind 0} { $anind < 8 } { incr anind } {
checkprops $results($anind) -s $areas($anind) -eps 1e-2

View File

@@ -52,7 +52,7 @@ if [catch {readfile S5 $filename -conf "global.general.length.unit : 1000 "} cat
puts "OK : Reading is correct"
}
array set areas {0 1.21752e+13 1 1.21752e+07 2 1.21752e+13 3 1.21752e+07 4 1.21752e+13 5 1.21752e+07}
array set areas {0 1.21752e+07 1 1.21752e+07 2 1.21752e+13 3 1.21752e+07 4 1.21752e+13 5 1.21752e+07}
array set results {0 res0 1 res1 2 S2 3 S3 4 S4 5 S5}
for { set anind 0} { $anind < 6 } { incr anind } {
checkprops $results($anind) -s $areas($anind) -eps 1e-2

View File

@@ -96,7 +96,7 @@ if [catch {ReadFile D7 $write_path -conf "global.general.length.unit : 1000 "} c
}
XGetOneShape S7 D7
array set areas {0 1.21752e+13 1 12.1752 2 1.21752e+13 3 1.21752e+13 4 12.1752 5 12.1752 6 1.21752e+13 7 1.21773e-05}
array set areas {0 1.21752e+07 1 12.1752 2 1.21752e+07 3 1.21752e+07 4 12.1752 5 12.1752 6 1.21752e+07 7 1.21773e-05}
array set results {0 S0 1 S1 2 S2 3 S3 4 S4 5 S5 6 S6 7 S7}
for { set anind 0} { $anind < 8 } { incr anind } {
checkprops $results($anind) -s $areas($anind) -eps 1e-2