1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

// in the process

This commit is contained in:
dpasukhi
2023-01-21 12:16:00 +00:00
parent df7e4ec695
commit ca282cf42b
82 changed files with 2077 additions and 3103 deletions

View File

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

View File

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

View File

@@ -14,10 +14,111 @@
#include <DE_Provider.hxx> #include <DE_Provider.hxx>
#include <DE_ConfigurationNode.hxx> #include <DE_ConfigurationNode.hxx>
#include <OSD_Directory.hxx>
#include <OSD_File.hxx>
#include <OSD_OpenFile.hxx>
#include <OSD_Protection.hxx>
#include <Message.hxx> #include <Message.hxx>
#include <stdio.h>
IMPLEMENT_STANDARD_RTTIEXT(DE_Provider, Standard_Transient) IMPLEMENT_STANDARD_RTTIEXT(DE_Provider, Standard_Transient)
namespace
{
class DE_TemporaryFile
{
public:
DE_TemporaryFile(const TCollection_AsciiString& theFolderPath,
const TCollection_AsciiString& theExtension);
~DE_TemporaryFile();
TCollection_AsciiString Path() const { return myTempPath; }
Standard_Boolean IsDone() const { return myIsCreated; }
private:
Standard_Boolean myIsCreated = Standard_False;
TCollection_AsciiString myTempPath;
OSD_File myFile;
};
}
//=======================================================================
// function : DE_TemporaryFile
// purpose :
//=======================================================================
DE_TemporaryFile::DE_TemporaryFile(const TCollection_AsciiString& theFolderPath,
const TCollection_AsciiString& theExtension)
{
Standard_Boolean anIsCreated = Standard_False;
OSD_Directory aDirectory;
if (!theFolderPath.IsEmpty())
{
OSD_Directory anInternalFolder(theFolderPath);
if (!anInternalFolder.Failed())
{
aDirectory = anInternalFolder;
anIsCreated = Standard_True;
}
}
if (!anIsCreated)
{
aDirectory = OSD_Directory::BuildTemporary();
}
OSD_Path aPath;
aDirectory.Path(aPath);
TCollection_AsciiString aFullPath;
aPath.SystemName(aFullPath);
if (!anIsCreated)
{
Message::SendTrace() << "DE Provider : Using temporary folder from system : ["
<< aFullPath << "]";
}
if (aDirectory.Failed())
{
Message::SendFail() << "Error: DE Provider : Can't create folder by path : ["
<< aFullPath << "]";
}
TCollection_AsciiString aTempName(tempnam(aFullPath.ToCString(), nullptr));
aTempName += ".";
aTempName += theExtension;
myFile = OSD_File(aTempName);
myFile.Build(OSD_ReadWrite, OSD_Protection());
if (myFile.Failed())
{
Message::SendFail() << "Error: DE Provider : Can't create tempolary file by path : ["
<< aTempName << "]";
return;
}
myIsCreated = Standard_True;
myTempPath = aTempName;
}
//=======================================================================
// function : DE_TemporaryFile
// purpose :
//=======================================================================
DE_TemporaryFile::~DE_TemporaryFile()
{
if (!myIsCreated)
{
return;
}
if (myFile.IsLocked())
{
myFile.UnLock();
}
myFile.Close();
if (std::remove(myTempPath.ToCString()) != 0)
{
Message::SendFail() << "Error: DE Provider : Can't remove tempolary file by path : ["
<< myTempPath << "]";
}
}
//======================================================================= //=======================================================================
// function : DE_Provider // function : DE_Provider
// purpose : // purpose :
@@ -51,6 +152,48 @@ Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
return Standard_False; 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)theName;
if (myNode.IsNull() ||
myNode->GetFormat() != GetFormat() ||
myNode->GetVendor() != GetVendor())
{
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " : Incorrect Configuration node";
return Standard_False;
}
if (!myNode->IsImportSupported())
{
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " doesn't support read operation";
return Standard_False;
}
TColStd_ListOfAsciiString anExtns = myNode->GetExtensions();
TCollection_AsciiString anExt("tmp");
if (!anExtns.IsEmpty())
{
anExt = anExtns.First();
}
DE_TemporaryFile aTempFile(myTempFolder, anExt);
if (!aTempFile.IsDone())
{
return Standard_False;
}
std::ofstream aStream;
OSD_OpenStream(aStream, aTempFile.Path(), std::ios::out | std::ios::binary);
aStream << theIStream.rdbuf();
return Read(aTempFile.Path(), theDocument, theWS, theProgress);
}
//======================================================================= //=======================================================================
// function : Write // function : Write
// purpose : // purpose :
@@ -69,6 +212,50 @@ Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
return Standard_False; 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)
{
if (myNode.IsNull() ||
myNode->GetFormat() != GetFormat() ||
myNode->GetVendor() != GetVendor())
{
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " : Incorrect Configuration node";
return Standard_False;
}
if (!myNode->IsExportSupported())
{
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " doesn't support write operation";
return Standard_False;
}
TColStd_ListOfAsciiString anExtns = myNode->GetExtensions();
TCollection_AsciiString anExt("tmp");
if (!anExtns.IsEmpty())
{
anExt = anExtns.First();
}
DE_TemporaryFile aTempFile(myTempFolder, anExt);
if (!aTempFile.IsDone())
{
return Standard_False;
}
if (!Write(aTempFile.Path(), theDocument, theWS, theProgress))
{
return Standard_False;
}
std::ifstream aStream;
OSD_OpenStream(aStream, aTempFile.Path().ToCString(), std::ios::in | std::ios::binary);
theOStream << aStream.rdbuf();
return Standard_True;
}
//======================================================================= //=======================================================================
// function : Read // function : Read
// purpose : // purpose :
@@ -87,6 +274,48 @@ Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
return Standard_False; 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)theName;
if (myNode.IsNull() ||
myNode->GetFormat() != GetFormat() ||
myNode->GetVendor() != GetVendor())
{
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " : Incorrect Configuration node";
return Standard_False;
}
if (!myNode->IsImportSupported())
{
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " doesn't support read operation";
return Standard_False;
}
TColStd_ListOfAsciiString anExtns = myNode->GetExtensions();
TCollection_AsciiString anExt("tmp");
if (!anExtns.IsEmpty())
{
anExt = anExtns.First();
}
DE_TemporaryFile aTempFile(myTempFolder, anExt);
if (!aTempFile.IsDone())
{
return Standard_False;
}
std::ofstream aStream;
OSD_OpenStream(aStream, aTempFile.Path(), std::ios::out | std::ios::binary);
aStream << theIStream.rdbuf();
return Read(aTempFile.Path(), theShape, theWS, theProgress);
}
//======================================================================= //=======================================================================
// function : Write // function : Write
// purpose : // purpose :
@@ -104,3 +333,47 @@ Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
" " << GetVendor() << " doesn't support write operation"; " " << GetVendor() << " doesn't support write operation";
return Standard_False; return Standard_False;
} }
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool DE_Provider::Write(std::ostream& theOStream,
const TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
if (myNode.IsNull() ||
myNode->GetFormat() != GetFormat() ||
myNode->GetVendor() != GetVendor())
{
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " : Incorrect Configuration node";
return Standard_False;
}
if (!myNode->IsExportSupported())
{
Message::SendFail() << "Error: provider " << GetFormat() <<
" " << GetVendor() << " doesn't support write operation";
return Standard_False;
}
TColStd_ListOfAsciiString anExtns = myNode->GetExtensions();
TCollection_AsciiString anExt("tmp");
if (!anExtns.IsEmpty())
{
anExt = anExtns.First();
}
DE_TemporaryFile aTempFile(myTempFolder, anExt);
if (!aTempFile.IsDone())
{
return Standard_False;
}
if (!Write(aTempFile.Path(), theShape, theWS, theProgress))
{
return Standard_False;
}
std::ifstream aStream;
OSD_OpenStream(aStream, aTempFile.Path().ToCString(), std::ios::in | std::ios::binary);
theOStream << aStream.rdbuf();
return Standard_True;
}

View File

@@ -61,18 +61,42 @@ public:
//! @param[in] theWS current work session //! @param[in] theWS current work session
//! @param theProgress[in] progress indicator //! @param theProgress[in] progress indicator
//! @return True if Read was successful //! @return True if Read was successful
Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath, Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument, const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS, Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Reads a CAD file, according internal configuration
//! @param[in] 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());
//! Writes a CAD file, according internal configuration //! Writes a CAD file, according internal configuration
//! @param[in] thePath path to the export CAD file //! @param[in] thePath path to the export CAD file
//! @param[out] theDocument document to export //! @param[out] theDocument document to export
//! @param[in] theWS current work session //! @param[in] theWS current work session
//! @param theProgress[in] progress indicator //! @param theProgress[in] progress indicator
//! @return True if Write was successful //! @return True if Write was successful
Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath, Standard_EXPORT virtual bool Write(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] theOStream stream to export CAD data
//! @param[out] theDocument document to export
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return true if Write operation has ended correctly
Standard_EXPORT virtual bool Write(std::ostream& theOStream,
const Handle(TDocStd_Document)& theDocument, const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS, Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -83,18 +107,42 @@ public:
//! @param[in] theWS current work session //! @param[in] theWS current work session
//! @param theProgress[in] progress indicator //! @param theProgress[in] progress indicator
//! @return True if Read was successful //! @return True if Read was successful
Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath, Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
TopoDS_Shape& theShape, TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS, Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Reads a CAD file, according internal configuration
//! @param[in] 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());
//! Writes a CAD file, according internal configuration //! Writes a CAD file, according internal configuration
//! @param[in] thePath path to the export CAD file //! @param[in] thePath path to the export CAD file
//! @param[out] theShape shape to export //! @param[out] theShape shape to export
//! @param[in] theWS current work session //! @param[in] theWS current work session
//! @param theProgress[in] progress indicator //! @param theProgress[in] progress indicator
//! @return True if Write was successful //! @return True if Write was successful
Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath, Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Writes a CAD file, according internal configuration
//! @param[in] theOStream stream to export CAD data
//! @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, const TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS, Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -111,21 +159,22 @@ public:
//! Gets internal configuration node //! Gets internal configuration node
//! @return configuration node object //! @return configuration node object
Handle(DE_ConfigurationNode) GetNode() const Handle(DE_ConfigurationNode) GetNode() const { return myNode; }
{
return myNode;
}
//! Sets internal configuration node //! Sets internal configuration node
//! @param[in] theNode configuration node to set //! @param[in] theNode configuration node to set
void SetNode(const Handle(DE_ConfigurationNode)& theNode) void SetNode(const Handle(DE_ConfigurationNode)& theNode) { myNode = theNode; }
{
myNode = theNode; //! Gets path to folder to create temp CAD files, that not support stream
} TCollection_AsciiString GetTempFolderPath() const { return myTempFolder; }
//! Sets path to folder to create temp CAD files, that not support stream
void SetTempFolderPath(const TCollection_AsciiString& theFolder) { myTempFolder = theFolder; }
private: private:
Handle(DE_ConfigurationNode) myNode; //!< Internal configuration for the own format Handle(DE_ConfigurationNode) myNode; //!< Internal configuration for the own format
TCollection_AsciiString myTempFolder; //!< Path to folder to create temp CAD files, that not support stream
}; };
#endif // _DE_Provider_HeaderFile #endif // _DE_Provider_HeaderFile

View File

@@ -36,7 +36,7 @@ OCAFKERNEL : DCAF
DATAEXCHANGEKERNEL : XSDRAW DATAEXCHANGEKERNEL : XSDRAW
OCAF : VISUALIZATION, OCAFKERNEL OCAF : VISUALIZATION, OCAFKERNEL
DATAEXCHANGE : XDE, VISUALIZATION DATAEXCHANGE : XDE, VISUALIZATION
XDE : DATAEXCHANGEKERNEL, XDEDRAW XDE : DATAEXCHANGEKERNEL, XDEDRAW, STEP, IGES, GLTF, OBJ, PLY, STL, VRML
ALL : MODELING, OCAFKERNEL, DATAEXCHANGE ALL : MODELING, OCAFKERNEL, DATAEXCHANGE
TOPTEST : TKTopTest TOPTEST : TKTopTest
@@ -54,3 +54,10 @@ DFBROWSER : TKDFBrowser
QAcommands : TKQADraw QAcommands : TKQADraw
VIS : TKIVtkDraw VIS : TKIVtkDraw
INSPECTOR : TKToolsDraw INSPECTOR : TKToolsDraw
STEP : TKXSDRAWSTEP
IGES : TKXSDRAWIGES
GLTF : TKXSDRAWGLTF
OBJ : TKXSDRAWOBJ
PLY : TKXSDRAWPLY
STL : TKXSDRAWSTL
VRML : TKXSDRAWVRML

View File

@@ -16,7 +16,6 @@
#include <BRepLib.hxx> #include <BRepLib.hxx>
#include <IFSelect_CheckCounter.hxx> #include <IFSelect_CheckCounter.hxx>
#include <IFSelect_Functions.hxx>
#include <IGESControl_Controller.hxx> #include <IGESControl_Controller.hxx>
#include <IGESControl_Reader.hxx> #include <IGESControl_Reader.hxx>
#include <IGESData_FileProtocol.hxx> #include <IGESData_FileProtocol.hxx>

View File

@@ -13,7 +13,6 @@
#include <IGESSelect.hxx> #include <IGESSelect.hxx>
#include <IFSelect_Functions.hxx>
#include <IFSelect_SessionPilot.hxx> #include <IFSelect_SessionPilot.hxx>
#include <IFSelect_ShareOut.hxx> #include <IFSelect_ShareOut.hxx>
#include <IFSelect_WorkSession.hxx> #include <IFSelect_WorkSession.hxx>
@@ -26,8 +25,6 @@
void IGESSelect::Run () void IGESSelect::Run ()
{ {
// Handle(IFSelect_BasicActivator) Activator = new IFSelect_BasicActivator;
IFSelect_Functions::Init();
Handle(IFSelect_SessionPilot) pilot = new IFSelect_SessionPilot("XSTEP-IGES>"); Handle(IFSelect_SessionPilot) pilot = new IFSelect_SessionPilot("XSTEP-IGES>");
Handle(IGESSelect_Activator) igesact = new IGESSelect_Activator; Handle(IGESSelect_Activator) igesact = new IGESSelect_Activator;
pilot->SetSession (new IFSelect_WorkSession ( )); pilot->SetSession (new IFSelect_WorkSession ( ));

View File

@@ -18,6 +18,7 @@
#include <Message.hxx> #include <Message.hxx>
#include <STEPControl_Controller.hxx> #include <STEPControl_Controller.hxx>
#include <StepData_StepModel.hxx> #include <StepData_StepModel.hxx>
#include <STEPControl_ActorWrite.hxx>
#include <STEPCAFControl_ConfigurationNode.hxx> #include <STEPCAFControl_ConfigurationNode.hxx>
#include <STEPCAFControl_Controller.hxx> #include <STEPCAFControl_Controller.hxx>
#include <STEPCAFControl_Reader.hxx> #include <STEPCAFControl_Reader.hxx>
@@ -708,11 +709,16 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
personizeWS(theWS); personizeWS(theWS);
STEPControl_Writer aWriter(theWS, Standard_True); STEPControl_Writer aWriter(theWS, Standard_True);
Handle(StepData_StepModel) aModel = aWriter.Model(); Handle(StepData_StepModel) aModel = aWriter.Model();
Standard_Integer aNbEntities = (aModel.IsNull() ? 0 : aModel->NbEntities());
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale( aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(
aNode->InternalParameters.WriteUnit, aNode->InternalParameters.WriteUnit,
UnitsMethods_LengthUnit_Millimeter)); UnitsMethods_LengthUnit_Millimeter));
IFSelect_ReturnStatus aWritestat = IFSelect_ReturnStatus aWritestat =
aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress); aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress);
if (aNbEntities > 0)
{
Message::SendTrace() << "STEPCAFControl_Provider : Model not empty before transferring";
}
if (aWritestat != IFSelect_RetDone) if (aWritestat != IFSelect_RetDone)
{ {
Message::SendFail() << "Error: STEPCAFControl_Provider : " Message::SendFail() << "Error: STEPCAFControl_Provider : "
@@ -720,6 +726,12 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
resetStatic(); resetStatic();
return false; return false;
} }
if (thePath == ".")
{
resetStatic();
Message::SendInfo() << "Step model has been translated into the session";
return true;
}
if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone) if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
{ {
Message::SendFail() << "Error: STEPCAFControl_Provider : " Message::SendFail() << "Error: STEPCAFControl_Provider : "
@@ -754,11 +766,16 @@ bool STEPCAFControl_Provider::Write(std::ostream& theOStream,
personizeWS(theWS); personizeWS(theWS);
STEPControl_Writer aWriter(theWS, Standard_True); STEPControl_Writer aWriter(theWS, Standard_True);
Handle(StepData_StepModel) aModel = aWriter.Model(); Handle(StepData_StepModel) aModel = aWriter.Model();
Standard_Integer aNbEntities = (aModel.IsNull() ? 0 : aModel->NbEntities());
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale( aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(
aNode->InternalParameters.WriteUnit, aNode->InternalParameters.WriteUnit,
UnitsMethods_LengthUnit_Millimeter)); UnitsMethods_LengthUnit_Millimeter));
IFSelect_ReturnStatus aWritestat = IFSelect_ReturnStatus aWritestat =
aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress); aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress);
if (aNbEntities > 0)
{
Message::SendTrace() << "STEPCAFControl_Provider : Model not empty before transferring";
}
if (aWritestat != IFSelect_RetDone) if (aWritestat != IFSelect_RetDone)
{ {
Message::SendFail() << "Error: STEPCAFControl_Provider : " Message::SendFail() << "Error: STEPCAFControl_Provider : "

View File

@@ -22,3 +22,4 @@ TKLCAF
TKDCAF TKDCAF
TKXCAF TKXCAF
TKRWMesh TKRWMesh
TKXSDRAWBase

View File

@@ -1,4 +1 @@
XSDRAW XSDRAW
XSDRAWIGES
XSDRAWSTEP
XSDRAWSTLVRML

View File

@@ -22,3 +22,6 @@ TKLCAF
TKDCAF TKDCAF
TKXCAF TKXCAF
TKRWMesh TKRWMesh
TKXSBase
TKXDE
TKXSDRAWBase

View File

@@ -22,3 +22,4 @@ TKLCAF
TKDCAF TKDCAF
TKXCAF TKXCAF
TKRWMesh TKRWMesh
TKXSDRAWBase

View File

@@ -22,3 +22,6 @@ TKLCAF
TKDCAF TKDCAF
TKXCAF TKXCAF
TKRWMesh TKRWMesh
TKXSBase
TKXDEIGES
TKXSDRAWBase

View File

@@ -22,3 +22,4 @@ TKLCAF
TKDCAF TKDCAF
TKXCAF TKXCAF
TKRWMesh TKRWMesh
TKXSDRAWBase

View File

@@ -22,3 +22,4 @@ TKLCAF
TKDCAF TKDCAF
TKXCAF TKXCAF
TKRWMesh TKRWMesh
TKXSDRAWBase

View File

@@ -22,3 +22,6 @@ TKLCAF
TKDCAF TKDCAF
TKXCAF TKXCAF
TKRWMesh TKRWMesh
TKXSBase
TKXDESTEP
TKXSDRAWBase

View File

@@ -22,3 +22,4 @@ TKLCAF
TKDCAF TKDCAF
TKXCAF TKXCAF
TKRWMesh TKRWMesh
TKXSDRAWBase

View File

@@ -22,3 +22,4 @@ TKLCAF
TKDCAF TKDCAF
TKXCAF TKXCAF
TKRWMesh TKRWMesh
TKXSDRAWBase

View File

@@ -149,7 +149,6 @@ static Standard_Integer newDoc (Draw_Interpretor& di, Standard_Integer argc, con
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : saveDoc //function : saveDoc
//purpose : //purpose :
@@ -316,7 +315,6 @@ static Standard_Integer dump (Draw_Interpretor& di, Standard_Integer argc, const
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : StatAssembly //function : StatAssembly
//purpose : recursive part of statistics //purpose : recursive part of statistics
@@ -441,7 +439,6 @@ static void StatAssembly(const TDF_Label L,
} }
//======================================================================= //=======================================================================
//function : statdoc //function : statdoc
//purpose : //purpose :
@@ -524,7 +521,6 @@ static Standard_Integer statdoc (Draw_Interpretor& di, Standard_Integer argc, co
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : setPrs //function : setPrs
//purpose : //purpose :
@@ -575,7 +571,6 @@ static Standard_Integer setPrs (Draw_Interpretor& di, Standard_Integer argc, con
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : show //function : show
//purpose : //purpose :
@@ -994,7 +989,6 @@ static Standard_Integer xwd (Draw_Interpretor& di, Standard_Integer argc, const
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : XAttributeValue //function : XAttributeValue
//purpose : //purpose :
@@ -1023,7 +1017,6 @@ static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : setviewName //function : setviewName
//purpose : //purpose :
@@ -1040,7 +1033,6 @@ static Standard_Integer setviewName (Draw_Interpretor& di, Standard_Integer argc
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : getviewName //function : getviewName
//purpose : auxiliary //purpose : auxiliary
@@ -1053,7 +1045,6 @@ static Standard_Integer getviewName (Draw_Interpretor& di, Standard_Integer /*a
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : XSetTransparency //function : XSetTransparency
//purpose : //purpose :
@@ -1721,7 +1712,6 @@ static Standard_Integer testDoc (Draw_Interpretor&,
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : Init //function : Init
//purpose : //purpose :
@@ -1848,32 +1838,13 @@ void XDEDRAW::Init(Draw_Interpretor& di)
XDEDRAW_Views::InitCommands(di); XDEDRAW_Views::InitCommands(di);
XDEDRAW_Notes::InitCommands(di); XDEDRAW_Notes::InitCommands(di);
XDEDRAW_Common::InitCommands ( di );//moved from EXE XDEDRAW_Common::InitCommands ( di );//moved from EXE
DE_Wrapper::GlobalWrapper()->Bind(new RWObj_ConfigurationNode());
DE_Wrapper::GlobalWrapper()->Bind(new RWPly_ConfigurationNode());
DE_Wrapper::GlobalWrapper()->Bind(new RWGltf_ConfigurationNode());
DE_Wrapper::GlobalWrapper()->Bind(new IGESCAFControl_ConfigurationNode());
DE_Wrapper::GlobalWrapper()->Bind(new STEPCAFControl_ConfigurationNode());
DE_Wrapper::GlobalWrapper()->Bind(new Vrml_ConfigurationNode());
DE_Wrapper::GlobalWrapper()->Bind(new DEXCAFCascade_ConfigurationNode());
DE_Wrapper::GlobalWrapper()->Bind(new RWStl_ConfigurationNode());
DE_Wrapper::GlobalWrapper()->Bind(new DEBRepCascade_ConfigurationNode());
} }
//============================================================================== //==============================================================================
// XDEDRAW::Factory // XDEDRAW::Factory
//============================================================================== //==============================================================================
void XDEDRAW::Factory(Draw_Interpretor& theDI) void XDEDRAW::Factory(Draw_Interpretor& theDI)
{ {
XSDRAWIGES::InitSelect();
XSDRAWIGES::InitToBRep(theDI);
XSDRAWIGES::InitFromBRep(theDI);
XSDRAWSTEP::InitCommands(theDI);
XSDRAW::LoadDraw(theDI);
XDEDRAW::Init(theDI); XDEDRAW::Init(theDI);
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG

View File

@@ -21,7 +21,6 @@
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
//! Provides DRAW commands for work with DECAF data structures //! Provides DRAW commands for work with DECAF data structures
class XDEDRAW class XDEDRAW
{ {

View File

@@ -13,7 +13,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <DBRep.hxx> #include <DBRep.hxx>
#include <DDocStd.hxx> #include <DDocStd.hxx>
#include <Draw.hxx> #include <Draw.hxx>

View File

@@ -35,6 +35,7 @@
#include <XSAlgo_AlgoContainer.hxx> #include <XSAlgo_AlgoContainer.hxx>
#include <XSControl_WorkSession.hxx> #include <XSControl_WorkSession.hxx>
#include <XSDRAW.hxx> #include <XSDRAW.hxx>
#include <XSDRAWBase.hxx>
#include <Vrml_ConfigurationNode.hxx> #include <Vrml_ConfigurationNode.hxx>
#include <Vrml_Provider.hxx> #include <Vrml_Provider.hxx>
@@ -50,60 +51,6 @@
#include <stdio.h> #include <stdio.h>
namespace
{
static XSControl_WorkSessionMap THE_PREVIOUS_WORK_SESSIONS;
}
//=======================================================================
//function : parseCoordinateSystem
//purpose : Parse RWMesh_CoordinateSystem enumeration.
//=======================================================================
static bool parseCoordinateSystem(const char* theArg,
RWMesh_CoordinateSystem& theSystem)
{
TCollection_AsciiString aCSStr(theArg);
aCSStr.LowerCase();
if (aCSStr == "zup")
{
theSystem = RWMesh_CoordinateSystem_Zup;
}
else if (aCSStr == "yup")
{
theSystem = RWMesh_CoordinateSystem_Yup;
}
else
{
return Standard_False;
}
return Standard_True;
}
//=======================================================================
//function : CollectActiveWorkSessions
//purpose : Fill map with active workSession items
//=======================================================================
static void CollectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS,
const TCollection_AsciiString& theName,
XSControl_WorkSessionMap& theMap,
const Standard_Boolean theIsFirst = Standard_True)
{
if (theIsFirst)
{
theMap.Clear();
}
if (theMap.IsBound(theName))
{
return;
}
theMap.Bind(theName, theWS);
for (XSControl_WorkSessionMap::Iterator anIter(theWS->ReferenceWS());
anIter.More(); anIter.Next())
{
CollectActiveWorkSessions(anIter.Value(), anIter.Key(), theMap, Standard_False);
}
}
//======================================================================= //=======================================================================
//function : SetCurWS //function : SetCurWS
//purpose : Set current file if many files are read //purpose : Set current file if many files are read
@@ -112,27 +59,26 @@ static Standard_Integer SetCurWS(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
if (theNbArgs < 2) //if (theNbArgs < 2)
{ //{
theDI << "Use: " << theArgVec[0] << " filename \n"; // theDI << "Use: " << theArgVec[0] << " filename \n";
return 1; // return 1;
} //}
const TCollection_AsciiString aSessionName(theArgVec[1]); //const TCollection_AsciiString aSessionName(theArgVec[1]);
Handle(XSControl_WorkSession) aSession; //Handle(XSControl_WorkSession) aSession;
if (!THE_PREVIOUS_WORK_SESSIONS.Find(aSessionName, aSession)) //if (!THE_PREVIOUS_WORK_SESSIONS.Find(aSessionName, aSession))
{ //{
TCollection_AsciiString aWSs; // TCollection_AsciiString aWSs;
for (XSControl_WorkSessionMap::Iterator anIter(THE_PREVIOUS_WORK_SESSIONS); // for (XSControl_WorkSessionMap::Iterator anIter(THE_PREVIOUS_WORK_SESSIONS);
anIter.More(); anIter.Next()) // anIter.More(); anIter.Next())
{ // {
aWSs += "\""; // aWSs += "\"";
aWSs += anIter.Key(); // aWSs += anIter.Key();
aWSs += "\"\n"; // aWSs += "\"\n";
} // }
theDI << "Error: Can't find active session. Active sessions list:\n" << aWSs; // theDI << "Error: Can't find active session. Active sessions list:\n" << aWSs;
return 1; // return 1;
} //}
XSDRAW::Pilot()->SetSession(aSession);
return 0; return 0;
} }
@@ -144,15 +90,15 @@ static Standard_Integer GetDicWSList(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
(void)theNbArgs; //(void)theNbArgs;
(void)theArgVec; //(void)theArgVec;
Message::SendInfo() << "Active sessions list:"; //Message::SendInfo() << "Active sessions list:";
TCollection_AsciiString aWSs; //TCollection_AsciiString aWSs;
for (XSControl_WorkSessionMap::Iterator anIter(THE_PREVIOUS_WORK_SESSIONS); //for (XSControl_WorkSessionMap::Iterator anIter(THE_PREVIOUS_WORK_SESSIONS);
anIter.More(); anIter.Next()) // anIter.More(); anIter.Next())
{ //{
theDI << "\"" << anIter.Key() << "\"\n"; // theDI << "\"" << anIter.Key() << "\"\n";
} //}
return 0; return 0;
} }
@@ -166,30 +112,11 @@ static Standard_Integer GetCurWS(Draw_Interpretor& theDI,
{ {
(void)theNbArgs; (void)theNbArgs;
(void)theArgVec; (void)theArgVec;
Handle(XSControl_WorkSession) WS = XSDRAW::Session(); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
theDI << "\"" << WS->LoadedFile() << "\""; theDI << "\"" << WS->LoadedFile() << "\"";
return 0; return 0;
} }
//=======================================================================
//function : GetLengthUnit
//purpose : Gets length unit value from static interface and document in M
//=======================================================================
static Standard_Real GetLengthUnit(const Handle(TDocStd_Document)& theDoc = nullptr)
{
if (!theDoc.IsNull())
{
Standard_Real aUnit = 1.;
if (XCAFDoc_DocumentTool::GetLengthUnit(theDoc, aUnit,
UnitsMethods_LengthUnit_Millimeter))
{
return aUnit;
}
}
XSAlgo::AlgoContainer()->PrepareForTransfer();
return UnitsMethods::GetCasCadeLengthUnit();
}
//======================================================================= //=======================================================================
//function : FromShape //function : FromShape
//purpose : Apply fromshape command to all the loaded WSs //purpose : Apply fromshape command to all the loaded WSs
@@ -198,28 +125,25 @@ static Standard_Integer FromShape(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
if (theNbArgs < 2) //if (theNbArgs < 2)
{ //{
theDI << theArgVec[0] << " shape: search for shape origin among all last tranalated files\n"; // theDI << theArgVec[0] << " shape: search for shape origin among all last tranalated files\n";
return 0; // return 0;
} //}
char command[256]; //char command[256];
Sprintf(command, "fromshape %.200s -1", theArgVec[1]); //Sprintf(command, "fromshape %.200s -1", theArgVec[1]);
XSControl_WorkSessionMap DictWS = THE_PREVIOUS_WORK_SESSIONS; //XSControl_WorkSessionMap DictWS = THE_PREVIOUS_WORK_SESSIONS;
if (DictWS.IsEmpty()) //if (DictWS.IsEmpty())
return theDI.Eval(command); // return theDI.Eval(command);
Handle(XSControl_WorkSession) WS = XSDRAW::Session(); //Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
for (XSControl_WorkSessionMap::Iterator DicIt(DictWS); //for (XSControl_WorkSessionMap::Iterator DicIt(DictWS);
DicIt.More(); DicIt.Next()) // DicIt.More(); DicIt.Next())
{ //{
Handle(XSControl_WorkSession) CurrentWS = DicIt.Value(); // Handle(XSControl_WorkSession) CurrentWS = DicIt.Value();
XSDRAW::Pilot()->SetSession(CurrentWS); // theDI.Eval(command);
theDI.Eval(command); //}
}
XSDRAW::Pilot()->SetSession(WS);
return 0; return 0;
} }

View File

@@ -50,7 +50,6 @@
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
static Standard_Integer DumpDGTs (Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer DumpDGTs (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc < 3) { if (argc < 3) {
@@ -741,7 +740,6 @@ static Standard_Integer getDatumPosition (Draw_Interpretor& di, Standard_Integer
return 0; return 0;
} }
static Standard_Integer getDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer getDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc < 3) { if (argc < 3) {

View File

@@ -13,7 +13,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <DBRep.hxx> #include <DBRep.hxx>
#include <DDocStd.hxx> #include <DDocStd.hxx>
#include <Draw.hxx> #include <Draw.hxx>
@@ -90,7 +89,6 @@ static Standard_Integer removeLayer (Draw_Interpretor& di, Standard_Integer argc
return 0; return 0;
} }
static Standard_Integer setLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer setLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc<4) { if (argc<4) {
@@ -119,7 +117,6 @@ static Standard_Integer setLayer (Draw_Interpretor& di, Standard_Integer argc, c
return 0; return 0;
} }
static Standard_Integer getLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer getLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc!=3) { if (argc!=3) {
@@ -151,7 +148,6 @@ static Standard_Integer getLayers (Draw_Interpretor& di, Standard_Integer argc,
return 0; return 0;
} }
static Standard_Integer getLayerLabels (Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer getLayerLabels (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc!=2) { if (argc!=2) {
@@ -179,7 +175,6 @@ static Standard_Integer getLayerLabels (Draw_Interpretor& di, Standard_Integer a
return 0; return 0;
} }
static Standard_Integer getOneLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer getOneLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc!=3) { if (argc!=3) {
@@ -200,7 +195,6 @@ static Standard_Integer getOneLayer (Draw_Interpretor& di, Standard_Integer argc
return 0; return 0;
} }
static Standard_Integer setLinkLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer setLinkLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc<4) { if (argc<4) {
@@ -231,7 +225,6 @@ static Standard_Integer setLinkLayer (Draw_Interpretor& di, Standard_Integer arg
return 0; return 0;
} }
static Standard_Integer getAllLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer getAllLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc!=2) { if (argc!=2) {
@@ -261,7 +254,6 @@ static Standard_Integer getAllLayers (Draw_Interpretor& di, Standard_Integer arg
return 0; return 0;
} }
static Standard_Integer unSetLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer unSetLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc!=4) { if (argc!=4) {
@@ -288,7 +280,6 @@ static Standard_Integer unSetLayer (Draw_Interpretor& di, Standard_Integer argc,
return 0; return 0;
} }
static Standard_Integer unSetAllLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer unSetAllLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc!=3) { if (argc!=3) {
@@ -314,7 +305,6 @@ static Standard_Integer unSetAllLayers (Draw_Interpretor& di, Standard_Integer a
return 0; return 0;
} }
static Standard_Integer removeAllLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer removeAllLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc!=2) { if (argc!=2) {
@@ -365,7 +355,6 @@ static Standard_Integer setVisibility (Draw_Interpretor& di, Standard_Integer ar
return 0; return 0;
} }
static Standard_Integer isVisible (Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer isVisible (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc!=3) { if (argc!=3) {

View File

@@ -93,7 +93,6 @@ static double TetraVol(gp_Pnt RefPoint, gp_Pnt Som1, gp_Pnt Som2, gp_Pnt Som3)
return (-curVolume); return (-curVolume);
} }
//======================================================================= //=======================================================================
//function : TetraCen //function : TetraCen
//purpose : auxiliary //purpose : auxiliary
@@ -109,7 +108,6 @@ static gp_XYZ TetraCen(const gp_Pnt& RefPoint,
return curCentr; return curCentr;
} }
//======================================================================= //=======================================================================
//function : CalculVolume //function : CalculVolume
//purpose : auxiliary //purpose : auxiliary
@@ -174,10 +172,8 @@ static Standard_Real CalculVolume(const TopoDS_Shape& So,
return (myVolume); return (myVolume);
} }
// --------------------- VolumeFix End --- // --------------------- VolumeFix End ---
//======================================================================= //=======================================================================
// Section: Work with val props // Section: Work with val props
//======================================================================= //=======================================================================
@@ -243,7 +239,6 @@ static Standard_Integer SetProps (Draw_Interpretor& di, Standard_Integer argc, c
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : SetVolume //function : SetVolume
//purpose : //purpose :
@@ -281,7 +276,6 @@ static Standard_Integer SetVolume (Draw_Interpretor& di, Standard_Integer argc,
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : SetArea //function : SetArea
//purpose : //purpose :
@@ -318,7 +312,6 @@ static Standard_Integer SetArea (Draw_Interpretor& di, Standard_Integer argc, co
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : SetCentroid //function : SetCentroid
//purpose : //purpose :
@@ -357,7 +350,6 @@ static Standard_Integer SetCentroid (Draw_Interpretor& di, Standard_Integer argc
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : GetVolume //function : GetVolume
//purpose : //purpose :
@@ -393,7 +385,6 @@ static Standard_Integer GetVolume (Draw_Interpretor& di, Standard_Integer argc,
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : GetArea //function : GetArea
//purpose : //purpose :
@@ -429,7 +420,6 @@ static Standard_Integer GetArea (Draw_Interpretor& di, Standard_Integer argc, co
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : GetCentroid //function : GetCentroid
//purpose : //purpose :
@@ -679,7 +669,6 @@ static Standard_Integer CheckProps (Draw_Interpretor& di, Standard_Integer argc,
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : ShapeVolume //function : ShapeVolume
//purpose : //purpose :
@@ -709,7 +698,6 @@ static Standard_Integer ShapeVolume (Draw_Interpretor& di, Standard_Integer argc
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : GetMassProps //function : GetMassProps
//purpose : auxiliary for ShapeMassProps //purpose : auxiliary for ShapeMassProps
@@ -793,7 +781,6 @@ static Standard_Boolean GetMassProps(const TDF_Label& aLabel, gp_XYZ& theCenterG
return Standard_True; return Standard_True;
} }
//======================================================================= //=======================================================================
//function : ShapeMassProps //function : ShapeMassProps
//purpose : //purpose :
@@ -863,7 +850,6 @@ static Standard_Integer ShapeMassProps (Draw_Interpretor& di, Standard_Integer a
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : SetMaterial //function : SetMaterial
//purpose : //purpose :

View File

@@ -13,7 +13,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
#include <DBRep.hxx> #include <DBRep.hxx>
#include <DDocStd.hxx> #include <DDocStd.hxx>
@@ -252,7 +251,6 @@ static Standard_Integer findMainShape(Draw_Interpretor& di, Standard_Integer arg
return 0; return 0;
} }
static Standard_Integer addSubShape(Draw_Interpretor& di, Standard_Integer argc, const char** argv) static Standard_Integer addSubShape(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
if (argc != 4) { if (argc != 4) {

View File

@@ -103,7 +103,6 @@ static Standard_Integer removeView(Draw_Interpretor& di, Standard_Integer argc,
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : setClippingPlanes //function : setClippingPlanes
//purpose : //purpose :

View File

@@ -15,7 +15,6 @@
//: gka 14.04.99: S4136: apply scaling //: gka 14.04.99: S4136: apply scaling
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
#include <IFSelect_Functions.hxx>
#include <Interface_ShareFlags.hxx> #include <Interface_ShareFlags.hxx>
#include <Message.hxx> #include <Message.hxx>
#include <Message_Messenger.hxx> #include <Message_Messenger.hxx>

View File

@@ -11,294 +11,25 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <DBRep.hxx>
#include <Draw_Appli.hxx>
#include <Draw_Printer.hxx>
#include <IFSelect_Functions.hxx>
#include <IFSelect_SessionPilot.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Protocol.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <Message_PrinterOStream.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_FinderProcess.hxx>
#include <Transfer_TransientProcess.hxx>
#include <TransferBRep.hxx>
#include <XSControl.hxx>
#include <XSControl_Controller.hxx>
#include <XSControl_FuncShape.hxx>
#include <XSControl_Functions.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_TransferWriter.hxx>
#include <XSControl_WorkSession.hxx>
#include <XSDRAW.hxx> #include <XSDRAW.hxx>
#include <XSDRAW_Vars.hxx>
#include <iostream> #include <Draw_PluginMacro.hxx>
#include <string> #include <XSDRAW_Functions.hxx>
//#include <XSDRAW_Shape.hxx> #include <XSDRAW_FunctionsSession.hxx>
static int deja = 0, dejald = 0; #include <XSDRAW_FunctionsShape.hxx>
//unused variable
//static int okxset = 0;
static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> theolds; void XSDRAW::Factory(Draw_Interpretor& theDI)
static Handle(TColStd_HSequenceOfAsciiString) thenews;
static Handle(IFSelect_SessionPilot) thepilot; // detient Session, Model
static Standard_Integer XSTEPDRAWRUN (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
TCollection_AsciiString mess; static Standard_Boolean initactor = Standard_False;
for (Standard_Integer i = 0; i < argc; i ++) { if (initactor)
mess.AssignCat(argv[i]); mess.AssignCat(" ");
}
const Handle(Message_Messenger)& aMsgMgr = Message::DefaultMessenger();
Message_SequenceOfPrinters aPrinters;
aPrinters.Append (aMsgMgr->ChangePrinters());
aMsgMgr->AddPrinter (new Draw_Printer (di));
IFSelect_ReturnStatus stat = thepilot->Execute (mess.ToCString());
aMsgMgr->RemovePrinters (STANDARD_TYPE(Draw_Printer));
aMsgMgr->ChangePrinters().Append (aPrinters);
if (stat == IFSelect_RetError || stat == IFSelect_RetFail) return 1;
else return 0;
}
void XSDRAW::ChangeCommand
(const Standard_CString oldname, const Standard_CString newname)
{
Standard_Integer num = 0;
if (newname[0] != '\0') {
if (thenews.IsNull()) thenews = new TColStd_HSequenceOfAsciiString();
TCollection_AsciiString newstr(newname);
thenews->Append(newstr);
num = thenews->Length();
}
theolds.Bind(oldname,num);
}
void XSDRAW::RemoveCommand
(const Standard_CString oldname)
{
ChangeCommand (oldname,"");
}
Standard_Boolean XSDRAW::LoadSession ()
{
if (deja) return Standard_False;
deja = 1;
thepilot = new IFSelect_SessionPilot("XSTEP-DRAW>");
Handle(XSControl_WorkSession) WS = new XSControl_WorkSession;
//WS->SetVars (new XSDRAW_Vars);
thepilot->SetSession (WS);
IFSelect_Functions::Init();
XSControl_Functions::Init();
XSControl_FuncShape::Init();
// XSDRAW_Shape::Init(); passe a present par theCommands
return Standard_True;
}
void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
{
if (dejald)
{ {
return; return;
} }
dejald = 1; initactor = Standard_True;
// Pour tout faire d un coup : BRepTest & cie: XSDRAW_Functions::Init(theDI);
LoadSession(); XSDRAW_FunctionsSession::Init(theDI);
XSDRAW_FunctionsShape::Init(theDI);
//skl: we make remove commands "x" and "exit" in order to this commands are
// performed not in IFSelect_SessionPilot but in standard Tcl interpretor
XSDRAW::RemoveCommand("x");
XSDRAW::RemoveCommand("exit");
// if (!getenv("WBHOSTTOP")) XSDRAW::RemoveCommand("xsnew");
Handle(TColStd_HSequenceOfAsciiString) list = IFSelect_Activator::Commands (0);
for (TColStd_HSequenceOfAsciiString::Iterator aCmdIter (*list); aCmdIter.More(); aCmdIter.Next())
{
Standard_Integer num = -1;
const TCollection_AsciiString& aCmd = aCmdIter.Value();
if (!theolds.IsEmpty())
{
theolds.Find (aCmd, num);
}
if (num == 0)
{
continue;
} }
Standard_Integer nact = 0; // Declare entry point PLUGINFACTORY
Handle(IFSelect_Activator) anAct; DPLUGIN(XSDRAW)
TCollection_AsciiString aHelp;
if (!IFSelect_Activator::Select (aCmd.ToCString(), nact, anAct))
{
aHelp = TCollection_AsciiString("type : xhelp ") + aCmd + " for help";
}
else if (!anAct.IsNull())
{
aHelp = anAct->Help (nact);
}
const TCollection_AsciiString& aCmdName = num < 0 ? aCmd : thenews->Value (num);
theCommands.Add (aCmdName.ToCString(), aHelp.ToCString(), "", XSTEPDRAWRUN, anAct->Group());
}
}
Standard_Integer XSDRAW::Execute
(const Standard_CString command, const Standard_CString varname)
{
char mess[100];
Sprintf (mess,command,varname);
thepilot->Execute (mess);
return 1; // stat ?
}
Handle(IFSelect_SessionPilot) XSDRAW::Pilot ()
{ return thepilot; }
Handle(XSControl_WorkSession) XSDRAW::Session ()
{ return XSControl::Session(thepilot); }
void XSDRAW::SetController (const Handle(XSControl_Controller)& control)
{
if (thepilot.IsNull()) XSDRAW::LoadSession();
if (control.IsNull()) std::cout<<"XSTEP Controller not defined"<<std::endl;
else if (!Session().IsNull()) Session()->SetController (control);
else std::cout<<"XSTEP Session badly or not defined"<<std::endl;
}
Handle(XSControl_Controller) XSDRAW::Controller ()
{ return Session()->NormAdaptor(); }
Standard_Boolean XSDRAW::SetNorm
(const Standard_CString norm)
{
return Session()->SelectNorm (norm);
}
Handle(Interface_Protocol) XSDRAW::Protocol ()
{ return thepilot->Session()->Protocol(); }
Handle(Interface_InterfaceModel) XSDRAW::Model ()
{ return thepilot->Session()->Model(); }
void XSDRAW::SetModel
(const Handle(Interface_InterfaceModel)& model, const Standard_CString file)
{
thepilot->Session()->SetModel(model);
if (file && file[0] != '\0') thepilot->Session()->SetLoadedFile(file);
}
Handle(Interface_InterfaceModel) XSDRAW::NewModel ()
{ return Session()->NewModel(); }
Handle(Standard_Transient) XSDRAW::Entity (const Standard_Integer num)
{ return thepilot->Session()->StartingEntity(num); }
Standard_Integer XSDRAW::Number (const Handle(Standard_Transient)& ent)
{ return thepilot->Session()->StartingNumber(ent); }
void XSDRAW::SetTransferProcess (const Handle(Standard_Transient)& ATP)
{
DeclareAndCast(Transfer_FinderProcess,FP,ATP);
DeclareAndCast(Transfer_TransientProcess,TP,ATP);
// Cas FinderProcess ==> TransferWriter
if (!FP.IsNull()) Session()->SetMapWriter(FP);
// Cas TransientProcess ==> TransferReader
if (!TP.IsNull()) {
if (!TP->Model().IsNull() && TP->Model() != Session()->Model())
Session()->SetModel (TP->Model());
Session()->SetMapReader(TP);
}
}
Handle(Transfer_TransientProcess) XSDRAW::TransientProcess ()
{ return Session()->TransferReader()->TransientProcess(); }
Handle(Transfer_FinderProcess) XSDRAW::FinderProcess ()
{ return Session()->TransferWriter()->FinderProcess(); }
void XSDRAW::InitTransferReader (const Standard_Integer mode)
{
// 0 nullify 1 clear
// 2 init TR avec contenu TP (roots) 3 init TP avec contenu TR
// 4 init avec model (debut scratch)
Session()->InitTransferReader(mode);
}
Handle(XSControl_TransferReader) XSDRAW::TransferReader ()
{ return Session()->TransferReader(); }
// ############ AUXILIAIRES #############
Handle(Standard_Transient) XSDRAW::GetEntity (const Standard_CString name)
{ return IFSelect_Functions::GiveEntity (Session(),name); }
Standard_Integer XSDRAW::GetEntityNumber (const Standard_CString name)
{ return IFSelect_Functions::GiveEntityNumber (Session(),name); }
Handle(TColStd_HSequenceOfTransient) XSDRAW::GetList
(const Standard_CString first, const Standard_CString second)
{
if ( !first || first[0] == '\0' )
{
std::string aLineFirst;
std::cin >> aLineFirst;
char terminateSymbol = '\0';
std::cin.get(terminateSymbol);
if ( terminateSymbol == '\n' )
return XSDRAW::GetList (aLineFirst.c_str(), nullptr);
else
{
std::string aLineSecond;
std::cin >> aLineSecond;
return XSDRAW::GetList (aLineFirst.c_str(), aLineSecond.c_str());
}
}
return IFSelect_Functions::GiveList (Session(),first,second);
}
Standard_Boolean XSDRAW::FileAndVar
(const Standard_CString file, const Standard_CString var,
const Standard_CString def,
TCollection_AsciiString& resfile, TCollection_AsciiString& resvar)
{ return XSControl_FuncShape::FileAndVar
(XSDRAW::Session(),file,var,def,resfile,resvar); }
Standard_Integer XSDRAW::MoreShapes
(Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name)
{ return XSControl_FuncShape::MoreShapes (XSDRAW::Session(),list,name); }
// FONCTION POUR LE DEBUG
Standard_Integer XSDRAW_WHAT (const Handle(Standard_Transient)& ent)
{
if (ent.IsNull()) { std::cout<<"(Null Handle)"<<std::endl; return 0; }
Handle(Interface_InterfaceModel) model = XSDRAW::Model();
if (model.IsNull()) { std::cout<<"(No model) Type:"<<ent->DynamicType()->Name()<<std::endl; return 0; }
std::cout<<" Num/Id :";
model->Print (ent, std::cout, 0);
std::cout<<" -- Recorded Type:"<<model->TypeName (ent)<<std::endl;
return model->Number(ent);
}

View File

@@ -30,10 +30,23 @@ class XSDRAW
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
public: public:
Standard_EXPORT static void Init();
//! Loads all Draw commands of XSDRAWDEWrapper. Used for plugin. //! Loads all Draw commands of XSDRAWDEWrapper. Used for plugin.
Standard_EXPORT static void Factory(Draw_Interpretor& theDI); Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
public:
class StreamContainer
{
DEFINE_STANDARD_ALLOC
public:
StreamContainer(Draw_Interpretor& theDI) : myDI(&theDI) {}
Standard_SStream& SStream() { return myStream; }
~StreamContainer() { *myDI << myStream; }
private:
Draw_Interpretor* myDI;
Standard_SStream myStream;
};
}; };
#endif // _XSDRAW_HeaderFile #endif // _XSDRAW_HeaderFile

View File

@@ -24,6 +24,7 @@
#include <Transfer_TransientProcess.hxx> #include <Transfer_TransientProcess.hxx>
#include <XSControl.hxx> #include <XSControl.hxx>
#include <XSControl_Controller.hxx> #include <XSControl_Controller.hxx>
#include <XSDRAW.hxx>
#include <XSDRAWBase.hxx> #include <XSDRAWBase.hxx>
#include <XSControl_SelectForTransfer.hxx> #include <XSControl_SelectForTransfer.hxx>
#include <XSControl_TransferReader.hxx> #include <XSControl_TransferReader.hxx>
@@ -38,23 +39,24 @@ static Standard_Integer XSControl_xinit(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
XSDRAW::StreamContainer aSSC(theDI);
if (theNbArgs != 2 && theNbArgs != 1) if (theNbArgs != 2 && theNbArgs != 1)
{ {
theDI << "Error:"; aSSC.SStream() << "Error:";
return 1; return 1;
} }
if (theNbArgs > 1) if (theNbArgs > 1)
{ {
if (!XSDRAWBase::Session()->SelectNorm(theArgVec[1])); if (!XSDRAWBase::Session()->SelectNorm(theArgVec[1]))
{ {
theDI << "Error:"; aSSC.SStream() << "Error:";
return 1; return 1;
} }
} }
else else
{ {
Message::SendInfo() << "Selected Norm:"; aSSC.SStream() << "Selected Norm:";
theDI << XSDRAWBase::Session()->SelectedNorm() << "\n"; aSSC.SStream() << XSDRAWBase::Session()->SelectedNorm() << "\n";
} }
return 0; return 0;
} }
@@ -67,23 +69,25 @@ static Standard_Integer XSControl_xnorm(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
XSDRAW::StreamContainer aSSC(theDI);
(void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
Handle(XSControl_Controller) control = WS->NormAdaptor(); Handle(XSControl_Controller) control = WS->NormAdaptor();
if (theNbArgs == 1) if (theNbArgs == 1)
{ {
Message::SendInfo() << "Current Norm. xnorm newnorm to change"; aSSC.SStream() << "Current Norm. xnorm newnorm to change";
} }
else else
{ {
Message::SendInfo() << "Selected Norm:"; aSSC.SStream() << "Selected Norm:";
} }
if (control.IsNull()) if (control.IsNull())
{ {
Message::SendInfo() << "no norm currently defined"; aSSC.SStream() << "no norm currently defined";
} }
else else
{ {
Message::SendInfo() << " Long Name (complete) : " aSSC.SStream() << " Long Name (complete) : "
<< control->Name(Standard_False) << control->Name(Standard_False)
<< " Short name (resource) : " << control->Name(Standard_True); << " Short name (resource) : " << control->Name(Standard_True);
} }
@@ -95,12 +99,12 @@ static Standard_Integer XSControl_xnorm(Draw_Interpretor& theDI,
control = XSControl_Controller::Recorded(theArgVec[1]); control = XSControl_Controller::Recorded(theArgVec[1]);
if (control.IsNull()) if (control.IsNull())
{ {
Message::SendInfo() << " No norm named : " << theArgVec[1]; aSSC.SStream() << " No norm named : " << theArgVec[1];
return 1; return 1;
} }
WS->SetController(control); WS->SetController(control);
Message::SendInfo() << "new norm : " << control->Name(); aSSC.SStream() << "new norm : " << control->Name();
return 0; return 0;
} }
@@ -112,13 +116,11 @@ static Standard_Integer XSControl_newmodel(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
if (!XSDRAWBase::Session()->NewModel().IsNull()) (void)theDI;
{ (void)theNbArgs;
(void)theArgVec;
return 0; return 0;
} }
Message::SendInfo() << "No new Model produced";
return 1;
}
//======================================================================= //=======================================================================
//function : XSControl_tpclear //function : XSControl_tpclear
@@ -128,6 +130,9 @@ static Standard_Integer XSControl_tpclear(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
XSDRAW::StreamContainer aSSC(theDI);
(void)theDI;
(void)theNbArgs;
const Standard_Boolean modew = (theArgVec[0][2] == 'w'); const Standard_Boolean modew = (theArgVec[0][2] == 'w');
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(Transfer_FinderProcess)& FP = const Handle(Transfer_FinderProcess)& FP =
@@ -137,14 +142,14 @@ static Standard_Integer XSControl_tpclear(Draw_Interpretor& theDI,
if (modew) if (modew)
{ {
if (!FP.IsNull()) FP->Clear(); if (!FP.IsNull()) FP->Clear();
else Message::SendInfo() << "No Transfer Write"; else aSSC.SStream() << "No Transfer Write";
} }
else else
{ {
if (!TP.IsNull()) if (!TP.IsNull())
TP->Clear(); TP->Clear();
else else
Message::SendInfo() << "No Transfer Read"; aSSC.SStream() << "No Transfer Read";
} }
return 0; return 0;
} }
@@ -157,13 +162,15 @@ static Standard_Integer XSControl_tpstat(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
XSDRAW::StreamContainer aSSC(theDI);
(void)theDI;
const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg1 = theArgVec[1];
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(Transfer_TransientProcess)& TP = const Handle(Transfer_TransientProcess)& TP =
WS->TransferReader()->TransientProcess(); WS->TransferReader()->TransientProcess();
if (TP.IsNull()) if (TP.IsNull())
{ {
Message::SendInfo() << "No Transfer Read"; aSSC.SStream() << "No Transfer Read";
return 1; return 1;
} }
// **** tpstat **** // **** tpstat ****
@@ -208,10 +215,10 @@ static Standard_Integer XSControl_tpstat(Draw_Interpretor& theDI,
} }
// A present help eventuel // A present help eventuel
if (mod1 < -1) if (mod1 < -1)
Message::SendInfo() << "Unknown Mode"; aSSC.SStream() << "Unknown Mode";
if (mod1 < 0) if (mod1 < 0)
{ {
Message::SendInfo() << "Modes available :\n" aSSC.SStream() << "Modes available :\n"
<< "g : general c : checks (count) C (list)\n" << "g : general c : checks (count) C (list)\n"
<< " f : fails (count) F (list)\n" << " f : fails (count) F (list)\n"
<< " n : numbers of transferred entities (on TRANSFER ROOTS)\n" << " n : numbers of transferred entities (on TRANSFER ROOTS)\n"
@@ -230,14 +237,14 @@ static Standard_Integer XSControl_tpstat(Draw_Interpretor& theDI,
if (!TP.IsNull()) if (!TP.IsNull())
{ {
Message::SendInfo() << "TransferRead :"; aSSC.SStream() << "TransferRead :";
if (TP->Model() != WS->Model()) Message::SendInfo() << "Model differs from the session"; if (TP->Model() != WS->Model()) aSSC.SStream() << "Model differs from the session";
Handle(TColStd_HSequenceOfTransient) list = Handle(TColStd_HSequenceOfTransient) list =
IFSelect_Functions::GiveList(WS, pilot->CommandPart(2)); WS->GiveList(theArgVec[2]);
XSControl_TransferReader::PrintStatsOnList(TP, list, mod1, mod2); XSControl_TransferReader::PrintStatsOnList(TP, list, mod1, mod2);
// TP->PrintStats (1,Message::SendInfo()); // TP->PrintStats (1,aSSC.SStream());
} }
else Message::SendInfo() << "TransferRead : not defined"; else aSSC.SStream() << "TransferRead : not defined";
return 0; return 0;
} }
@@ -249,6 +256,8 @@ static Standard_Integer XSControl_tpent(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
XSDRAW::StreamContainer aSSC(theDI);
(void)theDI;
const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg1 = theArgVec[1];
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(Transfer_TransientProcess)& TP = const Handle(Transfer_TransientProcess)& TP =
@@ -256,7 +265,7 @@ static Standard_Integer XSControl_tpent(Draw_Interpretor& theDI,
// **** tpent **** // **** tpent ****
if (TP.IsNull()) if (TP.IsNull())
{ {
Message::SendInfo() << "No Transfer Read"; aSSC.SStream() << "No Transfer Read";
return 1; return 1;
} }
Handle(Interface_InterfaceModel) model = TP->Model(); Handle(Interface_InterfaceModel) model = TP->Model();
@@ -265,22 +274,22 @@ static Standard_Integer XSControl_tpent(Draw_Interpretor& theDI,
if (theNbArgs < 2) if (theNbArgs < 2)
{ {
Message::SendInfo() << "Give ENTITY NUMBER (IN MODEL TransferProcess)"; aSSC.SStream() << "Give ENTITY NUMBER (IN MODEL TransferProcess)";
return 1; return 1;
} }
Standard_Integer num = atoi(arg1); Standard_Integer num = atoi(arg1);
if (num <= 0 || num > model->NbEntities()) if (num <= 0 || num > model->NbEntities())
{ {
Message::SendInfo() << "Number not in [1 - " aSSC.SStream() << "Number not in [1 - "
<< model->NbEntities() << "]"; << model->NbEntities() << "]";
return 1; return 1;
} }
Handle(Standard_Transient) ent = model->Value(num); Handle(Standard_Transient) ent = model->Value(num);
Standard_Integer index = TP->MapIndex(ent); Standard_Integer index = TP->MapIndex(ent);
if (index == 0) if (index == 0)
Message::SendInfo() << "Entity " << num << " not recorded in transfer"; aSSC.SStream() << "Entity " << num << " not recorded in transfer";
else else
WS->PrintTransferStatus(index, Standard_False, Message::SendInfo()); WS->PrintTransferStatus(index, Standard_False, aSSC.SStream());
return 0; return 0;
} }
@@ -292,11 +301,13 @@ static Standard_Integer XSControl_tpitem(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
XSDRAW::StreamContainer aSSC(theDI);
(void)theDI;
const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg1 = theArgVec[1];
// **** tpitem/tproot/twitem/twroot **** // **** tpitem/tproot/twitem/twroot ****
if (theNbArgs < 2) if (theNbArgs < 2)
{ {
Message::SendInfo() << "Give ITEM NUMBER (in TransferProcess)"; aSSC.SStream() << "Give ITEM NUMBER (in TransferProcess)";
return 1; return 1;
} }
Standard_Integer num = atoi(arg1); Standard_Integer num = atoi(arg1);
@@ -306,9 +317,9 @@ static Standard_Integer XSControl_tpitem(Draw_Interpretor& theDI,
Handle(Transfer_Binder) binder; Handle(Transfer_Binder) binder;
Handle(Transfer_Finder) finder; Handle(Transfer_Finder) finder;
Handle(Standard_Transient) ent; Handle(Standard_Transient) ent;
if (!XSDRAWBase::Session()->PrintTransferStatus(num, modew, Message::SendInfo())) if (!XSDRAWBase::Session()->PrintTransferStatus(num, modew, aSSC.SStream()))
{ {
Message::SendInfo() << " - Num=" << num << " incorrect"; aSSC.SStream() << " - Num=" << num << " incorrect";
} }
return 0; return 0;
} }
@@ -321,6 +332,8 @@ static Standard_Integer XSControl_trecord(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
XSDRAW::StreamContainer aSSC(theDI);
(void)theDI;
const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg1 = theArgVec[1];
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(Transfer_TransientProcess)& TP = WS->TransferReader()->TransientProcess(); const Handle(Transfer_TransientProcess)& TP = WS->TransferReader()->TransientProcess();
@@ -332,7 +345,7 @@ static Standard_Integer XSControl_trecord(Draw_Interpretor& theDI,
Handle(Standard_Transient) ent; Handle(Standard_Transient) ent;
if (mdl.IsNull() || TR.IsNull() || TP.IsNull()) if (mdl.IsNull() || TR.IsNull() || TP.IsNull())
{ {
Message::SendInfo() << " init not done"; aSSC.SStream() << " init not done";
return 1; return 1;
} }
if (!tous) if (!tous)
@@ -341,24 +354,24 @@ static Standard_Integer XSControl_trecord(Draw_Interpretor& theDI,
if (tous) if (tous)
{ {
Standard_Integer nb = TP->NbRoots(); Standard_Integer nb = TP->NbRoots();
Message::SendInfo() << " Recording " << nb << " Roots"; aSSC.SStream() << " Recording " << nb << " Roots";
for (Standard_Integer i = 1; i <= nb; i++) for (Standard_Integer i = 1; i <= nb; i++)
{ {
ent = TP->Root(i); ent = TP->Root(i);
if (TR->RecordResult(ent)) if (TR->RecordResult(ent))
Message::SendInfo() << " Root n0." << i; aSSC.SStream() << " Root n0." << i;
else else
Message::SendInfo() << " Root n0." << i << " not recorded"; aSSC.SStream() << " Root n0." << i << " not recorded";
} }
} }
else else
{ {
if (num < 1 || num > mdl->NbEntities()) if (num < 1 || num > mdl->NbEntities())
Message::SendInfo() << "incorrect number:" << num; aSSC.SStream() << "incorrect number:" << num;
else if (TR->RecordResult(mdl->Value(num))) else if (TR->RecordResult(mdl->Value(num)))
Message::SendInfo() << " Entity n0." << num; aSSC.SStream() << " Entity n0." << num;
else else
Message::SendInfo() << " Entity n0." << num << " not recorded"; aSSC.SStream() << " Entity n0." << num << " not recorded";
} }
return 0; return 0;
} }
@@ -371,26 +384,28 @@ static Standard_Integer XSControl_trstat(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
XSDRAW::StreamContainer aSSC(theDI);
(void)theDI;
const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg1 = theArgVec[1];
// **** trstat : TransferReader **** // **** trstat : TransferReader ****
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(XSControl_TransferReader)& TR = WS->TransferReader(); const Handle(XSControl_TransferReader)& TR = WS->TransferReader();
if (TR.IsNull()) if (TR.IsNull())
{ {
Message::SendInfo() << " init not done"; aSSC.SStream() << " init not done";
return 1; return 1;
} }
Handle(Interface_InterfaceModel) mdl = TR->Model(); Handle(Interface_InterfaceModel) mdl = TR->Model();
if (mdl.IsNull()) if (mdl.IsNull())
{ {
Message::SendInfo() << " No model"; aSSC.SStream() << " No model";
return 1; return 1;
} }
Message::SendInfo() << " Statistics : FileName : " << TR->FileName(); aSSC.SStream() << " Statistics : FileName : " << TR->FileName();
if (theNbArgs == 1) if (theNbArgs == 1)
{ {
// stats generales // stats generales
TR->PrintStats(Message::SendInfo(), 10, 0); TR->PrintStats(aSSC.SStream(), 10, 0);
} }
else else
{ {
@@ -398,31 +413,31 @@ static Standard_Integer XSControl_trstat(Draw_Interpretor& theDI,
Standard_Integer num = atoi(arg1); Standard_Integer num = atoi(arg1);
if (num < 1 || num > mdl->NbEntities()) if (num < 1 || num > mdl->NbEntities())
{ {
Message::SendInfo() << " incorrect number:" << arg1; aSSC.SStream() << " incorrect number:" << arg1;
return 1; return 1;
} }
Handle(Standard_Transient) ent = mdl->Value(num); Handle(Standard_Transient) ent = mdl->Value(num);
if (!TR->IsRecorded(ent)) if (!TR->IsRecorded(ent))
{ {
Message::SendInfo() << " Entity " << num << " not recorded"; aSSC.SStream() << " Entity " << num << " not recorded";
return 1; return 1;
} }
Handle(Transfer_ResultFromModel) RM = TR->FinalResult(ent); Handle(Transfer_ResultFromModel) RM = TR->FinalResult(ent);
Handle(TColStd_HSequenceOfTransient) list = TR->CheckedList(ent); Handle(TColStd_HSequenceOfTransient) list = TR->CheckedList(ent);
Standard_Integer i, nb = list->Length(); Standard_Integer i, nb = list->Length();
if (nb > 0) if (nb > 0)
Message::SendInfo() << " Entities implied by Check/Result :" << nb << " i.e.:"; aSSC.SStream() << " Entities implied by Check/Result :" << nb << " i.e.:";
for (i = 1; i <= nb; i++) for (i = 1; i <= nb; i++)
{ {
Message::SendInfo() << " "; mdl->Print(list->Value(i), Message::SendInfo()); aSSC.SStream() << " "; mdl->Print(list->Value(i), aSSC.SStream());
} }
if (RM.IsNull()) if (RM.IsNull())
{ {
Message::SendInfo() << " no other info"; aSSC.SStream() << " no other info";
return 0; return 0;
} }
Interface_CheckIterator chl = RM->CheckList(Standard_False); Interface_CheckIterator chl = RM->CheckList(Standard_False);
WS->PrintCheckList(Message::SendInfo(), chl, Standard_False, IFSelect_EntitiesByItem); WS->PrintCheckList(aSSC.SStream(), chl, Standard_False, IFSelect_EntitiesByItem);
} }
return 0; return 0;
} }
@@ -435,6 +450,8 @@ static Standard_Integer XSControl_trbegin(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
XSDRAW::StreamContainer aSSC(theDI);
(void)theDI;
// **** trbegin : TransferReader **** // **** trbegin : TransferReader ****
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
Handle(XSControl_TransferReader) TR = WS->TransferReader(); Handle(XSControl_TransferReader) TR = WS->TransferReader();
@@ -449,7 +466,7 @@ static Standard_Integer XSControl_trbegin(Draw_Interpretor& theDI,
TR = WS->TransferReader(); TR = WS->TransferReader();
if (TR.IsNull()) if (TR.IsNull())
{ {
Message::SendInfo() << " init not done or failed"; aSSC.SStream() << " init not done or failed";
return 1; return 1;
} }
} }
@@ -465,20 +482,21 @@ static Standard_Integer XSControl_tread(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
Standard_Integer theNbArgs = theNbArgs; XSDRAW::StreamContainer aSSC(theDI);
(void)theDI;
//const Standard_CString arg1 = pilot->Arg(1); //const Standard_CString arg1 = pilot->Arg(1);
// **** tread : TransferReader **** // **** tread : TransferReader ****
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
Handle(XSControl_TransferReader) TR = WS->TransferReader(); Handle(XSControl_TransferReader) TR = WS->TransferReader();
if (TR.IsNull()) if (TR.IsNull())
{ {
Message::SendInfo() << " init not done"; aSSC.SStream() << " init not done";
return 1; return 1;
} }
const Handle(Interface_InterfaceModel)& mdl = TR->Model(); const Handle(Interface_InterfaceModel)& mdl = TR->Model();
if (mdl.IsNull()) if (mdl.IsNull())
{ {
Message::SendInfo() << " No model"; aSSC.SStream() << " No model";
return 1; return 1;
} }
if (theNbArgs < 2) if (theNbArgs < 2)
@@ -487,19 +505,19 @@ static Standard_Integer XSControl_tread(Draw_Interpretor& theDI,
Handle(Standard_Transient) sel = WS->NamedItem("xst-model-roots"); Handle(Standard_Transient) sel = WS->NamedItem("xst-model-roots");
if (sel.IsNull()) if (sel.IsNull())
{ {
Message::SendInfo() << "Select Roots absent"; aSSC.SStream() << "Select Roots absent";
return 1; return 1;
} }
Handle(TColStd_HSequenceOfTransient) list = WS->GiveList(sel); Handle(TColStd_HSequenceOfTransient) list = WS->GiveList(sel);
Message::SendInfo() << " Transferring all roots i.e. : " << TR->TransferList(list); aSSC.SStream() << " Transferring all roots i.e. : " << TR->TransferList(list);
} }
else else
{ {
Handle(TColStd_HSequenceOfTransient) list = Handle(TColStd_HSequenceOfTransient) list =
IFSelect_Functions::GiveList(WS, pilot->CommandPart(1)); WS->GiveList(theArgVec[1]);
Message::SendInfo() << " Transfer of " << list->Length() << " entities"; aSSC.SStream() << " Transfer of " << list->Length() << " entities";
Standard_Integer nb = TR->TransferList(list); Standard_Integer nb = TR->TransferList(list);
Message::SendInfo() << " Gives " << nb << " results"; aSSC.SStream() << " Gives " << nb << " results";
} }
return 0; return 0;
} }
@@ -512,13 +530,17 @@ static Standard_Integer XSControl_trtp(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
XSDRAW::StreamContainer aSSC(theDI);
(void)theDI;
(void)theNbArgs;
(void)theArgVec;
// **** TReader -> TProcess **** // **** TReader -> TProcess ****
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(XSControl_TransferReader)& TR = WS->TransferReader(); const Handle(XSControl_TransferReader)& TR = WS->TransferReader();
if (TR.IsNull()) if (TR.IsNull())
Message::SendInfo() << " No TransferReader"; aSSC.SStream() << " No TransferReader";
else if (TR->TransientProcess().IsNull()) else if (TR->TransientProcess().IsNull())
Message::SendInfo() << " Transfer Reader without Process"; aSSC.SStream() << " Transfer Reader without Process";
return 0; return 0;
} }
@@ -530,6 +552,10 @@ static Standard_Integer XSControl_tptr(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
XSDRAW::StreamContainer aSSC(theDI);
(void)theDI;
(void)theNbArgs;
(void)theArgVec;
// **** TProcess -> TReader **** // **** TProcess -> TReader ****
XSDRAWBase::Session()->InitTransferReader(3); XSDRAWBase::Session()->InitTransferReader(3);
return 0; return 0;
@@ -543,7 +569,8 @@ static Standard_Integer XSControl_twmode(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
Standard_Integer theNbArgs = theNbArgs; XSDRAW::StreamContainer aSSC(theDI);
(void)theDI;
const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg1 = theArgVec[1];
// **** twmode **** // **** twmode ****
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
@@ -552,20 +579,20 @@ static Standard_Integer XSControl_twmode(Draw_Interpretor& theDI,
Standard_Integer modemin, modemax; Standard_Integer modemin, modemax;
if (control->ModeWriteBounds(modemin, modemax)) if (control->ModeWriteBounds(modemin, modemax))
{ {
Message::SendInfo() << "Write Mode : allowed values " << modemin << " to " << modemax; aSSC.SStream() << "Write Mode : allowed values " << modemin << " to " << modemax;
for (Standard_Integer modd = modemin; modd <= modemax; modd++) for (Standard_Integer modd = modemin; modd <= modemax; modd++)
{ {
Message::SendInfo() << modd << " : " << control->ModeWriteHelp(modd); aSSC.SStream() << modd << " : " << control->ModeWriteHelp(modd);
} }
} }
Message::SendInfo() << "Write Mode : actual = " << TW->TransferMode(); aSSC.SStream() << "Write Mode : actual = " << TW->TransferMode();
if (theNbArgs <= 1) if (theNbArgs <= 1)
return 0; return 0;
Standard_Integer mod = atoi(arg1); Standard_Integer mod = atoi(arg1);
Message::SendInfo() << "New value -> " << arg1; aSSC.SStream() << "New value -> " << arg1;
TW->SetTransferMode(mod); TW->SetTransferMode(mod);
if (!control->IsModeWrite(mod)) if (!control->IsModeWrite(mod))
Message::SendInfo() << "Warning : this new value is not supported"; aSSC.SStream() << "Warning : this new value is not supported";
return 0; return 0;
} }
@@ -577,36 +604,25 @@ static Standard_Integer XSControl_twstat(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
//Standard_Integer theNbArgs = theNbArgs; XSDRAW::StreamContainer aSSC(theDI);
//const Standard_CString arg1 = pilot->Arg(1); (void)theDI;
//const Standard_CString arg2 = pilot->Arg(2); (void)theNbArgs;
(void)theArgVec;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(Transfer_FinderProcess)& FP = WS->TransferWriter()->FinderProcess(); const Handle(Transfer_FinderProcess)& FP = WS->TransferWriter()->FinderProcess();
// **** twstat **** // **** twstat ****
// Pour Write // Pour Write
if (!FP.IsNull()) if (!FP.IsNull())
{ {
Message::SendInfo() << "TransferWrite:"; aSSC.SStream() << "TransferWrite:";
// XSControl_TransferWriter::PrintStatsProcess (FP,mod1,mod2); // XSControl_TransferWriter::PrintStatsProcess (FP,mod1,mod2);
FP->PrintStats(1, Message::SendInfo()); FP->PrintStats(1, aSSC.SStream());
} }
else else
Message::SendInfo() << "TransferWrite: not defined"; aSSC.SStream() << "TransferWrite: not defined";
return 0; return 0;
} }
//=======================================================================
//function : XSControl_settransfert
//purpose :
//=======================================================================
static Standard_Integer XSControl_settransfert(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
// **** SelectForTransfer ****
return pilot->RecordItem(new XSControl_SelectForTransfer(XSDRAWBase::Session()->TransferReader()));
}
//======================================================================= //=======================================================================
//function : Init //function : Init
//purpose : //purpose :
@@ -667,7 +683,4 @@ void XSDRAW_Functions::Init(Draw_Interpretor& theDI)
"displays mode transfer write, + num changes it", __FILE__, XSControl_twmode, aGroup); "displays mode transfer write, + num changes it", __FILE__, XSControl_twmode, aGroup);
theDI.Add("twstat", theDI.Add("twstat",
"Statistics on TransferProcess (WRITE)", __FILE__, XSControl_twstat, aGroup); "Statistics on TransferProcess (WRITE)", __FILE__, XSControl_twstat, aGroup);
theDI.Add("selecttransfer",
"selection (recognize from transfer actor)", __FILE__, XSControl_settransfert);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -15,6 +15,8 @@
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
#include <BRepTools.hxx> #include <BRepTools.hxx>
#include <DBRep.hxx>
#include <DrawTrSurf.hxx>
#include <Geom_Geometry.hxx> #include <Geom_Geometry.hxx>
#include <IFSelect_Act.hxx> #include <IFSelect_Act.hxx>
#include <IFSelect_SessionPilot.hxx> #include <IFSelect_SessionPilot.hxx>
@@ -39,39 +41,60 @@
#include <XSControl.hxx> #include <XSControl.hxx>
#include <XSControl_ConnectedShapes.hxx> #include <XSControl_ConnectedShapes.hxx>
#include <XSControl_Controller.hxx> #include <XSControl_Controller.hxx>
#include <XSDRAW_FunctionsShape.hxx> #include <XSDRAW.hxx>
#include <XSDRAWBase.hxx>
#include <XSControl_TransferReader.hxx> #include <XSControl_TransferReader.hxx>
#include <XSControl_TransferWriter.hxx> #include <XSControl_TransferWriter.hxx>
#include <XSControl_Vars.hxx> #include <XSControl_Vars.hxx>
#include <XSControl_WorkSession.hxx> #include <XSControl_WorkSession.hxx>
#include <stdio.h> //=======================================================================
//function : GiveEntityNumber
//purpose :
//=======================================================================
static Standard_Integer GiveEntityNumber(const Handle(XSControl_WorkSession)& WS,
const Standard_CString name)
{
Standard_Integer num = 0;
if (!name || name[0] == '\0')
{
char ligne[80]; ligne[0] = '\0';
std::cin >> ligne;
// std::cin.clear(); std::cin.getline (ligne,79);
if (ligne[0] == '\0') return 0;
num = WS->NumberFromLabel(ligne);
}
else num = WS->NumberFromLabel(name);
return num;
}
//======================================================================= //=======================================================================
//function : XSControl_tpdraw //function : XSControl_tpdraw
//purpose : //purpose :
//======================================================================= //=======================================================================
static Standard_Integer XSControl_tpdraw static Standard_Integer XSControl_tpdraw(Draw_Interpretor& theDI,
(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) Standard_Integer theNbArgs,
const char** theArgVec)
{ {
Standard_Integer argc = pilot->NbWords(); XSDRAW::StreamContainer aSSC(theDI);
const Standard_CString arg1 = pilot->Arg(1); (void)theDI;
const Standard_CString arg2 = pilot->Arg(2); const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg3 = pilot->Arg(3); const Standard_CString arg2 = theArgVec[2];
const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); const Standard_CString arg3 = theArgVec[3];
Message_Messenger::StreamBuffer sout = Message::SendInfo(); const Handle(Transfer_TransientProcess)& TP = XSDRAWBase::Session()->TransferReader()->TransientProcess();
if (TP.IsNull()) if (TP.IsNull())
{ {
sout << "No Transfer Read" << std::endl; return IFSelect_RetError; aSSC.SStream() << "No Transfer Read" << std::endl;
return 1;
} }
// **** tpdraw **** // **** tpdraw ****
if (argc < 2) if (theNbArgs < 2)
{ {
sout << "Donner [mode facultatif : item ou root] , NUMERO , nom DRAW facultatif" << std::endl; aSSC.SStream() << "Donner [mode facultatif : item ou root] , NUMERO , nom DRAW facultatif" << std::endl;
sout << " mode si present : item ou root, sinon n0 d entite modele" << std::endl; aSSC.SStream() << " mode si present : item ou root, sinon n0 d entite modele" << std::endl;
sout << " NUMERO entier : d entite, d item transfert ou de root transfert\n" aSSC.SStream() << " NUMERO entier : d entite, d item transfert ou de root transfert\n"
<< " ou * pour dire tous" << std::endl; << " ou * pour dire tous" << std::endl;
return IFSelect_RetError; return 1;
} }
Standard_Integer mode = 0, num = 0; Standard_Integer mode = 0, num = 0;
if (arg1[0] == 'i') mode = 1; if (arg1[0] == 'i') mode = 1;
@@ -79,17 +102,18 @@ static Standard_Integer XSControl_tpdraw
Standard_Boolean tout = Standard_False; Standard_Boolean tout = Standard_False;
if (mode == 0) if (mode == 0)
{ {
if (argc < 2) if (theNbArgs < 2)
{ {
sout << "Donner au moins un NUMERO ou *" << std::endl; return IFSelect_RetError; aSSC.SStream() << "Donner au moins un NUMERO ou *" << std::endl;
return 1;
} }
if (arg1[0] == '*') tout = Standard_True; if (arg1[0] == '*') tout = Standard_True;
else num = IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot), arg1); else num = GiveEntityNumber(XSDRAWBase::Session(), arg1);
} }
else else
{ {
if (arg2[0] == '*') tout = Standard_True; if (arg2[0] == '*') tout = Standard_True;
else num = IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot), arg2); else num = GiveEntityNumber(XSDRAWBase::Session(), arg2);
} }
Standard_Integer nbvar = 0; Standard_Integer nbvar = 0;
@@ -104,36 +128,36 @@ static Standard_Integer XSControl_tpdraw
{ {
if (mode == 0) if (mode == 0)
{ {
sout << "Pas de modele, preciser n0 d item de transfert" << std::endl; aSSC.SStream() << "Pas de modele, preciser n0 d item de transfert" << std::endl;
return IFSelect_RetError; return 1;
} }
} }
if (mode == 0) if (mode == 0)
{ {
sout << "Entite de modele"; max = model->NbEntities(); aSSC.SStream() << "Entite de modele"; max = model->NbEntities();
} }
if (mode == 1) if (mode == 1)
{ {
sout << "Item de transfert"; max = TP->NbMapped(); aSSC.SStream() << "Item de transfert"; max = TP->NbMapped();
} }
if (mode == 2) if (mode == 2)
{ {
sout << "Racine de transfert"; max = TP->NbRoots(); aSSC.SStream() << "Racine de transfert"; max = TP->NbRoots();
} }
if (tout) if (tout)
{ {
n1 = 1; n2 = max; n1 = 1; n2 = max;
sout << ", listage de 1 a " << max << std::endl; aSSC.SStream() << ", listage de 1 a " << max << std::endl;
} }
else if (num <= 0 || num > max) else if (num <= 0 || num > max)
{ {
sout << " - Num=" << num << " hors limite (de 1 a " << max << ")" << std::endl; aSSC.SStream() << " - Num=" << num << " hors limite (de 1 a " << max << ")" << std::endl;
return IFSelect_RetError; return 1;
} }
else else
{ {
n1 = n2 = num; nbvar = -1; // nbvar : 1ere shape simple = pas de n0 n1 = n2 = num; nbvar = -1; // nbvar : 1ere shape simple = pas de n0
sout << ", n0 " << num << std::endl; aSSC.SStream() << ", n0 " << num << std::endl;
} }
for (i = n1; i <= n2; i++) for (i = n1; i <= n2; i++)
@@ -163,12 +187,12 @@ static Standard_Integer XSControl_tpdraw
if (binder.IsNull()) index = 0; if (binder.IsNull()) index = 0;
if (index == 0) if (index == 0)
{ {
if (!tout) sout << "Entite n0 " << num << " : non repertoriee" << std::endl; if (!tout) aSSC.SStream() << "Entite n0 " << num << " : non repertoriee" << std::endl;
continue; continue;
} }
if (!binder->HasResult()) if (!binder->HasResult())
{ {
if (!tout) sout << "Entite n0 " << num << " : pas de resultat" << std::endl; if (!tout) aSSC.SStream() << "Entite n0 " << num << " : pas de resultat" << std::endl;
continue; continue;
} }
sh = TransferBRep::ShapeResult(binder); sh = TransferBRep::ShapeResult(binder);
@@ -179,51 +203,51 @@ static Standard_Integer XSControl_tpdraw
nbvar++; nbvar++;
if (sh.IsNull()) if (sh.IsNull())
{ {
sout << " (no Shape recorded)" << std::endl; continue; aSSC.SStream() << " (no Shape recorded)" << std::endl; continue;
} }
if (tout) sout << "[ " << i << " ]:"; if (tout) aSSC.SStream() << "[ " << i << " ]:";
if (num == 0) sout << " pas dans le modele"; if (num == 0) aSSC.SStream() << " pas dans le modele";
else sout << " ent.n0 " << num; else aSSC.SStream() << " ent.n0 " << num;
sout << ", item transfert n0 " << index; aSSC.SStream() << ", item transfert n0 " << index;
if (nbvar == 0) if (nbvar == 0)
{ {
if (argc > 3 && mode > 0) sprintf(nomvar, "%s", arg3); if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s", arg3);
else if (argc > 2 && mode == 0) sprintf(nomvar, "%s", arg2); else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s", arg2);
else sprintf(nomvar, "tp_%d", i); else sprintf(nomvar, "tp_%d", i);
} }
else else
{ {
if (argc > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar); if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar);
else if (argc > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar); else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar);
else sprintf(nomvar, "tp_%d", i); else sprintf(nomvar, "tp_%d", i);
} }
sout << " -> 1 DRAW Shape: " << nomvar << std::endl; aSSC.SStream() << " -> 1 DRAW Shape: " << nomvar << std::endl;
XSControl::Vars(pilot)->SetShape(nomvar, sh); DBRep::Set(nomvar, sh);
continue; continue;
} }
DeclareAndCast(TransferBRep_ShapeListBinder, slb, binder); DeclareAndCast(TransferBRep_ShapeListBinder, slb, binder);
if (!slb.IsNull()) if (!slb.IsNull())
{ {
Standard_Integer nbs = slb->NbShapes(); Standard_Integer nbs = slb->NbShapes();
if (tout) sout << "[ " << i << " ]:"; if (tout) aSSC.SStream() << "[ " << i << " ]:";
if (num == 0) sout << " pas dans le modele"; if (num == 0) aSSC.SStream() << " pas dans le modele";
else sout << " ent.n0 " << num; else aSSC.SStream() << " ent.n0 " << num;
sout << ", item transfert n0 " << index; aSSC.SStream() << ", item transfert n0 " << index;
sout << " -> " << nbs << " DRAW Shapes :"; aSSC.SStream() << " -> " << nbs << " DRAW Shapes :";
for (Standard_Integer j = 1; j <= nbs; j++) for (Standard_Integer j = 1; j <= nbs; j++)
{ {
sh = slb->Shape(j); if (nbvar < 0) nbvar = 0; nbvar++; sh = slb->Shape(j); if (nbvar < 0) nbvar = 0; nbvar++;
if (sh.IsNull()) if (sh.IsNull())
{ {
sout << " (no Shape recorded)" << std::endl; continue; aSSC.SStream() << " (no Shape recorded)" << std::endl; continue;
} }
if (argc > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar); if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar);
else if (argc > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar); else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar);
else sprintf(nomvar, "tp_%d_%d", i, nbvar); else sprintf(nomvar, "tp_%d_%d", i, nbvar);
sout << " " << nomvar; aSSC.SStream() << " " << nomvar;
XSControl::Vars(pilot)->SetShape(nomvar, sh); DBRep::Set(nomvar, sh);
} }
sout << std::endl; aSSC.SStream() << std::endl;
continue; continue;
} }
DeclareAndCast(Transfer_SimpleBinderOfTransient, trb, binder); DeclareAndCast(Transfer_SimpleBinderOfTransient, trb, binder);
@@ -232,121 +256,130 @@ static Standard_Integer XSControl_tpdraw
Handle(Standard_Transient) resu = trb->Result(); Handle(Standard_Transient) resu = trb->Result();
if (resu.IsNull()) if (resu.IsNull())
{ {
sout << "Entite n0 " << num << " : pas de resultat" << std::endl; aSSC.SStream() << "Entite n0 " << num << " : pas de resultat" << std::endl;
continue; continue;
} }
DeclareAndCast(Geom_Geometry, geom, resu); DeclareAndCast(Geom_Geometry, geom, resu);
sout << "Entite n0 " << num << " : resultat " << resu->DynamicType()->Name(); aSSC.SStream() << "Entite n0 " << num << " : resultat " << resu->DynamicType()->Name();
if (geom.IsNull()) if (geom.IsNull())
{ {
sout << std::endl; continue; aSSC.SStream() << std::endl; continue;
} }
nbvar++; nbvar++;
if (nbvar == 0) if (nbvar == 0)
{ {
if (argc > 3 && mode > 0) sprintf(nomvar, "%s", arg3); if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s", arg3);
else if (argc > 2 && mode == 0) sprintf(nomvar, "%s", arg2); else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s", arg2);
else sprintf(nomvar, "tp_%d", i); else sprintf(nomvar, "tp_%d", i);
} }
else else
{ {
if (argc > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar); if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar);
else if (argc > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar); else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar);
else sprintf(nomvar, "tp_%d", i); else sprintf(nomvar, "tp_%d", i);
} }
char* nomv = nomvar; char* nomv = nomvar;
XSControl::Vars(pilot)->Set(nomv, geom); DrawTrSurf::Set(nomv, geom);
sout << " -> DRAW Geom : " << nomvar << std::endl; aSSC.SStream() << " -> DRAW Geom : " << nomvar << std::endl;
continue; continue;
} }
if (sh.IsNull() && trb.IsNull()) if (sh.IsNull() && trb.IsNull())
if (!tout) sout << "Entite n0 " << num << " : resultat pas une Shape mais " << binder->ResultTypeName() << std::endl; if (!tout) aSSC.SStream() << "Entite n0 " << num << " : resultat pas une Shape mais " << binder->ResultTypeName() << std::endl;
} }
if (sh.IsNull()) sout << " (No Shape)" << std::endl; if (sh.IsNull()) aSSC.SStream() << " (No Shape)" << std::endl;
return IFSelect_RetDone; return 0;
} }
//======================================================================= //=======================================================================
//function : XSControl_tpcompound //function : XSControl_tpcompound
//purpose : //purpose :
//======================================================================= //=======================================================================
static Standard_Integer XSControl_tpcompound static Standard_Integer XSControl_tpcompound(Draw_Interpretor& theDI,
(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) Standard_Integer theNbArgs,
const char** theArgVec)
{ {
Standard_Integer argc = pilot->NbWords(); XSDRAW::StreamContainer aSSC(theDI);
const Standard_CString arg1 = pilot->Arg(1); (void)theDI;
const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); const Standard_CString arg1 = theArgVec[1];
Message_Messenger::StreamBuffer sout = Message::SendInfo(); const Handle(Transfer_TransientProcess)& TP = XSDRAWBase::Session()->TransferReader()->TransientProcess();
if (TP.IsNull()) if (TP.IsNull())
{ {
sout << "No Transfer Read" << std::endl; return IFSelect_RetError; aSSC.SStream() << "No Transfer Read" << std::endl;
return 1;
} }
// **** tpcompound **** // **** tpcompound ****
if (argc < 2) if (theNbArgs < 2)
{ {
sout << "Give a NAME for the Compound + optional givelist, else roots are taken" << std::endl; return IFSelect_RetError; aSSC.SStream() << "Give a NAME for the Compound + optional givelist, else roots are taken" << std::endl;
return 1;
} }
Handle(TopTools_HSequenceOfShape) list; Handle(TopTools_HSequenceOfShape) list;
if (argc == 2) list = TransferBRep::Shapes(TP); if (theNbArgs == 2) list = TransferBRep::Shapes(TP);
else else
{ {
Handle(TColStd_HSequenceOfTransient) lise = IFSelect_Functions::GiveList(pilot->Session(), pilot->CommandPart(2)); Handle(TColStd_HSequenceOfTransient) lise = XSDRAWBase::Session()->GiveList(theArgVec[2]);
if (lise.IsNull()) if (lise.IsNull())
{ {
sout << "Not a valid entity list : " << pilot->CommandPart(2) << std::endl; return IFSelect_RetError; aSSC.SStream() << "Not a valid entity list : " << theArgVec[2] << std::endl;
return 1;
} }
list = TransferBRep::Shapes(TP, lise); list = TransferBRep::Shapes(TP, lise);
sout << lise->Length() << " Entities, "; aSSC.SStream() << lise->Length() << " Entities, ";
} }
if (list.IsNull()) if (list.IsNull())
{ {
sout << "No Shape listed" << std::endl; return IFSelect_RetError; aSSC.SStream() << "No Shape listed" << std::endl;
return 1;
} }
Standard_Integer nb = list->Length(); Standard_Integer nb = list->Length();
sout << nb << " Shape(s) listed" << std::endl; aSSC.SStream() << nb << " Shape(s) listed" << std::endl;
TopoDS_Compound C; TopoDS_Compound C;
BRep_Builder B; BRep_Builder B;
B.MakeCompound(C); B.MakeCompound(C);
for (Standard_Integer i = 1; i <= nb; i++) B.Add(C, list->Value(i)); for (Standard_Integer i = 1; i <= nb; i++) B.Add(C, list->Value(i));
XSControl::Vars(pilot)->SetShape(arg1, C); DBRep::Set(arg1, C);
return IFSelect_RetDone; return 0;
} }
//======================================================================= //=======================================================================
//function : XSControl_traccess //function : XSControl_traccess
//purpose : //purpose :
//======================================================================= //=======================================================================
static Standard_Integer XSControl_traccess static Standard_Integer XSControl_traccess(Draw_Interpretor& theDI,
(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) Standard_Integer theNbArgs,
const char** theArgVec)
{ {
Standard_Integer argc = pilot->NbWords(); XSDRAW::StreamContainer aSSC(theDI);
const Standard_CString arg1 = pilot->Arg(1); (void)theDI;
const Standard_CString arg2 = pilot->Arg(2); const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg2 = theArgVec[2];
TCollection_AsciiString aCommand(theArgVec[0]);
// **** trdraw : TransferReader **** 26 // **** trdraw : TransferReader **** 26
// **** trsave : TransferReader **** 27 // **** trsave : TransferReader **** 27
// **** trcomp (comp -> DRAW) **** 28 // **** trcomp (comp -> DRAW) **** 28
// **** trscomp (comp -> save) **** 29 // **** trscomp (comp -> save) **** 29
Standard_Boolean cascomp = (pilot->Word(0).Location(1, 'o', 1, 5) > 0); Standard_Boolean cascomp = (aCommand.Location(1, 'o', 1, 5) > 0);
Standard_Boolean cassave = (pilot->Word(0).Location(1, 's', 1, 5) > 0); Standard_Boolean cassave = (aCommand.Location(1, 's', 1, 5) > 0);
TCollection_AsciiString nomsh, noms; TCollection_AsciiString nomsh, noms;
const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader(); const Handle(XSControl_TransferReader)& TR = XSDRAWBase::Session()->TransferReader();
Message_Messenger::StreamBuffer sout = Message::SendInfo();
if (TR.IsNull()) if (TR.IsNull())
{ {
sout << " manque init" << std::endl; return IFSelect_RetError; aSSC.SStream() << " manque init" << std::endl;
return 1;
} }
const Handle(Interface_InterfaceModel)& mdl = TR->Model(); const Handle(Interface_InterfaceModel)& mdl = TR->Model();
if (mdl.IsNull()) if (mdl.IsNull())
{ {
sout << " modele absent" << std::endl; return IFSelect_RetError; aSSC.SStream() << " modele absent" << std::endl;
return 1;
} }
Standard_Integer num = (argc > 1 ? IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot), arg1) : 0); Standard_Integer num = (theNbArgs > 1 ? GiveEntityNumber(XSDRAWBase::Session(), arg1) : 0);
if (argc > 1) nomsh = arg1; if (theNbArgs > 1) nomsh = arg1;
else nomsh = cascomp ? "TREAD_COMP" : "TREAD_LIST"; else nomsh = cascomp ? "TREAD_COMP" : "TREAD_LIST";
if (cassave) sout << " save shapes -> current directory" << std::endl; if (cassave) aSSC.SStream() << " save shapes -> current directory" << std::endl;
if (num == 0 || cascomp) if (num == 0 || cascomp)
{ {
@@ -355,41 +388,43 @@ static Standard_Integer XSControl_traccess
B.MakeCompound(C); B.MakeCompound(C);
const Handle(TopTools_HSequenceOfShape)& list = TR->ShapeResultList(Standard_True); const Handle(TopTools_HSequenceOfShape)& list = TR->ShapeResultList(Standard_True);
sout << " TOUS RESULTATS par ShapeResultList, soit " << list->Length() << std::endl; aSSC.SStream() << " TOUS RESULTATS par ShapeResultList, soit " << list->Length() << std::endl;
for (Standard_Integer i = 1, nb = list->Length(); i <= nb; ++i) for (Standard_Integer i = 1, nb = list->Length(); i <= nb; ++i)
{ {
noms = nomsh + "_" + i; noms = nomsh + "_" + i;
if ((i % 1000) == 0) sout << "(" << i << ")" << std::endl; if ((i % 1000) == 0) aSSC.SStream() << "(" << i << ")" << std::endl;
else if ((i % 100) == 0) sout << "*"; else if ((i % 100) == 0) aSSC.SStream() << "*";
else if ((i % 10) == 0) sout << "0"; else if ((i % 10) == 0) aSSC.SStream() << "0";
else sout << "."; else aSSC.SStream() << ".";
if (list->Value(i).IsNull()) continue; if (list->Value(i).IsNull()) continue;
if (!cascomp && !cassave) XSControl::Vars(pilot)->SetShape(noms.ToCString(), list->Value(i)); if (!cascomp && !cassave) DBRep::Set(noms.ToCString(), list->Value(i));
else if (!cascomp && cassave) BRepTools::Write(list->Value(i), noms.ToCString()); else if (!cascomp && cassave) BRepTools::Write(list->Value(i), noms.ToCString());
else if (cascomp) B.Add(C, list->Value(i)); else if (cascomp) B.Add(C, list->Value(i));
} }
sout << std::endl; aSSC.SStream() << std::endl;
if (cascomp && !cassave) XSControl::Vars(pilot)->SetShape(nomsh.ToCString(), C); if (cascomp && !cassave) DBRep::Set(nomsh.ToCString(), C);
else if (cascomp && cassave) BRepTools::Write(C, nomsh.ToCString()); else if (cascomp && cassave) BRepTools::Write(C, nomsh.ToCString());
} }
else else
{ {
if (num < 1 || num > mdl->NbEntities()) if (num < 1 || num > mdl->NbEntities())
{ {
sout << " incorrect:" << arg1 << std::endl; return IFSelect_RetError; aSSC.SStream() << " incorrect:" << arg1 << std::endl;
return 1;
} }
TopoDS_Shape sh = TR->ShapeResult(mdl->Value(num)); TopoDS_Shape sh = TR->ShapeResult(mdl->Value(num));
if (sh.IsNull()) if (sh.IsNull())
{ {
sout << " Pas de resultat pour " << arg1 << std::endl; return IFSelect_RetError; aSSC.SStream() << " Pas de resultat pour " << arg1 << std::endl;
return 1;
} }
if (argc > 2) nomsh = arg2; if (theNbArgs > 2) nomsh = arg2;
else nomsh = TCollection_AsciiString("TREAD_") + num; else nomsh = TCollection_AsciiString("TREAD_") + num;
if (!cascomp && !cassave) XSControl::Vars(pilot)->SetShape(nomsh.ToCString(), sh); if (!cascomp && !cassave) DBRep::Set(nomsh.ToCString(), sh);
else if (!cascomp && cassave) BRepTools::Write(sh, nomsh.ToCString()); else if (!cascomp && cassave) BRepTools::Write(sh, nomsh.ToCString());
else sout << "Option non comprise" << std::endl; else aSSC.SStream() << "Option non comprise" << std::endl;
} }
return IFSelect_RetDone; return 0;
} }
//======================================================================= //=======================================================================
@@ -398,7 +433,8 @@ static Standard_Integer XSControl_traccess
//======================================================================= //=======================================================================
// PTV 23.08.2000 Added for checking where are an entity from. // PTV 23.08.2000 Added for checking where are an entity from.
static Standard_Boolean XSControl_IsEqualSubShape(const TopoDS_Shape& Shape, static Standard_Boolean XSControl_IsEqualSubShape(const TopoDS_Shape& Shape,
TopoDS_Shape& sh, Standard_Integer aLevel) TopoDS_Shape& sh,
Standard_Integer aLevel)
{ {
if (sh.IsSame(Shape)) return Standard_True; if (sh.IsSame(Shape)) return Standard_True;
if (aLevel > 0) if (aLevel > 0)
@@ -419,29 +455,30 @@ static Standard_Boolean XSControl_IsEqualSubShape(const TopoDS_Shape& Shape,
//function : XSControl_fromshape //function : XSControl_fromshape
//purpose : //purpose :
//======================================================================= //=======================================================================
static Standard_Integer XSControl_fromshape static Standard_Integer XSControl_fromshape(Draw_Interpretor& theDI,
(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) Standard_Integer theNbArgs,
const char** theArgVec)
{ {
Standard_Integer argc = pilot->NbWords(); XSDRAW::StreamContainer aSSC(theDI);
const Standard_CString arg1 = pilot->Arg(1); (void)theDI;
const Standard_CString arg1 = theArgVec[1];
// **** fromshape (tread) **** // **** fromshape (tread) ****
Message_Messenger::StreamBuffer sout = Message::SendInfo(); if (theNbArgs < 2)
if (argc < 2)
{ {
sout << "Give name of a DRAW Shape" << std::endl; aSSC.SStream() << "Give name of a DRAW Shape" << std::endl;
return IFSelect_RetError; return 1;
} }
const char* a1 = (char*)arg1; const char* a1 = (char*)arg1;
TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(a1); TopoDS_Shape Shape = DBRep::Get(a1);
if (Shape.IsNull()) if (Shape.IsNull())
{ {
sout << "Not a DRAW Shape:" << arg1 << std::endl; aSSC.SStream() << "Not a DRAW Shape:" << arg1 << std::endl;
return IFSelect_RetError; return 1;
} }
Standard_Boolean yena = Standard_False; Standard_Boolean yena = Standard_False;
Standard_Integer aLevel = 1; Standard_Integer aLevel = 1;
if (argc >= 3) if (theNbArgs >= 3)
aLevel = atoi(pilot->Arg(2)); aLevel = atoi(theArgVec[2]);
Standard_Boolean silent = Standard_False; Standard_Boolean silent = Standard_False;
if (aLevel < 0) if (aLevel < 0)
{ {
@@ -450,14 +487,14 @@ static Standard_Integer XSControl_fromshape
} }
// IMPORT // IMPORT
const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader(); const Handle(XSControl_TransferReader)& TR = XSDRAWBase::Session()->TransferReader();
if (TR.IsNull()) if (TR.IsNull())
{ {
} // sout<<"No read transfer (import) recorded"<<std::endl; } // aSSC.SStream()<<"No read transfer (import) recorded"<<std::endl;
else else
{ {
yena = Standard_True; yena = Standard_True;
if (!silent) sout << "Shape " << arg1 << " : "; if (!silent) aSSC.SStream() << "Shape " << arg1 << " : ";
Standard_Integer modrec = 1; Standard_Integer modrec = 1;
Handle(Standard_Transient) ent = TR->EntityFromShapeResult(Shape, modrec); Handle(Standard_Transient) ent = TR->EntityFromShapeResult(Shape, modrec);
if (ent.IsNull()) if (ent.IsNull())
@@ -472,8 +509,8 @@ static Standard_Integer XSControl_fromshape
if (TP.IsNull()) if (TP.IsNull())
{ {
if (silent) if (silent)
sout << "Shape " << arg1 << " : "; aSSC.SStream() << "Shape " << arg1 << " : ";
sout << "no map" << std::endl; aSSC.SStream() << "no map" << std::endl;
} }
else else
{ {
@@ -481,7 +518,7 @@ static Standard_Integer XSControl_fromshape
TopLoc_Location L; TopLoc_Location L;
S0.Location(L); S0.Location(L);
Standard_Integer i, nb = TP->NbMapped(); Standard_Integer i, nb = TP->NbMapped();
if (!silent) sout << "searching in map among " << nb << " ..."; if (!silent) aSSC.SStream() << "searching in map among " << nb << " ...";
for (i = 1; i <= nb; i++) for (i = 1; i <= nb; i++)
{ {
ent = TP->Mapped(i); ent = TP->Mapped(i);
@@ -502,19 +539,19 @@ static Standard_Integer XSControl_fromshape
} }
if (!ent.IsNull()) if (!ent.IsNull())
{ {
if (silent) sout << "Shape " << arg1 << ": "; if (silent) aSSC.SStream() << "Shape " << arg1 << ": ";
if (modrec < 0) sout << "(moved from origin) "; if (modrec < 0) aSSC.SStream() << "(moved from origin) ";
//else sout<<"(origin) "; //else aSSC.SStream()<<"(origin) ";
} }
// on affiche // on affiche
if (ent.IsNull()) if (ent.IsNull())
{ {
if (!silent) sout << " unknown as imported"; if (!silent) aSSC.SStream() << " unknown as imported";
// skl 11.05.2004 // skl 11.05.2004
// if Shape is a compound try to make "fromshape" for its subshapes // if Shape is a compound try to make "fromshape" for its subshapes
if (Shape.ShapeType() == TopAbs_COMPOUND) if (Shape.ShapeType() == TopAbs_COMPOUND)
{ {
sout << std::endl << "Subshapes imported from entities:"; aSSC.SStream() << std::endl << "Subshapes imported from entities:";
TopoDS_Iterator Iter(Shape); TopoDS_Iterator Iter(Shape);
for (; Iter.More(); Iter.Next()) for (; Iter.More(); Iter.Next())
{ {
@@ -528,22 +565,22 @@ static Standard_Integer XSControl_fromshape
} }
if (!subent.IsNull()) if (!subent.IsNull())
{ {
sout << " " << XSControl::Session(pilot)->Model()->Number(subent); aSSC.SStream() << " " << XSDRAWBase::Session()->Model()->Number(subent);
} }
} }
} }
} }
else else
{ {
sout << "imported from entity "; aSSC.SStream() << "imported from entity ";
XSControl::Session(pilot)->Model()->Print(ent, sout); XSDRAWBase::Session()->Model()->Print(ent, aSSC.SStream());
if (silent) sout << " in file " << XSControl::Session(pilot)->LoadedFile() << std::endl; if (silent) aSSC.SStream() << " in file " << XSDRAWBase::Session()->LoadedFile() << std::endl;
} }
if (!silent) sout << std::endl; if (!silent) aSSC.SStream() << std::endl;
} }
// ET EN EXPORT ? // ET EN EXPORT ?
const Handle(Transfer_FinderProcess)& FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess(); const Handle(Transfer_FinderProcess)& FP = XSDRAWBase::Session()->TransferWriter()->FinderProcess();
if (FP.IsNull()) if (FP.IsNull())
{ {
} }
@@ -555,10 +592,10 @@ static Standard_Integer XSControl_fromshape
if (!fnd.IsNull()) ent = FP->FindTransient(fnd); if (!fnd.IsNull()) ent = FP->FindTransient(fnd);
if (!ent.IsNull()) if (!ent.IsNull())
{ {
sout << "Shape " << arg1 << ": exported to entity "; aSSC.SStream() << "Shape " << arg1 << ": exported to entity ";
XSControl::Session(pilot)->Model()->Print(ent, sout); XSDRAWBase::Session()->Model()->Print(ent, aSSC.SStream());
if (silent) sout << " in file " << XSControl::Session(pilot)->LoadedFile(); if (silent) aSSC.SStream() << " in file " << XSDRAWBase::Session()->LoadedFile();
sout << std::endl; aSSC.SStream() << std::endl;
} }
// abv 31.08.00: treat case of split shape (several results) // abv 31.08.00: treat case of split shape (several results)
// it is supposed that results are of the same type and lie in one-level comp // it is supposed that results are of the same type and lie in one-level comp
@@ -573,16 +610,16 @@ static Standard_Integer XSControl_fromshape
if (!TransientListBinder.IsNull()) if (!TransientListBinder.IsNull())
{ {
Standard_Integer i = 1, nb = TransientListBinder->NbTransients(); Standard_Integer i = 1, nb = TransientListBinder->NbTransients();
if (nb > 0) sout << "Shape " << arg1 << ": exported to entities "; if (nb > 0) aSSC.SStream() << "Shape " << arg1 << ": exported to entities ";
for (; i <= nb; i++) for (; i <= nb; i++)
{ {
XSControl::Session(pilot)->Model()->Print(TransientListBinder->Transient(i), sout); XSDRAWBase::Session()->Model()->Print(TransientListBinder->Transient(i), aSSC.SStream());
if (i < nb) sout << ", "; if (i < nb) aSSC.SStream() << ", ";
} }
if (nb > 0) if (nb > 0)
{ {
if (silent) sout << " in file " << XSControl::Session(pilot)->LoadedFile(); if (silent) aSSC.SStream() << " in file " << XSDRAWBase::Session()->LoadedFile();
sout << std::endl; aSSC.SStream() << std::endl;
} }
} }
/* else { /* else {
@@ -595,236 +632,109 @@ static Standard_Integer XSControl_fromshape
Handle(Standard_Transient) cent = FP->FindTransient (cfnd); Handle(Standard_Transient) cent = FP->FindTransient (cfnd);
if ( cent.IsNull() ) continue; if ( cent.IsNull() ) continue;
if ( start ) if ( start )
sout<<"Shape "<<arg1<<" : exported to entities "; aSSC.SStream()<<"Shape "<<arg1<<" : exported to entities ";
else sout << ", "; else aSSC.SStream() << ", ";
start = Standard_False; start = Standard_False;
XSControl::Session(pilot)->Model()->Print(cent,sout); XSControl::Session(pilot)->Model()->Print(cent,aSSC.SStream());
} }
if ( ! start ) sout<<std::endl; if ( ! start ) aSSC.SStream()<<std::endl;
} }
} */ } */
} }
} }
} }
if (!yena) sout << "No transfer (either import or export) recorded" << std::endl; if (!yena) aSSC.SStream() << "No transfer (either import or export) recorded" << std::endl;
return IFSelect_RetVoid; return 1;
} }
//======================================================================= //=======================================================================
//function : XSControl_trconnexentities //function : XSControl_trconnexentities
//purpose : //purpose :
//======================================================================= //=======================================================================
static Standard_Integer XSControl_trconnexentities static Standard_Integer XSControl_trconnexentities(Draw_Interpretor& theDI,
(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) Standard_Integer theNbArgs,
const char** theArgVec)
{ {
Standard_Integer argc = pilot->NbWords(); XSDRAW::StreamContainer aSSC(theDI);
const Standard_CString arg1 = pilot->Arg(1); (void)theDI;
const Standard_CString arg1 = theArgVec[1];
// **** connected entities (last transfer) **** // **** connected entities (last transfer) ****
const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader(); const Handle(XSControl_TransferReader)& TR = XSDRAWBase::Session()->TransferReader();
Handle(Transfer_TransientProcess) TP; Handle(Transfer_TransientProcess) TP;
if (!TR.IsNull()) TP = TR->TransientProcess(); if (!TR.IsNull()) TP = TR->TransientProcess();
Message_Messenger::StreamBuffer sout = Message::SendInfo();
if (TP.IsNull()) if (TP.IsNull())
{ {
sout << "no transfer map" << std::endl; return IFSelect_RetVoid; aSSC.SStream() << "no transfer map" << std::endl;
return 1;
} }
if (argc < 2) if (theNbArgs < 2)
{ {
sout << "Give name of a DRAW Shape + optional shape type v-e-w-f(D)-s" << std::endl; aSSC.SStream() << "Give name of a DRAW Shape + optional shape type v-e-w-f(D)-s" << std::endl;
return IFSelect_RetError; return 1;
} }
const char* a1 = (const char*)arg1; const char* a1 = arg1;
TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(a1); TopoDS_Shape Shape = DBRep::Get(a1);
if (Shape.IsNull()) if (Shape.IsNull())
{ {
sout << "Not a DRAW Shape:" << arg1 << std::endl; return IFSelect_RetError; aSSC.SStream() << "Not a DRAW Shape:" << arg1 << std::endl;
return 1;
} }
sout << "Shape " << arg1 << " : "; aSSC.SStream() << "Shape " << arg1 << " : ";
Handle(TColStd_HSequenceOfTransient) list = Handle(TColStd_HSequenceOfTransient) list =
XSControl_ConnectedShapes::AdjacentEntities(Shape, TP, TopAbs_FACE); XSControl_ConnectedShapes::AdjacentEntities(Shape, TP, TopAbs_FACE);
Standard_Integer i, nb = list->Length(); Standard_Integer i, nb = list->Length();
sout << nb << " Entities produced Connected Shapes :" << std::endl; aSSC.SStream() << nb << " Entities produced Connected Shapes :" << std::endl;
const Handle(Interface_InterfaceModel)& model = XSControl::Session(pilot)->Model(); const Handle(Interface_InterfaceModel)& model = XSDRAWBase::Session()->Model();
sout << "("; aSSC.SStream() << "(";
for (i = 1; i <= nb; i++) for (i = 1; i <= nb; i++)
{ {
if (i > 1) sout << ","; if (i > 1) aSSC.SStream() << ",";
sout << model->Number(list->Value(i)); aSSC.SStream() << model->Number(list->Value(i));
} }
sout << ")" << std::endl; aSSC.SStream() << ")" << std::endl;
return IFSelect_RetDone; return 0;
}
//=======================================================================
//function : XSControl_trimport
//purpose :
//=======================================================================
static Standard_Integer XSControl_trimport
(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec)
{
// FileName ou . (pour courant) VarName GiveList (obligatoire)
// GiveList : * pour xst-transferrable-roots
Handle(XSControl_WorkSession) WS = XSControl::Session(pilot);
Standard_Integer argc = pilot->NbWords();
Message_Messenger::StreamBuffer sout = Message::SendInfo();
if (argc < 4)
{
sout << "Give : filename or . for current model; varname or . to take fileroot\n GiveList, * for all transferrable roots" << std::endl;
return IFSelect_RetError;
}
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
const Standard_CString arg3 = pilot->Arg(3);
// File Name and Variable (root) Name
TCollection_AsciiString fnom, rnom;
Standard_Boolean modfic = XSDRAW_FunctionsShape::FileAndVar
(WS, arg1, arg2, "IMPORT", fnom, rnom);
if (modfic) sout << " File to read : " << fnom << std::endl;
else sout << " Model taken from the session : " << fnom << std::endl;
sout << " -- Names of variables BREP-DRAW prefixed by : " << rnom << std::endl;
// keep the current command, because sub-commands will be called
TCollection_AsciiString compart = pilot->CommandPart(3);
// Reading file if required
if (modfic)
{
TCollection_AsciiString comload("xload ");
comload.AssignCat(arg1);
IFSelect_ReturnStatus status = pilot->Execute(comload);
if (status != IFSelect_RetDone)
{
sout << "Abandon import" << std::endl; return status;
}
}
else
{
sout << "Currently Loaded Model" << std::endl;
}
// Selecting Entities
Handle(TColStd_HSequenceOfTransient) list;
if (arg3[0] == '*' && arg3[1] == '\0')
{
list = WS->GiveList("xst-transferrable-roots");
sout << "All Transferrable Roots : ";
}
else
{
sout << "List given by " << compart.ToCString() << " : ";
list = WS->GiveList(compart.ToCString());
}
if (list.IsNull())
{
sout << "No list defined. Abandon" << std::endl; return IFSelect_RetError;
}
Standard_Integer nbl = list->Length();
sout << "Nb entities selected : " << nbl << std::endl;
// Starting Transfer
WS->InitTransferReader(0);
const Handle(XSControl_TransferReader)& TR = WS->TransferReader();
if (TR.IsNull())
{
sout << " init not done or failed" << std::endl; return IFSelect_RetError;
}
TR->BeginTransfer();
// Transferring
Standard_Integer nbt = TR->TransferList(list);
sout << "Nb Entities Selected : " << nbl << " have given " << nbt << " results" << std::endl;
// Filling VARS. one compound (trimpcomp) or one shape per ent (trimport)
Standard_Boolean iscomp = (pilot->Arg(0)[5] == 'c');
Standard_Integer nbs = 0;
TopoDS_Shape sh;
TopoDS_Compound C;
BRep_Builder B;
B.MakeCompound(C);
Handle(Interface_InterfaceModel) mdl = TR->Model();
if (mdl.IsNull())
{
sout << " modele absent" << std::endl; return IFSelect_RetError;
}
for (Standard_Integer il = 1; il <= nbl; il++)
{
Handle(Standard_Transient) ent = list->Value(il);
sh = TR->ShapeResult(ent);
if (sh.IsNull()) continue;
nbs++;
if (iscomp) B.Add(C, sh);
else
{
char nomsh[50];
sprintf(nomsh, "%s_%d", rnom.ToCString(), nbs);
XSControl::Vars(pilot)->SetShape(nomsh, sh);
}
}
if (nbs == 0) sout << "No Shape produced" << std::endl;
else if (nbs == 1)
{
sout << "One Shape produced, named " << rnom.ToCString() << std::endl;
XSControl::Vars(pilot)->SetShape(rnom.ToCString(), sh);
}
else if (iscomp)
{
sout << "One compound made of " << nbs << " Shapes, named " << rnom.ToCString() << std::endl;
XSControl::Vars(pilot)->SetShape(rnom.ToCString(), C);
}
else
{ // several individual shapes
sout << nbs << " Shapes, named " << rnom.ToCString() << "_1 to " << rnom.ToCString() << "_" << nbs << std::endl;
}
return IFSelect_RetDone;
} }
//======================================================================= //=======================================================================
//function : XSControl_twrite //function : XSControl_twrite
//purpose : //purpose :
//======================================================================= //=======================================================================
static Standard_Integer XSControl_twrite static Standard_Integer XSControl_twrite(Draw_Interpretor& theDI,
(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) Standard_Integer theNbArgs,
const char** theArgVec)
{ {
Standard_Integer argc = pilot->NbWords(); XSDRAW::StreamContainer aSSC(theDI);
const Standard_CString arg1 = pilot->Arg(1); (void)theDI;
const Standard_CString arg1 = theArgVec[1];
// **** twrite **** // **** twrite ****
Message_Messenger::StreamBuffer sout = Message::SendInfo(); Handle(XSControl_TransferWriter) TW = XSDRAWBase::Session()->TransferWriter();
Handle(XSControl_TransferWriter) TW = XSControl::Session(pilot)->TransferWriter(); if (theNbArgs < 2)
if (argc < 2)
{ {
sout << " donner nom de shape draw" << std::endl; return IFSelect_RetError; aSSC.SStream() << " donner nom de shape draw" << std::endl;
return 1;
} }
sout << "Attention, on alimente le modele courant ..." << std::endl; aSSC.SStream() << "Attention, on alimente le modele courant ..." << std::endl;
// Shape // Shape
for (Standard_Integer i = 1; i < argc; i++) for (Standard_Integer i = 1; i < theNbArgs; i++)
{ {
const char* ai = (const char*)pilot->Arg(i); const char* ai = theArgVec[i];
TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(ai); TopoDS_Shape Shape = DBRep::Get(ai);
if (Shape.IsNull()) if (Shape.IsNull())
{ {
sout << "pas un nom de shape draw:" << arg1 << std::endl; continue; aSSC.SStream() << "pas un nom de shape draw:" << arg1 << std::endl; continue;
} }
sout << "Pour Shape : " << ai; aSSC.SStream() << "Pour Shape : " << ai;
Standard_Integer stat = TW->TransferWriteShape(XSControl::Session(pilot)->Model(), Shape); Standard_Integer stat = TW->TransferWriteShape(XSDRAWBase::Session()->Model(), Shape);
sout << " Transfer Write Status = " << stat << std::endl; aSSC.SStream() << " Transfer Write Status = " << stat << std::endl;
} }
pilot->Session()->ComputeGraph(); XSDRAWBase::Session()->ComputeGraph();
// Transient ? (Geom) : ignore // Transient ? (Geom) : ignore
return IFSelect_RetDone; return 0;
} }
//======================================================================= //=======================================================================
//function : Init //function : Init
//purpose : //purpose :
@@ -838,16 +748,14 @@ void XSDRAW_FunctionsShape::Init(Draw_Interpretor& theDI)
} }
THE_XSDRAW_FunctionsShape_initactor = 1; THE_XSDRAW_FunctionsShape_initactor = 1;
IFSelect_Act::SetGroup("DE: General"); Standard_CString aGroup = "DE: General";
IFSelect_Act::AddFunc("tpdraw", "[mode:item or root] num|* [nomvar] Passes an ITEM to Shape Draw (Start or Result)", XSControl_tpdraw); theDI.Add("tpdraw", "[mode:item or root] num|* [nomvar] Passes an ITEM to Shape Draw (Start or Result)", XSControl_tpdraw, aGroup);
IFSelect_Act::AddFunc("tpcompound", "name:cstring [givelist] : -> compound with Shapes Root or from givelist", XSControl_tpcompound); theDI.Add("tpcompound", "name:cstring [givelist] : -> compound with Shapes Root or from givelist", __FILE__, XSControl_tpcompound, aGroup);
IFSelect_Act::AddFunc("trdraw", "results ->DRAW : all; or num [name] : from ent.num -> DRAW [name/tread_num]", XSControl_traccess); theDI.Add("trdraw", "results ->DRAW : all; or num [name] : from ent.num -> DRAW [name/tread_num]", __FILE__, XSControl_traccess, aGroup);
IFSelect_Act::AddFunc("trsave", "results ->files : all; or num [name] : from ent.num -> DRAW [name/tread_num]", XSControl_traccess); theDI.Add("trsave", "results ->files : all; or num [name] : from ent.num -> DRAW [name/tread_num]", __FILE__, XSControl_traccess, aGroup);
IFSelect_Act::AddFunc("trcomp", "results -> 1 compound -> DRAW + name optional", XSControl_traccess); theDI.Add("trcomp", "results -> 1 compound -> DRAW + name optional", __FILE__, XSControl_traccess, aGroup);
IFSelect_Act::AddFunc("trscomp", "results -> 1 compound -> file + name optional", XSControl_traccess); theDI.Add("trscomp", "results -> 1 compound -> file + name optional", __FILE__, XSControl_traccess, aGroup);
IFSelect_Act::AddFunc("fromshape", "shape [level=1]: imported/exported entity (when known)", XSControl_fromshape); theDI.Add("fromshape", "shape [level=1]: imported/exported entity (when known)", __FILE__, XSControl_fromshape, aGroup);
IFSelect_Act::AddFunc("trconnexent", "name of draw shape : entities -> connected shapes (when known)", XSControl_trconnexentities); theDI.Add("trconnexent", "name of draw shape : entities -> connected shapes (when known)", __FILE__, XSControl_trconnexentities, aGroup);
IFSelect_Act::AddFunc("trimport", "filename or . varname givelist -> 1 shape per entity", XSControl_trimport); theDI.Add("twrite", "shape : transfer write for this shape, AFTER newmodel !", __FILE__, XSControl_twrite, aGroup);
IFSelect_Act::AddFunc("trimpcomp", "filename or . varname givelist -> one xcompound", XSControl_trimport);
IFSelect_Act::AddFunc("twrite", "shape : transfer write for this shape, AFTER newmodel !", XSControl_twrite);
} }

View File

@@ -13,3 +13,106 @@
#include <XSDRAWBase.hxx> #include <XSDRAWBase.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XSAlgo.hxx>
#include <XSAlgo_AlgoContainer.hxx>
#include <TDocStd_Document.hxx>
#include <UnitsMethods.hxx>
#include <memory>
namespace
{
//=======================================================================
//function : collectActiveWorkSessions
//purpose :
//=======================================================================
static void collectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS,
const TCollection_AsciiString& theName,
XSControl_WorkSessionMap& theMap,
const Standard_Boolean theIsFirst)
{
if (theIsFirst)
{
theMap.Clear();
}
if (theMap.IsBound(theName))
{
return;
}
theMap.Bind(theName, theWS);
for (XSControl_WorkSessionMap::Iterator anIter(theWS->ReferenceWS());
anIter.More(); anIter.Next())
{
collectActiveWorkSessions(anIter.Value(), anIter.Key(), theMap, Standard_False);
}
}
}
//=======================================================================
//function : Session
//purpose :
//=======================================================================
Handle(XSControl_WorkSession)& XSDRAWBase::Session()
{
static Handle(XSControl_WorkSession) THE_SINGLETON_SESSION;
if (THE_SINGLETON_SESSION.IsNull())
{
THE_SINGLETON_SESSION = new XSControl_WorkSession;
}
return THE_SINGLETON_SESSION;
}
//=======================================================================
//function : GetLengthUnit
//purpose :
//=======================================================================
Standard_Real XSDRAWBase::GetLengthUnit(const Handle(TDocStd_Document)& theDoc)
{
if (!theDoc.IsNull())
{
Standard_Real aUnit = 1.;
if (XCAFDoc_DocumentTool::GetLengthUnit(theDoc, aUnit,
UnitsMethods_LengthUnit_Millimeter))
{
return aUnit;
}
}
XSAlgo::AlgoContainer()->PrepareForTransfer();
return UnitsMethods::GetCasCadeLengthUnit();
}
//=======================================================================
//function : WorkSessionList
//purpose :
//=======================================================================
XSControl_WorkSessionMap& XSDRAWBase::WorkSessionList()
{
static std::shared_ptr<XSControl_WorkSessionMap> THE_PREVIOUS_WORK_SESSIONS;
if (THE_PREVIOUS_WORK_SESSIONS == nullptr)
{
THE_PREVIOUS_WORK_SESSIONS =
std::make_shared<XSControl_WorkSessionMap>();
}
return *THE_PREVIOUS_WORK_SESSIONS;
}
//=======================================================================
//function : CollectActiveWorkSessions
//purpose :
//=======================================================================
void XSDRAWBase::CollectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS,
const TCollection_AsciiString& theName,
XSControl_WorkSessionMap& theMap)
{
collectActiveWorkSessions(theWS, theName, theMap, Standard_True);
}
//=======================================================================
//function : CollectActiveWorkSessions
//purpose :
//=======================================================================
void XSDRAWBase::CollectActiveWorkSessions(const TCollection_AsciiString& theName)
{
collectActiveWorkSessions(Session(), theName, WorkSessionList(), Standard_True);
}

View File

@@ -17,21 +17,10 @@
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_DefineAlloc.hxx> #include <Standard_DefineAlloc.hxx>
#include <Draw_Interpretor.hxx> #include <XSControl_WorkSession.hxx>
#include <TColStd_HSequenceOfTransient.hxx> #include <TCollection_AsciiString.hxx>
#include <TopTools_HSequenceOfShape.hxx>
class IFSelect_SessionPilot;
class Interface_Protocol;
class Interface_InterfaceModel;
class Standard_Transient;
class TCollection_AsciiString;
class TDocStd_Document; class TDocStd_Document;
class Transfer_TransientProcess;
class Transfer_FinderProcess;
class XSControl_Controller;
class XSControl_TransferReader;
class XSControl_WorkSession;
//! Basic package to work functions of X-STEP (IFSelect & Co) //! Basic package to work functions of X-STEP (IFSelect & Co)
//! under control of DRAW //! under control of DRAW
@@ -44,18 +33,9 @@ class XSDRAWBase
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
public: public:
//! Returns the WorkSession defined in AddDraw (through Pilot) //! Returns the WorkSession defined in AddDraw
//! It is from XSControl, it brings functionalities for Transfers //! It is from XSControl, it brings functionalities for Transfers
Standard_EXPORT static Handle(XSControl_WorkSession) Session(); Standard_EXPORT static Handle(XSControl_WorkSession)& Session();
//! Evaluates and returns a list of entity, from :
//! keyboard if <first> and <second> are empty, see below
//! first if second is empty : can be a number/label of an entity
//! or the name of a selection to be evaluated (standard)
//! first : name of a selection, evaluated from a list defined by
//! second
//! In case of failure, returns a Null Handle
Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) GetList(const Standard_CString first = "", const Standard_CString second = "");
//! //!
Standard_EXPORT static Standard_Real GetLengthUnit(const Handle(TDocStd_Document)& theDoc = nullptr); Standard_EXPORT static Standard_Real GetLengthUnit(const Handle(TDocStd_Document)& theDoc = nullptr);
@@ -66,8 +46,10 @@ public:
//! //!
Standard_EXPORT static void CollectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS, Standard_EXPORT static void CollectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS,
const TCollection_AsciiString& theName, const TCollection_AsciiString& theName,
XSControl_WorkSessionMap& theMap, XSControl_WorkSessionMap& theMap);
const Standard_Boolean theIsFirst = Standard_True);
//!
Standard_EXPORT static void CollectActiveWorkSessions(const TCollection_AsciiString& theName);
}; };
#endif // _XSDRAWBase_HeaderFile #endif // _XSDRAWBase_HeaderFile

View File

@@ -17,6 +17,7 @@
#include <DDocStd.hxx> #include <DDocStd.hxx>
#include <DDocStd_DrawDocument.hxx> #include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx> #include <Draw.hxx>
#include <Draw_PluginMacro.hxx>
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
#include <Draw_ProgressIndicator.hxx> #include <Draw_ProgressIndicator.hxx>
#include <De_ConfigurationNode.hxx> #include <De_ConfigurationNode.hxx>
@@ -419,3 +420,6 @@ void XSDRAWDEWrapper::Factory(Draw_Interpretor& theDI)
"\n\t\t: Write CAD file to shape with registered format's providers. Use global configuration by default.", "\n\t\t: Write CAD file to shape with registered format's providers. Use global configuration by default.",
__FILE__, WriteFile, aGroup); __FILE__, WriteFile, aGroup);
} }
// Declare entry point PLUGINFACTORY
DPLUGIN(XSDRAWDEWrapper)

View File

@@ -18,6 +18,7 @@
#include <DDocStd_DrawDocument.hxx> #include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx> #include <Draw.hxx>
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx> #include <Draw_ProgressIndicator.hxx>
#include <RWGltf_ConfigurationNode.hxx> #include <RWGltf_ConfigurationNode.hxx>
#include <RWGltf_Provider.hxx> #include <RWGltf_Provider.hxx>
@@ -485,6 +486,12 @@ static Standard_Integer WriteGltf(Draw_Interpretor& theDI,
//======================================================================= //=======================================================================
void XSDRAWGLTF::Factory(Draw_Interpretor& theDI) void XSDRAWGLTF::Factory(Draw_Interpretor& theDI)
{ {
static Standard_Boolean initactor = Standard_False;
if (initactor)
{
return;
}
initactor = Standard_True;
const char* aGroup = "XSTEP-STL/VRML"; // Step transfer file commands const char* aGroup = "XSTEP-STL/VRML"; // Step transfer file commands
theDI.Add("ReadGltf", theDI.Add("ReadGltf",
@@ -540,3 +547,7 @@ void XSDRAWGLTF::Factory(Draw_Interpretor& theDI)
"writegltf shape file", "writegltf shape file",
__FILE__, WriteGltf, aGroup); __FILE__, WriteGltf, aGroup);
} }
// Declare entry point PLUGINFACTORY
DPLUGIN(XSDRAWGLTF)

View File

@@ -13,11 +13,14 @@
#include <XSDRAWIGES.hxx> #include <XSDRAWIGES.hxx>
#include <BRepTools.hxx>
#include <DBRep.hxx> #include <DBRep.hxx>
#include <DDocStd.hxx> #include <DDocStd.hxx>
#include <DDocStd_DrawDocument.hxx> #include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx> #include <Draw.hxx>
#include <DrawTrSurf.hxx>
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx> #include <Draw_ProgressIndicator.hxx>
#include <OSD_OpenFile.hxx> #include <OSD_OpenFile.hxx>
#include <OSD_Path.hxx> #include <OSD_Path.hxx>
@@ -35,10 +38,103 @@
#include <XSDRAWBase.hxx> #include <XSDRAWBase.hxx>
#include <XSAlgo.hxx> #include <XSAlgo.hxx>
#include <XSAlgo_AlgoContainer.hxx> #include <XSAlgo_AlgoContainer.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx> #include <XSControl_WorkSession.hxx>
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
#include <TDataStd_Name.hxx> #include <TDataStd_Name.hxx>
#include <TDocStd_Application.hxx> #include <TDocStd_Application.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <Transfer_IteratorOfProcessForTransient.hxx>
#include <Transfer_TransientProcess.hxx>
//=======================================================================
//function : WriteShape
//purpose : Creates a file Shape_'number'
//=======================================================================
void WriteShape(const TopoDS_Shape& shape,
const Standard_Integer number)
{
char fname[110];
sprintf(fname, "Shape_%d", number);
std::ofstream f(fname, std::ios::out | std::ios::binary);
std::cout << "Output file name : " << fname << std::endl;
f << "DBRep_DrawableShape\n";
BRepTools::Write(shape, f);
f.close();
}
//=======================================================================
//function : XSDRAW_CommandPart
//purpose :
//=======================================================================
TCollection_AsciiString XSDRAW_CommandPart(Standard_Integer argc,
const char** argv,
const Standard_Integer argf)
{
TCollection_AsciiString res;
for (Standard_Integer i = argf; i < argc; i++)
{
if (i > argf) res.AssignCat(" ");
res.AssignCat(argv[i]);
}
return res;
}
//=======================================================================
//function : GiveEntityNumber
//purpose :
//=======================================================================
static Standard_Integer GiveEntityNumber(const Handle(XSControl_WorkSession)& WS,
const Standard_CString name)
{
Standard_Integer num = 0;
if (!name || name[0] == '\0')
{
char ligne[80]; ligne[0] = '\0';
std::cin >> ligne;
// std::cin.clear(); std::cin.getline (ligne,79);
if (ligne[0] == '\0') return 0;
num = WS->NumberFromLabel(ligne);
}
else num = WS->NumberFromLabel(name);
return num;
}
//=======================================================================
//function : FileAndVar
//purpose :
//=======================================================================
Standard_Boolean FileAndVar(const Handle(XSControl_WorkSession)& session,
const Standard_CString file,
const Standard_CString var,
const Standard_CString def,
TCollection_AsciiString& resfile,
TCollection_AsciiString& resvar)
{
Standard_Boolean iafic = Standard_True;
resfile.Clear(); resvar.Clear();
if (file)
if (file[0] == '\0' ||
(file[0] == '.' && file[1] == '\0')) iafic = Standard_False;
if (!iafic) resfile.AssignCat(session->LoadedFile());
else resfile.AssignCat(file);
if (var && var[0] != '\0' && (var[0] != '.' || var[1] != '\0'))
resvar.AssignCat(var);
else if (resfile.Length() == 0) resvar.AssignCat(def);
else
{
Standard_Integer nomdeb, nomfin;
nomdeb = resfile.SearchFromEnd("/");
if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\"); // pour NT
if (nomdeb < 0) nomdeb = 0;
nomfin = resfile.SearchFromEnd(".");
if (nomfin < nomdeb) nomfin = resfile.Length() + 1;
resvar = resfile.SubString(nomdeb + 1, nomfin - 1);
}
return iafic;
}
//======================================================================= //=======================================================================
//function : igesbrep //function : igesbrep
@@ -48,8 +144,13 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
DeclareAndCast(IGESControl_Controller, ctl, XSDRAWBase::Controller()); Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session();
if (ctl.IsNull()) XSDRAWBase::SetNorm("IGES"); Handle(IGESControl_Controller) aCtl =
Handle(IGESControl_Controller)::DownCast(aWS->NormAdaptor());
if (aCtl.IsNull())
{
aWS->SelectNorm("IGES");
}
// Progress indicator // Progress indicator
Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator(theDI, 1); Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator(theDI, 1);
@@ -58,13 +159,11 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI,
IGESControl_Reader Reader(XSDRAWBase::Session(), Standard_False); IGESControl_Reader Reader(XSDRAWBase::Session(), Standard_False);
Standard_Boolean aFullMode = Standard_True; Standard_Boolean aFullMode = Standard_True;
Reader.WS()->SetModeStat(aFullMode); Reader.WS()->SetModeStat(aFullMode);
if (ctl.IsNull())
ctl = Handle(IGESControl_Controller)::DownCast(XSDRAWBase::Controller());
TCollection_AsciiString fnom, rnom; TCollection_AsciiString fnom, rnom;
Standard_Boolean modfic = XSDRAWBase::FileAndVar Standard_Boolean modfic = FileAndVar
(theArgVec[1], theArgVec[2], "IGESBREP", fnom, rnom); (aWS, theArgVec[1], theArgVec[2], "IGESBREP", fnom, rnom);
if (modfic) theDI << " File IGES to read : " << fnom.ToCString() << "\n"; if (modfic) theDI << " File IGES to read : " << fnom.ToCString() << "\n";
else theDI << " Model taken from the session : " << fnom.ToCString() << "\n"; else theDI << " Model taken from the session : " << fnom.ToCString() << "\n";
theDI << " -- Names of variables BREP-DRAW prefixed by : " << rnom.ToCString() << "\n"; theDI << " -- Names of variables BREP-DRAW prefixed by : " << rnom.ToCString() << "\n";
@@ -75,7 +174,6 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI,
IDT_SetLevel(3); IDT_SetLevel(3);
#endif #endif
// Reading the file // Reading the file
aPSRoot.SetName("Loading"); aPSRoot.SetName("Loading");
progress->Show(aPSRoot); progress->Show(aPSRoot);
@@ -127,7 +225,6 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI,
theDI << " To modify : command param read.iges.bspline.continuity\n"; theDI << " To modify : command param read.iges.bspline.continuity\n";
const Handle(XSControl_WorkSession)& thesession = Reader.WS(); const Handle(XSControl_WorkSession)& thesession = Reader.WS();
thesession->TransferReader()->Context().Clear(); thesession->TransferReader()->Context().Clear();
XSDRAWBase::SetTransferProcess(thesession->TransferReader()->TransientProcess());
aPSRoot.SetName("Translation"); aPSRoot.SetName("Translation");
progress->Show(aPSRoot); progress->Show(aPSRoot);
@@ -210,7 +307,7 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI,
std::cout << "spline_continuity (read) : " << Interface_Static::IVal("read.iges.bspline.continuity") << " (0 : no modif, 1 : C1, 2 : C2)" << std::endl; std::cout << "spline_continuity (read) : " << Interface_Static::IVal("read.iges.bspline.continuity") << " (0 : no modif, 1 : C1, 2 : C2)" << std::endl;
std::cout << " To modify : command param read.iges.bspline.continuity" << std::endl; std::cout << " To modify : command param read.iges.bspline.continuity" << std::endl;
std::cout << " give the number of the Entity : " << std::flush; std::cout << " give the number of the Entity : " << std::flush;
nent = XSDRAWBase::GetEntityNumber(); nent = GiveEntityNumber(aWS, "");
if (!Reader.TransferOne(nent)) if (!Reader.TransferOne(nent))
theDI << "Transfer entity n0 " << nent << " : no result\n"; theDI << "Transfer entity n0 " << nent << " : no result\n";
@@ -241,7 +338,6 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI,
theDI << " To modify : command param read.iges.bspline.continuity\n"; theDI << " To modify : command param read.iges.bspline.continuity\n";
const Handle(XSControl_WorkSession)& thesession = Reader.WS(); const Handle(XSControl_WorkSession)& thesession = Reader.WS();
thesession->TransferReader()->Context().Clear(); thesession->TransferReader()->Context().Clear();
XSDRAWBase::SetTransferProcess(thesession->TransferReader()->TransientProcess());
aPSRoot.SetName("Translation"); aPSRoot.SetName("Translation");
progress->Show(aPSRoot); progress->Show(aPSRoot);
@@ -280,13 +376,13 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI,
if (theArgVec[3][0] == '*' && theArgVec[3][1] == 'r' && theArgVec[3][2] == '\0') if (theArgVec[3][0] == '*' && theArgVec[3][1] == 'r' && theArgVec[3][2] == '\0')
{ {
theDI << "All Roots : "; theDI << "All Roots : ";
list = XSDRAWBase::GetList("xst-model-roots"); list = XSDRAWBase::Session()->GiveList("xst-model-roots");
} }
else else
{ {
TCollection_AsciiString compart = XSDRAW_CommandPart(theNbArgs, theArgVec, 3); TCollection_AsciiString compart = XSDRAW_CommandPart(theNbArgs, theArgVec, 3);
theDI << "List given by " << compart.ToCString() << " : "; theDI << "List given by " << compart.ToCString() << " : ";
list = XSDRAWBase::GetList(compart.ToCString()); list = XSDRAWBase::Session()->GiveList(compart.ToCString());
} }
if (list.IsNull()) if (list.IsNull())
{ {
@@ -297,7 +393,7 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI,
else else
{ {
std::cout << "Name of Selection :" << std::flush; std::cout << "Name of Selection :" << std::flush;
list = XSDRAWBase::GetList(); list = XSDRAWBase::Session()->GiveList("");
if (list.IsNull()) { std::cout << "No list defined" << std::endl; continue; } if (list.IsNull()) { std::cout << "No list defined" << std::endl; continue; }
} }
@@ -330,7 +426,6 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI,
Standard_Integer nbt = 0; Standard_Integer nbt = 0;
Handle(XSControl_WorkSession) thesession = Reader.WS(); Handle(XSControl_WorkSession) thesession = Reader.WS();
XSDRAWBase::SetTransferProcess(thesession->TransferReader()->TransientProcess());
aPSRoot.SetName("Translation"); aPSRoot.SetName("Translation");
progress->Show(aPSRoot); progress->Show(aPSRoot);
@@ -364,38 +459,38 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI,
return 0; return 0;
} }
////======================================================================= //=======================================================================
////function : testread //function : testread
////purpose : //purpose :
////======================================================================= //=======================================================================
//static Standard_Integer testread(Draw_Interpretor& theDI, static Standard_Integer testread(Draw_Interpretor& theDI,
// Standard_Integer theNbArgs, Standard_Integer theNbArgs,
// const char** theArgVec) const char** theArgVec)
//{ {
// if (theNbArgs != 3) if (theNbArgs != 3)
// { {
// theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n"; theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
// theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n"; theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n";
// return 1; return 1;
// } }
// IGESControl_Reader Reader; IGESControl_Reader Reader;
// Standard_CString filename = theArgVec[1]; Standard_CString filename = theArgVec[1];
// IFSelect_ReturnStatus readstat = Reader.ReadFile(filename); IFSelect_ReturnStatus readstat = Reader.ReadFile(filename);
// theDI << "Status from reading IGES file " << filename << " : "; theDI << "Status from reading IGES file " << filename << " : ";
// switch (readstat) switch (readstat)
// { {
// case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; } case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; }
// case IFSelect_RetDone: { theDI << "file read\n"; break; } case IFSelect_RetDone: { theDI << "file read\n"; break; }
// case IFSelect_RetError: { theDI << "file not found\n"; return 1; } case IFSelect_RetError: { theDI << "file not found\n"; return 1; }
// case IFSelect_RetFail: { theDI << "error during read\n"; return 1; } case IFSelect_RetFail: { theDI << "error during read\n"; return 1; }
// default: { theDI << "failure\n"; return 1; } default: { theDI << "failure\n"; return 1; }
// } }
// Reader.TransferRoots(); Reader.TransferRoots();
// TopoDS_Shape shape = Reader.OneShape(); TopoDS_Shape shape = Reader.OneShape();
// DBRep::Set(theArgVec[2], shape); DBRep::Set(theArgVec[2], shape);
// theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n"; theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n";
// return 0; return 0;
//} }
//======================================================================= //=======================================================================
//function : brepiges //function : brepiges
@@ -405,7 +500,8 @@ static Standard_Integer brepiges(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
XSDRAWBase::SetNorm("IGES"); Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session();
aWS->SelectNorm("IGES");
// ecriture dans le model d'une entite : // ecriture dans le model d'une entite :
// - model_AddEntity(ent) : ecriture de l`entite seule // - model_AddEntity(ent) : ecriture de l`entite seule
// - model->AddWithRefs(ent, protocol): ecriture de l`entite et eventuellement // - model->AddWithRefs(ent, protocol): ecriture de l`entite et eventuellement
@@ -427,7 +523,7 @@ static Standard_Integer brepiges(Draw_Interpretor& theDI,
Message_ProgressScope aPSRoot(progress->Start(), "Translating", 100); Message_ProgressScope aPSRoot(progress->Start(), "Translating", 100);
progress->Show(aPSRoot); progress->Show(aPSRoot);
Message_ProgressScope aPS(aPSRoot.Next(90), NULL, n); Message_ProgressScope aPS(aPSRoot.Next(90), NULL, theNbArgs);
for (Standard_Integer i = 1; i < theNbArgs && aPS.More(); i++) for (Standard_Integer i = 1; i < theNbArgs && aPS.More(); i++)
{ {
const char* nomvar = theArgVec[i]; const char* nomvar = theArgVec[i];
@@ -439,15 +535,13 @@ static Standard_Integer brepiges(Draw_Interpretor& theDI,
else if (ICW.AddGeom(DrawTrSurf::GetSurface(nomvar))) npris++; else if (ICW.AddGeom(DrawTrSurf::GetSurface(nomvar))) npris++;
} }
ICW.ComputeModel(); ICW.ComputeModel();
XSDRAWBase::SetModel(ICW.Model());
XSDRAWBase::SetTransferProcess(ICW.TransferProcess());
if (aPSRoot.UserBreak()) if (aPSRoot.UserBreak())
return 1; return 1;
aPSRoot.SetName("Writing"); aPSRoot.SetName("Writing");
progress->Show(aPSRoot); progress->Show(aPSRoot);
theDI << npris << " Shapes written, giving " << XSDRAWBase::Model()->NbEntities() << " Entities\n"; theDI << npris << " Shapes written, giving " << ICW.Model()->NbEntities() << " Entities\n";
if (!nomfic) // delayed write if (!nomfic) // delayed write
{ {
@@ -456,62 +550,67 @@ static Standard_Integer brepiges(Draw_Interpretor& theDI,
} }
// write file // write file
if (!ICW.Write(nomfic)) theDI << " Error: could not write file " << nomfic; if (!ICW.Write(nomfic))
else theDI << " File " << nomfic << " written"; {
theDI << " Error: could not write file " << nomfic << "\n";
return 1;
}
theDI << " File " << nomfic << " written\n";
aWS->SetModel(ICW.Model());
return 0; return 0;
} }
////======================================================================= //=======================================================================
////function : testwrite //function : testwrite
////purpose : //purpose :
////======================================================================= //=======================================================================
//static Standard_Integer testwrite(Draw_Interpretor& theDI, static Standard_Integer testwrite(Draw_Interpretor& theDI,
// Standard_Integer theNbArgs, Standard_Integer theNbArgs,
// const char** theArgVec) const char** theArgVec)
//{ {
// if (theNbArgs != 3) if (theNbArgs != 3)
// { {
// theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n"; theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
// theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n"; theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n";
// return 1; return 1;
// } }
// IGESControl_Writer Writer; IGESControl_Writer Writer;
// Standard_CString filename = theArgVec[1]; Standard_CString filename = theArgVec[1];
// TopoDS_Shape shape = DBRep::Get(theArgVec[2]); TopoDS_Shape shape = DBRep::Get(theArgVec[2]);
// Standard_Boolean ok = Writer.AddShape(shape); Standard_Boolean ok = Writer.AddShape(shape);
// if (!ok) if (!ok)
// { {
// theDI << "Shape not add\n"; theDI << "Shape not add\n";
// return 1; return 1;
// } }
//
// if (!(Writer.Write(filename)))
// {
// theDI << "Error on writing file\n";
// return 1;
// }
// theDI << "File Is Written\n";
// return 0;
//}
////======================================================================= if (!(Writer.Write(filename)))
////function : igesparam {
////purpose : theDI << "Error on writing file\n";
////======================================================================= return 1;
//static Standard_Integer igesparam(Draw_Interpretor& theDI, }
// Standard_Integer, theDI << "File Is Written\n";
// const char**) return 0;
//{ }
// // liste des parametres
// theDI << "List of parameters which control IGES :\n"; //=======================================================================
// theDI << " unit : write.iges.unit\n mode write : write.iges.brep.mode\n spline_continuity (read) : read.iges.bspline.continuity\nSee definition by defparam, read/edit value by param\n"; //function : igesparam
// theDI << "unit (write) : " << Interface_Static::CVal("write.iges.unit") << "\n"; //purpose :
// theDI << "mode write : " << Interface_Static::CVal("write.iges.brep.mode") << "\n"; //=======================================================================
// theDI << "spline_continuity (read) : " << Interface_Static::IVal("read.iges.bspline.continuity") << " (0 : no modif, 1 : C1, 2 : C2)\n"; static Standard_Integer igesparam(Draw_Interpretor& theDI,
// theDI << "\n To modifier, param nom_param new_val\n"; Standard_Integer,
// return 0; const char**)
//} {
// liste des parametres
theDI << "List of parameters which control IGES :\n";
theDI << " unit : write.iges.unit\n mode write : write.iges.brep.mode\n spline_continuity (read) : read.iges.bspline.continuity\nSee definition by defparam, read/edit value by param\n";
theDI << "unit (write) : " << Interface_Static::CVal("write.iges.unit") << "\n";
theDI << "mode write : " << Interface_Static::CVal("write.iges.brep.mode") << "\n";
theDI << "spline_continuity (read) : " << Interface_Static::IVal("read.iges.bspline.continuity") << " (0 : no modif, 1 : C1, 2 : C2)\n";
theDI << "\n To modifier, param nom_param new_val\n";
return 0;
}
//======================================================================= //=======================================================================
//function : XSDRAWIGES_tplosttrim //function : XSDRAWIGES_tplosttrim
@@ -521,12 +620,8 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
Handle(IFSelect_SessionPilot) pilot = XSDRAWBase::Pilot(); Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session();
const Handle(Transfer_TransientProcess)& TP = aWS->TransferReader()->TransientProcess();
// Standard_Integer narg = pilot->NbWords();
Standard_Integer narg = theNbArgs;
const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
TColStd_Array1OfAsciiString strarg(1, 3); TColStd_Array1OfAsciiString strarg(1, 3);
TColStd_Array1OfAsciiString typarg(1, 3); TColStd_Array1OfAsciiString typarg(1, 3);
strarg.SetValue(1, "xst-type(CurveOnSurface)"); strarg.SetValue(1, "xst-type(CurveOnSurface)");
@@ -537,10 +632,9 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI,
typarg.SetValue(3, "IGESSolid_Face"); typarg.SetValue(3, "IGESSolid_Face");
if (TP.IsNull()) { theDI << "No Transfer Read\n"; return 1; } if (TP.IsNull()) { theDI << "No Transfer Read\n"; return 1; }
Standard_Integer nbFaces = 0, totFaces = 0; Standard_Integer nbFaces = 0, totFaces = 0;
Handle(IFSelect_WorkSession) WS = pilot->Session();
Transfer_IteratorOfProcessForTransient itrp = TP->AbnormalResult(); Transfer_IteratorOfProcessForTransient itrp = TP->AbnormalResult();
Standard_Integer k = 0; Standard_Integer k = 0;
if (narg > 1) if (theNbArgs > 1)
{ {
// TCollection_AsciiString Arg = pilot->Word(1); // TCollection_AsciiString Arg = pilot->Word(1);
TCollection_AsciiString Arg(theArgVec[1]); TCollection_AsciiString Arg(theArgVec[1]);
@@ -553,8 +647,8 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI,
for (Standard_Integer j = 1; j <= 3; j++) for (Standard_Integer j = 1; j <= 3; j++)
{ {
TColStd_MapOfTransient aMap; TColStd_MapOfTransient aMap;
if (narg == 1) k = j; if (theNbArgs == 1) k = j;
Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList(pilot->Session(), strarg.Value(k).ToCString()); Handle(TColStd_HSequenceOfTransient) list = aWS->GiveList(strarg.Value(k).ToCString());
if (!list.IsNull()) itrp.Filter(list); if (!list.IsNull()) itrp.Filter(list);
else else
{ {
@@ -564,7 +658,7 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI,
for (itrp.Start(); itrp.More(); itrp.Next()) for (itrp.Start(); itrp.More(); itrp.Next())
{ {
Handle(Standard_Transient) ent = itrp.Starting(); Handle(Standard_Transient) ent = itrp.Starting();
Handle(TColStd_HSequenceOfTransient) super = WS->Sharings(ent); Handle(TColStd_HSequenceOfTransient) super = aWS->Sharings(ent);
if (!super.IsNull()) if (!super.IsNull())
{ {
Standard_Integer nb = super->Length(); Standard_Integer nb = super->Length();
@@ -595,7 +689,7 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI,
Standard_SStream aTmpStream; Standard_SStream aTmpStream;
for (itmap.Initialize(aMap); itmap.More(); itmap.Next()) for (itmap.Initialize(aMap); itmap.More(); itmap.Next())
{ {
XSDRAWBase::Model()->Print(itmap.Key(), aTmpStream); aWS->Model()->Print(itmap.Key(), aTmpStream);
aTmpStream << " "; aTmpStream << " ";
} }
theDI << aTmpStream.str().c_str(); theDI << aTmpStream.str().c_str();
@@ -603,7 +697,7 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI,
theDI << "\nNumber:" << nbFaces << "\n"; theDI << "\nNumber:" << nbFaces << "\n";
totFaces += nbFaces; totFaces += nbFaces;
} }
if (narg > 1) break; if (theNbArgs > 1) break;
nbFaces = 0; nbFaces = 0;
} }
@@ -612,73 +706,71 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI,
return 0; return 0;
} }
////======================================================================= //=======================================================================
////function : XSDRAWIGES_TPSTAT //function : XSDRAWIGES_TPSTAT
////purpose : //purpose :
////======================================================================= //=======================================================================
//static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& theDI, static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& theDI,
// Standard_Integer theNbArgs, Standard_Integer theNbArgs,
// const char** theArgVec) const char** theArgVec)
//{ {
// Handle(IFSelect_SessionPilot) pilot = XSDRAWBase::Pilot(); Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session();
// Standard_Integer theNbArgs = theNbArgs;//= pilot->NbWords(); const Standard_CString arg1 = theArgVec[1];
// const Standard_CString arg1 = theArgVec[1];//pilot->Arg(1); const Handle(Transfer_TransientProcess)& TP = aWS->TransferReader()->TransientProcess();
// const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); IGESControl_Reader read;
// IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False); Handle(Interface_InterfaceModel) model = TP->Model();
//// **** tpent **** if (model.IsNull()) { theDI << "No Transfer Read\n"; return -1; }
// Handle(Interface_InterfaceModel) model = TP->Model(); Handle(XSControl_WorkSession) thesession = read.WS();
// if (model.IsNull()) { theDI << "No Transfer Read\n"; return -1; } thesession->SetMapReader(TP);
// Handle(XSControl_WorkSession) thesession = read.WS(); Standard_Integer mod1 = 0;
// thesession->SetMapReader(TP); if (theNbArgs > 1)
// Standard_Integer mod1 = 0; {
// if (theNbArgs > 1) char a2 = arg1[1]; if (a2 == '\0') a2 = '!';
// { switch (arg1[0])
// char a2 = arg1[1]; if (a2 == '\0') a2 = '!'; {
// switch (arg1[0]) case 'g': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_GeneralInfo); break;
// { case 'c': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_CountByItem); break;
// case 'g': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_GeneralInfo); break; case 'C': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ListByItem); break;
// case 'c': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_CountByItem); break; case 'r': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ResultCount); break;
// case 'C': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ListByItem); break; case 's': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_Mapping); break;
// case 'r': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ResultCount); break; case '?': mod1 = -1; break;
// case 's': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_Mapping); break; default: mod1 = -2; break;
// case '?': mod1 = -1; break; }
// default: mod1 = -2; break; }
// } if (mod1 < -1) theDI << "Unknown Mode\n";
// } if (mod1 < 0)
// if (mod1 < -1) theDI << "Unknown Mode\n"; {
// if (mod1 < 0) theDI << "Modes available :\n"
// { << "g : general c : checks (count) C (list)\n"
// theDI << "Modes available :\n" << "r : number of CasCade resulting shapes\n"
// << "g : general c : checks (count) C (list)\n" << "s : mapping between IGES entities and CasCade shapes\n";
// << "r : number of CasCade resulting shapes\n" if (mod1 < -1) return -1;
// << "s : mapping between IGES entities and CasCade shapes\n"; return 0;
// if (mod1 < -1) return -1; }
// return 0; return 0;
// } }
// return 0;
//}
////======================================================================= //=======================================================================
////function : etest //function : etest
////purpose : //purpose :
////======================================================================= //=======================================================================
//static Standard_Integer etest(Draw_Interpretor& theDI, static Standard_Integer etest(Draw_Interpretor& theDI,
// Standard_Integer theNbArgs, Standard_Integer theNbArgs,
// const char** theArgVec) const char** theArgVec)
//{ {
// if (theNbArgs < 3) if (theNbArgs < 3)
// { {
// theDI << "etest igesfile shape\n"; theDI << "etest igesfile shape\n";
// return 0; return 0;
// } }
// IGESControl_Reader aReader; IGESControl_Reader aReader;
// aReader.ReadFile(theArgVec[1]); aReader.ReadFile(theArgVec[1]);
// aReader.SetReadVisible(Standard_True); aReader.SetReadVisible(Standard_True);
// aReader.TransferRoots(); aReader.TransferRoots();
// TopoDS_Shape shape = aReader.OneShape(); TopoDS_Shape shape = aReader.OneShape();
// DBRep::Set(theArgVec[2], shape); DBRep::Set(theArgVec[2], shape);
// return 0; return 0;
//} }
//======================================================================= //=======================================================================
//function : ReadIges //function : ReadIges
@@ -787,27 +879,36 @@ static Standard_Integer WriteIges(Draw_Interpretor& theDI,
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : InitToBRep //function : InitToBRep
//purpose : //purpose :
//======================================================================= //=======================================================================
void XSDRAWIGES::Factory(Draw_Interpretor& theDI) void XSDRAWIGES::Factory(Draw_Interpretor& theDI)
{ {
static Standard_Boolean initactor = Standard_False;
if (initactor)
{
return;
}
IGESControl_Controller::Init();
initactor = Standard_True;
const char* aGroup = "DE: IGES"; const char* aGroup = "DE: IGES";
theDI.Add("tplosttrim", "number of untrimmed faces during last transfer", __FILE__, XSDRAWIGES_tplosttrim, aGroup); theDI.Add("tplosttrim", "number of untrimmed faces during last transfer", __FILE__, XSDRAWIGES_tplosttrim, aGroup);
//theDI.Add("igesbrep", "igesbrep [file else already loaded model] [name DRAW]", __FILE__, igesbrep, aGroup); theDI.Add("igesbrep", "igesbrep [file else already loaded model] [name DRAW]", __FILE__, igesbrep, aGroup);
//theDI.Add("testreadiges", "testreadiges [file else already loaded model] [name DRAW]", __FILE__, testread, aGroup); theDI.Add("testreadiges", "testreadiges [file else already loaded model] [name DRAW]", __FILE__, testread, aGroup);
//theDI.Add("igesparam", "igesparam ->list, + name ->one param, + name val->change", __FILE__, igesparam, aGroup); theDI.Add("igesparam", "igesparam ->list, + name ->one param, + name val->change", __FILE__, igesparam, aGroup);
//theDI.Add("TPSTAT", " ", __FILE__, XSDRAWIGES_TPSTAT, aGroup); theDI.Add("TPSTAT", " ", __FILE__, XSDRAWIGES_TPSTAT, aGroup);
//theDI.Add("etest", "test of eviewer", __FILE__, etest, aGroup); theDI.Add("etest", "test of eviewer", __FILE__, etest, aGroup);
theDI.Add("ReadIges", "Doc filename: Read IGES file to DECAF document", __FILE__, ReadIges, aGroup); theDI.Add("ReadIges", "Doc filename: Read IGES file to DECAF document", __FILE__, ReadIges, aGroup);
theDI.Add("WriteIges", "Doc filename: Write DECAF document to IGES file", __FILE__, WriteIges, aGroup); theDI.Add("WriteIges", "Doc filename: Write DECAF document to IGES file", __FILE__, WriteIges, aGroup);
theDI.Add("igesread", "igesread [file else already loaded model] [name DRAW]", __FILE__, igesbrep, aGroup); theDI.Add("igesread", "igesread [file else already loaded model] [name DRAW]", __FILE__, igesbrep, aGroup);
theDI.Add("igeswrite", "igesread [file else already loaded model] [name DRAW]", __FILE__, brepiges, aGroup); theDI.Add("igeswrite", "igesread [file else already loaded model] [name DRAW]", __FILE__, brepiges, aGroup);
//theDI.Add("brepiges", "brepiges sh1 [+sh2 [+sh3 ..]] filename.igs", __FILE__, brepiges, aGroup); theDI.Add("brepiges", "brepiges sh1 [+sh2 [+sh3 ..]] filename.igs", __FILE__, brepiges, aGroup);
//theDI.Add("testwriteiges", "testwriteiges filename.igs shape", __FILE__, testwrite, aGroup); theDI.Add("testwriteiges", "testwriteiges filename.igs shape", __FILE__, testwrite, aGroup);
} }
// Declare entry point PLUGINFACTORY
DPLUGIN(XSDRAWIGES)

View File

@@ -18,6 +18,7 @@
#include <DDocStd_DrawDocument.hxx> #include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx> #include <Draw.hxx>
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx> #include <Draw_ProgressIndicator.hxx>
#include <RWObj_ConfigurationNode.hxx> #include <RWObj_ConfigurationNode.hxx>
#include <RWObj_Provider.hxx> #include <RWObj_Provider.hxx>
@@ -327,6 +328,12 @@ static Standard_Integer WriteObj(Draw_Interpretor& theDI,
//======================================================================= //=======================================================================
void XSDRAWOBJ::Factory(Draw_Interpretor& theDI) void XSDRAWOBJ::Factory(Draw_Interpretor& theDI)
{ {
static Standard_Boolean initactor = Standard_False;
if (initactor)
{
return;
}
initactor = Standard_True;
const char* g = "XSTEP-STL/VRML"; // Step transfer file commands const char* g = "XSTEP-STL/VRML"; // Step transfer file commands
theDI.Add("ReadObj", theDI.Add("ReadObj",
"ReadObj Doc file [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]" "ReadObj Doc file [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]"
@@ -360,3 +367,6 @@ void XSDRAWOBJ::Factory(Draw_Interpretor& theDI)
"writeobj shape file", "writeobj shape file",
__FILE__, WriteObj, g); __FILE__, WriteObj, g);
} }
// Declare entry point PLUGINFACTORY
DPLUGIN(XSDRAWOBJ)

View File

@@ -18,6 +18,7 @@
#include <DDocStd_DrawDocument.hxx> #include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx> #include <Draw.hxx>
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx> #include <Draw_ProgressIndicator.hxx>
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
#include <BRepLib_PointCloudShape.hxx> #include <BRepLib_PointCloudShape.hxx>
@@ -326,6 +327,12 @@ static Standard_Integer WritePly(Draw_Interpretor& theDI,
//======================================================================= //=======================================================================
void XSDRAWPLY::Factory(Draw_Interpretor& theDI) void XSDRAWPLY::Factory(Draw_Interpretor& theDI)
{ {
static Standard_Boolean initactor = Standard_False;
if (initactor)
{
return;
}
initactor = Standard_True;
const char* g = "XSTEP-STL/VRML"; // Step transfer file commands const char* g = "XSTEP-STL/VRML"; // Step transfer file commands
//XSDRAW::LoadDraw(theCommands); //XSDRAW::LoadDraw(theCommands);
theDI.Add("WritePly", R"( theDI.Add("WritePly", R"(
@@ -348,3 +355,6 @@ Generate point cloud out of the shape and write it into PLY file.
"writeply shape file", "writeply shape file",
__FILE__, WritePly, g); __FILE__, WritePly, g);
} }
// Declare entry point PLUGINFACTORY
DPLUGIN(XSDRAWPLY)

View File

@@ -18,6 +18,7 @@
#include <DDocStd_DrawDocument.hxx> #include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx> #include <Draw.hxx>
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx> #include <Draw_ProgressIndicator.hxx>
#include <OSD_OpenFile.hxx> #include <OSD_OpenFile.hxx>
#include <OSD_Path.hxx> #include <OSD_Path.hxx>
@@ -46,6 +47,64 @@
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <UnitsMethods.hxx> #include <UnitsMethods.hxx>
namespace
{
//=======================================================================
//function : GiveEntityNumber
//purpose :
//=======================================================================
static Standard_Integer GiveEntityNumber(const Handle(XSControl_WorkSession)& WS,
const Standard_CString name)
{
Standard_Integer num = 0;
if (!name || name[0] == '\0')
{
char ligne[80]; ligne[0] = '\0';
std::cin >> ligne;
// std::cin.clear(); std::cin.getline (ligne,79);
if (ligne[0] == '\0') return 0;
num = WS->NumberFromLabel(ligne);
}
else num = WS->NumberFromLabel(name);
return num;
}
//=======================================================================
//function : FileAndVar
//purpose :
//=======================================================================
Standard_Boolean FileAndVar(const Handle(XSControl_WorkSession)& session,
const Standard_CString file,
const Standard_CString var,
const Standard_CString def,
TCollection_AsciiString& resfile,
TCollection_AsciiString& resvar)
{
Standard_Boolean iafic = Standard_True;
resfile.Clear(); resvar.Clear();
if (file)
if (file[0] == '\0' ||
(file[0] == '.' && file[1] == '\0')) iafic = Standard_False;
if (!iafic) resfile.AssignCat(session->LoadedFile());
else resfile.AssignCat(file);
if (var && var[0] != '\0' && (var[0] != '.' || var[1] != '\0'))
resvar.AssignCat(var);
else if (resfile.Length() == 0) resvar.AssignCat(def);
else
{
Standard_Integer nomdeb, nomfin;
nomdeb = resfile.SearchFromEnd("/");
if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\"); // pour NT
if (nomdeb < 0) nomdeb = 0;
nomfin = resfile.SearchFromEnd(".");
if (nomfin < nomdeb) nomfin = resfile.Length() + 1;
resvar = resfile.SubString(nomdeb + 1, nomfin - 1);
}
return iafic;
}
}
//======================================================================= //=======================================================================
//function : stepread //function : stepread
//purpose : //purpose :
@@ -66,8 +125,8 @@ static Standard_Integer stepread(Draw_Interpretor& theDI,
STEPControl_Reader sr(XSDRAWBase::Session(), Standard_False); STEPControl_Reader sr(XSDRAWBase::Session(), Standard_False);
TCollection_AsciiString fnom, rnom; TCollection_AsciiString fnom, rnom;
Standard_Boolean modfic = XSDRAWBase::FileAndVar Standard_Boolean modfic = FileAndVar
(theArgVec[1], theArgVec[2], "STEP", fnom, rnom); (XSDRAWBase::Session(), theArgVec[1], theArgVec[2], "STEP", fnom, rnom);
if (modfic) theDI << " File STEP to read : " << fnom.ToCString() << "\n"; if (modfic) theDI << " File STEP to read : " << fnom.ToCString() << "\n";
else theDI << " Model taken from the session : " << fnom.ToCString() << "\n"; else theDI << " Model taken from the session : " << fnom.ToCString() << "\n";
theDI << " -- Names of variables BREP-DRAW prefixed by : " << rnom.ToCString() << "\n"; theDI << " -- Names of variables BREP-DRAW prefixed by : " << rnom.ToCString() << "\n";
@@ -103,7 +162,6 @@ static Standard_Integer stepread(Draw_Interpretor& theDI,
sr.WS()->SetModeStat(aFullMode); sr.WS()->SetModeStat(aFullMode);
if (modfic) readstat = sr.ReadFile(fnom.ToCString()); if (modfic) readstat = sr.ReadFile(fnom.ToCString());
else if (XSDRAWBase::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone; else if (XSDRAWBase::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
@@ -170,7 +228,7 @@ static Standard_Integer stepread(Draw_Interpretor& theDI,
} }
else if (modepri == 3) else if (modepri == 3)
{ {
std::cout << "Entity : " << std::flush; num = XSDRAWBase::GetEntityNumber(); std::cout << "Entity : " << std::flush; num = GiveEntityNumber(XSDRAWBase::Session(), "");
if (!sr.TransferOne(num)) if (!sr.TransferOne(num))
theDI << "Transfer entity n0 " << num << " : no result\n"; theDI << "Transfer entity n0 " << num << " : no result\n";
else else
@@ -196,7 +254,7 @@ static Standard_Integer stepread(Draw_Interpretor& theDI,
if (theArgVec[k][0] == '*' && theArgVec[k][1] == '\0') if (theArgVec[k][0] == '*' && theArgVec[k][1] == '\0')
{ {
theDI << "Transferrable Roots : "; theDI << "Transferrable Roots : ";
list = XSDRAWBase::GetList("xst-transferrable-roots"); list = XSDRAWBase::Session()->GiveList("xst-transferrable-roots");
//list = new TColStd_HSequenceOfTransient; //list = new TColStd_HSequenceOfTransient;
//for(Standard_Integer j=1; j<=num; j++) //for(Standard_Integer j=1; j<=num; j++)
// list->Append(sr.RootForTransfer(j)); // list->Append(sr.RootForTransfer(j));
@@ -206,14 +264,14 @@ static Standard_Integer stepread(Draw_Interpretor& theDI,
theDI << "List given by " << theArgVec[k]; theDI << "List given by " << theArgVec[k];
if (theNbArgs > k + 1) theDI << " " << theArgVec[k + 1]; if (theNbArgs > k + 1) theDI << " " << theArgVec[k + 1];
theDI << " : "; theDI << " : ";
list = XSDRAWBase::GetList(theArgVec[k], (theNbArgs > (k + 1) ? theArgVec[k + 1] : 0)); list = XSDRAWBase::Session()->GiveList(theArgVec[k], (theNbArgs > (k + 1) ? theArgVec[k + 1] : 0));
} }
if (list.IsNull()) { theDI << "No list defined. Give a selection name or * for all transferrable roots\n"; continue; } if (list.IsNull()) { theDI << "No list defined. Give a selection name or * for all transferrable roots\n"; continue; }
} }
else else
{ {
std::cout << "Name of Selection :" << std::flush; std::cout << "Name of Selection :" << std::flush;
list = XSDRAWBase::GetList(); list = XSDRAWBase::Session()->GiveList("");
if (list.IsNull()) { theDI << "No list defined\n"; continue; } if (list.IsNull()) { theDI << "No list defined\n"; continue; }
} }
@@ -249,56 +307,56 @@ static Standard_Integer stepread(Draw_Interpretor& theDI,
return 0; return 0;
} }
////======================================================================= //=======================================================================
////function : testreadstep //function : testreadstep
////purpose : //purpose :
////======================================================================= //=======================================================================
//static Standard_Integer testreadstep(Draw_Interpretor& theDI, static Standard_Integer testreadstep(Draw_Interpretor& theDI,
// Standard_Integer theNbArgs, Standard_Integer theNbArgs,
// const char** theArgVec) const char** theArgVec)
//{ {
// if (theNbArgs < 3 || theNbArgs > 4) if (theNbArgs < 3 || theNbArgs > 4)
// { {
// theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n"; theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
// theDI << " Usage : " << theArgVec[0] << " file_name shape_name [-stream]\n"; theDI << " Usage : " << theArgVec[0] << " file_name shape_name [-stream]\n";
// theDI << " Option -stream forces usage of API accepting stream\n"; theDI << " Option -stream forces usage of API accepting stream\n";
// return 1; return 1;
// } }
//
// Standard_Boolean useStream = (theNbArgs > 3 && !strcasecmp(theArgVec[3], "-stream")); Standard_Boolean useStream = (theNbArgs > 3 && !strcasecmp(theArgVec[3], "-stream"));
//
// STEPControl_Reader Reader; STEPControl_Reader Reader;
// Standard_CString filename = theArgVec[1]; Standard_CString filename = theArgVec[1];
// IFSelect_ReturnStatus readstat; IFSelect_ReturnStatus readstat;
// if (useStream) if (useStream)
// { {
// std::ifstream aStream; std::ifstream aStream;
// OSD_OpenStream(aStream, filename, std::ios::in | std::ios::binary); OSD_OpenStream(aStream, filename, std::ios::in | std::ios::binary);
// TCollection_AsciiString aFolder, aFileNameShort; TCollection_AsciiString aFolder, aFileNameShort;
// OSD_Path::FolderAndFileFromPath(filename, aFolder, aFileNameShort); OSD_Path::FolderAndFileFromPath(filename, aFolder, aFileNameShort);
// readstat = Reader.ReadStream(aFileNameShort.ToCString(), aStream); readstat = Reader.ReadStream(aFileNameShort.ToCString(), aStream);
// } }
// else else
// { {
// readstat = Reader.ReadFile(filename); readstat = Reader.ReadFile(filename);
// } }
// theDI << "Status from reading STEP file " << filename << " : "; theDI << "Status from reading STEP file " << filename << " : ";
// switch (readstat) switch (readstat)
// { {
// case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; } case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; }
// case IFSelect_RetDone: { theDI << "file read\n"; break; } case IFSelect_RetDone: { theDI << "file read\n"; break; }
// case IFSelect_RetError: { theDI << "file not found\n"; return 1; } case IFSelect_RetError: { theDI << "file not found\n"; return 1; }
// case IFSelect_RetFail: { theDI << "error during read\n"; return 1; } case IFSelect_RetFail: { theDI << "error during read\n"; return 1; }
// default: { theDI << "failure\n"; return 1; } default: { theDI << "failure\n"; return 1; }
// } }
// XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
// Reader.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit()); Reader.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
// Reader.TransferRoots(); Reader.TransferRoots();
// TopoDS_Shape shape = Reader.OneShape(); TopoDS_Shape shape = Reader.OneShape();
// DBRep::Set(theArgVec[2], shape); DBRep::Set(theArgVec[2], shape);
// theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n"; theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n";
// return 0; return 0;
//} }
//======================================================================= //=======================================================================
//function : steptrans //function : steptrans
@@ -313,6 +371,7 @@ static Standard_Integer steptrans(Draw_Interpretor& theDI,
theDI << "give shape-name new-shape + entity-n0 entity-n0: AXIS2\n"; theDI << "give shape-name new-shape + entity-n0 entity-n0: AXIS2\n";
return 1; return 1;
} }
Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session();
TopoDS_Shape shape = DBRep::Get(theArgVec[1]); TopoDS_Shape shape = DBRep::Get(theArgVec[1]);
if (shape.IsNull()) if (shape.IsNull())
{ {
@@ -321,12 +380,12 @@ static Standard_Integer steptrans(Draw_Interpretor& theDI,
} }
Handle(StepGeom_Axis2Placement3d) ax1, ax2; Handle(StepGeom_Axis2Placement3d) ax1, ax2;
Standard_Integer n1 = 0, n2 = 0; Standard_Integer n1 = 0, n2 = 0;
n1 = XSDRAWBase::GetEntityNumber(theArgVec[3]); n1 = GiveEntityNumber(aWS, theArgVec[3]);
if (theNbArgs > 4) n2 = XSDRAWBase::GetEntityNumber(theArgVec[4]); if (theNbArgs > 4) n2 = GiveEntityNumber(aWS, theArgVec[4]);
if (n1 > 0) ax1 = Handle(StepGeom_Axis2Placement3d)::DownCast if (n1 > 0) ax1 = Handle(StepGeom_Axis2Placement3d)::DownCast
(XSDRAWBase::Entity(n1)); (aWS->StartingEntity(n1));
if (n2 > 0) ax2 = Handle(StepGeom_Axis2Placement3d)::DownCast if (n2 > 0) ax2 = Handle(StepGeom_Axis2Placement3d)::DownCast
(XSDRAWBase::Entity(n2)); (aWS->StartingEntity(n2));
StepToTopoDS_MakeTransformed mktrans; StepToTopoDS_MakeTransformed mktrans;
if (mktrans.Compute(ax1, ax2)) if (mktrans.Compute(ax1, ax2))
{ {
@@ -341,8 +400,6 @@ static Standard_Integer steptrans(Draw_Interpretor& theDI,
return 0; return 0;
} }
// ######## COMMANDE stepwrite : teste le Writer #########
//======================================================================= //=======================================================================
//function : stepwrite //function : stepwrite
//purpose : //purpose :
@@ -351,16 +408,22 @@ static Standard_Integer stepwrite(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session();
Handle(STEPControl_Controller) aCtl =
Handle(STEPControl_Controller)::DownCast(aWS->NormAdaptor());
if (aCtl.IsNull())
{
aWS->SelectNorm("STEP");
}
if (theNbArgs < 3) if (theNbArgs < 3)
{ {
theDI << "Give mode[1-4] and Shape name + optional file. Mode possible\n"; theDI << "Error: Give mode[1-4] and Shape name + optional file. Mode possible\n";
theDI << "f ou 1 : FacettedBRep s ou 2 : ShellBasedSurfaceModel\n" theDI << "f ou 1 : FacettedBRep s ou 2 : ShellBasedSurfaceModel\n"
<< "m ou 3 : ManifoldSolidBrep w ou 4 : GeometricCurveSet/WireFrame\n"; << "m ou 3 : ManifoldSolidBrep w ou 4 : GeometricCurveSet/WireFrame\n";
return 1; return 1;
} }
char modeshape = theArgVec[1][0];
STEPControl_StepModelType mode; STEPControl_StepModelType mode;
switch (modeshape) switch (theArgVec[1][0])
{ {
case 'a': case 'a':
case '0': mode = STEPControl_AsIs; break; case '0': mode = STEPControl_AsIs; break;
@@ -372,17 +435,15 @@ static Standard_Integer stepwrite(Draw_Interpretor& theDI,
case '3': mode = STEPControl_ManifoldSolidBrep; break; case '3': mode = STEPControl_ManifoldSolidBrep; break;
case 'w': case 'w':
case '4': mode = STEPControl_GeometricCurveSet; break; case '4': mode = STEPControl_GeometricCurveSet; break;
default: theDI << "1st arg = mode, incorrect [give fsmw]\n"; return 1; default: theDI << "Error: 1st arg = mode, incorrect [give fsmw]\n"; return 1;
} }
//:k8 abv 6 Jan 98: using parameter for writing mode (assemblies/shapes)
Handle(STEPControl_ActorWrite) ActWrite = Handle(STEPControl_ActorWrite) ActWrite =
Handle(STEPControl_ActorWrite)::DownCast(ctl->ActorWrite()); Handle(STEPControl_ActorWrite)::DownCast(aWS->NormAdaptor()->ActorWrite());
if (!ActWrite.IsNull()) if (!ActWrite.IsNull())
ActWrite->SetGroupMode(Interface_Static::IVal("write.step.assembly")); ActWrite->SetGroupMode(Interface_Static::IVal("write.step.assembly"));
TopoDS_Shape shape = DBRep::Get(theArgVec[2]); TopoDS_Shape shape = DBRep::Get(theArgVec[2]);
STEPControl_Writer sw(XSDRAWBase::Session(), Standard_False); STEPControl_Writer sw(aWS, Standard_False);
Handle(Interface_InterfaceModel) stepmodel = sw.Model(); Handle(Interface_InterfaceModel) stepmodel = sw.Model();
Standard_Integer nbavant = (stepmodel.IsNull() ? 0 : stepmodel->NbEntities()); Standard_Integer nbavant = (stepmodel.IsNull() ? 0 : stepmodel->NbEntities());
@@ -399,7 +460,6 @@ static Standard_Integer stepwrite(Draw_Interpretor& theDI,
{ {
theDI << "Error: translation failed, status = " << stat << "\n"; theDI << "Error: translation failed, status = " << stat << "\n";
} }
if (aPSRoot.UserBreak()) if (aPSRoot.UserBreak())
return 1; return 1;
aPSRoot.SetName("Writing"); aPSRoot.SetName("Writing");
@@ -417,96 +477,95 @@ static Standard_Integer stepwrite(Draw_Interpretor& theDI,
theDI << " Now, to write a file, command : writeall filename\n"; theDI << " Now, to write a file, command : writeall filename\n";
return 0; return 0;
} }
const char* nomfic = theArgVec[3]; const char* nomfic = theArgVec[3];
stat = sw.Write(nomfic); stat = sw.Write(nomfic);
switch (stat) switch (stat)
{ {
case IFSelect_RetVoid: theDI << "Error: No file written\n"; break; case IFSelect_RetVoid: theDI << "Error: No file written\n"; return 1;
case IFSelect_RetDone: theDI << "File " << nomfic << " written\n"; break; case IFSelect_RetDone: theDI << "File " << nomfic << " written\n"; break;
case IFSelect_RetStop: theDI << "Error on writing file: no space on disk or destination is write protected\n"; break; case IFSelect_RetStop: theDI << "Error on writing file: no space on disk or destination is write protected\n"; return 1;
default: theDI << "Error: File " << nomfic << " written with fail messages\n"; break; default: theDI << "Error: File " << nomfic << " written with fail messages\n"; return 1;
} }
XSDRAWBase::CollectActiveWorkSessions(aWS, nomfic, XSDRAWBase::WorkSessionList());
return 0; return 0;
} }
////======================================================================= //=======================================================================
////function : testwritestep //function : testwrite
////purpose : //purpose :
////======================================================================= //=======================================================================
//static Standard_Integer testwrite(Draw_Interpretor& theDI, static Standard_Integer testwrite(Draw_Interpretor& theDI,
// Standard_Integer theNbArgs, Standard_Integer theNbArgs,
// const char** theArgVec) const char** theArgVec)
//{ {
// TCollection_AsciiString aFilePath; TCollection_AsciiString aFilePath;
// TopoDS_Shape aShape; TopoDS_Shape aShape;
// bool toTestStream = false; bool toTestStream = false;
// for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter) for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
// { {
// TCollection_AsciiString anArgCase(theArgVec[anArgIter]); TCollection_AsciiString anArgCase(theArgVec[anArgIter]);
// anArgCase.LowerCase(); anArgCase.LowerCase();
// if (anArgCase == "-stream") if (anArgCase == "-stream")
// { {
// toTestStream = true; toTestStream = true;
// } }
// else if (aFilePath.IsEmpty()) else if (aFilePath.IsEmpty())
// { {
// aFilePath = theArgVec[anArgIter]; aFilePath = theArgVec[anArgIter];
// } }
// else if (aShape.IsNull()) else if (aShape.IsNull())
// { {
// aShape = DBRep::Get(theArgVec[anArgIter]); aShape = DBRep::Get(theArgVec[anArgIter]);
// if (aShape.IsNull()) if (aShape.IsNull())
// { {
// theDI << "Syntax error: '" << theArgVec[anArgIter] << "' is not a shape"; theDI << "Syntax error: '" << theArgVec[anArgIter] << "' is not a shape\n";
// return 1; return 1;
// } }
// } }
// else else
// { {
// theDI << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'"; theDI << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
// return 1; return 1;
// } }
// } }
// if (aShape.IsNull()) if (aShape.IsNull())
// { {
// theDI << "Syntax error: wrong number of arguments"; theDI << "Syntax error: wrong number of arguments\n";
// return 1; return 1;
// } }
//
// STEPControl_Writer aWriter; STEPControl_Writer aWriter;
// IFSelect_ReturnStatus aStat = aWriter.Transfer(aShape, STEPControl_AsIs); IFSelect_ReturnStatus aStat = aWriter.Transfer(aShape, STEPControl_AsIs);
// if (aStat != IFSelect_RetDone) if (aStat != IFSelect_RetDone)
// { {
// theDI << "Error on transferring shape"; theDI << "Error on transferring shape\n";
// return 1; return 1;
// } }
//
// if (toTestStream) if (toTestStream)
// { {
// std::ofstream aStream; std::ofstream aStream;
// OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary); OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary);
// aStat = aWriter.WriteStream(aStream); aStat = aWriter.WriteStream(aStream);
// aStream.close(); aStream.close();
// if (!aStream.good() if (!aStream.good()
// && aStat == IFSelect_RetDone) && aStat == IFSelect_RetDone)
// { {
// aStat = IFSelect_RetFail; aStat = IFSelect_RetFail;
// } }
// } }
// else else
// { {
// aStat = aWriter.Write(aFilePath.ToCString()); aStat = aWriter.Write(aFilePath.ToCString());
// } }
// if (aStat != IFSelect_RetDone) if (aStat != IFSelect_RetDone)
// { {
// theDI << "Error on writing file"; theDI << "Error on writing file\n";
// return 1; return 1;
// } }
// theDI << "File Is Written"; theDI << "File Is Written\n";
// return 0; return 0;
//} }
//======================================================================= //=======================================================================
//function : countexpected //function : countexpected
@@ -566,20 +625,16 @@ static Standard_Integer stepfileunits(Draw_Interpretor& theDI,
Standard_Integer theNbArgs, Standard_Integer theNbArgs,
const char** theArgVec) const char** theArgVec)
{ {
if (theNbArgs < 2) if (theNbArgs < 2)
{ {
theDI << "Error: Invalid number of parameters. Should be: getfileunits name_file\n"; theDI << "Error: Invalid number of parameters. Should be: getfileunits name_file\n";
return 1; return 1;
} }
STEPControl_Reader aStepReader; STEPControl_Reader aStepReader;
IFSelect_ReturnStatus readstat = IFSelect_RetVoid; IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
readstat = aStepReader.ReadFile(theArgVec[1]); readstat = aStepReader.ReadFile(theArgVec[1]);
if (readstat != IFSelect_RetDone) if (readstat != IFSelect_RetDone)
{ {
theDI << "No model loaded\n"; theDI << "No model loaded\n";
return 1; return 1;
} }
@@ -688,8 +743,6 @@ static Standard_Integer ReadStep(Draw_Interpretor& theDI,
{ {
std::ifstream aStream; std::ifstream aStream;
OSD_OpenStream(aStream, aFilePath.ToCString(), std::ios::in | std::ios::binary); OSD_OpenStream(aStream, aFilePath.ToCString(), std::ios::in | std::ios::binary);
TCollection_AsciiString aFolder, aFileNameShort;
OSD_Path::FolderAndFileFromPath(aFilePath, aFolder, aFileNameShort);
aReadStat = aReadStat =
aProvider->Read(aStream, aDoc, aFilePath, aWS, aProgress->Start()); aProvider->Read(aStream, aDoc, aFilePath, aWS, aProgress->Start());
} }
@@ -823,8 +876,6 @@ static Standard_Integer WriteStep(Draw_Interpretor& theDI,
{ {
std::ofstream aStream; std::ofstream aStream;
OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary); OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary);
TCollection_AsciiString aFolder, aFileNameShort;
OSD_Path::FolderAndFileFromPath(aFilePath, aFolder, aFileNameShort);
aReadStat = aReadStat =
aProvider->Write(aStream, aDoc, aWS, aProgress->Start()); aProvider->Write(aStream, aDoc, aWS, aProgress->Start());
} }
@@ -848,12 +899,18 @@ static Standard_Integer WriteStep(Draw_Interpretor& theDI,
//======================================================================= //=======================================================================
void XSDRAWSTEP::Factory(Draw_Interpretor& theDI) void XSDRAWSTEP::Factory(Draw_Interpretor& theDI)
{ {
static Standard_Boolean initactor = Standard_False;
if (initactor)
{
return;
}
initactor = Standard_True;
const char* g = "DE: STEP"; // Step transfer file commands const char* g = "DE: STEP"; // Step transfer file commands
theDI.Add("stepwrite", "stepwrite [mode[0-4 afsmw]] shape", __FILE__, stepwrite, g); theDI.Add("stepwrite", "stepwrite mode[0-4 afsmw] shape", __FILE__, stepwrite, g);
//theDI.Add("testwritestep", "testwritestep filename.stp shape [-stream]", theDI.Add("testwritestep", "testwritestep filename.stp shape [-stream]",
// __FILE__, testwrite, g); __FILE__, testwrite, g);
theDI.Add("stepread", "stepread [file] [f or r (type of model full or reduced)]", __FILE__, stepread, g); theDI.Add("stepread", "stepread [file] [f or r (type of model full or reduced)]", __FILE__, stepread, g);
//theDI.Add("testreadstep", "testreadstep file shape [-stream]", __FILE__, testreadstep, g); theDI.Add("testreadstep", "testreadstep file shape [-stream]", __FILE__, testreadstep, g);
theDI.Add("steptrans", "steptrans shape stepax1 stepax2", __FILE__, steptrans, g); theDI.Add("steptrans", "steptrans shape stepax1 stepax2", __FILE__, steptrans, g);
theDI.Add("countexpected", "TEST", __FILE__, countexpected, g); theDI.Add("countexpected", "TEST", __FILE__, countexpected, g);
theDI.Add("dumpassembly", "TEST", __FILE__, dumpassembly, g); theDI.Add("dumpassembly", "TEST", __FILE__, dumpassembly, g);
@@ -875,3 +932,6 @@ void XSDRAWSTEP::Factory(Draw_Interpretor& theDI)
"\n\t\t: -stream read using ostream writing interface (testing)", "\n\t\t: -stream read using ostream writing interface (testing)",
__FILE__, WriteStep, g); __FILE__, WriteStep, g);
} }
// Declare entry point PLUGINFACTORY
DPLUGIN(XSDRAWSTEP)

View File

@@ -24,8 +24,6 @@ class XSDRAWSTEP
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
public: public:
Standard_EXPORT static void Init();
//! Loads all Draw commands of XSDRAWSTEP. Used for plugin. //! Loads all Draw commands of XSDRAWSTEP. Used for plugin.
Standard_EXPORT static void Factory(Draw_Interpretor& theDI); Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
}; };

View File

@@ -18,6 +18,7 @@
#include <DDocStd_DrawDocument.hxx> #include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx> #include <Draw.hxx>
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx> #include <Draw_ProgressIndicator.hxx>
#include <RWStl_ConfigurationNode.hxx> #include <RWStl_ConfigurationNode.hxx>
#include <RWStl_Provider.hxx> #include <RWStl_Provider.hxx>
@@ -168,6 +169,12 @@ static Standard_Integer readstl(Draw_Interpretor& theDI,
//============================================================================= //=============================================================================
void XSDRAWSTL::Factory(Draw_Interpretor& theDI) void XSDRAWSTL::Factory(Draw_Interpretor& theDI)
{ {
static Standard_Boolean initactor = Standard_False;
if (initactor)
{
return;
}
initactor = Standard_True;
const char* g = "XSTEP-STL/VRML"; // Step transfer file commands const char* g = "XSTEP-STL/VRML"; // Step transfer file commands
theDI.Add("writestl", "shape file [ascii/binary (0/1) : 1 by default] [InParallel (0/1) : 0 by default]", __FILE__, writestl, g); theDI.Add("writestl", "shape file [ascii/binary (0/1) : 1 by default] [InParallel (0/1) : 0 by default]", __FILE__, writestl, g);
@@ -180,3 +187,6 @@ void XSDRAWSTL::Factory(Draw_Interpretor& theDI)
"\n\t\t: -multi creates a face per solid in multi-domain files; ignored when -brep is set.", "\n\t\t: -multi creates a face per solid in multi-domain files; ignored when -brep is set.",
__FILE__, readstl, g); __FILE__, readstl, g);
} }
// Declare entry point PLUGINFACTORY
DPLUGIN(XSDRAWSTL)

View File

@@ -641,7 +641,6 @@ static Standard_Integer showonly(Draw_Interpretor& theDI,
return 0; return 0;
} }
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext(); Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI); Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
if (aMesh.IsNull()) if (aMesh.IsNull())
@@ -798,7 +797,6 @@ static Standard_Integer meshcolors(Draw_Interpretor& theDI,
aMesh->AddBuilder(aBuilder, Standard_True); aMesh->AddBuilder(aBuilder, Standard_True);
} }
if (aMode.IsEqual("nodal")) if (aMode.IsEqual("nodal"))
{ {
Handle(MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder( Handle(MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder(
@@ -1306,12 +1304,7 @@ void XSDRAWSTLVRML::InitCommands(Draw_Interpretor& theCommands)
//======================================================================= //=======================================================================
void XSDRAWSTLVRML::Factory(Draw_Interpretor& theDI) void XSDRAWSTLVRML::Factory(Draw_Interpretor& theDI)
{ {
XSDRAWIGES::InitSelect();
XSDRAWIGES::InitToBRep(theDI);
XSDRAWIGES::InitFromBRep(theDI);
XSDRAWSTEP::InitCommands(theDI);
XSDRAWSTLVRML::InitCommands(theDI); XSDRAWSTLVRML::InitCommands(theDI);
XSDRAW::LoadDraw(theDI);
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
theDI << "Draw Plugin : All TKXSDRAW commands are loaded\n"; theDI << "Draw Plugin : All TKXSDRAW commands are loaded\n";
#endif #endif

View File

@@ -22,8 +22,6 @@
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
class XSDRAWSTLVRML class XSDRAWSTLVRML
{ {
public: public:

View File

@@ -23,5 +23,4 @@
typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerReal,TColStd_MapIntegerHasher> XSDRAWSTLVRML_CoordsMap; typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerReal,TColStd_MapIntegerHasher> XSDRAWSTLVRML_CoordsMap;
typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerReal,TColStd_MapIntegerHasher>::Iterator XSDRAWSTLVRML_DataMapIteratorOfCoordsMap; typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerReal,TColStd_MapIntegerHasher>::Iterator XSDRAWSTLVRML_DataMapIteratorOfCoordsMap;
#endif #endif

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef XSDRAWSTLVRML_DataMapIteratorOfCoordsMap_HeaderFile #ifndef XSDRAWSTLVRML_DataMapIteratorOfCoordsMap_HeaderFile
#define XSDRAWSTLVRML_DataMapIteratorOfCoordsMap_HeaderFile #define XSDRAWSTLVRML_DataMapIteratorOfCoordsMap_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap_HeaderFile #ifndef XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap_HeaderFile
#define XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap_HeaderFile #define XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap_HeaderFile

View File

@@ -28,14 +28,12 @@
#include <TColStd_Array1OfInteger.hxx> #include <TColStd_Array1OfInteger.hxx>
#include <Poly_Triangulation.hxx> #include <Poly_Triangulation.hxx>
class XSDRAWSTLVRML_DataSource; class XSDRAWSTLVRML_DataSource;
DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource, MeshVS_DataSource) DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource, MeshVS_DataSource)
//! The sample DataSource for working with STLMesh_Mesh //! The sample DataSource for working with STLMesh_Mesh
class XSDRAWSTLVRML_DataSource : public MeshVS_DataSource class XSDRAWSTLVRML_DataSource : public MeshVS_DataSource
{ {
public: public:
@@ -68,19 +66,12 @@ public:
//! There is default method, for advance reflection this method can be redefined. //! There is default method, for advance reflection this method can be redefined.
Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer Id, const Standard_Integer Max, Standard_Real& nx, Standard_Real& ny, Standard_Real& nz) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer Id, const Standard_Integer Max, Standard_Real& nx, Standard_Real& ny, Standard_Real& nz) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource,MeshVS_DataSource) DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource,MeshVS_DataSource)
protected: protected:
private: private:
Handle(Poly_Triangulation) myMesh; Handle(Poly_Triangulation) myMesh;
TColStd_PackedMapOfInteger myNodes; TColStd_PackedMapOfInteger myNodes;
TColStd_PackedMapOfInteger myElements; TColStd_PackedMapOfInteger myElements;
@@ -88,13 +79,6 @@ private:
Handle(TColStd_HArray2OfReal) myNodeCoords; Handle(TColStd_HArray2OfReal) myNodeCoords;
Handle(TColStd_HArray2OfReal) myElemNormals; Handle(TColStd_HArray2OfReal) myElemNormals;
}; };
#endif // _XSDRAWSTLVRML_DataSource_HeaderFile #endif // _XSDRAWSTLVRML_DataSource_HeaderFile

View File

@@ -13,7 +13,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Standard_Type.hxx> #include <Standard_Type.hxx>
#include <TColgp_SequenceOfXYZ.hxx> #include <TColgp_SequenceOfXYZ.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx> #include <TColStd_DataMapOfIntegerInteger.hxx>

View File

@@ -30,14 +30,12 @@
#include <Standard_Address.hxx> #include <Standard_Address.hxx>
#include <TColStd_Array1OfInteger.hxx> #include <TColStd_Array1OfInteger.hxx>
class XSDRAWSTLVRML_DataSource3D; class XSDRAWSTLVRML_DataSource3D;
DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource3D, MeshVS_DataSource) DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource3D, MeshVS_DataSource)
//! The sample DataSource3D for working with STLMesh_Mesh //! The sample DataSource3D for working with STLMesh_Mesh
class XSDRAWSTLVRML_DataSource3D : public MeshVS_DataSource class XSDRAWSTLVRML_DataSource3D : public MeshVS_DataSource
{ {
public: public:
@@ -74,32 +72,18 @@ public:
//! There is default method, for advance reflection this method can be redefined. //! There is default method, for advance reflection this method can be redefined.
Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer theID, const Standard_Integer theMax, Standard_Real& theNx, Standard_Real& theNy, Standard_Real& theNz) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer theID, const Standard_Integer theMax, Standard_Real& theNx, Standard_Real& theNy, Standard_Real& theNz) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource3D,MeshVS_DataSource) DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource3D,MeshVS_DataSource)
protected: protected:
private: private:
TColStd_PackedMapOfInteger myNodes; TColStd_PackedMapOfInteger myNodes;
TColStd_PackedMapOfInteger myElements; TColStd_PackedMapOfInteger myElements;
Handle(TColStd_HArray1OfInteger) myElemNbNodes; Handle(TColStd_HArray1OfInteger) myElemNbNodes;
Handle(TColStd_HArray2OfReal) myNodeCoords; Handle(TColStd_HArray2OfReal) myNodeCoords;
Handle(TColStd_HArray2OfInteger) myElemNodes; Handle(TColStd_HArray2OfInteger) myElemNodes;
}; };
#endif // _XSDRAWSTLVRML_DataSource3D_HeaderFile #endif // _XSDRAWSTLVRML_DataSource3D_HeaderFile

View File

@@ -13,7 +13,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Draw_Display.hxx> #include <Draw_Display.hxx>
#include <MeshVS_Mesh.hxx> #include <MeshVS_Mesh.hxx>
#include <Standard_Type.hxx> #include <Standard_Type.hxx>

View File

@@ -23,14 +23,11 @@
class MeshVS_Mesh; class MeshVS_Mesh;
class Draw_Display; class Draw_Display;
class XSDRAWSTLVRML_DrawableMesh; class XSDRAWSTLVRML_DrawableMesh;
DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DrawableMesh, Draw_Drawable3D) DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DrawableMesh, Draw_Drawable3D)
class XSDRAWSTLVRML_DrawableMesh : public Draw_Drawable3D class XSDRAWSTLVRML_DrawableMesh : public Draw_Drawable3D
{ {
public: public:
@@ -40,28 +37,14 @@ public:
Standard_EXPORT Handle(MeshVS_Mesh) GetMesh() const; Standard_EXPORT Handle(MeshVS_Mesh) GetMesh() const;
DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DrawableMesh,Draw_Drawable3D) DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DrawableMesh,Draw_Drawable3D)
protected: protected:
private: private:
Handle(MeshVS_Mesh) myMesh; Handle(MeshVS_Mesh) myMesh;
}; };
#endif // _XSDRAWSTLVRML_DrawableMesh_HeaderFile #endif // _XSDRAWSTLVRML_DrawableMesh_HeaderFile

View File

@@ -23,5 +23,4 @@
typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerInteger,TColStd_MapIntegerHasher> XSDRAWSTLVRML_ElemNodesMap; typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerInteger,TColStd_MapIntegerHasher> XSDRAWSTLVRML_ElemNodesMap;
typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerInteger,TColStd_MapIntegerHasher>::Iterator XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap; typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerInteger,TColStd_MapIntegerHasher>::Iterator XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap;
#endif #endif

View File

@@ -18,6 +18,7 @@
#include <DDocStd_DrawDocument.hxx> #include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx> #include <Draw.hxx>
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx> #include <Draw_ProgressIndicator.hxx>
#include <Vrml_ConfigurationNode.hxx> #include <Vrml_ConfigurationNode.hxx>
#include <Vrml_Provider.hxx> #include <Vrml_Provider.hxx>
@@ -322,3 +323,7 @@ void XSDRAWVRML::Factory(Draw_Interpretor& theDI)
theDI.Add("loadvrml", "shape file", __FILE__, loadvrml, aGroup); theDI.Add("loadvrml", "shape file", __FILE__, loadvrml, aGroup);
theDI.Add("writevrml", "shape file [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 1 by default]", __FILE__, writevrml, aGroup); theDI.Add("writevrml", "shape file [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 1 by default]", __FILE__, writevrml, aGroup);
} }
// Declare entry point PLUGINFACTORY
DPLUGIN(XSDRAWVRML)

View File

@@ -17,6 +17,6 @@ close $fd
puts "# Load IGES file which is known to generate the message, and check it" puts "# Load IGES file which is known to generate the message, and check it"
puts "REQUIRED 14673 ALL: $message" puts "REQUIRED 14673 ALL: $message"
pload XSDRAW pload XSDRAW IGES
igesbrep [locate_data_file hammer.iges] a * igesbrep [locate_data_file hammer.iges] a *
tpstat c tpstat c

View File

@@ -1,4 +1,4 @@
pload XSDRAW pload XDE
set subgroup heal set subgroup heal

View File

@@ -6,7 +6,7 @@ puts ""
# Mesh generation hangs then crashes # Mesh generation hangs then crashes
########################################### ###########################################
pload DATAEXCHANGEKERNEL pload DATAEXCHANGE
testreadstep [locate_data_file bug28118_18547.stp] result testreadstep [locate_data_file bug28118_18547.stp] result
vclear vclear

View File

@@ -3,7 +3,7 @@ puts "0029715: Mesh - Estimate the grid size of the acceleration structure by th
puts "=======" puts "======="
puts "" puts ""
if {[info commands stepread] == ""} {pload XSDRAW} pload XSDRAW STEP
stepread [locate_data_file bug29715_slow.stp] a * stepread [locate_data_file bug29715_slow.stp] a *
renamevar a_1 a renamevar a_1 a

View File

@@ -8,7 +8,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -8,7 +8,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -8,7 +8,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -8,7 +8,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -8,7 +8,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -8,7 +8,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -9,7 +9,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -8,7 +8,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -8,7 +8,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -10,7 +10,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -8,7 +8,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -12,7 +12,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -8,7 +8,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -8,7 +8,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -10,7 +10,7 @@ set BugNumber OCC8842
cpulimit 500 cpulimit 500
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -8,7 +8,7 @@ puts ""
set BugNumber OCC8842 set BugNumber OCC8842
if {[info commands testreadiges] == ""} {pload XSDRAW} pload XSDRAW IGES
proc myoffset {result sh val tan} { proc myoffset {result sh val tan} {
if {$tan == 1} { if {$tan == 1} {

View File

@@ -6,7 +6,7 @@ puts ""
# BRepBuilderAPI_Sewing can crash if an edge without 3D curve is presented # BRepBuilderAPI_Sewing can crash if an edge without 3D curve is presented
########################################################################### ###########################################################################
pload XSDRAW pload XSDRAW IGES
igesread [locate_data_file bug25175_3.igs] a * igesread [locate_data_file bug25175_3.igs] a *

View File

@@ -6,7 +6,7 @@ puts ""
# Tool for extended check of validity of the curve on the surface # Tool for extended check of validity of the curve on the surface
###################################################### ######################################################
pload XSDRAW pload XSDRAW IGES
testreadiges [locate_data_file bug25410_Tank8.igs] b1 testreadiges [locate_data_file bug25410_Tank8.igs] b1

View File

@@ -3,7 +3,7 @@ puts "0030595: Oriented Bounding Box seems not optimal for some shapes"
puts "===============================================================" puts "==============================================================="
puts "" puts ""
pload XSDRAW pload XSDRAW STEP
stepread [locate_data_file bug30595_UC1.stp] s * stepread [locate_data_file bug30595_UC1.stp] s *
incmesh s_1 0.1 incmesh s_1 0.1

View File

@@ -3,7 +3,7 @@ puts "0030829: BRepExtrema_ShapeProximity crashes with shape from STL/WRL"
puts "========" puts "========"
puts "" puts ""
pload XSDRAW pload XSDRAW STL
box b 10 10 10 box b 10 10 10
pcylinder c 5 10 pcylinder c 5 10

View File

@@ -3,7 +3,7 @@ puts "0033165: Data exchange - Instance name is not saved during writing step fi
puts "====================================" puts "===================================="
puts "" puts ""
pload OCAF XDEDRAW pload OCAF XDEDRAW STEP
box b 1 1 1 box b 1 1 1
reset b reset b

View File

@@ -1,3 +1,3 @@
pload XSDRAW pload XSDRAW STL VRML
set subgroup stlvrml set subgroup stlvrml