return false;
}
+//=======================================================================
+// function : IsExportSupported
+// purpose :
+//=======================================================================
+bool DE_ConfigurationNode::IsStreamSupported() const
+{
+ return false;
+}
+
//=======================================================================
// function : CheckForSupport
// purpose :
//! @return Standard_True if export is support
Standard_EXPORT virtual bool IsExportSupported() const;
+ //! Checks the stream for import/export supporting
+ //! @return Standard_True if stream is support
+ Standard_EXPORT virtual bool IsStreamSupported() const;
+
//! Gets CAD format name of associated provider
//! @return provider CAD format
Standard_EXPORT virtual TCollection_AsciiString GetFormat() const = 0;
//! Gets the provider loading status
//! @return Standard_True if the load is correct
- Standard_Boolean IsEnabled() const
- {
- return myIsEnabled;
- }
+ Standard_Boolean IsEnabled() const { return myIsEnabled; }
//! Sets the provider loading status
//! @param[in] theIsLoaded input load status
- void SetEnabled(const Standard_Boolean theIsLoaded)
- {
- myIsEnabled = theIsLoaded;
- }
+ void SetEnabled(const Standard_Boolean theIsLoaded) { myIsEnabled = theIsLoaded; }
public:
#include <DE_Provider.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 <stdio.h>
+
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
// purpose :
(void)theWS;
(void)theProgress;
Message::SendFail() << "Error: provider " << GetFormat() <<
- " " << GetVendor() <<" doesn't support read operation";
+ " " << GetVendor() << " doesn't support read operation";
return Standard_False;
}
+//=======================================================================
+// function : Read
+// purpose :
+//=======================================================================
+bool DE_Provider::Read(std::istream& theIStream,
+ const Handle(TDocStd_Document)& theDocument,
+ const TCollection_AsciiString theName,
+ Handle(XSControl_WorkSession)& theWS,
+ const Message_ProgressRange& theProgress)
+{
+ (void)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
// purpose :
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
// purpose :
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
// purpose :
" " << GetVendor() << " doesn't support write operation";
return Standard_False;
}
+
+//=======================================================================
+// function : Write
+// purpose :
+//=======================================================================
+bool DE_Provider::Write(std::ostream& theOStream,
+ const TopoDS_Shape& theShape,
+ Handle(XSControl_WorkSession)& theWS,
+ const Message_ProgressRange& theProgress)
+{
+ 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;
+}
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return True if Read was successful
- Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
- const Handle(TDocStd_Document)& theDocument,
- Handle(XSControl_WorkSession)& theWS,
- const Message_ProgressRange& theProgress = Message_ProgressRange());
+ Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
+ const Handle(TDocStd_Document)& theDocument,
+ Handle(XSControl_WorkSession)& theWS,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
+
+ //! Reads a CAD file, according internal configuration
+ //! @param[in] theIStream stream to import CAD data
+ //! @param[out] theDocument document to save result
+ //! @paramp[in] theName name of CAD file, can be empty
+ //! @param[in] theWS current work session
+ //! @param theProgress[in] progress indicator
+ //! @return true if Read operation has ended correctly
+ Standard_EXPORT virtual bool Read(std::istream& theIStream,
+ const Handle(TDocStd_Document)& theDocument,
+ const TCollection_AsciiString theName,
+ Handle(XSControl_WorkSession)& theWS,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Writes a CAD file, according internal configuration
//! @param[in] thePath path to the export CAD file
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return True if Write was successful
- Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
- const Handle(TDocStd_Document)& theDocument,
- Handle(XSControl_WorkSession)& theWS,
- const Message_ProgressRange& theProgress = Message_ProgressRange());
+ 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,
+ Handle(XSControl_WorkSession)& theWS,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Reads a CAD file, according internal configuration
//! @param[in] thePath path to the import CAD file
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return True if Read was successful
- Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
- TopoDS_Shape& theShape,
- Handle(XSControl_WorkSession)& theWS,
- const Message_ProgressRange& theProgress = Message_ProgressRange());
+ Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
+ TopoDS_Shape& theShape,
+ Handle(XSControl_WorkSession)& theWS,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
+
+ //! Reads a CAD file, according internal configuration
+ //! @param[in] theIStream stream to the CAD file
+ //! @param[out] theShape shape to save result
+ //! @paramp[in] theName name of CAD file, can be empty
+ //! @param[in] theWS current work session
+ //! @param theProgress[in] progress indicator
+ //! @return true if Read operation has ended correctly
+ Standard_EXPORT virtual bool Read(std::istream& theIStream,
+ TopoDS_Shape& theShape,
+ const TCollection_AsciiString theName,
+ Handle(XSControl_WorkSession)& theWS,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Writes a CAD file, according internal configuration
//! @param[in] thePath path to the export CAD file
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return True if Write was successful
- Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
- const TopoDS_Shape& theShape,
- Handle(XSControl_WorkSession)& theWS,
- const Message_ProgressRange& theProgress = Message_ProgressRange());
+ 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,
+ Handle(XSControl_WorkSession)& theWS,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
public:
//! Gets internal configuration node
//! @return configuration node object
- Handle(DE_ConfigurationNode) GetNode() const
- {
- return myNode;
- }
+ Handle(DE_ConfigurationNode) GetNode() const { return myNode; }
//! Sets internal configuration node
//! @param[in] theNode configuration node to set
- void SetNode(const Handle(DE_ConfigurationNode)& theNode)
- {
- myNode = theNode;
- }
+ void SetNode(const Handle(DE_ConfigurationNode)& theNode) { myNode = theNode; }
+
+ //! 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:
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
DATAEXCHANGEKERNEL : XSDRAW
OCAF : VISUALIZATION, OCAFKERNEL
DATAEXCHANGE : XDE, VISUALIZATION
-XDE : DATAEXCHANGEKERNEL, XDEDRAW
+XDE : DATAEXCHANGEKERNEL, XDEDRAW, STEP, IGES, GLTF, OBJ, PLY, STL, VRML
ALL : MODELING, OCAFKERNEL, DATAEXCHANGE
TOPTEST : TKTopTest
QAcommands : TKQADraw
VIS : TKIVtkDraw
INSPECTOR : TKToolsDraw
+STEP : TKXSDRAWSTEP
+IGES : TKXSDRAWIGES
+GLTF : TKXSDRAWGLTF
+OBJ : TKXSDRAWOBJ
+PLY : TKXSDRAWPLY
+STL : TKXSDRAWSTL
+VRML : TKXSDRAWVRML
#include <BRepLib.hxx>
#include <IFSelect_CheckCounter.hxx>
-#include <IFSelect_Functions.hxx>
#include <IGESControl_Controller.hxx>
#include <IGESControl_Reader.hxx>
#include <IGESData_FileProtocol.hxx>
#include <IGESSelect.hxx>
-#include <IFSelect_Functions.hxx>
#include <IFSelect_SessionPilot.hxx>
#include <IFSelect_ShareOut.hxx>
#include <IFSelect_WorkSession.hxx>
void IGESSelect::Run ()
{
-// Handle(IFSelect_BasicActivator) Activator = new IFSelect_BasicActivator;
- IFSelect_Functions::Init();
Handle(IFSelect_SessionPilot) pilot = new IFSelect_SessionPilot("XSTEP-IGES>");
Handle(IGESSelect_Activator) igesact = new IGESSelect_Activator;
pilot->SetSession (new IFSelect_WorkSession ( ));
#include <Message.hxx>
#include <STEPControl_Controller.hxx>
#include <StepData_StepModel.hxx>
+#include <STEPControl_ActorWrite.hxx>
#include <STEPCAFControl_ConfigurationNode.hxx>
#include <STEPCAFControl_Controller.hxx>
#include <STEPCAFControl_Reader.hxx>
personizeWS(theWS);
STEPControl_Writer aWriter(theWS, Standard_True);
Handle(StepData_StepModel) aModel = aWriter.Model();
+ Standard_Integer aNbEntities = (aModel.IsNull() ? 0 : aModel->NbEntities());
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(
aNode->InternalParameters.WriteUnit,
UnitsMethods_LengthUnit_Millimeter));
IFSelect_ReturnStatus aWritestat =
aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress);
+ if (aNbEntities > 0)
+ {
+ Message::SendTrace() << "STEPCAFControl_Provider : Model not empty before transferring";
+ }
if (aWritestat != IFSelect_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
resetStatic();
return false;
}
+ if (thePath == ".")
+ {
+ resetStatic();
+ Message::SendInfo() << "Step model has been translated into the session";
+ return true;
+ }
if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
personizeWS(theWS);
STEPControl_Writer aWriter(theWS, Standard_True);
Handle(StepData_StepModel) aModel = aWriter.Model();
+ Standard_Integer aNbEntities = (aModel.IsNull() ? 0 : aModel->NbEntities());
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(
aNode->InternalParameters.WriteUnit,
UnitsMethods_LengthUnit_Millimeter));
IFSelect_ReturnStatus aWritestat =
aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress);
+ if (aNbEntities > 0)
+ {
+ Message::SendTrace() << "STEPCAFControl_Provider : Model not empty before transferring";
+ }
if (aWritestat != IFSelect_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
TKDCAF
TKXCAF
TKRWMesh
+TKXSDRAWBase
\ No newline at end of file
XSDRAW
-XSDRAWIGES
-XSDRAWSTEP
-XSDRAWSTLVRML
TKDCAF
TKXCAF
TKRWMesh
+TKXSBase
+TKXDE
+TKXSDRAWBase
\ No newline at end of file
TKDCAF
TKXCAF
TKRWMesh
+TKXSDRAWBase
\ No newline at end of file
TKDCAF
TKXCAF
TKRWMesh
+TKXSBase
+TKXDEIGES
+TKXSDRAWBase
\ No newline at end of file
TKDCAF
TKXCAF
TKRWMesh
+TKXSDRAWBase
\ No newline at end of file
TKDCAF
TKXCAF
TKRWMesh
+TKXSDRAWBase
\ No newline at end of file
TKDCAF
TKXCAF
TKRWMesh
+TKXSBase
+TKXDESTEP
+TKXSDRAWBase
\ No newline at end of file
TKDCAF
TKXCAF
TKRWMesh
+TKXSDRAWBase
\ No newline at end of file
TKDCAF
TKXCAF
TKRWMesh
+TKXSDRAWBase
\ No newline at end of file
return 0;
}
-
//=======================================================================
//function : saveDoc
//purpose :
return 0;
}
-
//=======================================================================
//function : StatAssembly
//purpose : recursive part of statistics
}
-
//=======================================================================
//function : statdoc
//purpose :
return 0;
}
-
//=======================================================================
//function : setPrs
//purpose :
return 0;
}
-
//=======================================================================
//function : show
//purpose :
return 0;
}
-
//=======================================================================
//function : XAttributeValue
//purpose :
return 0;
}
-
//=======================================================================
//function : setviewName
//purpose :
return 0;
}
-
//=======================================================================
//function : getviewName
//purpose : auxiliary
return 0;
}
-
//=======================================================================
//function : XSetTransparency
//purpose :
return 0;
}
-
//=======================================================================
//function : Init
//purpose :
XDEDRAW_Views::InitCommands(di);
XDEDRAW_Notes::InitCommands(di);
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
//==============================================================================
void XDEDRAW::Factory(Draw_Interpretor& theDI)
{
- XSDRAWIGES::InitSelect();
- XSDRAWIGES::InitToBRep(theDI);
- XSDRAWIGES::InitFromBRep(theDI);
-
- XSDRAWSTEP::InitCommands(theDI);
-
- XSDRAW::LoadDraw(theDI);
-
XDEDRAW::Init(theDI);
#ifdef OCCT_DEBUG
#include <Draw_Interpretor.hxx>
-
//! Provides DRAW commands for work with DECAF data structures
class XDEDRAW
{
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
#include <DBRep.hxx>
#include <DDocStd.hxx>
#include <Draw.hxx>
#include <XSAlgo_AlgoContainer.hxx>
#include <XSControl_WorkSession.hxx>
#include <XSDRAW.hxx>
+#include <XSDRAWBase.hxx>
#include <Vrml_ConfigurationNode.hxx>
#include <Vrml_Provider.hxx>
#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
//purpose : Set current file if many files are read
Standard_Integer theNbArgs,
const char** theArgVec)
{
- if (theNbArgs < 2)
- {
- theDI << "Use: " << theArgVec[0] << " filename \n";
- return 1;
- }
- const TCollection_AsciiString aSessionName(theArgVec[1]);
- Handle(XSControl_WorkSession) aSession;
- if (!THE_PREVIOUS_WORK_SESSIONS.Find(aSessionName, aSession))
- {
- TCollection_AsciiString aWSs;
- for (XSControl_WorkSessionMap::Iterator anIter(THE_PREVIOUS_WORK_SESSIONS);
- anIter.More(); anIter.Next())
- {
- aWSs += "\"";
- aWSs += anIter.Key();
- aWSs += "\"\n";
- }
- theDI << "Error: Can't find active session. Active sessions list:\n" << aWSs;
- return 1;
- }
- XSDRAW::Pilot()->SetSession(aSession);
+ //if (theNbArgs < 2)
+ //{
+ // theDI << "Use: " << theArgVec[0] << " filename \n";
+ // return 1;
+ //}
+ //const TCollection_AsciiString aSessionName(theArgVec[1]);
+ //Handle(XSControl_WorkSession) aSession;
+ //if (!THE_PREVIOUS_WORK_SESSIONS.Find(aSessionName, aSession))
+ //{
+ // TCollection_AsciiString aWSs;
+ // for (XSControl_WorkSessionMap::Iterator anIter(THE_PREVIOUS_WORK_SESSIONS);
+ // anIter.More(); anIter.Next())
+ // {
+ // aWSs += "\"";
+ // aWSs += anIter.Key();
+ // aWSs += "\"\n";
+ // }
+ // theDI << "Error: Can't find active session. Active sessions list:\n" << aWSs;
+ // return 1;
+ //}
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
- (void)theNbArgs;
- (void)theArgVec;
- Message::SendInfo() << "Active sessions list:";
- TCollection_AsciiString aWSs;
- for (XSControl_WorkSessionMap::Iterator anIter(THE_PREVIOUS_WORK_SESSIONS);
- anIter.More(); anIter.Next())
- {
- theDI << "\"" << anIter.Key() << "\"\n";
- }
+ //(void)theNbArgs;
+ //(void)theArgVec;
+ //Message::SendInfo() << "Active sessions list:";
+ //TCollection_AsciiString aWSs;
+ //for (XSControl_WorkSessionMap::Iterator anIter(THE_PREVIOUS_WORK_SESSIONS);
+ // anIter.More(); anIter.Next())
+ //{
+ // theDI << "\"" << anIter.Key() << "\"\n";
+ //}
return 0;
}
{
(void)theNbArgs;
(void)theArgVec;
- Handle(XSControl_WorkSession) WS = XSDRAW::Session();
+ Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
theDI << "\"" << WS->LoadedFile() << "\"";
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
//purpose : Apply fromshape command to all the loaded WSs
Standard_Integer theNbArgs,
const char** theArgVec)
{
- if (theNbArgs < 2)
- {
- theDI << theArgVec[0] << " shape: search for shape origin among all last tranalated files\n";
- return 0;
- }
+ //if (theNbArgs < 2)
+ //{
+ // theDI << theArgVec[0] << " shape: search for shape origin among all last tranalated files\n";
+ // return 0;
+ //}
- char command[256];
- Sprintf(command, "fromshape %.200s -1", theArgVec[1]);
- XSControl_WorkSessionMap DictWS = THE_PREVIOUS_WORK_SESSIONS;
- if (DictWS.IsEmpty())
- return theDI.Eval(command);
-
- Handle(XSControl_WorkSession) WS = XSDRAW::Session();
- for (XSControl_WorkSessionMap::Iterator DicIt(DictWS);
- DicIt.More(); DicIt.Next())
- {
- Handle(XSControl_WorkSession) CurrentWS = DicIt.Value();
- XSDRAW::Pilot()->SetSession(CurrentWS);
- theDI.Eval(command);
- }
+ //char command[256];
+ //Sprintf(command, "fromshape %.200s -1", theArgVec[1]);
+ //XSControl_WorkSessionMap DictWS = THE_PREVIOUS_WORK_SESSIONS;
+ //if (DictWS.IsEmpty())
+ // return theDI.Eval(command);
- XSDRAW::Pilot()->SetSession(WS);
+ //Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+ //for (XSControl_WorkSessionMap::Iterator DicIt(DictWS);
+ // DicIt.More(); DicIt.Next())
+ //{
+ // Handle(XSControl_WorkSession) CurrentWS = DicIt.Value();
+ // theDI.Eval(command);
+ //}
return 0;
}
#include <BRep_Tool.hxx>
-
static Standard_Integer DumpDGTs (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc < 3) {
return 0;
}
-
static Standard_Integer getDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc < 3) {
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
#include <DBRep.hxx>
#include <DDocStd.hxx>
#include <Draw.hxx>
return 0;
}
-
static Standard_Integer setLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc<4) {
return 0;
}
-
static Standard_Integer getLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc!=3) {
return 0;
}
-
static Standard_Integer getLayerLabels (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc!=2) {
return 0;
}
-
static Standard_Integer getOneLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc!=3) {
return 0;
}
-
static Standard_Integer setLinkLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc<4) {
return 0;
}
-
static Standard_Integer getAllLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc!=2) {
return 0;
}
-
static Standard_Integer unSetLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc!=4) {
return 0;
}
-
static Standard_Integer unSetAllLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc!=3) {
return 0;
}
-
static Standard_Integer removeAllLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc!=2) {
return 0;
}
-
static Standard_Integer isVisible (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc!=3) {
return (-curVolume);
}
-
//=======================================================================
//function : TetraCen
//purpose : auxiliary
return curCentr;
}
-
//=======================================================================
//function : CalculVolume
//purpose : auxiliary
return (myVolume);
}
-
// --------------------- VolumeFix End ---
-
//=======================================================================
// Section: Work with val props
//=======================================================================
return 0;
}
-
//=======================================================================
//function : SetVolume
//purpose :
return 0;
}
-
//=======================================================================
//function : SetArea
//purpose :
return 0;
}
-
//=======================================================================
//function : SetCentroid
//purpose :
return 0;
}
-
//=======================================================================
//function : GetVolume
//purpose :
return 0;
}
-
//=======================================================================
//function : GetArea
//purpose :
return 0;
}
-
//=======================================================================
//function : GetCentroid
//purpose :
return 0;
}
-
//=======================================================================
//function : ShapeVolume
//purpose :
return 0;
}
-
//=======================================================================
//function : GetMassProps
//purpose : auxiliary for ShapeMassProps
return Standard_True;
}
-
//=======================================================================
//function : ShapeMassProps
//purpose :
return 0;
}
-
//=======================================================================
//function : SetMaterial
//purpose :
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
#include <BRep_Builder.hxx>
#include <DBRep.hxx>
#include <DDocStd.hxx>
return 0;
}
-
static Standard_Integer addSubShape(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (argc != 4) {
return 0;
}
-
//=======================================================================
//function : setClippingPlanes
//purpose :
//: gka 14.04.99: S4136: apply scaling
#include <BRep_Builder.hxx>
-#include <IFSelect_Functions.hxx>
#include <Interface_ShareFlags.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
XSDRAW_FunctionsSession.cxx
XSDRAW_FunctionsSession.hxx
XSDRAW_FunctionsShape.cxx
-XSDRAW_FunctionsShape.hxx
\ No newline at end of file
+XSDRAW_FunctionsShape.hxx
// Alternatively, this file may be used under the terms of Open CASCADE
// 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_Vars.hxx>
-
-#include <iostream>
-#include <string>
-//#include <XSDRAW_Shape.hxx>
-static int deja = 0, dejald = 0;
-//unused variable
-//static int okxset = 0;
-
-static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> theolds;
-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;
- for (Standard_Integer i = 0; i < argc; i ++) {
- 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;
-}
+#include <Draw_PluginMacro.hxx>
+#include <XSDRAW_Functions.hxx>
+#include <XSDRAW_FunctionsSession.hxx>
+#include <XSDRAW_FunctionsShape.hxx>
-void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
+void XSDRAW::Factory(Draw_Interpretor& theDI)
{
- if (dejald)
+ static Standard_Boolean initactor = Standard_False;
+ if (initactor)
{
return;
}
- dejald = 1;
-// Pour tout faire d un coup : BRepTest & cie:
- LoadSession();
-
- //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;
- Handle(IFSelect_Activator) anAct;
- 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);
+ initactor = Standard_True;
+ XSDRAW_Functions::Init(theDI);
+ XSDRAW_FunctionsSession::Init(theDI);
+ XSDRAW_FunctionsShape::Init(theDI);
}
-
- 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);
-}
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAW)
DEFINE_STANDARD_ALLOC
public:
- Standard_EXPORT static void Init();
-
//! Loads all Draw commands of XSDRAWDEWrapper. Used for plugin.
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
#include <Transfer_TransientProcess.hxx>
#include <XSControl.hxx>
#include <XSControl_Controller.hxx>
+#include <XSDRAW.hxx>
#include <XSDRAWBase.hxx>
#include <XSControl_SelectForTransfer.hxx>
#include <XSControl_TransferReader.hxx>
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
if (theNbArgs != 2 && theNbArgs != 1)
{
- theDI << "Error:";
+ aSSC.SStream() << "Error:";
return 1;
}
if (theNbArgs > 1)
{
- if (!XSDRAWBase::Session()->SelectNorm(theArgVec[1]));
+ if (!XSDRAWBase::Session()->SelectNorm(theArgVec[1]))
{
- theDI << "Error:";
+ aSSC.SStream() << "Error:";
return 1;
}
}
else
{
- Message::SendInfo() << "Selected Norm:";
- theDI << XSDRAWBase::Session()->SelectedNorm() << "\n";
+ aSSC.SStream() << "Selected Norm:";
+ aSSC.SStream() << XSDRAWBase::Session()->SelectedNorm() << "\n";
}
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
Handle(XSControl_Controller) control = WS->NormAdaptor();
if (theNbArgs == 1)
{
- Message::SendInfo() << "Current Norm. xnorm newnorm to change";
+ aSSC.SStream() << "Current Norm. xnorm newnorm to change";
}
else
{
- Message::SendInfo() << "Selected Norm:";
+ aSSC.SStream() << "Selected Norm:";
}
if (control.IsNull())
{
- Message::SendInfo() << "no norm currently defined";
+ aSSC.SStream() << "no norm currently defined";
}
else
{
- Message::SendInfo() << " Long Name (complete) : "
+ aSSC.SStream() << " Long Name (complete) : "
<< control->Name(Standard_False)
<< " Short name (resource) : " << control->Name(Standard_True);
}
control = XSControl_Controller::Recorded(theArgVec[1]);
if (control.IsNull())
{
- Message::SendInfo() << " No norm named : " << theArgVec[1];
+ aSSC.SStream() << " No norm named : " << theArgVec[1];
return 1;
}
WS->SetController(control);
- Message::SendInfo() << "new norm : " << control->Name();
+ aSSC.SStream() << "new norm : " << control->Name();
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
- if (!XSDRAWBase::Session()->NewModel().IsNull())
- {
- return 0;
- }
- Message::SendInfo() << "No new Model produced";
- return 1;
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
+ return 0;
}
//=======================================================================
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
const Standard_Boolean modew = (theArgVec[0][2] == 'w');
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(Transfer_FinderProcess)& FP =
if (modew)
{
if (!FP.IsNull()) FP->Clear();
- else Message::SendInfo() << "No Transfer Write";
+ else aSSC.SStream() << "No Transfer Write";
}
else
{
if (!TP.IsNull())
TP->Clear();
else
- Message::SendInfo() << "No Transfer Read";
+ aSSC.SStream() << "No Transfer Read";
}
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
const Standard_CString arg1 = theArgVec[1];
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(Transfer_TransientProcess)& TP =
WS->TransferReader()->TransientProcess();
if (TP.IsNull())
{
- Message::SendInfo() << "No Transfer Read";
+ aSSC.SStream() << "No Transfer Read";
return 1;
}
// **** tpstat ****
}
// A present help eventuel
if (mod1 < -1)
- Message::SendInfo() << "Unknown Mode";
+ aSSC.SStream() << "Unknown Mode";
if (mod1 < 0)
{
- Message::SendInfo() << "Modes available :\n"
+ aSSC.SStream() << "Modes available :\n"
<< "g : general c : checks (count) C (list)\n"
<< " f : fails (count) F (list)\n"
<< " n : numbers of transferred entities (on TRANSFER ROOTS)\n"
if (!TP.IsNull())
{
- Message::SendInfo() << "TransferRead :";
- if (TP->Model() != WS->Model()) Message::SendInfo() << "Model differs from the session";
+ aSSC.SStream() << "TransferRead :";
+ if (TP->Model() != WS->Model()) aSSC.SStream() << "Model differs from the session";
Handle(TColStd_HSequenceOfTransient) list =
- IFSelect_Functions::GiveList(WS, pilot->CommandPart(2));
+ WS->GiveList(theArgVec[2]);
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;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
const Standard_CString arg1 = theArgVec[1];
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(Transfer_TransientProcess)& TP =
// **** tpent ****
if (TP.IsNull())
{
- Message::SendInfo() << "No Transfer Read";
+ aSSC.SStream() << "No Transfer Read";
return 1;
}
Handle(Interface_InterfaceModel) model = TP->Model();
if (theNbArgs < 2)
{
- Message::SendInfo() << "Give ENTITY NUMBER (IN MODEL TransferProcess)";
+ aSSC.SStream() << "Give ENTITY NUMBER (IN MODEL TransferProcess)";
return 1;
}
Standard_Integer num = atoi(arg1);
if (num <= 0 || num > model->NbEntities())
{
- Message::SendInfo() << "Number not in [1 - "
+ aSSC.SStream() << "Number not in [1 - "
<< model->NbEntities() << "]";
return 1;
}
Handle(Standard_Transient) ent = model->Value(num);
Standard_Integer index = TP->MapIndex(ent);
if (index == 0)
- Message::SendInfo() << "Entity " << num << " not recorded in transfer";
+ aSSC.SStream() << "Entity " << num << " not recorded in transfer";
else
- WS->PrintTransferStatus(index, Standard_False, Message::SendInfo());
+ WS->PrintTransferStatus(index, Standard_False, aSSC.SStream());
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
const Standard_CString arg1 = theArgVec[1];
// **** tpitem/tproot/twitem/twroot ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Give ITEM NUMBER (in TransferProcess)";
+ aSSC.SStream() << "Give ITEM NUMBER (in TransferProcess)";
return 1;
}
Standard_Integer num = atoi(arg1);
Handle(Transfer_Binder) binder;
Handle(Transfer_Finder) finder;
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;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
const Standard_CString arg1 = theArgVec[1];
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(Transfer_TransientProcess)& TP = WS->TransferReader()->TransientProcess();
Handle(Standard_Transient) ent;
if (mdl.IsNull() || TR.IsNull() || TP.IsNull())
{
- Message::SendInfo() << " init not done";
+ aSSC.SStream() << " init not done";
return 1;
}
if (!tous)
if (tous)
{
Standard_Integer nb = TP->NbRoots();
- Message::SendInfo() << " Recording " << nb << " Roots";
+ aSSC.SStream() << " Recording " << nb << " Roots";
for (Standard_Integer i = 1; i <= nb; i++)
{
ent = TP->Root(i);
if (TR->RecordResult(ent))
- Message::SendInfo() << " Root n0." << i;
+ aSSC.SStream() << " Root n0." << i;
else
- Message::SendInfo() << " Root n0." << i << " not recorded";
+ aSSC.SStream() << " Root n0." << i << " not recorded";
}
}
else
{
if (num < 1 || num > mdl->NbEntities())
- Message::SendInfo() << "incorrect number:" << num;
+ aSSC.SStream() << "incorrect number:" << num;
else if (TR->RecordResult(mdl->Value(num)))
- Message::SendInfo() << " Entity n0." << num;
+ aSSC.SStream() << " Entity n0." << num;
else
- Message::SendInfo() << " Entity n0." << num << " not recorded";
+ aSSC.SStream() << " Entity n0." << num << " not recorded";
}
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
const Standard_CString arg1 = theArgVec[1];
// **** trstat : TransferReader ****
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(XSControl_TransferReader)& TR = WS->TransferReader();
if (TR.IsNull())
{
- Message::SendInfo() << " init not done";
+ aSSC.SStream() << " init not done";
return 1;
}
Handle(Interface_InterfaceModel) mdl = TR->Model();
if (mdl.IsNull())
{
- Message::SendInfo() << " No model";
+ aSSC.SStream() << " No model";
return 1;
}
- Message::SendInfo() << " Statistics : FileName : " << TR->FileName();
+ aSSC.SStream() << " Statistics : FileName : " << TR->FileName();
if (theNbArgs == 1)
{
// stats generales
- TR->PrintStats(Message::SendInfo(), 10, 0);
+ TR->PrintStats(aSSC.SStream(), 10, 0);
}
else
{
Standard_Integer num = atoi(arg1);
if (num < 1 || num > mdl->NbEntities())
{
- Message::SendInfo() << " incorrect number:" << arg1;
+ aSSC.SStream() << " incorrect number:" << arg1;
return 1;
}
Handle(Standard_Transient) ent = mdl->Value(num);
if (!TR->IsRecorded(ent))
{
- Message::SendInfo() << " Entity " << num << " not recorded";
+ aSSC.SStream() << " Entity " << num << " not recorded";
return 1;
}
Handle(Transfer_ResultFromModel) RM = TR->FinalResult(ent);
Handle(TColStd_HSequenceOfTransient) list = TR->CheckedList(ent);
Standard_Integer i, nb = list->Length();
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++)
{
- Message::SendInfo() << " "; mdl->Print(list->Value(i), Message::SendInfo());
+ aSSC.SStream() << " "; mdl->Print(list->Value(i), aSSC.SStream());
}
if (RM.IsNull())
{
- Message::SendInfo() << " no other info";
+ aSSC.SStream() << " no other info";
return 0;
}
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;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
// **** trbegin : TransferReader ****
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
Handle(XSControl_TransferReader) TR = WS->TransferReader();
TR = WS->TransferReader();
if (TR.IsNull())
{
- Message::SendInfo() << " init not done or failed";
+ aSSC.SStream() << " init not done or failed";
return 1;
}
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
- Standard_Integer theNbArgs = theNbArgs;
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
//const Standard_CString arg1 = pilot->Arg(1);
// **** tread : TransferReader ****
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
Handle(XSControl_TransferReader) TR = WS->TransferReader();
if (TR.IsNull())
{
- Message::SendInfo() << " init not done";
+ aSSC.SStream() << " init not done";
return 1;
}
const Handle(Interface_InterfaceModel)& mdl = TR->Model();
if (mdl.IsNull())
{
- Message::SendInfo() << " No model";
+ aSSC.SStream() << " No model";
return 1;
}
if (theNbArgs < 2)
Handle(Standard_Transient) sel = WS->NamedItem("xst-model-roots");
if (sel.IsNull())
{
- Message::SendInfo() << "Select Roots absent";
+ aSSC.SStream() << "Select Roots absent";
return 1;
}
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
{
Handle(TColStd_HSequenceOfTransient) list =
- IFSelect_Functions::GiveList(WS, pilot->CommandPart(1));
- Message::SendInfo() << " Transfer of " << list->Length() << " entities";
+ WS->GiveList(theArgVec[1]);
+ aSSC.SStream() << " Transfer of " << list->Length() << " entities";
Standard_Integer nb = TR->TransferList(list);
- Message::SendInfo() << " Gives " << nb << " results";
+ aSSC.SStream() << " Gives " << nb << " results";
}
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
// **** TReader -> TProcess ****
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(XSControl_TransferReader)& TR = WS->TransferReader();
if (TR.IsNull())
- Message::SendInfo() << " No TransferReader";
+ aSSC.SStream() << " No TransferReader";
else if (TR->TransientProcess().IsNull())
- Message::SendInfo() << " Transfer Reader without Process";
+ aSSC.SStream() << " Transfer Reader without Process";
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
// **** TProcess -> TReader ****
XSDRAWBase::Session()->InitTransferReader(3);
return 0;
Standard_Integer theNbArgs,
const char** theArgVec)
{
- Standard_Integer theNbArgs = theNbArgs;
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
const Standard_CString arg1 = theArgVec[1];
// **** twmode ****
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
Standard_Integer 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++)
{
- 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)
return 0;
Standard_Integer mod = atoi(arg1);
- Message::SendInfo() << "New value -> " << arg1;
+ aSSC.SStream() << "New value -> " << arg1;
TW->SetTransferMode(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;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
- //Standard_Integer theNbArgs = theNbArgs;
- //const Standard_CString arg1 = pilot->Arg(1);
- //const Standard_CString arg2 = pilot->Arg(2);
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Handle(Transfer_FinderProcess)& FP = WS->TransferWriter()->FinderProcess();
// **** twstat ****
// Pour Write
if (!FP.IsNull())
{
- Message::SendInfo() << "TransferWrite:";
+ aSSC.SStream() << "TransferWrite:";
// XSControl_TransferWriter::PrintStatsProcess (FP,mod1,mod2);
- FP->PrintStats(1, Message::SendInfo());
+ FP->PrintStats(1, aSSC.SStream());
}
else
- Message::SendInfo() << "TransferWrite: not defined";
+ aSSC.SStream() << "TransferWrite: not defined";
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
//purpose :
"displays mode transfer write, + num changes it", __FILE__, XSControl_twmode, aGroup);
theDI.Add("twstat",
"Statistics on TransferProcess (WRITE)", __FILE__, XSControl_twstat, aGroup);
-
- theDI.Add("selecttransfer",
- "selection (recognize from transfer actor)", __FILE__, XSControl_settransfert);
}
#include <TColStd_HSequenceOfAsciiString.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
+#include <XSDRAW.hxx>
#include <XSDRAWBase.hxx>
-//=======================================================================
-//function : SplitFileName
-//purpose : Decomposition of a file name in its parts : prefix, root, suffix
-//=======================================================================
-static void SplitFileName(const Standard_CString filename,
- TCollection_AsciiString& prefix,
- TCollection_AsciiString& fileroot,
- TCollection_AsciiString& suffix)
-{
- Standard_Integer nomdeb, nomfin, nomlon;
- TCollection_AsciiString resfile(filename);
- nomlon = resfile.Length();
- nomdeb = resfile.SearchFromEnd("/");
- if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\"); // pour NT
- if (nomdeb < 0) nomdeb = 0;
- nomfin = resfile.SearchFromEnd(".");
- if (nomfin < nomdeb) nomfin = nomlon + 1;
-
- if (nomdeb > 0) prefix = resfile.SubString(1, nomdeb);
- fileroot = resfile.SubString(nomdeb + 1, nomfin - 1);
- if (nomfin <= nomlon) suffix = resfile.SubString(nomfin, nomlon);
-}
-
//=======================================================================
//function : GiveList
//purpose :
// Or a name of dispatch + a parameter : dispatch-name(param-value)
// According to type of Dispatch : integer , signature name
-//=======================================================================
-//function : GiveDispatch
-//purpose :
-//=======================================================================
-Handle(IFSelect_Dispatch) GiveDispatch(const Handle(XSControl_WorkSession)& WS,
- const Standard_CString name,
- const Standard_Boolean mode)
-{
- DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(name));
- if (!disp.IsNull()) return disp; // OK as it is given
-
-// Else, let s try special cases
- TCollection_AsciiString nam(name);
- Standard_Integer paro = nam.Location(1, '(', 1, nam.Length());
- Standard_Integer parf = nam.Location(1, ')', 1, nam.Length());
- nam.SetValue(paro, '\0'); nam.SetValue(parf, '\0');
- if (paro <= 0 && parf <= 0) return disp;
- disp = GetCasted(IFSelect_Dispatch, WS->NamedItem(nam.ToCString()));
- if (disp.IsNull()) return disp; // KO anyway
-
-// According to the type of dispatch :
- DeclareAndCast(IFSelect_DispPerCount, dc, disp);
- if (!dc.IsNull())
- {
- Standard_Integer nb = atoi(&(nam.ToCString())[paro]);
- if (nb <= 0)
- {
- Message::SendInfo() << " DispPerCount, count is not positive";
- disp.Nullify();
- return disp;
- }
- if (mode)
- {
- Handle(IFSelect_IntParam) val = new IFSelect_IntParam;
- val->SetValue(nb);
- dc->SetCount(val);
- }
- return dc;
- }
- DeclareAndCast(IFSelect_DispPerFiles, dp, disp);
- if (!dp.IsNull())
- {
- Standard_Integer nb = atoi(&(nam.ToCString())[paro]);
- if (nb <= 0)
- {
- Message::SendInfo() << " DispPerFiles, count is not positive";
- disp.Nullify();
- return disp;
- }
- if (mode)
- {
- Handle(IFSelect_IntParam) val = new IFSelect_IntParam;
- val->SetValue(nb);
- dp->SetCount(val);
- }
- return dp;
- }
- DeclareAndCast(IFSelect_DispPerSignature, ds, disp);
- if (!ds.IsNull())
- {
- DeclareAndCast(IFSelect_Signature, sg, WS->NamedItem(&(nam.ToCString())[paro]));
- if (sg.IsNull())
- {
- Message::SendInfo() << "DispPerSignature " << nam << " , Signature not valid : " << &(nam.ToCString())[paro];
- disp.Nullify();
- return disp;
- }
- if (mode) ds->SetSignCounter(new IFSelect_SignCounter(sg));
- return ds;
- }
- Message::SendInfo() << "Dispatch : " << name << " , Parameter : " << &(nam.ToCString())[paro];
- return disp;
-}
-
// Functions definit un certain nombre de commandes
// enregistrees dans le Dictionnaire de Activator (par des Act unitaires)
// Les actions elles-memes sont regroupees en fin de fichier
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
// **** Version & cie ****
//#58 rln
- Message::SendInfo() << "Processor Version : " << XSTEP_PROCESSOR_VERSION;
- Message::SendInfo() << "OL Version : " << XSTEP_SYSTEM_VERSION;
- Message::SendInfo() << "Configuration : " << XSTEP_Config;
- Message::SendInfo() << "UL Names : " << XSTEP_ULNames;
+ aSSC.SStream() << "Processor Version : " << XSTEP_PROCESSOR_VERSION;
+ aSSC.SStream() << "OL Version : " << XSTEP_SYSTEM_VERSION;
+ aSSC.SStream() << "Configuration : " << XSTEP_Config;
+ aSSC.SStream() << "UL Names : " << XSTEP_ULNames;
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
// **** ToggleHandler ****
Standard_Boolean hand = !WS->ErrorHandle();
- if (hand) Message::SendInfo() << " -- Mode Catch Error now Active";
- else Message::SendInfo() << " -- Mode Catch Error now Inactive";
+ if (hand) aSSC.SStream() << " -- Mode Catch Error now Active";
+ else aSSC.SStream() << " -- Mode Catch Error now Inactive";
WS->SetErrorHandle(hand);
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** XRead / Load ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Read/Load : give file name !";
+ aSSC.SStream() << "Read/Load : give file name !";
return 1;
}
if (WS->Protocol().IsNull())
{
- Message::SendInfo() << "Protocol not defined";
+ aSSC.SStream() << "Protocol not defined";
return 1;
}
if (WS->WorkLibrary().IsNull())
{
- Message::SendInfo() << "WorkLibrary not defined";
+ aSSC.SStream() << "WorkLibrary not defined";
return 1;
}
-
IFSelect_ReturnStatus status = WS->ReadFile(arg1);
// status : 0 OK, 1 erreur lecture, 2 Fail(try/catch),
// -1 fichier non trouve, -2 lecture faite mais resultat vide
switch (status)
{
- case IFSelect_RetVoid: Message::SendInfo() << "file:" << arg1 << " gives empty result"; break;
- case IFSelect_RetError: Message::SendInfo() << "file:" << arg1 << " could not be opened"; break;
- case IFSelect_RetDone: Message::SendInfo() << "file:" << arg1 << " read"; break;
- case IFSelect_RetFail: Message::SendInfo() << "file:" << arg1 << " : error while reading"; break;
- case IFSelect_RetStop: Message::SendInfo() << "file:" << arg1 << " : EXCEPTION while reading"; break;
- default: Message::SendInfo() << "file:" << arg1 << " could not be read"; break;
+ case IFSelect_RetVoid: aSSC.SStream() << "file:" << arg1 << " gives empty result"; break;
+ case IFSelect_RetError: aSSC.SStream() << "file:" << arg1 << " could not be opened"; break;
+ case IFSelect_RetDone: aSSC.SStream() << "file:" << arg1 << " read"; break;
+ case IFSelect_RetFail: aSSC.SStream() << "file:" << arg1 << " : error while reading"; break;
+ case IFSelect_RetStop: aSSC.SStream() << "file:" << arg1 << " : EXCEPTION while reading"; break;
+ default: aSSC.SStream() << "file:" << arg1 << " could not be read"; break;
}
- if (status != IFSelect_RetDone) return status;
- // Message::SendInfo()<<" - clearing list of already written files"<<std::endl;
+ if (status != IFSelect_RetDone)
+ return 1;
+ // aSSC.SStream()<<" - clearing list of already written files"<<std::endl;
WS->BeginSentFiles(Standard_True);
- return status;
+ return 0;
}
//=======================================================================
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** Write All ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Write All : give file name !";
- return 1;
- }
- return WS->SendAll(arg1);
-}
-
-//=======================================================================
-//function : fun5
-//purpose :
-//=======================================================================
-static Standard_Integer fun5(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- // const Standard_CString arg2 = theArgVec[2];
- // **** Write Selected ****
- if (theNbArgs < 3)
- {
- Message::SendInfo() << "Write Selected : give file name + givelist !";
- return 1;
- }
- Handle(TColStd_HSequenceOfTransient) result =
- XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart(2));
- if (result.IsNull())
- {
- Message::SendInfo() << "No entity selected";
+ aSSC.SStream() << "Write All : give file name !";
return 1;
}
- else Message::SendInfo() << "Nb Entities selected : " << result->Length();
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- sp->SetList(result);
- return WS->SendSelected(arg1, sp);
+ return WS->SendAll(arg1) == IFSelect_RetDone;
}
//=======================================================================
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** Write Entite(s) ****
if (theNbArgs < 3)
{
- Message::SendInfo() << "Write Entitie(s) : give file name + n0s entitie(s)!";
+ aSSC.SStream() << "Write Entitie(s) : give file name + n0s entitie(s)!";
return 1;
}
int ko = 0;
Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
for (Standard_Integer ia = 2; ia < theNbArgs; ia++)
{
- Standard_Integer id = pilot->Number(pilot->Arg(ia));
+ Standard_Integer id = WS->NumberFromLabel(theArgVec[ia]);
if (id > 0)
{
Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Add(item)) Message::SendInfo() << "Added:no." << id;
+ if (sp->Add(item)) aSSC.SStream() << "Added:no." << id;
else
{
- Message::SendInfo() << " Fail Add n0." << id; ko++;
+ aSSC.SStream() << " Fail Add n0." << id; ko++;
}
}
else
{
- Message::SendInfo() << "Not an entity number:" << pilot->Arg(ia); ko++;
+ aSSC.SStream() << "Not an entity number:" << theArgVec[ia]; ko++;
}
}
if (ko > 0)
{
- Message::SendInfo() << ko << " bad arguments, abandon";
+ aSSC.SStream() << ko << " bad arguments, abandon";
return 1;
}
- return WS->SendSelected(arg1, sp);
+ return WS->SendSelected(arg1, sp) == IFSelect_RetDone;
}
//=======================================================================
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** Entity Label ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Give entity number";
+ aSSC.SStream() << "Give entity number";
return 1;
}
if (!WS->HasModel())
{
- Message::SendInfo() << "No loaded model, abandon";
+ aSSC.SStream() << "No loaded model, abandon";
return 1;
}
Standard_Integer nument = WS->NumberFromLabel(arg1);
if (nument <= 0 || nument > WS->NbStartingEntities())
{
- Message::SendInfo() << "Not a suitable number: " << arg1;
+ aSSC.SStream() << "Not a suitable number: " << arg1;
return 1;
}
- Message::SendInfo() << "N0." << nument << " ->Label in Model : ";
- WS->Model()->PrintLabel(WS->StartingEntity(nument), Message::SendInfo());
- Message::SendInfo();
+ aSSC.SStream() << "N0." << nument << " ->Label in Model : ";
+ WS->Model()->PrintLabel(WS->StartingEntity(nument), aSSC.SStream());
+
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** Entity Number ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Give label to search";
+ aSSC.SStream() << "Give label to search";
return 1;
}
if (!WS->HasModel())
{
- Message::SendInfo() << "No loaded model, abandon";
+ aSSC.SStream() << "No loaded model, abandon";
return 1;
}
const Handle(Interface_InterfaceModel)& model = WS->Model();
Standard_Integer i, cnt = 0;
Standard_Boolean exact = Standard_False;
- Message::SendInfo() << " ** Search Entity Number for Label : " << arg1;
+ aSSC.SStream() << " ** Search Entity Number for Label : " << arg1;
for (i = model->NextNumberForLabel(arg1, 0, exact); i != 0;
i = model->NextNumberForLabel(arg1, i, exact))
{
cnt++;
- Message::SendInfo() << " ** Found n0/id:";
- model->Print(model->Value(i), Message::SendInfo());
- Message::SendInfo();
+ aSSC.SStream() << " ** Found n0/id:";
+ model->Print(model->Value(i), aSSC.SStream());
+
}
- if (cnt == 0) Message::SendInfo() << " ** No Match";
- else if (cnt == 1) Message::SendInfo() << " ** 1 Match";
- else Message::SendInfo() << cnt << " Matches";
+ if (cnt == 0) aSSC.SStream() << " ** No Match";
+ else if (cnt == 1) aSSC.SStream() << " ** 1 Match";
+ else aSSC.SStream() << cnt << " Matches";
return 0;
}
//=======================================================================
-//function : fun9
+//function : funsigntype
//purpose :
//=======================================================================
static Standard_Integer fun9(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
- // **** List Types ****
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theNbArgs;
+ (void)theArgVec;
+ Handle(IFSelect_WorkSession) WS = XSDRAWBase::Session();
Handle(IFSelect_Signature) signtype = WS->SignType();
if (signtype.IsNull()) signtype = new IFSelect_SignType;
Handle(IFSelect_SignCounter) counter =
new IFSelect_SignCounter(signtype, Standard_False);
- return pilot->ExecuteCounter(counter, 1);
-}
-
-//=======================================================================
-//function : funcount
-//purpose :
-//=======================================================================
-static Standard_Integer funcount(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg0 = theArgVec[0];
- const Standard_CString arg1 = theArgVec[1];
- Standard_Boolean listmode = (arg0[0] == 'l');
- // **** List Counter ****
-
- if (theNbArgs < 2)
- {
- Message::SendInfo() << "Designer signature ou compteur, + facultatif selection + facultatif entite";
- Message::SendInfo() << " signature/compteur seul -> tout le modele"
- << " sign/compteur + selection -> cette selection, evaluation normale"
- << " sign/compteur + sel + num -> cette selection evaluee sur entite n0 num";
- return 1;
- }
- DeclareAndCast(IFSelect_SignCounter, counter, WS->NamedItem(arg1));
- if (counter.IsNull())
- {
- DeclareAndCast(IFSelect_Signature, signa, WS->NamedItem(arg1));
- if (!signa.IsNull()) counter = new IFSelect_SignCounter(signa, Standard_False, listmode);
- }
- // Handle(IFSelect_Selection) sel;
- // Standard_Integer n3 = 0; if (theNbArgs > 3) n3 = WS->NumberFromLabel(arg3);
- // if (theNbArgs > 2) sel = GetCasted(IFSelect_Selection,WS->NamedItem(arg2));
- // if (counter.IsNull() || (theNbArgs > 2 && n3 <= 0 && sel.IsNull()) ) {
- // Message::SendInfo()<<"Nom:"<<arg1; if (theNbArgs > 2) Message::SendInfo()<<" et/ou "<<arg2;
- // Message::SendInfo()<<" incorrect (demande: compteur ou signature [selection])"<<std::endl;
- // return 1;
- // }
-
- // Ajout : si Selection, on applique un GraphCounter
- // Et en ce cas, on peut en avoir plusieurs : la limite est le mot-cle "on"
- Standard_Integer onflag = 0;
- Standard_Integer i; // svv Jan11 2000 : porting on DEC
- for (i = 2; i < theNbArgs; i++)
- {
- if (!strcmp(theArgVec[i], "on"))
- {
- onflag = i; break;
- }
- }
-
- Handle(IFSelect_Selection) sel = WS->GiveSelection(arg1);
- DeclareAndCast(IFSelect_SelectDeduct, seld, sel);
- if (!seld.IsNull())
- {
- // Si onflag, faire une SelectSuite
- if (onflag > 2)
- {
- Handle(IFSelect_SelectSuite) suite = new IFSelect_SelectSuite;
- for (i = 1; i < onflag; i++)
- {
- sel = WS->GiveSelection(theArgVec[i]);
- if (!suite->AddInput(sel))
- {
- Message::SendInfo() << "Incorrect definition for applied selection";
- return 1;
- }
- }
- seld = suite;
- }
-
- Handle(IFSelect_GraphCounter) gc = new IFSelect_GraphCounter(Standard_False, listmode);
- gc->SetApplied(seld);
- counter = gc;
- }
-
- if (counter.IsNull())
- {
- Message::SendInfo() << "Neither Counter nor Signature : " << arg1;
- return 1;
- }
-
- if (onflag == 0) onflag = 1;
- IFSelect_PrintCount pcm = IFSelect_ListByItem;
- if (arg0[0] == 'c') pcm = IFSelect_CountByItem;
- if (arg0[0] == 's') pcm = IFSelect_CountSummary;
- return pilot->ExecuteCounter(counter, onflag + 1, pcm);
+ counter->AddModel(WS->Model());
+ counter->PrintList(aSSC.SStream(), WS->Model(), IFSelect_CountByItem);
+ return 0;
}
//=======================================================================
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** Sign Type ****
Handle(IFSelect_Signature) signtype = WS->SignType();
- if (signtype.IsNull()) Message::SendInfo() << "signtype actually undefined";
+ if (signtype.IsNull()) aSSC.SStream() << "signtype actually undefined";
else
{
Handle(TCollection_HAsciiString) str = WS->Name(signtype);
Standard_Integer id = WS->ItemIdent(signtype);
- Message::SendInfo() << signtype->Label();
+ aSSC.SStream() << signtype->Label();
if (str.IsNull())
{
- if (id > 0) Message::SendInfo() << "signtype : item n0 " << id;
+ if (id > 0) aSSC.SStream() << "signtype : item n0 " << id;
}
else
{
- Message::SendInfo() << "signtype : also named as " << str->ToCString();
+ aSSC.SStream() << "signtype : also named as " << str->ToCString();
}
}
- if (theNbArgs < 2) Message::SendInfo() << "signtype newitem to change, signtype . to clear";
+ if (theNbArgs < 2) aSSC.SStream() << "signtype newitem to change, signtype . to clear";
else
{
if (arg1[0] == '.' && arg1[1] == '\0')
{
signtype.Nullify();
- Message::SendInfo() << "signtype now cleared";
+ aSSC.SStream() << "signtype now cleared";
}
else
{
signtype = GetCasted(IFSelect_Signature, WS->NamedItem(arg1));
if (signtype.IsNull())
{
- Message::SendInfo() << "Not a Signature : " << arg1;
+ aSSC.SStream() << "Not a Signature : " << arg1;
return 1;
}
- else Message::SendInfo() << "signtype now set to " << arg1;
+ else aSSC.SStream() << "signtype now set to " << arg1;
}
WS->SetSignType(signtype);
return 0;
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Standard_CString arg1 = theArgVec[1];
// **** Sign Case ****
Handle(IFSelect_Signature) signcase = GetCasted(IFSelect_Signature, WS->NamedItem(arg1));
- if (signcase.IsNull()) Message::SendInfo() << "Not a Signature : " << arg1;
+ if (signcase.IsNull()) aSSC.SStream() << "Not a Signature : " << arg1;
else
{
Standard_Boolean hasmin, hasmax; Standard_Integer valmin, valmax;
if (signcase->IsIntCase(hasmin, valmin, hasmax, valmax))
{
- Message::SendInfo() << "Signature " << arg1 << " : Integer Case";
- if (hasmin) Message::SendInfo() << " - Mini:" << valmin;
- if (hasmax) Message::SendInfo() << " - Maxi:" << valmax;
- Message::SendInfo();
+ aSSC.SStream() << "Signature " << arg1 << " : Integer Case";
+ if (hasmin) aSSC.SStream() << " - Mini:" << valmin;
+ if (hasmax) aSSC.SStream() << " - Maxi:" << valmax;
+
}
Handle(TColStd_HSequenceOfAsciiString) caselist = signcase->CaseList();
- if (caselist.IsNull()) Message::SendInfo() << "Signature " << arg1 << " : no predefined case, see command count " << arg1;
+ if (caselist.IsNull()) aSSC.SStream() << "Signature " << arg1 << " : no predefined case, see command count " << arg1;
else
{
Standard_Integer i, nb = caselist->Length();
- Message::SendInfo() << "Signature " << arg1 << " : " << nb << " basic cases :";
- for (i = 1; i <= nb; i++) Message::SendInfo() << " " << caselist->Value(i);
- Message::SendInfo();
+ aSSC.SStream() << "Signature " << arg1 << " : " << nb << " basic cases :";
+ for (i = 1; i <= nb; i++) aSSC.SStream() << " " << caselist->Value(i);
+
}
}
return 0;
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** Entity Status ****
Standard_Integer i, nb;
if (theNbArgs < 2)
{
nb = Interface_Category::NbCategories();
- Message::SendInfo() << " Categories defined :" << nb << " i.e. :\n";
+ aSSC.SStream() << " Categories defined :" << nb << " i.e. :\n";
for (i = 0; i <= nb; i++)
- Message::SendInfo() << "Cat." << i << " : " << Interface_Category::Name(i) << "\n";
- Message::SendInfo() << " On a given entity : give its number";
+ aSSC.SStream() << "Cat." << i << " : " << Interface_Category::Name(i) << "\n";
+ aSSC.SStream() << " On a given entity : give its number";
return 0;
}
- Standard_Integer num = pilot->Number(arg1);
+ Standard_Integer num = WS->NumberFromLabel(arg1);
if (num <= 0 || num > WS->NbStartingEntities())
{
- Message::SendInfo() << "Not a suitable entity number : " << arg1;
+ aSSC.SStream() << "Not a suitable entity number : " << arg1;
return 1;
}
Handle(Standard_Transient) ent = WS->StartingEntity(num);
- WS->PrintEntityStatus(ent, Message::SendInfo());
+ WS->PrintEntityStatus(ent, aSSC.SStream());
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // Standard_Integer theNbArgs = theNbArgs;
+ //
const Standard_CString arg1 = theArgVec[1];
// **** DumpModel (Data) ****
Standard_Integer niv = 0;
switch (arg1[0])
{
case '?':
- Message::SendInfo() << "? for this help, else give a listing mode (first letter suffices) :\n"
+ aSSC.SStream() << "? for this help, else give a listing mode (first letter suffices) :\n"
<< " general General Statistics\n roots Roots\n"
<< " entities All Entities\n"
<< " listfails CheckList (fails) per entity\n"
case 'T': niv = 7; break;
case 'f': niv = 8; break;
case 'F': niv = 10; break;
- default: Message::SendInfo() << "Unknown Mode . data tout court pour help";
+ default: aSSC.SStream() << "Unknown Mode . data tout court pour help";
return 1;
}
WS->TraceDumpModel(niv);
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
Handle(IFSelect_WorkLibrary) WL = WS->WorkLibrary();
+ Standard_SStream aStream;
Standard_Integer levdef = 0, levmax = 10, level;
WL->DumpLevels(levdef, levmax);
if (theNbArgs < 2 || (theNbArgs == 2 && levmax < 0))
{
- Message::SendInfo() << "Give n0 or id of entity";
- if (levmax < 0) Message::SendInfo() << " and dump level";
- else Message::SendInfo() << " + optional, dump level in [0 - " << levmax << "] , default = " << levdef;
+ aSSC.SStream() << "Give n0 or id of entity";
+ if (levmax < 0)
+ aSSC.SStream() << " and dump level";
+ else
+ aSSC.SStream() << " + optional, dump level in [0 - " << levmax << "] , default = " << levdef;
for (level = 0; level <= levmax; level++)
{
Standard_CString help = WL->DumpHelp(level);
- if (help[0] != '\0') Message::SendInfo() << level << " : " << help;
+ if (help[0] != '\0')
+ aStream << level << " : " << help;
}
return 1;
}
const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg2 = theArgVec[2];
- Standard_Integer num = pilot->Number(arg1);
+ Standard_Integer num = WS->NumberFromLabel(arg1);
if (num == 0)
return 1;
level = levdef;
- if (theNbArgs > 2) level = atoi(arg2);
+ if (theNbArgs > 2)
+ level = atoi(arg2);
Handle(Standard_Transient) ent = WS->StartingEntity(num);
if (ent.IsNull())
{
- Message::SendInfo() << "No entity with given id " << arg1 << " (" << num << ") is found in the current model";
+ aStream << "No entity with given id " << arg1 << " (" << num << ") is found in the current model";
}
else
{
- Message::SendInfo() << " -- DUMP Entity n0 " << num << " level " << level;
- WL->DumpEntity(WS->Model(), WS->Protocol(), ent, Message::SendInfo(), level);
+ aStream << " -- DUMP Entity n0 " << num << " level " << level;
+ WL->DumpEntity(WS->Model(), WS->Protocol(), ent, aStream, level);
Interface_CheckIterator chl = WS->CheckOne(ent);
- if (!chl.IsEmpty(Standard_False)) chl.Print(Message::SendInfo(), WS->Model(), Standard_False);
+ if (!chl.IsEmpty(Standard_False))
+ chl.Print(aStream, WS->Model(), Standard_False);
}
- // Message::SendInfo() << std::flush;
-
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg2 = theArgVec[2];
if (theNbArgs < 3)
{
- Message::SendInfo() << " Give signature name + n0 or id of entity";
+ aSSC.SStream() << " Give signature name + n0 or id of entity";
return 1;
}
DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1));
if (sign.IsNull())
{
- Message::SendInfo() << "Not a signature : " << arg1;
+ aSSC.SStream() << "Not a signature : " << arg1;
return 1;
}
- Standard_Integer num = pilot->Number(arg2);
+ Standard_Integer num = WS->NumberFromLabel(arg2);
Handle(Standard_Transient) ent = WS->StartingEntity(num);
if (num == 0)
return 1;
- Message::SendInfo() << "Entity n0 " << num << " : " << WS->SignValue(sign, ent);
+ aSSC.SStream() << "Entity n0 " << num << " : " << WS->SignValue(sign, ent);
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg2 = theArgVec[2];
if (theNbArgs < 3)
{
- Message::SendInfo() << " Give 2 numeros or labels : dad son";
+ aSSC.SStream() << " Give 2 numeros or labels : dad son";
return 1;
}
Standard_Integer n1 = WS->NumberFromLabel(arg1);
Standard_Integer n2 = WS->NumberFromLabel(arg2);
- Message::SendInfo() << "QueryParent for dad:" << arg1 << ":" << n1 << " and son:" << arg2 << ":" << n2;
+ aSSC.SStream() << "QueryParent for dad:" << arg1 << ":" << n1 << " and son:" << arg2 << ":" << n2;
Standard_Integer qp = WS->QueryParent(WS->StartingEntity(n1), WS->StartingEntity(n2));
- if (qp < 0) Message::SendInfo() << arg1 << " is not super-entity of " << arg2;
- else if (qp == 0) Message::SendInfo() << arg1 << " is same as " << arg2;
- else Message::SendInfo() << arg1 << " is super-entity of " << arg2 << " , max level found=" << qp;
- // Message::SendInfo()<<" Trouve "<<qp<<std::endl;
+ if (qp < 0) aSSC.SStream() << arg1 << " is not super-entity of " << arg2;
+ else if (qp == 0) aSSC.SStream() << arg1 << " is same as " << arg2;
+ else aSSC.SStream() << arg1 << " is super-entity of " << arg2 << " , max level found=" << qp;
+ // aSSC.SStream()<<" Trouve "<<qp<<std::endl;
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
// **** DumpShare ****
- WS->DumpShare(); return 0;
+ WS->DumpShare();
+ return 0;
}
//=======================================================================
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
// **** ListItems ****
- WS->ListItems(theArgVec[1]); return 0;
-}
-
-//=======================================================================
-//function : fun14
-//purpose :
-//=======================================================================
-static Standard_Integer fun14(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- // **** NewInt ****
- if (theNbArgs < 1)
- {
- Message::SendInfo() << "Donner la valeur entiere pour IntParam";
- return 1;
- }
- Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam;
- if (theNbArgs >= 1) intpar->SetValue(atoi(arg1));
- return pilot->RecordItem(intpar);
+ WS->ListItems(theArgVec[1]);
+ return 0;
}
//=======================================================================
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg2 = theArgVec[2];
// **** SetInt ****
if (theNbArgs < 3)
{
- Message::SendInfo() << "Donner 2 arguments : nom Parametre et Valeur";
+ aSSC.SStream() << "Donner 2 arguments : nom Parametre et Valeur";
return 1;
}
Standard_Integer val = atoi(arg2);
return 0;
}
-//=======================================================================
-//function : fun16
-//purpose :
-//=======================================================================
-static Standard_Integer fun16(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- // **** NewText ****
- if (theNbArgs < 1)
- {
- Message::SendInfo() << "Donner la valeur texte pour TextParam";
- return 1;
- }
- Handle(TCollection_HAsciiString) textpar = new TCollection_HAsciiString();
- if (theNbArgs >= 1) textpar->AssignCat(arg1);
- return pilot->RecordItem(textpar);
-}
-
//=======================================================================
//function : fun17
//purpose :
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg2 = theArgVec[2];
// **** SetText ****
if (theNbArgs < 3)
{
- Message::SendInfo() << "Donner 2 arguments : nom Parametre et Valeur";
+ aSSC.SStream() << "Donner 2 arguments : nom Parametre et Valeur";
return 1;
}
DeclareAndCast(TCollection_HAsciiString, par, WS->NamedItem(arg1));
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** DumpSel ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Give 1 argument : Selection Name";
+ aSSC.SStream() << "Give 1 argument : Selection Name";
return 1;
}
WS->DumpSelection(GetCasted(IFSelect_Selection, WS->NamedItem(arg1)));
return 0;
}
-//=======================================================================
-//function : fun20
-//purpose :
-//=======================================================================
-static Standard_Integer fun20(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- // **** EvalSel ****
- // **** GiveList ****
- // **** GiveShort GivePointed ****
- // **** MakeList ****
- char mode = theArgVec[0][0]; // givelist/makelist
- if (mode == 'g') mode = theArgVec[0][4]; // l list s short p pointed
- if (theNbArgs < 2)
- {
- Message::SendInfo() << "Give Entity ID, or Selection Name [+ optional other selection or entity]";
- return 1;
- }
-
- // MakeList : sur Pointed existante ou a creer
- Handle(IFSelect_SelectPointed) pnt;
- if (mode == 'm')
- {
- const Standard_CString arg1 = theArgVec[1];
- Handle(Standard_Transient) item = WS->NamedItem(arg1);
- pnt = GetCasted(IFSelect_SelectPointed, item);
- if (!pnt.IsNull())
- {
- Message::SendInfo() << arg1 << ":Already existing Selection for List, cleared then filled";
- pnt->Clear();
- }
- else if (!item.IsNull())
- {
- Message::SendInfo() << arg1 << ":Already existing Item not for a List, command ignored";
- return 1;
- }
- else
- {
- pnt = new IFSelect_SelectPointed;
- WS->AddNamedItem(arg1, pnt);
- }
- }
-
- Handle(TColStd_HSequenceOfTransient) result =
- XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart((mode == 'm' ? 2 : 1)));
- if (result.IsNull())
- return 1;
- Interface_EntityIterator iter(result);
- Message::SendInfo() << pilot->CommandPart((mode == 'm' ? 2 : 1)) << " : ";
- if (mode == 'l') WS->ListEntities(iter, 0, Message::SendInfo());
- else if (mode == 's' || mode == 'm') WS->ListEntities(iter, 2, Message::SendInfo());
- else if (mode == 'p')
- {
- Message::SendInfo() << iter.NbEntities() << " Entities : ";
- for (iter.Start(); iter.More(); iter.Next())
- Message::SendInfo() << " +" << WS->StartingNumber(iter.Value());
- Message::SendInfo();
- }
-
- if (!pnt.IsNull())
- {
- pnt->SetList(result);
- Message::SendInfo() << "List set to a SelectPointed : " << theArgVec[1];
- Message::SendInfo() << "Later editable by command setlist";
- }
-
- return 0;
-}
-
-//=======================================================================
-//function : fun20c
-//purpose :
-//=======================================================================
-static Standard_Integer fun20c(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- // **** GiveCount ****
- if (theNbArgs < 2)
- {
- Message::SendInfo() << "Give Entity ID, or Selection Name [+ optional other selection or entity]";
- return 1;
- }
- // WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
- Handle(TColStd_HSequenceOfTransient) result =
- XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart(1));
- if (result.IsNull())
- return 1;
- Message::SendInfo() << pilot->CommandPart(1) << " : List of " << result->Length() << " Entities";
- return 0;
-}
-
-//=======================================================================
-//function : funselsuite
-//purpose :
-//=======================================================================
-static Standard_Integer funselsuite(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- // **** SelSuite ****
- if (theNbArgs < 2)
- {
- Message::SendInfo() << "Give Entity ID, or Selection Name [+ optional other selection or entity]";
- return 1;
- }
- // WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
- Handle(IFSelect_SelectSuite) selsuite = new IFSelect_SelectSuite;
-
- for (Standard_Integer i = 1; i < theNbArgs; i++)
- {
- Handle(IFSelect_Selection) sel = WS->GiveSelection(theArgVec[i]);
- if (!selsuite->AddInput(sel))
- {
- Message::SendInfo() << pilot->Arg(i - 1) << " : not a SelectDeduct, no more can be added. Abandon";
- return 1;
- }
- }
- selsuite->SetLabel(pilot->CommandPart(1));
- return pilot->RecordItem(selsuite);
-}
-
//=======================================================================
//function : fun21
//purpose :
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
// **** ClearItems ****
WS->ClearItems(); WS->ClearFinalModifiers(); WS->ClearShareOut(Standard_False);
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** ClearData ****
Standard_Integer mode = -1;
else mode = 0;
if (mode <= 0)
{
- if (mode < 0) Message::SendInfo() << "Give a suitable mode";
- Message::SendInfo() << " Available Modes :\n"
+ if (mode < 0) aSSC.SStream() << "Give a suitable mode";
+ aSSC.SStream() << " Available Modes :\n"
<< " a : all data g : graph+check c : check p : selectpointed";
- return (mode < 0 ? IFSelect_RetError : IFSelect_RetVoid);
+ return 1;
}
WS->ClearData(mode);
return 0;
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
// **** Item Label ****
TCollection_AsciiString label;
if (theNbArgs < 2)
{
- Message::SendInfo() << " Give label to search";
+ aSSC.SStream() << " Give label to search";
return 1;
}
for (int i = 1; i < theNbArgs; i++)
for (int mode = 0; mode <= 2; mode++)
{
int nbitems = 0; int id;
- Message::SendInfo() << "Searching label : " << label << ". in mode ";
- if (mode == 0) Message::SendInfo() << " exact";
- if (mode == 1) Message::SendInfo() << " same head";
- if (mode == 2) Message::SendInfo() << " search if present";
+ aSSC.SStream() << "Searching label : " << label << ". in mode ";
+ if (mode == 0) aSSC.SStream() << " exact";
+ if (mode == 1) aSSC.SStream() << " same head";
+ if (mode == 2) aSSC.SStream() << " search if present";
for (id = WS->NextIdentForLabel(label.ToCString(), 0, mode); id != 0;
id = WS->NextIdentForLabel(label.ToCString(), id, mode))
{
- Message::SendInfo() << " " << id; nbitems++;
+ aSSC.SStream() << " " << id; nbitems++;
}
- Message::SendInfo() << " -- giving " << nbitems << " found";
+ aSSC.SStream() << " -- giving " << nbitems << " found";
}
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** Save (Dump) ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Donner nom du Fichier";
+ aSSC.SStream() << "Donner nom du Fichier";
return 1;
}
IFSelect_SessionFile dumper(WS, arg1);
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** Restore (Dump) ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Donner nom du Fichier";
+ aSSC.SStream() << "Donner nom du Fichier";
return 1;
}
IFSelect_SessionFile dumper(WS);
Standard_Integer readstat = dumper.Read(arg1);
- if (readstat == 0) return 0;
- else if (readstat > 0) Message::SendInfo() << "-- Erreur Lecture Fichier " << arg1;
- else Message::SendInfo() << "-- Pas pu ouvrir Fichier " << arg1;
+ if (readstat == 0)
+ return 0;
+ else if (readstat > 0) aSSC.SStream() << "-- Erreur Lecture Fichier " << arg1;
+ else aSSC.SStream() << "-- Pas pu ouvrir Fichier " << arg1;
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
- Standard_Integer theNbArgs = theNbArgs;
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Standard_CString arg1 = theArgVec[1];
Standard_CString arg2 = theArgVec[2];
{
aPatternNb = nb;
}
- Message::SendInfo() << " List of parameters : " << aPatternNb << " items : ";
+ aSSC.SStream() << " List of parameters : " << aPatternNb << " items : ";
for (i = 1; i <= nb; i++)
{
if (theNbArgs == 3 && strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) != 0)
{
continue;
}
- Message::SendInfo() << li->Value(i)->String();
- Message::SendInfo() << " : " << Interface_Static::CVal(li->Value(i)->ToCString());
+ aSSC.SStream() << li->Value(i)->String();
+ aSSC.SStream() << " : " << Interface_Static::CVal(li->Value(i)->ToCString());
}
return 0;
}
}
else
{
- if (theNbArgs > 2) Message::SendInfo() << " FORMER STATUS of Static Parameter " << arg1;
- else Message::SendInfo() << " ACTUAL STATUS of Static Parameter " << arg1;
+ if (theNbArgs > 2) aSSC.SStream() << " FORMER STATUS of Static Parameter " << arg1;
+ else aSSC.SStream() << " ACTUAL STATUS of Static Parameter " << arg1;
if (!Interface_Static::IsPresent(arg1))
{
- Message::SendInfo() << " Parameter " << arg1 << " undefined";
+ aSSC.SStream() << " Parameter " << arg1 << " undefined";
return 1;
}
- if (!Interface_Static::IsSet(arg1)) Message::SendInfo() << " Parameter " << arg1 << " not valued";
- else if (theNbArgs == 2) Interface_Static::Static(arg1)->Print(Message::SendInfo());
- else Message::SendInfo() << " Value : " << Interface_Static::CVal(arg1);
+ if (!Interface_Static::IsSet(arg1)) aSSC.SStream() << " Parameter " << arg1 << " not valued";
+ else if (theNbArgs == 2) Interface_Static::Static(arg1)->Print(aSSC.SStream());
+ else aSSC.SStream() << " Value : " << Interface_Static::CVal(arg1);
- if (theNbArgs == 2) Message::SendInfo() << "To modify, param name_param new_val";
+ if (theNbArgs == 2) aSSC.SStream() << "To modify, param name_param new_val";
else
{
if (strlen(arg2) != 0)
{
- Message::SendInfo() << " New demanded value : " << arg2;
+ aSSC.SStream() << " New demanded value : " << arg2;
}
else
{
- Message::SendInfo() << " New demanded value : not valued";
+ aSSC.SStream() << " New demanded value : not valued";
}
if (Interface_Static::SetCVal(arg1, arg2))
{
- Message::SendInfo() << " OK";
+ aSSC.SStream() << " OK";
return 0;
}
else
{
- Message::SendInfo() << " , refused";
+ aSSC.SStream() << " , refused";
return 1;
}
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
// **** SentFiles ****
Handle(TColStd_HSequenceOfHAsciiString) list = WS->SentFiles();
if (list.IsNull())
{
- Message::SendInfo() << "List of Sent Files not enabled"; return 0;
+ aSSC.SStream() << "List of Sent Files not enabled";
+ return 0;
}
Standard_Integer i, nb = list->Length();
- Message::SendInfo() << " Sent Files : " << nb << " : ";
+ aSSC.SStream() << " Sent Files : " << nb << " : ";
for (i = 1; i <= nb; i++)
- Message::SendInfo() << list->Value(i)->ToCString();
+ aSSC.SStream() << list->Value(i)->ToCString();
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** FilePrefix ****
if (theNbArgs < 2)
{
- if (WS->FilePrefix().IsNull()) Message::SendInfo() << "Pas de prefixe defini";
- else Message::SendInfo() << "Prefixe : " << WS->FilePrefix()->ToCString();
- Message::SendInfo() << "Pour changer : filepref newprefix";
+ if (WS->FilePrefix().IsNull()) aSSC.SStream() << "Pas de prefixe defini";
+ else aSSC.SStream() << "Prefixe : " << WS->FilePrefix()->ToCString();
+ aSSC.SStream() << "Pour changer : filepref newprefix";
return 0;
}
WS->SetFilePrefix(arg1);
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** FileExtension ****
if (theNbArgs < 2)
{
- if (WS->FileExtension().IsNull()) Message::SendInfo() << "Pas d extension definie";
- else Message::SendInfo() << "Extension : " << WS->FileExtension()->ToCString();
- Message::SendInfo() << "Pour changer : fileext newext";
+ if (WS->FileExtension().IsNull()) aSSC.SStream() << "Pas d extension definie";
+ else aSSC.SStream() << "Extension : " << WS->FileExtension()->ToCString();
+ aSSC.SStream() << "Pour changer : fileext newext";
return 0;
}
WS->SetFileExtension(arg1);
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg2 = theArgVec[2];
// **** FileRoot ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Donner Dispatch et nom de Root";
+ aSSC.SStream() << "Donner Dispatch et nom de Root";
return 1;
}
DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
if (theNbArgs < 3)
{
- if (WS->FileRoot(disp).IsNull()) Message::SendInfo() << "Pas de racine definie pour " << arg1;
- else Message::SendInfo() << "Racine pour " << arg1 << " : " << WS->FileRoot(disp)->ToCString();
- Message::SendInfo() << "Pour changer : fileroot nomdisp newroot";
+ if (WS->FileRoot(disp).IsNull()) aSSC.SStream() << "Pas de racine definie pour " << arg1;
+ else aSSC.SStream() << "Racine pour " << arg1 << " : " << WS->FileRoot(disp)->ToCString();
+ aSSC.SStream() << "Pour changer : fileroot nomdisp newroot";
return 0;
}
if (!WS->SetFileRoot(disp, arg2))
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** Default File Root ****
if (theNbArgs < 2)
{
- if (WS->DefaultFileRoot().IsNull()) Message::SendInfo() << "Pas de racine par defaut definie";
- else Message::SendInfo() << "Racine par defaut : " << WS->DefaultFileRoot()->ToCString();
- Message::SendInfo() << "Pour changer : filedef newdef";
+ if (WS->DefaultFileRoot().IsNull()) aSSC.SStream() << "Pas de racine par defaut definie";
+ else aSSC.SStream() << "Racine par defaut : " << WS->DefaultFileRoot()->ToCString();
+ aSSC.SStream() << "Pour changer : filedef newdef";
return 0;
}
WS->SetDefaultFileRoot(arg1);
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
// **** EvalFile ****
if (!WS->HasModel())
{
- Message::SendInfo() << "Pas de Modele charge, abandon";
+ aSSC.SStream() << "Pas de Modele charge, abandon";
return 1;
}
- Message::SendInfo() << "Evaluation avec Memorisation des resultats";
+ aSSC.SStream() << "Evaluation avec Memorisation des resultats";
WS->EvaluateFile();
Standard_Integer nbf = WS->NbFiles();
for (Standard_Integer i = 1; i <= nbf; i++)
Handle(Interface_InterfaceModel) mod = WS->FileModel(i);
if (mod.IsNull())
{
- Message::SendInfo() << "Modele " << i << " Model non genere ..."; continue;
+ aSSC.SStream() << "Modele " << i << " Model non genere ..."; continue;
}
TCollection_AsciiString name = WS->FileName(i);
- Message::SendInfo() << "Fichier n0 " << i << " Nb Entites : " << mod->NbEntities() << " Nom: ";
- Message::SendInfo() << name;
+ aSSC.SStream() << "Fichier n0 " << i << " Nb Entites : " << mod->NbEntities() << " Nom: ";
+ aSSC.SStream() << name;
}
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
// **** ClearFile ****
WS->ClearFile();
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
// **** Split ****
IFSelect_ReturnStatus stat = IFSelect_RetVoid;
- if (theNbArgs < 2) Message::SendInfo() << "Split : derniere liste de dispatches definie";
+ if (theNbArgs < 2) aSSC.SStream() << "Split : derniere liste de dispatches definie";
else
{
WS->ClearShareOut(Standard_True);
DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i]));
if (disp.IsNull())
{
- Message::SendInfo() << "Pas un dispatch:" << theArgVec[i] << ", Splitt abandonne";
+ aSSC.SStream() << "Pas un dispatch:" << theArgVec[i] << ", Splitt abandonne";
stat = IFSelect_RetError;
}
else WS->SetActive(disp, Standard_True);
}
}
- if (stat == IFSelect_RetError) return stat;
+ if (stat == IFSelect_RetError)
+ return stat;
WS->BeginSentFiles(Standard_True);
if (!WS->SendSplit())
return 1;
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** Remaining Data ****
char mode = '?'; IFSelect_RemainMode numod = IFSelect_RemainDisplay;
else if (mode == 'f') numod = IFSelect_RemainForget;
else
{
- if (theNbArgs < 2) Message::SendInfo() << "Donner un Mode - ";
- Message::SendInfo() << "Modes possibles : l list, c compute, u undo, f forget";
- if (mode == '?') return 0; else return 1;
+ if (theNbArgs < 2) aSSC.SStream() << "Donner un Mode - ";
+ aSSC.SStream() << "Modes possibles : l list, c compute, u undo, f forget";
+ if (mode == '?')
+ return 0;
+ else
+ return 1;
}
- if (!WS->SetRemaining(numod)) return 0;
+ if (!WS->SetRemaining(numod))
+ return 0;
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg2 = theArgVec[2];
// **** SetModelContent ****
if (theNbArgs < 3)
{
- Message::SendInfo() << "Donner nom selection et mode (k=keep,r=remove)";
+ aSSC.SStream() << "Donner nom selection et mode (k=keep,r=remove)";
return 1;
}
Standard_Boolean keepmode;
DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
if (sel.IsNull())
{
- Message::SendInfo() << "Pas de Selection de Nom : " << arg1;
+ aSSC.SStream() << "Pas de Selection de Nom : " << arg1;
return 1;
}
if (arg2[0] == 'k')
{
- Message::SendInfo() << " -- SetContent keep ..."; keepmode = Standard_True;
+ aSSC.SStream() << " -- SetContent keep ..."; keepmode = Standard_True;
}
else if (arg2[0] == 'r')
{
- Message::SendInfo() << " -- SetContent remove ..."; keepmode = Standard_False;
+ aSSC.SStream() << " -- SetContent remove ..."; keepmode = Standard_False;
}
else
{
- Message::SendInfo() << "Donner nom selection et mode (k=keep,r=remove)";
+ aSSC.SStream() << "Donner nom selection et mode (k=keep,r=remove)";
return 1;
}
- if (WS->SetModelContent(sel, keepmode)) Message::SendInfo() << " Done";
- else Message::SendInfo() << " Result empty, ignored";
+ if (WS->SetModelContent(sel, keepmode)) aSSC.SStream() << " Done";
+ else aSSC.SStream() << " Result empty, ignored";
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
// **** ListModif ****
WS->ListFinalModifiers(Standard_True);
- WS->ListFinalModifiers(Standard_False); return 0;
+ WS->ListFinalModifiers(Standard_False);
+ return 0;
}
//=======================================================================
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** Modifier ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Donner Nom du Modifier";
+ aSSC.SStream() << "Donner Nom du Modifier";
return 1;
}
DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
if (modif.IsNull())
{
- Message::SendInfo() << "Pas de Modifier de Nom : " << arg1; return 0;
+ aSSC.SStream() << "Pas de Modifier de Nom : " << arg1;
+ return 0;
}
Handle(IFSelect_IntParam) low, up;
Handle(IFSelect_Dispatch) disp = modif->Dispatch();
- Message::SendInfo() << "Modifier : " << arg1 << " Label : " << modif->Label();
+ aSSC.SStream() << "Modifier : " << arg1 << " Label : " << modif->Label();
Standard_Integer rank = WS->ModifierRank(modif);
if (modif->IsKind(STANDARD_TYPE(IFSelect_Modifier)))
- Message::SendInfo() << "Model Modifier n0." << rank;
- else Message::SendInfo() << "File Modifier n0." << rank;
- if (disp.IsNull()) Message::SendInfo() << " Applique a tous les Dispatchs";
+ aSSC.SStream() << "Model Modifier n0." << rank;
+ else aSSC.SStream() << "File Modifier n0." << rank;
+ if (disp.IsNull()) aSSC.SStream() << " Applique a tous les Dispatchs";
else
{
- Message::SendInfo() << " Dispatch : " << disp->Label();
- if (WS->HasName(disp)) Message::SendInfo() << " - Nom:" << WS->Name(disp)->ToCString();
- Message::SendInfo();
+ aSSC.SStream() << " Dispatch : " << disp->Label();
+ if (WS->HasName(disp)) aSSC.SStream() << " - Nom:" << WS->Name(disp)->ToCString();
+
}
Handle(IFSelect_Selection) sel = modif->Selection();
- if (!sel.IsNull()) Message::SendInfo() << " Selection : " << sel->Label();
- if (WS->HasName(sel)) Message::SendInfo() << " - Nom:" << WS->Name(sel)->ToCString();
- Message::SendInfo();
+ if (!sel.IsNull()) aSSC.SStream() << " Selection : " << sel->Label();
+ if (WS->HasName(sel)) aSSC.SStream() << " - Nom:" << WS->Name(sel)->ToCString();
+
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg2 = theArgVec[2];
// **** ModifSel ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Donner Nom Modifier; + Nom Selection optionnel\n"
+ aSSC.SStream() << "Donner Nom Modifier; + Nom Selection optionnel\n"
<< "Selection pour Mettre une Selection, sinon Annule";
return 1;
}
DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
if (modif.IsNull())
{
- Message::SendInfo() << "Pas un nom de Modifier : " << arg1;
+ aSSC.SStream() << "Pas un nom de Modifier : " << arg1;
return 1;
}
Handle(IFSelect_Selection) sel;
sel = GetCasted(IFSelect_Selection, WS->NamedItem(arg2));
if (sel.IsNull())
{
- Message::SendInfo() << "Pas un nom de Selection : " << arg2;
+ aSSC.SStream() << "Pas un nom de Selection : " << arg2;
return 1;
}
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg2 = theArgVec[2];
// **** SetAppliedModifier ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Donner Nom Modifier; + Nom Dispatch ou Transformer optionnel :\n"
+ aSSC.SStream() << "Donner Nom Modifier; + Nom Dispatch ou Transformer optionnel :\n"
<< " - rien : tous Dispatches\n - Dispatch : ce Dispatch seul\n"
<< " - Transformer : pas un Dispatch mais un Transformer";
return 1;
DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
if (modif.IsNull())
{
- Message::SendInfo() << "Pas un nom de Modifier : " << arg1;
+ aSSC.SStream() << "Pas un nom de Modifier : " << arg1;
return 1;
}
Handle(Standard_Transient) item;
item = WS->NamedItem(arg2);
if (item.IsNull())
{
- Message::SendInfo() << "Pas un nom connu : " << arg2;
+ aSSC.SStream() << "Pas un nom connu : " << arg2;
return 1;
}
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** ResetApplied (modifier) ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Designer un modifier";
+ aSSC.SStream() << "Designer un modifier";
return 1;
}
DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
if (modif.IsNull())
{
- Message::SendInfo() << "Pas un nom de Modifier : " << arg1;
+ aSSC.SStream() << "Pas un nom de Modifier : " << arg1;
return 1;
}
if (!WS->ResetAppliedModifier(modif))
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg2 = theArgVec[2];
const Standard_CString arg3 = theArgVec[3];
// **** ModifMove ****
if (theNbArgs < 4)
{
- Message::SendInfo() << "modifmove MF rang1 rang2, M pour Model F pour File";
+ aSSC.SStream() << "modifmove MF rang1 rang2, M pour Model F pour File";
return 1;
}
Standard_Boolean formodel;
else if (arg1[0] == 'f' || arg1[0] == 'F') formodel = Standard_False;
else
{
- Message::SendInfo() << "preciser M pour Model, F pour File";
+ aSSC.SStream() << "preciser M pour Model, F pour File";
return 1;
}
Standard_Integer before = atoi(arg2);
Standard_Integer after = atoi(arg3);
if (before == 0 || after == 0)
{
- Message::SendInfo() << "Donner 2 Entiers Positifs";
+ aSSC.SStream() << "Donner 2 Entiers Positifs";
return 1;
}
if (!WS->ChangeModifierRank(formodel, before, after))
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
const Standard_CString arg1 = theArgVec[1];
const Standard_CString arg2 = theArgVec[2];
// **** DispSel ****
if (theNbArgs < 3)
{
- Message::SendInfo() << "Donner Noms Dispatch et Selection Finale";
+ aSSC.SStream() << "Donner Noms Dispatch et Selection Finale";
return 1;
}
DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
if (disp.IsNull())
{
- Message::SendInfo() << "Pas un nom de Dispatch : " << arg1;
+ aSSC.SStream() << "Pas un nom de Dispatch : " << arg1;
return 1;
}
DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg2));
if (sel.IsNull())
{
- Message::SendInfo() << "Pas un nom de Selection : " << arg2;
+ aSSC.SStream() << "Pas un nom de Selection : " << arg2;
return 1;
}
if (!WS->SetItemSelection(disp, sel))
return 0;
}
-////=======================================================================
-////function : fun_dispone
-////purpose :
-////=======================================================================
-//static Standard_Integer fun_dispone(Draw_Interpretor& theDI,
-// Standard_Integer theNbArgs,
-// const char** theArgVec)
-//{
-// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-// // **** DispOne ****
-// Handle(IFSelect_DispPerOne) disp = new IFSelect_DispPerOne;
-// return pilot->RecordItem(disp);
-//}
-
-////=======================================================================
-////function : fun_dispglob
-////purpose :
-////=======================================================================
-//static Standard_Integer fun_dispglob(Draw_Interpretor& theDI,
-// Standard_Integer theNbArgs,
-// const char** theArgVec)
-//{
-// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-// // **** DispGlob ****
-// Handle(IFSelect_DispGlobal) disp = new IFSelect_DispGlobal;
-// return pilot->RecordItem(disp);
-//}
-
-//=======================================================================
-//function : fun_dispcount
+//=======================================================================
+//function : fun56
//purpose :
//=======================================================================
-static Standard_Integer fun_dispcount(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
+static Standard_Integer fun56(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
- // **** DispCount ****
+ // **** Dispatch ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Donner Nom IntParam pour Count";
+ aSSC.SStream() << "Donner Nom du Dispatch";
return 1;
}
- DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1));
- if (par.IsNull())
+ DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
+ if (disp.IsNull())
{
- Message::SendInfo() << "Pas un nom de IntParam : " << arg1;
+ aSSC.SStream() << "Pas un dispatch : " << arg1;
return 1;
}
- Handle(IFSelect_DispPerCount) disp = new IFSelect_DispPerCount;
- disp->SetCount(par);
- return pilot->RecordItem(disp);
+ Standard_Integer num = WS->DispatchRank(disp);
+ aSSC.SStream() << "Dispatch de Nom : " << arg1 << " , en ShareOut, Numero " << num << " : ";
+ Handle(IFSelect_Selection) sel = WS->ItemSelection(disp);
+ Handle(TCollection_HAsciiString) selname = WS->Name(sel);
+ if (sel.IsNull()) aSSC.SStream() << "Pas de Selection Finale";
+ else if (selname.IsNull()) aSSC.SStream() << "Selection Finale : #" << WS->ItemIdent(sel);
+ else aSSC.SStream() << "Selection Finale : " << selname->ToCString();
+ if (disp->HasRootName()) aSSC.SStream() << "-- Racine nom de fichier : "
+ << disp->RootName()->ToCString();
+ return 0;
}
//=======================================================================
-//function : fun_dispfiles
+//function : fun57
//purpose :
//=======================================================================
-static Standard_Integer fun_dispfiles(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
+static Standard_Integer fun57(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
- // **** DispFiles ****
+ // **** Remove ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Donner Nom IntParam pour NbFiles";
+ aSSC.SStream() << "Give Name to Remove !";
return 1;
}
- DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1));
- if (par.IsNull())
- {
- Message::SendInfo() << "Pas un nom de IntParam : " << arg1;
+ if (!WS->RemoveNamedItem(arg1))
return 1;
- }
- Handle(IFSelect_DispPerFiles) disp = new IFSelect_DispPerFiles;
- disp->SetCount(par);
- return pilot->RecordItem(disp);
+ return 0;
}
//=======================================================================
-//function : fun_dispsign
-//purpose :
-//=======================================================================
-static Standard_Integer fun_dispsign(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- // **** DispFiles ****
- if (theNbArgs < 2)
- {
- Message::SendInfo() << "Donner Nom Signature";
- return 1;
- }
- DeclareAndCast(IFSelect_Signature, sig, WS->NamedItem(arg1));
- if (sig.IsNull())
- {
- Message::SendInfo() << "Pas un nom de Signature : " << arg1;
- return 1;
- }
- Handle(IFSelect_DispPerSignature) disp = new IFSelect_DispPerSignature;
- disp->SetSignCounter(new IFSelect_SignCounter(sig));
- return pilot->RecordItem(disp);
-}
-
-//=======================================================================
-//function : fun56
-//purpose :
-//=======================================================================
-static Standard_Integer fun56(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- // **** Dispatch ****
- if (theNbArgs < 2)
- {
- Message::SendInfo() << "Donner Nom du Dispatch";
- return 1;
- }
- DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
- if (disp.IsNull())
- {
- Message::SendInfo() << "Pas un dispatch : " << arg1;
- return 1;
- }
- Standard_Integer num = WS->DispatchRank(disp);
- Message::SendInfo() << "Dispatch de Nom : " << arg1 << " , en ShareOut, Numero " << num << " : ";
- Handle(IFSelect_Selection) sel = WS->ItemSelection(disp);
- Handle(TCollection_HAsciiString) selname = WS->Name(sel);
- if (sel.IsNull()) Message::SendInfo() << "Pas de Selection Finale";
- else if (selname.IsNull()) Message::SendInfo() << "Selection Finale : #" << WS->ItemIdent(sel);
- else Message::SendInfo() << "Selection Finale : " << selname->ToCString();
- if (disp->HasRootName()) Message::SendInfo() << "-- Racine nom de fichier : "
- << disp->RootName()->ToCString();
- return 0;
-}
-
-//=======================================================================
-//function : fun57
-//purpose :
-//=======================================================================
-static Standard_Integer fun57(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- // **** Remove ****
- if (theNbArgs < 2)
- {
- Message::SendInfo() << "Give Name to Remove !";
- return 1;
- }
- if (!WS->RemoveNamedItem(arg1))
- return 1;
- return 0;
-}
-
-//=======================================================================
-//function : fun58
+//function : fun58
//purpose :
//=======================================================================
static Standard_Integer fun58(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** EvalDisp ****
if (theNbArgs < 3)
{
- Message::SendInfo() << "evaldisp mode disp [disp ...] : Mode + Name(s) of Dispatch(es). Mode:\n"
+ aSSC.SStream() << "evaldisp mode disp [disp ...] : Mode + Name(s) of Dispatch(es). Mode:\n"
<< " 0 brief 1 +forgotten ents 2 +duplicata 3 1+2"
<< "See also : evaladisp writedisp xsplit";
return 0;
}
Standard_Boolean OK = Standard_True;
- Standard_Integer i, mode = atoi(arg1); Message::SendInfo() << " Mode " << mode << "\n";
+ Standard_Integer i, mode = atoi(arg1); aSSC.SStream() << " Mode " << mode << "\n";
for (i = 2; i < theNbArgs; i++)
{
DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i]));
if (disp.IsNull())
{
- Message::SendInfo() << "Not a dispatch:" << theArgVec[i]; OK = Standard_False;
+ aSSC.SStream() << "Not a dispatch:" << theArgVec[i]; OK = Standard_False;
}
}
if (!OK)
{
- Message::SendInfo() << "Some of the parameters are not correct";
+ aSSC.SStream() << "Some of the parameters are not correct";
return 1;
}
return 0;
}
-//=======================================================================
-//function : fun_evaladisp
-//purpose :
-//=======================================================================
-static Standard_Integer fun_evaladisp(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- // **** EvalADisp [GiveList] ****
- if (theNbArgs < 3)
- {
- Message::SendInfo() << "evaladisp mode(=0-1-2-3) disp [givelist] : Mode + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch. Mode:\n"
- << " 0 brief 1 +forgotten ents 2 +duplicata 3 1+2"
- << "See also : writedisp";
- return 0;
- }
- if (arg1[1] != '\0')
- {
- Message::SendInfo() << "first parameter : mode, must be a number between 0 and 3";
- return 1;
- }
- Standard_Integer mode = atoi(arg1); Message::SendInfo() << " Mode " << mode << "\n";
- // DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(theArgVec[2]));
- Handle(IFSelect_Dispatch) disp = XSDRAW_FunctionsSession::GiveDispatch(WS, theArgVec[2], Standard_True);
- if (disp.IsNull())
- {
- Message::SendInfo() << "Not a dispatch:" << theArgVec[2];
- return 1;
- }
- Handle(IFSelect_Selection) selsav = disp->FinalSelection();
- Handle(IFSelect_Selection) sel;
- if (theNbArgs > 3)
- {
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- Handle(TColStd_HSequenceOfTransient) list = XSDRAW_FunctionsSession::GiveList
- (XSDRAWBase::Session(), pilot->CommandPart(3));
- Standard_Integer nb = (list.IsNull() ? 0 : list->Length());
- if (nb > 0)
- {
- sp->AddList(list); sel = sp;
- }
- }
-
- if (sel.IsNull() && selsav.IsNull())
- {
- Message::SendInfo() << "No Selection nor GiveList defined";
- return 1;
- }
- if (sel.IsNull() && !selsav.IsNull())
- {
- if (theNbArgs > 3) Message::SendInfo() << "GiveList is empty, hence computed from the Selection of the Dispatch";
- sel = selsav;
- }
- disp->SetFinalSelection(sel);
- // WS->ClearShareOut(Standard_True);
- // WS->SetActive(disp,Standard_True);
- WS->EvaluateDispatch(disp, mode);
- disp->SetFinalSelection(selsav);
-
- return 0;
-}
-
-//=======================================================================
-//function : fun_writedisp
-//purpose :
-//=======================================================================
-static Standard_Integer fun_writedisp(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- // **** EvalADisp [GiveList] ****
- if (theNbArgs < 3)
- {
- Message::SendInfo() << "writedisp filename disp [givelist] : FileName + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch.\n"
- << "FileName : rootname.ext will gives rootname_1.ext etc...\n"
- << " path/rootname.ext gives path/rootname_1.ext etc...\n"
- << "See also : evaladisp";
- return 0;
- }
- TCollection_AsciiString prefix, rootname, suffix;
- SplitFileName(arg1, prefix, rootname, suffix);
- if (rootname.Length() == 0 || suffix.Length() == 0)
- {
- Message::SendInfo() << "Empty Root Name or Extension";
- return 1;
- }
-
- // DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(theArgVec[2]));
- Handle(IFSelect_Dispatch) disp = XSDRAW_FunctionsSession::GiveDispatch(WS, theArgVec[2], Standard_True);
- if (disp.IsNull())
- {
- Message::SendInfo() << "Not a dispatch:" << theArgVec[2];
- return 1;
- }
- Handle(IFSelect_Selection) selsav = disp->FinalSelection();
- Handle(IFSelect_Selection) sel;
- if (theNbArgs > 3)
- {
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- Handle(TColStd_HSequenceOfTransient) list = XSDRAW_FunctionsSession::GiveList
- (XSDRAWBase::Session(), pilot->CommandPart(3));
- Standard_Integer nb = (list.IsNull() ? 0 : list->Length());
- if (nb > 0)
- {
- sp->AddList(list); sel = sp;
- }
- }
-
- if (sel.IsNull() && selsav.IsNull())
- {
- Message::SendInfo() << "No Selection nor GiveList defined";
- return 1;
- }
- if (sel.IsNull() && !selsav.IsNull())
- {
- if (theNbArgs > 3) Message::SendInfo() << "GiveList is empty, hence computed from the Selection of the Dispatch";
- sel = selsav;
- }
-
- WS->ClearShareOut(Standard_True);
- disp->SetFinalSelection(sel);
- WS->SetActive(disp, Standard_True);
- WS->BeginSentFiles(Standard_True);
-
- WS->SetFilePrefix(prefix.ToCString());
- WS->SetFileExtension(suffix.ToCString());
- WS->SetFileRoot(disp, rootname.ToCString());
-
- Standard_Boolean OK = WS->SendSplit();
- disp->SetFinalSelection(selsav);
- return (OK ? IFSelect_RetDone : IFSelect_RetFail);
-}
-
//=======================================================================
//function : fun59
//purpose :
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** EvalComplete ****
Standard_Integer mode = 0;
- if (theNbArgs < 2) Message::SendInfo() << " -- mode par defaut 0\n";
+ if (theNbArgs < 2) aSSC.SStream() << " -- mode par defaut 0\n";
else
{
- mode = atoi(arg1); Message::SendInfo() << " -- mode : " << mode;
+ mode = atoi(arg1); aSSC.SStream() << " -- mode : " << mode;
}
- WS->EvaluateComplete(mode); return 0;
+ WS->EvaluateComplete(mode);
+ return 0;
}
//=======================================================================
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ (void)theNbArgs;
+ (void)theArgVec;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
// **** LastRunCheckList ****
Interface_CheckIterator chlist = WS->LastRunCheckList();
Handle(IFSelect_CheckCounter) counter = new IFSelect_CheckCounter(0);
counter->Analyse(chlist, WS->Model(), Standard_False);
- counter->PrintCount(Message::SendInfo());
+ counter->PrintCount(aSSC.SStream());
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** RunTransformer ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Donner Nom de Transformer";
+ aSSC.SStream() << "Donner Nom de Transformer";
return 1;
}
DeclareAndCast(IFSelect_Transformer, tsf, WS->NamedItem(arg1));
Standard_Integer effect = WS->RunTransformer(tsf);
switch (effect)
{
- case -4: Message::SendInfo() << "Edition sur place, nouveau Protocole, erreur recalcul graphe"; break;
- case -3: Message::SendInfo() << "Erreur, Transformation ignoree"; break;
- case -2: Message::SendInfo() << "Erreur sur edition sur place, risque de corruption (verifier)"; break;
- case -1: Message::SendInfo() << "Erreur sur edition locale, risque de corruption (verifier)"; break;
+ case -4: aSSC.SStream() << "Edition sur place, nouveau Protocole, erreur recalcul graphe"; break;
+ case -3: aSSC.SStream() << "Erreur, Transformation ignoree"; break;
+ case -2: aSSC.SStream() << "Erreur sur edition sur place, risque de corruption (verifier)"; break;
+ case -1: aSSC.SStream() << "Erreur sur edition locale, risque de corruption (verifier)"; break;
case 0:
- if (tsf.IsNull()) Message::SendInfo() << "Erreur, pas un Transformer: " << arg1;
- else Message::SendInfo() << "Execution non faite";
+ if (tsf.IsNull()) aSSC.SStream() << "Erreur, pas un Transformer: " << arg1;
+ else aSSC.SStream() << "Execution non faite";
break;
- case 1: Message::SendInfo() << "Transformation locale (graphe non touche)"; break;
- case 2: Message::SendInfo() << "Edition sur place (graphe recalcule)"; break;
- case 3: Message::SendInfo() << "Modele reconstruit"; break;
- case 4: Message::SendInfo() << "Edition sur place, nouveau Protocole"; break;
- case 5: Message::SendInfo() << "Nouveau Modele avec nouveau Protocole"; break;
- default: break;
- }
- return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail);
-}
-
-//=======================================================================
-//function : fun62
-//purpose :
-//=======================================================================
-static Standard_Integer fun62(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** TransformStandard Copy ****
- return pilot->RecordItem(WS->NewTransformStandard(Standard_True));
-}
-
-//=======================================================================
-//function : fun63
-//purpose :
-//=======================================================================
-static Standard_Integer fun63(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** TransformStandard OntheSpot ****
- return pilot->RecordItem(WS->NewTransformStandard(Standard_False));
-}
-
-//=======================================================================
-//function : fun6465
-//purpose :
-//=======================================================================
-static Standard_Integer fun6465(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- // **** Run Modifier avec Standard Copy ****
- // **** Run Modifier avec OnTheSpot ****
- Standard_Boolean runcopy = (theArgVec[0][3] == 'c');
- // soit c est un nom, sinon c est une commande
- Handle(IFSelect_Modifier) modif;
- if (WS->NameIdent(arg1) > 0)
- modif = GetCasted(IFSelect_Modifier, WS->NamedItem(arg1));
- else
- {
- pilot->RemoveWord(0); // c etait la commande run
- pilot->Perform();
- modif = GetCasted(IFSelect_Modifier, pilot->RecordedItem());
- }
- Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo();
- if (modif.IsNull())
- {
- Message::SendInfo() << "Pas un nom de Modifier : " << arg1;
- return 1;
- }
-
- Handle(TColStd_HSequenceOfTransient) list;
- Handle(IFSelect_SelectPointed) sp;
- if (theNbArgs > 2)
- {
- list = XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart(2));
- sp = new IFSelect_SelectPointed;
- sp->SetList(list);
- }
-
- Standard_Integer effect = 0;
- effect = WS->RunModifierSelected(modif, sp, runcopy);
- // Message::SendInfo()<<"Modifier applique sur TransformStandard #"<<WS->ItemIdent(tsf)<<std::endl;
- switch (effect)
- {
- case -4: Message::SendInfo() << "Edition sur place, nouveau Protocole, erreur recalcul graphe"; break;
- case -3: Message::SendInfo() << "Erreur, Transformation ignoree"; break;
- case -2: Message::SendInfo() << "Erreur sur edition sur place, risque de corruption (verifier)"; break;
- case -1: Message::SendInfo() << "Erreur sur edition locale, risque de corruption (verifier)"; break;
- case 0:
- if (modif.IsNull()) Message::SendInfo() << "Erreur, pas un Modifier: " << arg1;
- else Message::SendInfo() << "Execution non faite";
- break;
- case 1: Message::SendInfo() << "Transformation locale (graphe non touche)"; break;
- case 2: Message::SendInfo() << "Edition sur place (graphe recalcule)"; break;
- case 3: Message::SendInfo() << "Modele reconstruit"; break;
- case 4: Message::SendInfo() << "Edition sur place, nouveau Protocole"; break;
- case 5: Message::SendInfo() << "Nouveau Modele avec nouveau Protocole"; break;
- default: break;
- }
- return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail);
-}
-
-//=======================================================================
-//function : fun66
-//purpose :
-//=======================================================================
-static Standard_Integer fun66(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- // **** (xset) ModifReorder ****
- char opt = ' ';
- Standard_Integer theNbArgs = theNbArgs;
- if (theNbArgs >= 2) opt = pilot->Word(1).Value(1);
- if (opt != 'f' && opt != 'l')
- {
- Message::SendInfo() << "Donner option : f -> root-first l -> root-last";
- return 1;
- }
- return pilot->RecordItem(new IFSelect_ModifReorder(opt == 'l'));
-}
-
-//=======================================================================
-//function : fun70
-//purpose :
-//=======================================================================
-static Standard_Integer fun70(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- // **** SelToggle ****
- if (theNbArgs < 2)
- {
- Message::SendInfo() << "Donner Nom de Selection";
- return 1;
- }
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- if (!WS->ToggleSelectExtract(sel))
- {
- Message::SendInfo() << "Pas une SelectExtract : " << arg1;
- return 1;
- }
- if (WS->IsReversedSelectExtract(sel)) Message::SendInfo() << arg1 << " a present Reversed";
- else Message::SendInfo() << arg1 << " a present Directe";
- return 0;
-}
-
-//=======================================================================
-//function : fun71
-//purpose :
-//=======================================================================
-static Standard_Integer fun71(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SelInput ****
- if (theNbArgs < 3)
- {
- Message::SendInfo() << "Donner Noms Selections cible et input";
- return 1;
- }
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection, sou, WS->NamedItem(arg2));
- if (sel.IsNull() || sou.IsNull())
- {
- Message::SendInfo() << "Incorrect : " << arg1 << "," << arg2;
- return 1;
- }
- if (!WS->SetInputSelection(sel, sou))
- {
- Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " ni Extract ni Deduct";
- return 1;
- }
- return 0;
-}
-
-//=======================================================================
-//function : fun72
-//purpose :
-//=======================================================================
-static Standard_Integer fun72(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** SelModelRoots ****
- return pilot->RecordItem(new IFSelect_SelectModelRoots);
-}
-
-//=======================================================================
-//function : fun73
-//purpose :
-//=======================================================================
-static Standard_Integer fun73(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SelRange ****
- if (theNbArgs >= 2 && arg1[0] == '?') theNbArgs = 1;
- if (theNbArgs < 2)
- {
- Message::SendInfo() << "Donner la description du SelectRange"
- << " Formes admises :\n <n1> <n2> : Range de <n1> a <n2>\n"
- << " <n1> tout seul : Range n0 <n1>\n from <n1> : Range From <n1>\n"
- << " until <n2> : Range Until <n2>";
- return 0;
- }
-
- Handle(IFSelect_IntParam) low, up;
- Handle(IFSelect_SelectRange) sel;
- // Range From
- if (pilot->Word(1).IsEqual("from"))
- {
- if (theNbArgs < 3)
- {
- Message::SendInfo() << "Forme admise : from <i>";
- return 1;
- }
- low = GetCasted(IFSelect_IntParam, WS->NamedItem(arg2));
- sel = new IFSelect_SelectRange;
- sel->SetFrom(low);
- // Range Until
- }
- else if (pilot->Word(1).IsEqual("until"))
- {
- if (theNbArgs < 3)
- {
- Message::SendInfo() << "Forme admise : until <i>";
- return 1;
- }
- up = GetCasted(IFSelect_IntParam, WS->NamedItem(arg2));
- sel = new IFSelect_SelectRange;
- sel->SetUntil(up);
- // Range One (n-th)
- }
- else if (theNbArgs < 3)
- {
- low = GetCasted(IFSelect_IntParam, WS->NamedItem(arg1));
- sel = new IFSelect_SelectRange;
- sel->SetOne(low);
- // Range (from-to)
- }
- else
- {
- low = GetCasted(IFSelect_IntParam, WS->NamedItem(arg1));
- up = GetCasted(IFSelect_IntParam, WS->NamedItem(arg2));
- sel = new IFSelect_SelectRange;
- sel->SetRange(low, up);
- }
- return pilot->RecordItem(sel);
-}
-
-//=======================================================================
-//function : fun74
-//purpose :
-//=======================================================================
-static Standard_Integer fun74(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** SelRoots ****
- return pilot->RecordItem(new IFSelect_SelectRoots);
-}
-
-//=======================================================================
-//function : fun75
-//purpose :
-//=======================================================================
-static Standard_Integer fun75(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** SelShared ****
- return pilot->RecordItem(new IFSelect_SelectShared);
-}
-
-//=======================================================================
-//function : fun76
-//purpose :
-//=======================================================================
-static Standard_Integer fun76(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SelDiff ****
- Handle(IFSelect_Selection) sel = new IFSelect_SelectDiff;
- if (sel.IsNull())
- return 1;
- if (theNbArgs < 3) Message::SendInfo() << "Diff sans input : ne pas oublier de les definir (ctlmain, ctlsec)!";
- DeclareAndCast(IFSelect_Selection, selmain, WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection, selsec, WS->NamedItem(arg2));
- if (theNbArgs >= 2)
- if (!WS->SetControl(sel, selmain, Standard_True))
- Message::SendInfo() << "Echec ControlMain:" << arg1 << " , a refaire (ctlmain)";
- if (theNbArgs >= 3)
- if (!WS->SetControl(sel, selsec, Standard_False))
- Message::SendInfo() << "Echec ControlSecond:" << arg2 << " , a refaire (ctlsec)";
- return pilot->RecordItem(sel);
-}
-
-//=======================================================================
-//function : fun77
-//purpose :
-//=======================================================================
-static Standard_Integer fun77(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SelControlMain ****
- if (theNbArgs < 3)
- {
- Message::SendInfo() << "Donner Noms de Control et MainInput";
- return 1;
- }
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection, selmain, WS->NamedItem(arg2));
- if (WS->SetControl(sel, selmain, Standard_True)) return 0;
- Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " pas de type Control";
- return 1;
-}
-
-//=======================================================================
-//function : fun78
-//purpose :
-//=======================================================================
-static Standard_Integer fun78(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SelControlSecond ****
- if (theNbArgs < 3)
- {
- Message::SendInfo() << "Donner Noms de Control et SecondInput";
- return 1;
- }
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection, seldif, WS->NamedItem(arg2));
- if (WS->SetControl(sel, seldif, Standard_False)) return 0;
- Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " pas de type Control";
- return 1;
-}
-
-//=======================================================================
-//function : fun79
-//purpose :
-//=======================================================================
-static Standard_Integer fun79(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** SelModelAll ****
- return pilot->RecordItem(new IFSelect_SelectModelEntities);
-}
-
-//=======================================================================
-//function : fun80
-//purpose :
-//=======================================================================
-static Standard_Integer fun80(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SelCombAdd ****
- if (theNbArgs < 3)
- {
- Message::SendInfo() << "Donner n0 Combine et une Input";
- return 1;
- }
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection, seladd, WS->NamedItem(arg2));
- if (WS->CombineAdd(sel, seladd)) return 0;
- Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " pas Combine";
- return 1;
-}
-
-//=======================================================================
-//function : fun81
-//purpose :
-//=======================================================================
-static Standard_Integer fun81(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SelCombRem ****
- if (theNbArgs < 3)
- {
- Message::SendInfo() << "Donner n0 Combine et RANG a supprimer";
- return 1;
+ case 1: aSSC.SStream() << "Transformation locale (graphe non touche)"; break;
+ case 2: aSSC.SStream() << "Edition sur place (graphe recalcule)"; break;
+ case 3: aSSC.SStream() << "Modele reconstruit"; break;
+ case 4: aSSC.SStream() << "Edition sur place, nouveau Protocole"; break;
+ case 5: aSSC.SStream() << "Nouveau Modele avec nouveau Protocole"; break;
+ default: break;
}
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection, inp, WS->NamedItem(arg2));
- if (WS->CombineRemove(sel, inp)) return 0;
- Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " ni Union ni Intersection";
- return 1;
+ return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail);
}
//=======================================================================
-//function : fun82
+//function : fun70
//purpose :
//=======================================================================
-static Standard_Integer fun82(Draw_Interpretor& theDI,
+static Standard_Integer fun70(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
- // **** SelEntNumber ****
+ // **** SelToggle ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Donner Nom IntParam pour n0 Entite";
+ aSSC.SStream() << "Donner Nom de Selection";
return 1;
}
- DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1));
- Handle(IFSelect_SelectEntityNumber) sel = new IFSelect_SelectEntityNumber;
- sel->SetNumber(par);
- return pilot->RecordItem(sel);
+ DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+ if (!WS->ToggleSelectExtract(sel))
+ {
+ aSSC.SStream() << "Pas une SelectExtract : " << arg1;
+ return 1;
+ }
+ if (WS->IsReversedSelectExtract(sel)) aSSC.SStream() << arg1 << " a present Reversed";
+ else aSSC.SStream() << arg1 << " a present Directe";
+ return 0;
}
//=======================================================================
-//function : fun83
+//function : fun71
//purpose :
//=======================================================================
-static Standard_Integer fun83(Draw_Interpretor& theDI,
+static Standard_Integer fun71(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** SelUnion ****
- return pilot->RecordItem(new IFSelect_SelectUnion);
+
+ const Standard_CString arg1 = theArgVec[1];
+ const Standard_CString arg2 = theArgVec[2];
+ // **** SelInput ****
+ if (theNbArgs < 3)
+ {
+ aSSC.SStream() << "Donner Noms Selections cible et input";
+ return 1;
+ }
+ DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+ DeclareAndCast(IFSelect_Selection, sou, WS->NamedItem(arg2));
+ if (sel.IsNull() || sou.IsNull())
+ {
+ aSSC.SStream() << "Incorrect : " << arg1 << "," << arg2;
+ return 1;
+ }
+ if (!WS->SetInputSelection(sel, sou))
+ {
+ aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " ni Extract ni Deduct";
+ return 1;
+ }
+ return 0;
}
//=======================================================================
-//function : fun84
+//function : fun77
//purpose :
//=======================================================================
-static Standard_Integer fun84(Draw_Interpretor& theDI,
+static Standard_Integer fun77(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** SelIntersection ****
- return pilot->RecordItem(new IFSelect_SelectIntersection);
-}
-//=======================================================================
-//function : fun85
-//purpose :
-//=======================================================================
-static Standard_Integer fun85(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Standard_Integer theNbArgs = theNbArgs;
const Standard_CString arg1 = theArgVec[1];
- // **** SelTextType Exact ****
- if (theNbArgs < 2)
+ const Standard_CString arg2 = theArgVec[2];
+ // **** SelControlMain ****
+ if (theNbArgs < 3)
{
- Message::SendInfo() << "Donner le TYPE a selectionner";
+ aSSC.SStream() << "Donner Noms de Control et MainInput";
return 1;
}
- return pilot->RecordItem(new IFSelect_SelectSignature
- (new IFSelect_SignType, arg1, Standard_True));
+ DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+ DeclareAndCast(IFSelect_Selection, selmain, WS->NamedItem(arg2));
+ if (WS->SetControl(sel, selmain, Standard_True))
+ return 0;
+ aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " pas de type Control";
+ return 1;
}
//=======================================================================
-//function : fun86
+//function : fun78
//purpose :
//=======================================================================
-static Standard_Integer fun86(Draw_Interpretor& theDI,
+static Standard_Integer fun78(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
- // **** SelErrorEntities ****
- return pilot->RecordItem(new IFSelect_SelectErrorEntities);
-}
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-//=======================================================================
-//function : fun87
-//purpose :
-//=======================================================================
-static Standard_Integer fun87(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- // **** SelUnknownEntities **
- return pilot->RecordItem(new IFSelect_SelectUnknownEntities);
+ const Standard_CString arg1 = theArgVec[1];
+ const Standard_CString arg2 = theArgVec[2];
+ // **** SelControlSecond ****
+ if (theNbArgs < 3)
+ {
+ aSSC.SStream() << "Donner Noms de Control et SecondInput";
+ return 1;
+ }
+ DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+ DeclareAndCast(IFSelect_Selection, seldif, WS->NamedItem(arg2));
+ if (WS->SetControl(sel, seldif, Standard_False)) return 0;
+ aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " pas de type Control";
+ return 1;
}
//=======================================================================
-//function : fun88
+//function : fun80
//purpose :
//=======================================================================
-static Standard_Integer fun88(Draw_Interpretor& theDI,
+static Standard_Integer fun80(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
- // **** SelSharing ****
- return pilot->RecordItem(new IFSelect_SelectSharing);
-}
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-//=======================================================================
-//function : fun89
-//purpose :
-//=======================================================================
-static Standard_Integer fun89(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Standard_Integer theNbArgs = theNbArgs;
const Standard_CString arg1 = theArgVec[1];
- // **** SelTextType Contain **
- if (theNbArgs < 2)
+ const Standard_CString arg2 = theArgVec[2];
+ // **** SelCombAdd ****
+ if (theNbArgs < 3)
{
- Message::SendInfo() << "Donner le TYPE a selectionner";
+ aSSC.SStream() << "Donner n0 Combine et une Input";
return 1;
}
- return pilot->RecordItem(new IFSelect_SelectSignature
- (new IFSelect_SignType, arg1, Standard_False));
+ DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+ DeclareAndCast(IFSelect_Selection, seladd, WS->NamedItem(arg2));
+ if (WS->CombineAdd(sel, seladd))
+ return 0;
+ aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " pas Combine";
+ return 1;
}
//=======================================================================
-//function : fun90
+//function : fun81
//purpose :
//=======================================================================
-static Standard_Integer fun90(Draw_Interpretor& theDI,
+static Standard_Integer fun81(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
- // **** SelPointed ****
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- if (theNbArgs > 1)
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+
+ const Standard_CString arg1 = theArgVec[1];
+ const Standard_CString arg2 = theArgVec[2];
+ // **** SelCombRem ****
+ if (theNbArgs < 3)
{
- Handle(TColStd_HSequenceOfTransient) list = GiveList
- (XSDRAWBase::Session(), pilot->CommandPart(1));
- if (list.IsNull())
- return 1;
- Message::SendInfo() << "SelectPointed : " << list->Length() << " entities";
- sp->AddList(list);
+ aSSC.SStream() << "Donner n0 Combine et RANG a supprimer";
+ return 1;
}
- return pilot->RecordItem(sp);
+ DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+ DeclareAndCast(IFSelect_Selection, inp, WS->NamedItem(arg2));
+ if (WS->CombineRemove(sel, inp))
+ return 0;
+ aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " ni Union ni Intersection";
+ return 1;
}
//=======================================================================
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Standard_Integer theNbArgs = theNbArgs;
+
const Standard_CString arg1 = theArgVec[1];
// **** SetPointed (edit) / SetList (edit) ****
if (theNbArgs < 2)
{
- Message::SendInfo() << "Donner NOM SelectPointed + Option(s) :\n"
+ aSSC.SStream() << "Donner NOM SelectPointed + Option(s) :\n"
<< " aucune : liste des entites pointees\n"
<< " 0: Clear +nn ajout entite nn -nn enleve nn /nn toggle nn";
return 1;
DeclareAndCast(IFSelect_SelectPointed, sp, WS->NamedItem(arg1));
if (sp.IsNull())
{
- Message::SendInfo() << "Pas une SelectPointed:" << arg1;
+ aSSC.SStream() << "Pas une SelectPointed:" << arg1;
return 1;
}
const Handle(Interface_InterfaceModel)& model = WS->Model(); // pour Print
if (theNbArgs == 2)
{ // listage simple
Standard_Integer nb = sp->NbItems();
- Message::SendInfo() << " SelectPointed : " << arg1 << " : " << nb << " Items :";
+ aSSC.SStream() << " SelectPointed : " << arg1 << " : " << nb << " Items :";
for (Standard_Integer i = 1; i <= nb; i++)
{
Handle(Standard_Transient) pointed = sp->Item(i);
Standard_Integer id = WS->StartingNumber(pointed);
- if (id == 0) Message::SendInfo() << " (inconnu)";
+ if (id == 0) aSSC.SStream() << " (inconnu)";
else
{
- Message::SendInfo() << " "; model->Print(pointed, Message::SendInfo());
+ aSSC.SStream() << " "; model->Print(pointed, aSSC.SStream());
}
}
- if (nb > 0) Message::SendInfo();
return 0;
}
for (Standard_Integer ia = 2; ia < theNbArgs; ia++)
{
- const TCollection_AsciiString argi = pilot->Word(ia);
- Standard_Integer id = pilot->Number(&(argi.ToCString())[1]);
+ const TCollection_AsciiString argi = theArgVec[ia];
+ Standard_Integer id = WS->NumberFromLabel(&(argi.ToCString())[1]);
if (id == 0)
{
- if (!argi.IsEqual("0")) Message::SendInfo() << "Incorrect,ignore:" << argi;
+ if (!argi.IsEqual("0")) aSSC.SStream() << "Incorrect,ignore:" << argi;
else
{
- Message::SendInfo() << "Clear SelectPointed"; sp->Clear();
+ aSSC.SStream() << "Clear SelectPointed"; sp->Clear();
}
}
else if (argi.Value(1) == '-')
{
Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Remove(item)) Message::SendInfo() << "Removed:no." << id;
- else Message::SendInfo() << " Echec Remove " << id;
- Message::SendInfo() << ": ";
- model->Print(item, Message::SendInfo());
+ if (sp->Remove(item)) aSSC.SStream() << "Removed:no." << id;
+ else aSSC.SStream() << " Echec Remove " << id;
+ aSSC.SStream() << ": ";
+ model->Print(item, aSSC.SStream());
}
else if (argi.Value(1) == '/')
{
Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Remove(item)) Message::SendInfo() << "Toggled:n0." << id;
- else Message::SendInfo() << " Echec Toggle " << id;
- Message::SendInfo() << ": ";
- model->Print(item, Message::SendInfo());
+ if (sp->Remove(item)) aSSC.SStream() << "Toggled:n0." << id;
+ else aSSC.SStream() << " Echec Toggle " << id;
+ aSSC.SStream() << ": ";
+ model->Print(item, aSSC.SStream());
}
else if (argi.Value(1) == '+')
{
Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Add(item)) Message::SendInfo() << "Added:no." << id;
- else Message::SendInfo() << " Echec Add " << id;
- Message::SendInfo() << ": ";
- model->Print(item, Message::SendInfo());
+ if (sp->Add(item)) aSSC.SStream() << "Added:no." << id;
+ else aSSC.SStream() << " Echec Add " << id;
+ aSSC.SStream() << ": ";
+ model->Print(item, aSSC.SStream());
}
else
{
- Message::SendInfo() << "Ignore:" << argi << " , donner n0 PRECEDE de + ou - ou /";
+ aSSC.SStream() << "Ignore:" << argi << " , donner n0 PRECEDE de + ou - ou /";
}
}
return 0;
}
-//=======================================================================
-//function : fun92
-//purpose :
-//=======================================================================
-static Standard_Integer fun92(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** SelIncorrectEntities ****
- WS->ComputeCheck();
- return pilot->RecordItem(new IFSelect_SelectIncorrectEntities);
-}
-
-//=======================================================================
-//function : fun93
-//purpose :
-//=======================================================================
-static Standard_Integer fun93(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** SelSignature ****
- if (theNbArgs < 3)
- {
- Message::SendInfo() << "Give name of Signature or Counter, text + option exact(D) else contains";
- return 1;
- }
- Standard_Boolean exact = Standard_True;
- if (theNbArgs > 3)
- {
- if (theArgVec[3][0] == 'c') exact = Standard_False;
- }
-
- DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_SignCounter, cnt, WS->NamedItem(arg1));
- Handle(IFSelect_SelectSignature) sel;
-
- if (!sign.IsNull()) sel = new IFSelect_SelectSignature(sign, arg2, exact);
- else if (!cnt.IsNull()) sel = new IFSelect_SelectSignature(cnt, arg2, exact);
- else
- {
- Message::SendInfo() << arg1 << ":neither Signature nor Counter";
- return 1;
- }
-
- return pilot->RecordItem(sel);
-}
-
-//=======================================================================
-//function : fun94
-//purpose :
-//=======================================================================
-static Standard_Integer fun94(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** SignCounter ****
- if (theNbArgs < 2)
- {
- Message::SendInfo() << "Donner nom signature";
- return 1;
- }
- DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1));
- if (sign.IsNull())
- {
- Message::SendInfo() << arg1 << ":pas une signature";
- return 1;
- }
- Handle(IFSelect_SignCounter) cnt = new IFSelect_SignCounter(sign, Standard_True, Standard_True);
- return pilot->RecordItem(cnt);
-}
-
-//=======================================================================
-//function : funbselected
-//purpose :
-//=======================================================================
-static Standard_Integer funbselected(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Standard_Integer theNbArgs = theNbArgs;
- const Standard_CString arg1 = theArgVec[1];
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** NbSelected = GraphCounter ****
- if (theNbArgs < 2)
- {
- Message::SendInfo() << "Donner nom selection (deduction) a appliquer";
- return 1;
- }
- DeclareAndCast(IFSelect_SelectDeduct, applied, WS->GiveSelection(arg1));
- if (applied.IsNull())
- {
- Message::SendInfo() << arg1 << ":pas une SelectDeduct";
- return 1;
- }
- Handle(IFSelect_GraphCounter) cnt = new IFSelect_GraphCounter(Standard_True, Standard_True);
- cnt->SetApplied(applied);
- return pilot->RecordItem(cnt);
-}
-
//=======================================================================
//function : fun_editlist
//purpose :
Standard_Integer theNbArgs,
const char** theArgVec)
{
- Standard_Integer theNbArgs = theNbArgs;
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
if (theNbArgs < 2)
{
- Message::SendInfo() << "Give the name of an EditForm or an Editor";
+ aSSC.SStream() << "Give the name of an EditForm or an Editor";
return 1;
}
const Standard_CString arg1 = theArgVec[1];
Handle(IFSelect_Editor) edt;
if (!edf.IsNull())
{
- Message::SendInfo() << "Print EditForm " << arg1;
+ aSSC.SStream() << "Print EditForm " << arg1;
edt = edf->Editor();
if (theNbArgs < 3)
{
-
// DEFINITIONS : Editor (direct ou via EditForm)
if (edt.IsNull()) edt = GetCasted(IFSelect_Editor, WS->NamedItem(arg1));
- if (edt.IsNull()) return 0;
+ if (edt.IsNull())
+ return 0;
- Message::SendInfo() << "Editor, Label : " << edt->Label();
- Message::SendInfo() << " -- Names (short - complete) + Labels of Values";
- edt->PrintNames(Message::SendInfo());
- Message::SendInfo() << " -- Definitions --";
- edt->PrintDefs(Message::SendInfo());
+ aSSC.SStream() << "Editor, Label : " << edt->Label();
+ aSSC.SStream() << " -- Names (short - complete) + Labels of Values";
+ edt->PrintNames(aSSC.SStream());
+ aSSC.SStream() << " -- Definitions --";
+ edt->PrintDefs(aSSC.SStream());
if (!edf.IsNull())
{
- edf->PrintDefs(Message::SendInfo());
- Message::SendInfo() << "To display values, add an option : o original f final m modified";
+ edf->PrintDefs(aSSC.SStream());
+ aSSC.SStream() << "To display values, add an option : o original f final m modified";
}
return 0;
if (opt == 'o') what = -1;
else if (opt == 'f') what = 1;
- edf->PrintValues(Message::SendInfo(), what, Standard_False);
- }
- }
-
- return 0;
-}
-
-//=======================================================================
-//function : fun_editvalue
-//purpose :
-//=======================================================================
-static Standard_Integer fun_editvalue(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- Standard_Integer theNbArgs = theNbArgs;
- if (theNbArgs < 3)
- {
- Message::SendInfo() << "Give the name of an EditForm + name of Value [+ newvalue or . to nullify]";
- return 1;
- }
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1));
- if (edf.IsNull())
- {
- Message::SendInfo() << "Not an EditForm : " << arg1;
- return 1;
- }
- Standard_Integer num = edf->NameNumber(arg2);
- if (num == 0) Message::SendInfo() << "Unknown Value Name : " << arg2;
- if (num < 0) Message::SendInfo() << "Not Extracted Value Name : " << arg2;
- if (num <= 0)
- return 1;
-
- Standard_Boolean islist = edf->Editor()->IsList(num);
- Standard_CString name = edf->Editor()->Name(num, Standard_True); // vrai nom
- Handle(TColStd_HSequenceOfHAsciiString) listr;
- Handle(TCollection_HAsciiString) str;
- Message::SendInfo() << "Value Name : " << name << (edf->IsModified(num) ? "(already edited) : " : " : ");
-
- if (islist)
- {
- listr = edf->EditedList(num);
- if (listr.IsNull()) Message::SendInfo() << "(NULL LIST)";
- else
- {
- Standard_Integer ilist, nblist = listr->Length();
- Message::SendInfo() << "(List : " << nblist << " Items)";
- for (ilist = 1; ilist <= nblist; ilist++)
- {
- str = listr->Value(ilist);
- Message::SendInfo() << " [" << ilist << "] " << (str.IsNull() ? "(NULL)" : str->ToCString());
- }
+ edf->PrintValues(aSSC.SStream(), what, Standard_False);
}
- if (theNbArgs < 4) Message::SendInfo() << "To Edit, options by editval edit-form value-name ?";
- }
- else
- {
- str = edf->EditedValue(num);
- Message::SendInfo() << (str.IsNull() ? "(NULL)" : str->ToCString());
}
- if (theNbArgs < 4) return 0;
- // Valeur simple ou liste ?
- Standard_Integer numarg = 3;
- str.Nullify();
-
- const Standard_CString argval = pilot->Arg(numarg);
- if (islist)
- {
- if (argval[0] == '?')
- {
- Message::SendInfo() << "To Edit, options" << " + val : add value at end (blanks allowed)"
- << " +nn text : insert val before item nn"
- << " nn text : replace item nn with a new value"
- << " -nn : remove item nn" << " . : clear the list";
- return 0;
- }
- Standard_Boolean stated = Standard_False;
- Handle(IFSelect_ListEditor) listed = edf->ListEditor(num);
- if (listed.IsNull())
- return 1;
- if (argval[0] == '.')
- {
- listr.Nullify(); stated = listed->LoadEdited(listr);
- }
- else if (argval[0] == '+')
- {
- Standard_Integer numadd = 0;
- if (argval[1] != '\0') numadd = atoi(argval);
- stated = listed->AddValue(new TCollection_HAsciiString(pilot->CommandPart(numarg + 1)), numadd);
- }
- else if (argval[0] == '-')
- {
- Standard_Integer numrem = atoi(argval);
- stated = listed->Remove(numrem);
- }
- else
- {
- Standard_Integer numset = atoi(argval);
- if (numset > 0) stated = listed->AddValue
- (new TCollection_HAsciiString(pilot->CommandPart(numarg + 1)), numset);
- }
- if (stated) stated = edf->ModifyList(num, listed, Standard_True);
- if (stated) Message::SendInfo() << "List Edition done";
- else Message::SendInfo() << "List Edition not done, option" << argval;
- }
- else
- {
- if (argval[0] == '.' && argval[1] == '\0') str.Nullify();
- else str = new TCollection_HAsciiString(pilot->CommandPart(numarg));
- if (edf->Modify(num, str, Standard_True))
- {
- Message::SendInfo() << "Now set to " << (str.IsNull() ? "(NULL)" : str->ToCString());
- }
- else
- {
- Message::SendInfo() << "Modify not done";
- return 1;
- }
- }
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
if (theNbArgs < 2)
{
- Message::SendInfo() << "Give the name of an EditForm [+ name of Value else all]";
+ aSSC.SStream() << "Give the name of an EditForm [+ name of Value else all]";
return 1;
}
const Standard_CString arg1 = theArgVec[1];
DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1));
if (edf.IsNull())
{
- Message::SendInfo() << "Not an EditForm : " << arg1;
+ aSSC.SStream() << "Not an EditForm : " << arg1;
return 1;
}
if (theNbArgs < 3)
{
- edf->ClearEdit(); Message::SendInfo() << "All Modifications Cleared";
+ edf->ClearEdit(); aSSC.SStream() << "All Modifications Cleared";
}
else
{
Standard_Integer num = edf->NameNumber(arg2);
- if (num == 0) Message::SendInfo() << "Unknown Value Name : " << arg2;
- if (num < 0) Message::SendInfo() << "Not Extracted Value Name : " << arg2;
+ if (num == 0) aSSC.SStream() << "Unknown Value Name : " << arg2;
+ if (num < 0) aSSC.SStream() << "Not Extracted Value Name : " << arg2;
if (num <= 0)
return 1;
if (!edf->IsModified(num))
{
- Message::SendInfo() << "Value " << arg2 << " was not modified"; return 0;
+ aSSC.SStream() << "Value " << arg2 << " was not modified";
+ return 0;
}
edf->ClearEdit(num);
- Message::SendInfo() << "Modification on Value " << arg2 << " Cleared";
+ aSSC.SStream() << "Modification on Value " << arg2 << " Cleared";
}
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
if (theNbArgs < 2)
{
- Message::SendInfo() << "Give the name of an EditForm [+ option keep to re-apply edited values]";
+ aSSC.SStream() << "Give the name of an EditForm [+ option keep to re-apply edited values]";
return 1;
}
const Standard_CString arg1 = theArgVec[1];
DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1));
if (edf.IsNull())
{
- Message::SendInfo() << "Not an EditForm : " << arg1;
+ aSSC.SStream() << "Not an EditForm : " << arg1;
return 1;
}
Handle(Interface_InterfaceModel) model = edf->Model();
if (!model.IsNull())
{
- if (ent.IsNull()) Message::SendInfo() << "Applying modifications on loaded model";
+ if (ent.IsNull()) aSSC.SStream() << "Applying modifications on loaded model";
else
{
- Message::SendInfo() << "Applying modifications on loaded entity : ";
- model->PrintLabel(ent, Message::SendInfo());
+ aSSC.SStream() << "Applying modifications on loaded entity : ";
+ model->PrintLabel(ent, aSSC.SStream());
}
}
- else Message::SendInfo() << "Applying modifications";
+ else aSSC.SStream() << "Applying modifications";
if (!edf->ApplyData(edf->Entity(), edf->Model()))
{
- Message::SendInfo() << "Modifications could not be applied";
+ aSSC.SStream() << "Modifications could not be applied";
return 1;
}
- Message::SendInfo() << "Modifications have been applied";
+ aSSC.SStream() << "Modifications have been applied";
Standard_Boolean stat = Standard_True;
if (theNbArgs > 2 && arg2[0] == 'k') stat = Standard_False;
if (stat)
{
edf->ClearEdit();
- Message::SendInfo() << "Edited values are cleared";
+ aSSC.SStream() << "Edited values are cleared";
}
- else Message::SendInfo() << "Edited values are kept for another loading/applying";
+ else aSSC.SStream() << "Edited values are kept for another loading/applying";
return 0;
}
Standard_Integer theNbArgs,
const char** theArgVec)
{
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
if (theNbArgs < 2)
{
- Message::SendInfo() << "Give the name of an EditForm [+ Entity-Ident]";
+ aSSC.SStream() << "Give the name of an EditForm [+ Entity-Ident]";
return 1;
}
const Standard_CString arg1 = theArgVec[1];
DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1));
if (edf.IsNull())
{
- Message::SendInfo() << "Not an EditForm : " << arg1;
+ aSSC.SStream() << "Not an EditForm : " << arg1;
return 1;
}
- Standard_Integer num = (theNbArgs < 3 ? 0 : pilot->Number(arg2));
+ Standard_Integer num = (theNbArgs < 3 ? 0 : WS->NumberFromLabel(arg2));
Standard_Boolean stat = Standard_False;
if (theNbArgs < 3)
{
- Message::SendInfo() << "EditForm " << arg1 << " : Loading Model";
+ aSSC.SStream() << "EditForm " << arg1 << " : Loading Model";
stat = edf->LoadModel(WS->Model());
}
else if (num <= 0)
{
- Message::SendInfo() << "Not an entity ident : " << arg2;
+ aSSC.SStream() << "Not an entity ident : " << arg2;
return 1;
}
else
{
- Message::SendInfo() << "EditForm " << arg1 << " : Loading Entity " << arg2;
+ aSSC.SStream() << "EditForm " << arg1 << " : Loading Entity " << arg2;
stat = edf->LoadData(WS->StartingEntity(num), WS->Model());
}
if (!stat)
{
- Message::SendInfo() << "Loading not done";
+ aSSC.SStream() << "Loading not done";
return 1;
}
- Message::SendInfo() << "Loading done";
+ aSSC.SStream() << "Loading done";
return 0;
}
-//=======================================================================
-//function : GiveEntity
-//purpose :
-//=======================================================================
-Handle(Standard_Transient) GiveEntity(const Handle(XSControl_WorkSession)& WS,
- const Standard_CString name)
-{
- Handle(Standard_Transient) ent; // demarre a Null
- Standard_Integer num = GiveEntityNumber(WS, name);
- if (num > 0) ent = WS->StartingEntity(num);
- return ent;
-}
-
-//=======================================================================
-//function : GiveEntityNumber
-//purpose :
-//=======================================================================
-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 : Init
//purpose :
theDI.Add("xload", "file:string : Read File -> Load Model", __FILE__, fun3, aGroup);
theDI.Add("xread", "file:string : Read File -> Load Model", __FILE__, fun3, aGroup);
theDI.Add("writeall", "file:string : Write all model (no split)", __FILE__, fun4, aGroup);
- theDI.Add("writesel", "file:string sel:Selection : Write Selected (no split)", __FILE__, fun5, aGroup);
+ //theDI.Add("writesel", "file:string sel:Selection : Write Selected (no split)", __FILE__, fun5, aGroup);
theDI.Add("writeent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)", __FILE__, fun6, aGroup);
theDI.Add("writent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)", __FILE__, fun6, aGroup);
theDI.Add("elabel", "nument:integer : Displays Label Model of an entity", __FILE__, fun7, aGroup);
theDI.Add("enum", "label:string : Displays entities n0.s of which Label Model ends by..", __FILE__, fun8, aGroup);
theDI.Add("listtypes", "List nb entities per type. Optional selection name else all model", __FILE__, fun9, aGroup);
- theDI.Add("count", "Count : counter [selection]", __FILE__, funcount, aGroup);
- theDI.Add("listcount", "List Counted : counter [selection [nument]]", __FILE__, funcount, aGroup);
- theDI.Add("sumcount", "Summary Counted : counter [selection [nument]]", __FILE__, funcount, aGroup);
+ //theDI.Add("count", "Count : counter [selection]", __FILE__, funcount, aGroup);
+ //theDI.Add("listcount", "List Counted : counter [selection [nument]]", __FILE__, funcount, aGroup);
+ //theDI.Add("sumcount", "Summary Counted : counter [selection [nument]]", __FILE__, funcount, aGroup);
theDI.Add("signtype", "Sign Type [newone]", __FILE__, funsigntype, aGroup);
theDI.Add("signcase", "signature : displays possible cases", __FILE__, funsigncase, aGroup);
theDI.Add("dumpshare", "Dump Share (dispatches, IntParams)", __FILE__, fun12, aGroup);
theDI.Add("listitems", "List Items [label else all] ->Type,Label[,Name]", __FILE__, fun13, aGroup);
- theDI.Add("integer", "value:integer : cree un IntParam", __FILE__, fun14, aGroup);
+ //theDI.Add("integer", "value:integer : cree un IntParam", __FILE__, fun14, aGroup);
theDI.Add("setint", "name:IntParam newValue:integer : Change valeur IntParam", __FILE__, fun15, aGroup);
- theDI.Add("text", "value:string : cree un TextParam", __FILE__, fun16, aGroup);
+ //theDI.Add("text", "value:string : cree un TextParam", __FILE__, fun16, aGroup);
theDI.Add("settext", "Name:TextParam newValue:string : Change valeur TextParam", __FILE__, fun17, aGroup);
theDI.Add("dumpsel", "Dump Selection suivi du Nom de la Selection a dumper", __FILE__, fun19, aGroup);
- theDI.Add("evalsel", "name:Selection [num/sel] : Evalue une Selection", __FILE__, fun20, aGroup);
- theDI.Add("givelist", "num/sel [num/sel ...] : Evaluates GiveList", __FILE__, fun20, aGroup);
- theDI.Add("giveshort", "num/sel [num/sel ...] : GiveList in short form", __FILE__, fun20, aGroup);
- theDI.Add("givepointed", "num/sel [num/sel ...] : GiveList to fill a SelectPointed", __FILE__, fun20, aGroup);
- theDI.Add("makelist", "listname [givelist] : Makes a List(SelectPointed) from GiveList", __FILE__, fun20, aGroup);
- theDI.Add("givecount", "num/sel [num/sel ...] : Counts GiveList", __FILE__, fun20c, aGroup);
- theDI.Add("selsuite", "sel sel ... : Creates a SelectSuite", __FILE__, funselsuite, aGroup);
+ //theDI.Add("evalsel", "name:Selection [num/sel] : Evalue une Selection", __FILE__, fun20, aGroup);
+ //theDI.Add("givelist", "num/sel [num/sel ...] : Evaluates GiveList", __FILE__, fun20, aGroup);
+ //theDI.Add("giveshort", "num/sel [num/sel ...] : GiveList in short form", __FILE__, fun20, aGroup);
+ //theDI.Add("givepointed", "num/sel [num/sel ...] : GiveList to fill a SelectPointed", __FILE__, fun20, aGroup);
+ //theDI.Add("makelist", "listname [givelist] : Makes a List(SelectPointed) from GiveList", __FILE__, fun20, aGroup);
+ //theDI.Add("givecount", "num/sel [num/sel ...] : Counts GiveList", __FILE__, fun20c, aGroup);
+ //theDI.Add("selsuite", "sel sel ... : Creates a SelectSuite", __FILE__, funselsuite, aGroup);
theDI.Add("clearitems", "Clears all items (selections, dispatches, etc)", __FILE__, fun21, aGroup);
theDI.Add("cleardata", "mode:a-g-c-p : Clears all or some data (model, check...)", __FILE__, fun22, aGroup);
theDI.Add("modifmove", "modif:Modifier M(model)/F(file) avant,apres:integer : Deplace un Modifier (sortie fichier)", __FILE__, fun45, aGroup);
theDI.Add("dispsel", "disp:Dispatch sel:Selection -> Selection Finale de Dispatch", __FILE__, fun51, aGroup);
- theDI.Add("dispone", "cree DispPerOne", __FILE__, fun_dispone, aGroup);
- theDI.Add("dispglob", "cree DispGlobal", __FILE__, fun_dispglob, aGroup);
- theDI.Add("dispcount", "count:IntParam : cree DispPerCount", __FILE__, fun_dispcount, aGroup);
- theDI.Add("dispfile", "files:IntParam : cree DispPerFiles", __FILE__, fun_dispfiles, aGroup);
- theDI.Add("dispsign", "sign:Signature : cree DispPerSignature", __FILE__, fun_dispsign, aGroup);
+ //theDI.Add("dispone", "cree DispPerOne", __FILE__, fun_dispone, aGroup);
+ //theDI.Add("dispglob", "cree DispGlobal", __FILE__, fun_dispglob, aGroup);
+ //theDI.Add("dispcount", "count:IntParam : cree DispPerCount", __FILE__, fun_dispcount, aGroup);
+ //theDI.Add("dispfile", "files:IntParam : cree DispPerFiles", __FILE__, fun_dispfiles, aGroup);
+ //theDI.Add("dispsign", "sign:Signature : cree DispPerSignature", __FILE__, fun_dispsign, aGroup);
theDI.Add("dumpdisp", "disp:Dispatch : Affiche le Statut d'un Dispatch", __FILE__, fun56, aGroup);
theDI.Add("xremove", "nom : Remove a Control Item de la Session", __FILE__, fun57, aGroup);
theDI.Add("evaldisp", "mode=[0-3] disp:Dispatch : Evaluates one or more Dispatch(es)", __FILE__, fun58, aGroup);
- theDI.Add("evaladisp", "mode=[0-3] disp:Dispatch [givelist] : Evaluates a Dispatch (on a GiveList)", __FILE__, fun_evaladisp, aGroup);
- theDI.Add("writedisp", "filepattern disp:Dispatch [givelist] : Writes Entities by Splitting by a Dispatch", __FILE__, fun_writedisp, aGroup);
+ //theDI.Add("evaladisp", "mode=[0-3] disp:Dispatch [givelist] : Evaluates a Dispatch (on a GiveList)", __FILE__, fun_evaladisp, aGroup);
+ //theDI.Add("writedisp", "filepattern disp:Dispatch [givelist] : Writes Entities by Splitting by a Dispatch", __FILE__, fun_writedisp, aGroup);
theDI.Add("evalcomplete", "Evaluation Complete de la Repartition", __FILE__, fun59, aGroup);
theDI.Add("runcheck", "affiche LastRunCheckList (write,modif)", __FILE__, fun60, aGroup);
theDI.Add("runtranformer", "transf:Transformer : Applique un Transformer", __FILE__, fun61, aGroup);
- theDI.Add("copy", "cree TransformStandard, option Copy, vide", __FILE__, fun62, aGroup);
- theDI.Add("onthespot", "cree TransformStandard, option OntheSpot, vide", __FILE__, fun63, aGroup);
- theDI.Add("runcopy", "modif:ModelModifier [givelist] : Run <modif> via TransformStandard option Copy", __FILE__, fun6465, aGroup);
- theDI.Add("runonthespot", "modif:ModelModifier [givelist] : Run <modif> via TransformStandard option OnTheSpot", __FILE__, fun6465, aGroup);
- theDI.Add("reorder", "[f ou t] reordonne le modele", __FILE__, fun66, aGroup);
+ //theDI.Add("copy", "cree TransformStandard, option Copy, vide", __FILE__, fun62, aGroup);
+ //theDI.Add("onthespot", "cree TransformStandard, option OntheSpot, vide", __FILE__, fun63, aGroup);
+ //theDI.Add("runcopy", "modif:ModelModifier [givelist] : Run <modif> via TransformStandard option Copy", __FILE__, fun6465, aGroup);
+ //theDI.Add("runonthespot", "modif:ModelModifier [givelist] : Run <modif> via TransformStandard option OnTheSpot", __FILE__, fun6465, aGroup);
+ //theDI.Add("reorder", "[f ou t] reordonne le modele", __FILE__, fun66, aGroup);
theDI.Add("toggle", "sel:Selection genre Extract : Toggle Direct/Reverse", __FILE__, fun70, aGroup);
theDI.Add("input", "sel:Selection genre Deduct ou Extract input:Selection : Set Input", __FILE__, fun71, aGroup);
- theDI.Add("modelroots", "cree SelectModelRoots", __FILE__, fun72, aGroup);
- theDI.Add("range", "options... : cree SelectRange ...; tout court pour help", __FILE__, fun73, aGroup);
- theDI.Add("roots", "cree SelectRoots (local roots)", __FILE__, fun74, aGroup);
- theDI.Add("shared", "cree SelectShared", __FILE__, fun75, aGroup);
- theDI.Add("diff", "[main:Selection diff:Selection] : cree SelectDiff", __FILE__, fun76, aGroup);
+ //theDI.Add("modelroots", "cree SelectModelRoots", __FILE__, fun72, aGroup);
+ //theDI.Add("range", "options... : cree SelectRange ...; tout court pour help", __FILE__, fun73, aGroup);
+ //theDI.Add("roots", "cree SelectRoots (local roots)", __FILE__, fun74, aGroup);
+ //theDI.Add("shared", "cree SelectShared", __FILE__, fun75, aGroup);
+ //theDI.Add("diff", "[main:Selection diff:Selection] : cree SelectDiff", __FILE__, fun76, aGroup);
theDI.Add("selmain", "sel:Selection genre Control main:Selection : Set Main Input", __FILE__, fun77, aGroup);
theDI.Add("selsecond", "sel:Selection genre Control sec:Selection : Set Second Input", __FILE__, fun78, aGroup);
- theDI.Add("modelall", "cree SelectModelAll", __FILE__, fun79, aGroup);
+ //theDI.Add("modelall", "cree SelectModelAll", __FILE__, fun79, aGroup);
theDI.Add("seladd", "sel:Selection genre Combine input:Selection : Add Selection", __FILE__, fun80, aGroup);
theDI.Add("selrem", "sel:Selection genre Combine input:Selection : Remove Selection", __FILE__, fun81, aGroup);
- theDI.Add("number", "num:IntParam : Cree SelectEntityNumber", __FILE__, fun82, aGroup);
-
- theDI.Add("union", "cree SelectUnion (vide), cf aussi combadd, combrem", __FILE__, fun83, aGroup);
- theDI.Add("intersect", "cree SelectIntersection (vide), cf aussi combadd, combrem", __FILE__, fun84, aGroup);
- theDI.Add("typexact", "type:string : cree SelectTextType Exact", __FILE__, fun85, aGroup);
- theDI.Add("errors", "cree SelectErrorEntities (from file)", __FILE__, fun86, aGroup);
- theDI.Add("unknown", "cree SelectUnknownEntities", __FILE__, fun87, aGroup);
- theDI.Add("sharing", "cree SelectSharing", __FILE__, fun88, aGroup);
- theDI.Add("typecontain", "type:string : cree SelectTextType Contains", __FILE__, fun89, aGroup);
- theDI.Add("pointed", "cree SelectPointed [num/sel num/sel]", __FILE__, fun90, aGroup);
+ //theDI.Add("number", "num:IntParam : Cree SelectEntityNumber", __FILE__, fun82, aGroup);
+
+ //theDI.Add("union", "cree SelectUnion (vide), cf aussi combadd, combrem", __FILE__, fun83, aGroup);
+ //theDI.Add("intersect", "cree SelectIntersection (vide), cf aussi combadd, combrem", __FILE__, fun84, aGroup);
+ //theDI.Add("typexact", "type:string : cree SelectTextType Exact", __FILE__, fun85, aGroup);
+ //theDI.Add("errors", "cree SelectErrorEntities (from file)", __FILE__, fun86, aGroup);
+ //theDI.Add("unknown", "cree SelectUnknownEntities", __FILE__, fun87, aGroup);
+ //theDI.Add("sharing", "cree SelectSharing", __FILE__, fun88, aGroup);
+ //theDI.Add("typecontain", "type:string : cree SelectTextType Contains", __FILE__, fun89, aGroup);
+ //theDI.Add("pointed", "cree SelectPointed [num/sel num/sel]", __FILE__, fun90, aGroup);
theDI.Add("setpointed", "sel:SelectPointed : edition SelectPointed. tout court pour help", __FILE__, fun91, aGroup);
theDI.Add("setlist", "sel:SelectPointed : edition SelectPointed. tout court pour help", __FILE__, fun91, aGroup);
- theDI.Add("incorrect", "cree SelectIncorrectEntities (computed)", __FILE__, fun92, aGroup);
+ //theDI.Add("incorrect", "cree SelectIncorrectEntities (computed)", __FILE__, fun92, aGroup);
- theDI.Add("signsel", "sign:Signature|cnt:Counter text:string [e(D)|c] : cree SelectSignature", __FILE__, fun93, aGroup);
- theDI.Add("signcounter", "sign:Signature : cree SignCounter", __FILE__, fun94, aGroup);
- theDI.Add("nbselected", "applied:Selection : cree GraphCounter(=NbSelected)", __FILE__, funbselected, aGroup);
+ //theDI.Add("signsel", "sign:Signature|cnt:Counter text:string [e(D)|c] : cree SelectSignature", __FILE__, fun93, aGroup);
+ //theDI.Add("signcounter", "sign:Signature : cree SignCounter", __FILE__, fun94, aGroup);
+ //theDI.Add("nbselected", "applied:Selection : cree GraphCounter(=NbSelected)", __FILE__, funbselected, aGroup);
theDI.Add("editlist", "editor or editform : lists defs + values", __FILE__, fun_editlist, aGroup);
- theDI.Add("editvalue", "editform paramname [newval or .] : lists-changes a value", __FILE__, fun_editvalue, aGroup);
+ //theDI.Add("editvalue", "editform paramname [newval or .] : lists-changes a value", __FILE__, fun_editvalue, aGroup);
theDI.Add("editclear", "editform [paramname] : clears edition on all or one param", __FILE__, fun_editclear, aGroup);
theDI.Add("editload", "editform [entity-id] : loads from model or an entity", __FILE__, fun_editload, aGroup);
theDI.Add("editapply", "editform [keep] : applies on loaded data", __FILE__, fun_editapply, aGroup);
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
#include <Geom_Geometry.hxx>
#include <IFSelect_Act.hxx>
#include <IFSelect_SessionPilot.hxx>
#include <XSControl.hxx>
#include <XSControl_ConnectedShapes.hxx>
#include <XSControl_Controller.hxx>
-#include <XSDRAW_FunctionsShape.hxx>
+#include <XSDRAW.hxx>
+#include <XSDRAWBase.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_TransferWriter.hxx>
#include <XSControl_Vars.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
//purpose :
//=======================================================================
-static Standard_Integer XSControl_tpdraw
-(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec)
+static Standard_Integer XSControl_tpdraw(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- const Standard_CString arg3 = pilot->Arg(3);
- const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ const Standard_CString arg1 = theArgVec[1];
+ const Standard_CString arg2 = theArgVec[2];
+ const Standard_CString arg3 = theArgVec[3];
+ const Handle(Transfer_TransientProcess)& TP = XSDRAWBase::Session()->TransferReader()->TransientProcess();
if (TP.IsNull())
{
- sout << "No Transfer Read" << std::endl; return IFSelect_RetError;
+ aSSC.SStream() << "No Transfer Read" << std::endl;
+ return 1;
}
// **** tpdraw ****
- if (argc < 2)
+ if (theNbArgs < 2)
{
- sout << "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;
- sout << " NUMERO entier : d entite, d item transfert ou de root transfert\n"
+ aSSC.SStream() << "Donner [mode facultatif : item ou root] , NUMERO , nom DRAW facultatif" << std::endl;
+ aSSC.SStream() << " mode si present : item ou root, sinon n0 d entite modele" << std::endl;
+ aSSC.SStream() << " NUMERO entier : d entite, d item transfert ou de root transfert\n"
<< " ou * pour dire tous" << std::endl;
- return IFSelect_RetError;
+ return 1;
}
Standard_Integer mode = 0, num = 0;
if (arg1[0] == 'i') mode = 1;
Standard_Boolean tout = Standard_False;
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;
- else num = IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot), arg1);
+ else num = GiveEntityNumber(XSDRAWBase::Session(), arg1);
}
else
{
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;
{
if (mode == 0)
{
- sout << "Pas de modele, preciser n0 d item de transfert" << std::endl;
- return IFSelect_RetError;
+ aSSC.SStream() << "Pas de modele, preciser n0 d item de transfert" << std::endl;
+ return 1;
}
}
if (mode == 0)
{
- sout << "Entite de modele"; max = model->NbEntities();
+ aSSC.SStream() << "Entite de modele"; max = model->NbEntities();
}
if (mode == 1)
{
- sout << "Item de transfert"; max = TP->NbMapped();
+ aSSC.SStream() << "Item de transfert"; max = TP->NbMapped();
}
if (mode == 2)
{
- sout << "Racine de transfert"; max = TP->NbRoots();
+ aSSC.SStream() << "Racine de transfert"; max = TP->NbRoots();
}
if (tout)
{
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)
{
- sout << " - Num=" << num << " hors limite (de 1 a " << max << ")" << std::endl;
- return IFSelect_RetError;
+ aSSC.SStream() << " - Num=" << num << " hors limite (de 1 a " << max << ")" << std::endl;
+ return 1;
}
else
{
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++)
if (binder.IsNull()) 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;
}
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;
}
sh = TransferBRep::ShapeResult(binder);
nbvar++;
if (sh.IsNull())
{
- sout << " (no Shape recorded)" << std::endl; continue;
+ aSSC.SStream() << " (no Shape recorded)" << std::endl; continue;
}
- if (tout) sout << "[ " << i << " ]:";
- if (num == 0) sout << " pas dans le modele";
- else sout << " ent.n0 " << num;
- sout << ", item transfert n0 " << index;
+ if (tout) aSSC.SStream() << "[ " << i << " ]:";
+ if (num == 0) aSSC.SStream() << " pas dans le modele";
+ else aSSC.SStream() << " ent.n0 " << num;
+ aSSC.SStream() << ", item transfert n0 " << index;
if (nbvar == 0)
{
- if (argc > 3 && mode > 0) sprintf(nomvar, "%s", arg3);
- else if (argc > 2 && mode == 0) sprintf(nomvar, "%s", arg2);
+ if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s", arg3);
+ else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s", arg2);
else sprintf(nomvar, "tp_%d", i);
}
else
{
- if (argc > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar);
- else if (argc > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar);
+ if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar);
+ else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar);
else sprintf(nomvar, "tp_%d", i);
}
- sout << " -> 1 DRAW Shape: " << nomvar << std::endl;
- XSControl::Vars(pilot)->SetShape(nomvar, sh);
+ aSSC.SStream() << " -> 1 DRAW Shape: " << nomvar << std::endl;
+ DBRep::Set(nomvar, sh);
continue;
}
DeclareAndCast(TransferBRep_ShapeListBinder, slb, binder);
if (!slb.IsNull())
{
Standard_Integer nbs = slb->NbShapes();
- if (tout) sout << "[ " << i << " ]:";
- if (num == 0) sout << " pas dans le modele";
- else sout << " ent.n0 " << num;
- sout << ", item transfert n0 " << index;
- sout << " -> " << nbs << " DRAW Shapes :";
+ if (tout) aSSC.SStream() << "[ " << i << " ]:";
+ if (num == 0) aSSC.SStream() << " pas dans le modele";
+ else aSSC.SStream() << " ent.n0 " << num;
+ aSSC.SStream() << ", item transfert n0 " << index;
+ aSSC.SStream() << " -> " << nbs << " DRAW Shapes :";
for (Standard_Integer j = 1; j <= nbs; j++)
{
sh = slb->Shape(j); if (nbvar < 0) nbvar = 0; nbvar++;
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);
- else if (argc > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar);
+ if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar);
+ else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar);
else sprintf(nomvar, "tp_%d_%d", i, nbvar);
- sout << " " << nomvar;
- XSControl::Vars(pilot)->SetShape(nomvar, sh);
+ aSSC.SStream() << " " << nomvar;
+ DBRep::Set(nomvar, sh);
}
- sout << std::endl;
+ aSSC.SStream() << std::endl;
continue;
}
DeclareAndCast(Transfer_SimpleBinderOfTransient, trb, binder);
Handle(Standard_Transient) resu = trb->Result();
if (resu.IsNull())
{
- sout << "Entite n0 " << num << " : pas de resultat" << std::endl;
+ aSSC.SStream() << "Entite n0 " << num << " : pas de resultat" << std::endl;
continue;
}
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())
{
- sout << std::endl; continue;
+ aSSC.SStream() << std::endl; continue;
}
nbvar++;
if (nbvar == 0)
{
- if (argc > 3 && mode > 0) sprintf(nomvar, "%s", arg3);
- else if (argc > 2 && mode == 0) sprintf(nomvar, "%s", arg2);
+ if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s", arg3);
+ else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s", arg2);
else sprintf(nomvar, "tp_%d", i);
}
else
{
- if (argc > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar);
- else if (argc > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar);
+ if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar);
+ else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar);
else sprintf(nomvar, "tp_%d", i);
}
char* nomv = nomvar;
- XSControl::Vars(pilot)->Set(nomv, geom);
- sout << " -> DRAW Geom : " << nomvar << std::endl;
+ DrawTrSurf::Set(nomv, geom);
+ aSSC.SStream() << " -> DRAW Geom : " << nomvar << std::endl;
continue;
}
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;
- return IFSelect_RetDone;
+ if (sh.IsNull()) aSSC.SStream() << " (No Shape)" << std::endl;
+ return 0;
}
//=======================================================================
//function : XSControl_tpcompound
//purpose :
//=======================================================================
-static Standard_Integer XSControl_tpcompound
-(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec)
+static Standard_Integer XSControl_tpcompound(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ const Standard_CString arg1 = theArgVec[1];
+ const Handle(Transfer_TransientProcess)& TP = XSDRAWBase::Session()->TransferReader()->TransientProcess();
if (TP.IsNull())
{
- sout << "No Transfer Read" << std::endl; return IFSelect_RetError;
+ aSSC.SStream() << "No Transfer Read" << std::endl;
+ return 1;
}
// **** 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;
- if (argc == 2) list = TransferBRep::Shapes(TP);
+ if (theNbArgs == 2) list = TransferBRep::Shapes(TP);
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())
{
- 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);
- sout << lise->Length() << " Entities, ";
+ aSSC.SStream() << lise->Length() << " Entities, ";
}
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();
- sout << nb << " Shape(s) listed" << std::endl;
+ aSSC.SStream() << nb << " Shape(s) listed" << std::endl;
TopoDS_Compound C;
BRep_Builder B;
B.MakeCompound(C);
for (Standard_Integer i = 1; i <= nb; i++) B.Add(C, list->Value(i));
- XSControl::Vars(pilot)->SetShape(arg1, C);
- return IFSelect_RetDone;
+ DBRep::Set(arg1, C);
+ return 0;
}
//=======================================================================
//function : XSControl_traccess
//purpose :
//=======================================================================
-static Standard_Integer XSControl_traccess
-(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec)
+static Standard_Integer XSControl_traccess(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ const Standard_CString arg1 = theArgVec[1];
+ const Standard_CString arg2 = theArgVec[2];
+ TCollection_AsciiString aCommand(theArgVec[0]);
// **** trdraw : TransferReader **** 26
// **** trsave : TransferReader **** 27
// **** trcomp (comp -> DRAW) **** 28
// **** trscomp (comp -> save) **** 29
- Standard_Boolean cascomp = (pilot->Word(0).Location(1, 'o', 1, 5) > 0);
- Standard_Boolean cassave = (pilot->Word(0).Location(1, 's', 1, 5) > 0);
+ Standard_Boolean cascomp = (aCommand.Location(1, 'o', 1, 5) > 0);
+ Standard_Boolean cassave = (aCommand.Location(1, 's', 1, 5) > 0);
TCollection_AsciiString nomsh, noms;
- const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader();
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ const Handle(XSControl_TransferReader)& TR = XSDRAWBase::Session()->TransferReader();
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();
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";
- if (cassave) sout << " save shapes -> current directory" << std::endl;
+ if (cassave) aSSC.SStream() << " save shapes -> current directory" << std::endl;
if (num == 0 || cascomp)
{
B.MakeCompound(C);
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)
{
noms = nomsh + "_" + i;
- if ((i % 1000) == 0) sout << "(" << i << ")" << std::endl;
- else if ((i % 100) == 0) sout << "*";
- else if ((i % 10) == 0) sout << "0";
- else sout << ".";
+ if ((i % 1000) == 0) aSSC.SStream() << "(" << i << ")" << std::endl;
+ else if ((i % 100) == 0) aSSC.SStream() << "*";
+ else if ((i % 10) == 0) aSSC.SStream() << "0";
+ else aSSC.SStream() << ".";
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) B.Add(C, list->Value(i));
}
- sout << std::endl;
- if (cascomp && !cassave) XSControl::Vars(pilot)->SetShape(nomsh.ToCString(), C);
+ aSSC.SStream() << std::endl;
+ if (cascomp && !cassave) DBRep::Set(nomsh.ToCString(), C);
else if (cascomp && cassave) BRepTools::Write(C, nomsh.ToCString());
}
else
{
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));
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;
- 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 sout << "Option non comprise" << std::endl;
+ else aSSC.SStream() << "Option non comprise" << std::endl;
}
- return IFSelect_RetDone;
+ return 0;
}
//=======================================================================
//=======================================================================
// PTV 23.08.2000 Added for checking where are an entity from.
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 (aLevel > 0)
//function : XSControl_fromshape
//purpose :
//=======================================================================
-static Standard_Integer XSControl_fromshape
-(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec)
+static Standard_Integer XSControl_fromshape(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ const Standard_CString arg1 = theArgVec[1];
// **** fromshape (tread) ****
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2)
+ if (theNbArgs < 2)
{
- sout << "Give name of a DRAW Shape" << std::endl;
- return IFSelect_RetError;
+ aSSC.SStream() << "Give name of a DRAW Shape" << std::endl;
+ return 1;
}
const char* a1 = (char*)arg1;
- TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(a1);
+ TopoDS_Shape Shape = DBRep::Get(a1);
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;
}
Standard_Boolean yena = Standard_False;
Standard_Integer aLevel = 1;
- if (argc >= 3)
- aLevel = atoi(pilot->Arg(2));
+ if (theNbArgs >= 3)
+ aLevel = atoi(theArgVec[2]);
Standard_Boolean silent = Standard_False;
if (aLevel < 0)
{
}
// IMPORT
- const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader();
+ const Handle(XSControl_TransferReader)& TR = XSDRAWBase::Session()->TransferReader();
if (TR.IsNull())
{
- } // sout<<"No read transfer (import) recorded"<<std::endl;
+ } // aSSC.SStream()<<"No read transfer (import) recorded"<<std::endl;
else
{
yena = Standard_True;
- if (!silent) sout << "Shape " << arg1 << " : ";
+ if (!silent) aSSC.SStream() << "Shape " << arg1 << " : ";
Standard_Integer modrec = 1;
Handle(Standard_Transient) ent = TR->EntityFromShapeResult(Shape, modrec);
if (ent.IsNull())
if (TP.IsNull())
{
if (silent)
- sout << "Shape " << arg1 << " : ";
- sout << "no map" << std::endl;
+ aSSC.SStream() << "Shape " << arg1 << " : ";
+ aSSC.SStream() << "no map" << std::endl;
}
else
{
TopLoc_Location L;
S0.Location(L);
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++)
{
ent = TP->Mapped(i);
}
if (!ent.IsNull())
{
- if (silent) sout << "Shape " << arg1 << ": ";
- if (modrec < 0) sout << "(moved from origin) ";
- //else sout<<"(origin) ";
+ if (silent) aSSC.SStream() << "Shape " << arg1 << ": ";
+ if (modrec < 0) aSSC.SStream() << "(moved from origin) ";
+ //else aSSC.SStream()<<"(origin) ";
}
// on affiche
if (ent.IsNull())
{
- if (!silent) sout << " unknown as imported";
+ if (!silent) aSSC.SStream() << " unknown as imported";
// skl 11.05.2004
// if Shape is a compound try to make "fromshape" for its subshapes
if (Shape.ShapeType() == TopAbs_COMPOUND)
{
- sout << std::endl << "Subshapes imported from entities:";
+ aSSC.SStream() << std::endl << "Subshapes imported from entities:";
TopoDS_Iterator Iter(Shape);
for (; Iter.More(); Iter.Next())
{
}
if (!subent.IsNull())
{
- sout << " " << XSControl::Session(pilot)->Model()->Number(subent);
+ aSSC.SStream() << " " << XSDRAWBase::Session()->Model()->Number(subent);
}
}
}
}
else
{
- sout << "imported from entity ";
- XSControl::Session(pilot)->Model()->Print(ent, sout);
- if (silent) sout << " in file " << XSControl::Session(pilot)->LoadedFile() << std::endl;
+ aSSC.SStream() << "imported from entity ";
+ XSDRAWBase::Session()->Model()->Print(ent, aSSC.SStream());
+ 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 ?
- const Handle(Transfer_FinderProcess)& FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess();
+ const Handle(Transfer_FinderProcess)& FP = XSDRAWBase::Session()->TransferWriter()->FinderProcess();
if (FP.IsNull())
{
}
if (!fnd.IsNull()) ent = FP->FindTransient(fnd);
if (!ent.IsNull())
{
- sout << "Shape " << arg1 << ": exported to entity ";
- XSControl::Session(pilot)->Model()->Print(ent, sout);
- if (silent) sout << " in file " << XSControl::Session(pilot)->LoadedFile();
- sout << std::endl;
+ aSSC.SStream() << "Shape " << arg1 << ": exported to entity ";
+ XSDRAWBase::Session()->Model()->Print(ent, aSSC.SStream());
+ if (silent) aSSC.SStream() << " in file " << XSDRAWBase::Session()->LoadedFile();
+ aSSC.SStream() << std::endl;
}
// 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
if (!TransientListBinder.IsNull())
{
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++)
{
- XSControl::Session(pilot)->Model()->Print(TransientListBinder->Transient(i), sout);
- if (i < nb) sout << ", ";
+ XSDRAWBase::Session()->Model()->Print(TransientListBinder->Transient(i), aSSC.SStream());
+ if (i < nb) aSSC.SStream() << ", ";
}
if (nb > 0)
{
- if (silent) sout << " in file " << XSControl::Session(pilot)->LoadedFile();
- sout << std::endl;
+ if (silent) aSSC.SStream() << " in file " << XSDRAWBase::Session()->LoadedFile();
+ aSSC.SStream() << std::endl;
}
}
/* else {
Handle(Standard_Transient) cent = FP->FindTransient (cfnd);
if ( cent.IsNull() ) continue;
if ( start )
- sout<<"Shape "<<arg1<<" : exported to entities ";
- else sout << ", ";
+ aSSC.SStream()<<"Shape "<<arg1<<" : exported to entities ";
+ else aSSC.SStream() << ", ";
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
//purpose :
//=======================================================================
-static Standard_Integer XSControl_trconnexentities
-(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec)
+static Standard_Integer XSControl_trconnexentities(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ const Standard_CString arg1 = theArgVec[1];
// **** 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;
if (!TR.IsNull()) TP = TR->TransientProcess();
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
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;
- return IFSelect_RetError;
+ aSSC.SStream() << "Give name of a DRAW Shape + optional shape type v-e-w-f(D)-s" << std::endl;
+ return 1;
}
- const char* a1 = (const char*)arg1;
- TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(a1);
+ const char* a1 = arg1;
+ TopoDS_Shape Shape = DBRep::Get(a1);
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 =
XSControl_ConnectedShapes::AdjacentEntities(Shape, TP, TopAbs_FACE);
Standard_Integer i, nb = list->Length();
- sout << nb << " Entities produced Connected Shapes :" << std::endl;
- const Handle(Interface_InterfaceModel)& model = XSControl::Session(pilot)->Model();
- sout << "(";
+ aSSC.SStream() << nb << " Entities produced Connected Shapes :" << std::endl;
+ const Handle(Interface_InterfaceModel)& model = XSDRAWBase::Session()->Model();
+ aSSC.SStream() << "(";
for (i = 1; i <= nb; i++)
{
- if (i > 1) sout << ",";
- sout << model->Number(list->Value(i));
- }
- sout << ")" << std::endl;
- return IFSelect_RetDone;
-}
-
-//=======================================================================
-//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 : ";
+ if (i > 1) aSSC.SStream() << ",";
+ aSSC.SStream() << model->Number(list->Value(i));
}
- 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;
+ aSSC.SStream() << ")" << std::endl;
+ return 0;
}
//=======================================================================
//function : XSControl_twrite
//purpose :
//=======================================================================
-static Standard_Integer XSControl_twrite
-(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec)
+static Standard_Integer XSControl_twrite(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
+ XSDRAW::StreamContainer aSSC(theDI);
+ (void)theDI;
+ const Standard_CString arg1 = theArgVec[1];
// **** twrite ****
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- Handle(XSControl_TransferWriter) TW = XSControl::Session(pilot)->TransferWriter();
- if (argc < 2)
+ Handle(XSControl_TransferWriter) TW = XSDRAWBase::Session()->TransferWriter();
+ if (theNbArgs < 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
- for (Standard_Integer i = 1; i < argc; i++)
+ for (Standard_Integer i = 1; i < theNbArgs; i++)
{
- const char* ai = (const char*)pilot->Arg(i);
- TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(ai);
+ const char* ai = theArgVec[i];
+ TopoDS_Shape Shape = DBRep::Get(ai);
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;
- Standard_Integer stat = TW->TransferWriteShape(XSControl::Session(pilot)->Model(), Shape);
- sout << " Transfer Write Status = " << stat << std::endl;
+ aSSC.SStream() << "Pour Shape : " << ai;
+ Standard_Integer stat = TW->TransferWriteShape(XSDRAWBase::Session()->Model(), Shape);
+ aSSC.SStream() << " Transfer Write Status = " << stat << std::endl;
}
- pilot->Session()->ComputeGraph();
+ XSDRAWBase::Session()->ComputeGraph();
// Transient ? (Geom) : ignore
- return IFSelect_RetDone;
+ return 0;
}
-
//=======================================================================
//function : Init
//purpose :
}
THE_XSDRAW_FunctionsShape_initactor = 1;
- IFSelect_Act::SetGroup("DE: General");
- IFSelect_Act::AddFunc("tpdraw", "[mode:item or root] num|* [nomvar] Passes an ITEM to Shape Draw (Start or Result)", XSControl_tpdraw);
- IFSelect_Act::AddFunc("tpcompound", "name:cstring [givelist] : -> compound with Shapes Root or from givelist", XSControl_tpcompound);
- IFSelect_Act::AddFunc("trdraw", "results ->DRAW : all; or num [name] : from ent.num -> DRAW [name/tread_num]", XSControl_traccess);
- IFSelect_Act::AddFunc("trsave", "results ->files : all; or num [name] : from ent.num -> DRAW [name/tread_num]", XSControl_traccess);
- IFSelect_Act::AddFunc("trcomp", "results -> 1 compound -> DRAW + name optional", XSControl_traccess);
- IFSelect_Act::AddFunc("trscomp", "results -> 1 compound -> file + name optional", XSControl_traccess);
- IFSelect_Act::AddFunc("fromshape", "shape [level=1]: imported/exported entity (when known)", XSControl_fromshape);
- IFSelect_Act::AddFunc("trconnexent", "name of draw shape : entities -> connected shapes (when known)", XSControl_trconnexentities);
- IFSelect_Act::AddFunc("trimport", "filename or . varname givelist -> 1 shape per entity", XSControl_trimport);
- 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);
+ Standard_CString aGroup = "DE: General";
+ theDI.Add("tpdraw", "[mode:item or root] num|* [nomvar] Passes an ITEM to Shape Draw (Start or Result)", XSControl_tpdraw, aGroup);
+ theDI.Add("tpcompound", "name:cstring [givelist] : -> compound with Shapes Root or from givelist", __FILE__, XSControl_tpcompound, aGroup);
+ theDI.Add("trdraw", "results ->DRAW : all; or num [name] : from ent.num -> DRAW [name/tread_num]", __FILE__, XSControl_traccess, aGroup);
+ theDI.Add("trsave", "results ->files : all; or num [name] : from ent.num -> DRAW [name/tread_num]", __FILE__, XSControl_traccess, aGroup);
+ theDI.Add("trcomp", "results -> 1 compound -> DRAW + name optional", __FILE__, XSControl_traccess, aGroup);
+ theDI.Add("trscomp", "results -> 1 compound -> file + name optional", __FILE__, XSControl_traccess, aGroup);
+ theDI.Add("fromshape", "shape [level=1]: imported/exported entity (when known)", __FILE__, XSControl_fromshape, aGroup);
+ theDI.Add("trconnexent", "name of draw shape : entities -> connected shapes (when known)", __FILE__, XSControl_trconnexentities, aGroup);
+ theDI.Add("twrite", "shape : transfer write for this shape, AFTER newmodel !", __FILE__, XSControl_twrite, aGroup);
}
#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);
+}
\ No newline at end of file
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
-#include <Draw_Interpretor.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <TCollection_AsciiString.hxx>
-class IFSelect_SessionPilot;
-class Interface_Protocol;
-class Interface_InterfaceModel;
-class Standard_Transient;
-class TCollection_AsciiString;
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)
//! under control of DRAW
DEFINE_STANDARD_ALLOC
public:
- //! Returns the WorkSession defined in AddDraw (through Pilot)
+ //! Returns the WorkSession defined in AddDraw
//! It is from XSControl, it brings functionalities for Transfers
- 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 Handle(XSControl_WorkSession)& Session();
//!
Standard_EXPORT static Standard_Real GetLengthUnit(const Handle(TDocStd_Document)& theDoc = nullptr);
//!
Standard_EXPORT static void CollectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS,
const TCollection_AsciiString& theName,
- XSControl_WorkSessionMap& theMap,
- const Standard_Boolean theIsFirst = Standard_True);
+ XSControl_WorkSessionMap& theMap);
+
+ //!
+ Standard_EXPORT static void CollectActiveWorkSessions(const TCollection_AsciiString& theName);
};
#endif // _XSDRAWBase_HeaderFile
#include <DDocStd.hxx>
#include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx>
+#include <Draw_PluginMacro.hxx>
#include <Draw_Interpretor.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <De_ConfigurationNode.hxx>
"\n\t\t: Write CAD file to shape with registered format's providers. Use global configuration by default.",
__FILE__, WriteFile, aGroup);
}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWDEWrapper)
#include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <RWGltf_ConfigurationNode.hxx>
#include <RWGltf_Provider.hxx>
//=======================================================================
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
theDI.Add("ReadGltf",
"writegltf shape file",
__FILE__, WriteGltf, aGroup);
}
+
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWGLTF)
#include <XSDRAWIGES.hxx>
+#include <BRepTools.hxx>
#include <DBRep.hxx>
#include <DDocStd.hxx>
#include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx>
+#include <DrawTrSurf.hxx>
#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <OSD_OpenFile.hxx>
#include <OSD_Path.hxx>
#include <XSDRAWBase.hxx>
#include <XSAlgo.hxx>
#include <XSAlgo_AlgoContainer.hxx>
+#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
+#include <TColStd_MapIteratorOfMapOfTransient.hxx>
#include <TDataStd_Name.hxx>
#include <TDocStd_Application.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
Standard_Integer theNbArgs,
const char** theArgVec)
{
- DeclareAndCast(IGESControl_Controller, ctl, XSDRAWBase::Controller());
- if (ctl.IsNull()) XSDRAWBase::SetNorm("IGES");
+ Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session();
+ Handle(IGESControl_Controller) aCtl =
+ Handle(IGESControl_Controller)::DownCast(aWS->NormAdaptor());
+ if (aCtl.IsNull())
+ {
+ aWS->SelectNorm("IGES");
+ }
// Progress indicator
Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator(theDI, 1);
IGESControl_Reader Reader(XSDRAWBase::Session(), Standard_False);
Standard_Boolean aFullMode = Standard_True;
Reader.WS()->SetModeStat(aFullMode);
- if (ctl.IsNull())
- ctl = Handle(IGESControl_Controller)::DownCast(XSDRAWBase::Controller());
TCollection_AsciiString fnom, rnom;
- Standard_Boolean modfic = XSDRAWBase::FileAndVar
- (theArgVec[1], theArgVec[2], "IGESBREP", fnom, rnom);
+ Standard_Boolean modfic = FileAndVar
+ (aWS, theArgVec[1], theArgVec[2], "IGESBREP", fnom, rnom);
if (modfic) theDI << " File IGES to read : " << fnom.ToCString() << "\n";
else theDI << " Model taken from the session : " << fnom.ToCString() << "\n";
theDI << " -- Names of variables BREP-DRAW prefixed by : " << rnom.ToCString() << "\n";
IDT_SetLevel(3);
#endif
-
// Reading the file
aPSRoot.SetName("Loading");
progress->Show(aPSRoot);
theDI << " To modify : command param read.iges.bspline.continuity\n";
const Handle(XSControl_WorkSession)& thesession = Reader.WS();
thesession->TransferReader()->Context().Clear();
- XSDRAWBase::SetTransferProcess(thesession->TransferReader()->TransientProcess());
aPSRoot.SetName("Translation");
progress->Show(aPSRoot);
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 << " give the number of the Entity : " << std::flush;
- nent = XSDRAWBase::GetEntityNumber();
+ nent = GiveEntityNumber(aWS, "");
if (!Reader.TransferOne(nent))
theDI << "Transfer entity n0 " << nent << " : no result\n";
theDI << " To modify : command param read.iges.bspline.continuity\n";
const Handle(XSControl_WorkSession)& thesession = Reader.WS();
thesession->TransferReader()->Context().Clear();
- XSDRAWBase::SetTransferProcess(thesession->TransferReader()->TransientProcess());
aPSRoot.SetName("Translation");
progress->Show(aPSRoot);
if (theArgVec[3][0] == '*' && theArgVec[3][1] == 'r' && theArgVec[3][2] == '\0')
{
theDI << "All Roots : ";
- list = XSDRAWBase::GetList("xst-model-roots");
+ list = XSDRAWBase::Session()->GiveList("xst-model-roots");
}
else
{
TCollection_AsciiString compart = XSDRAW_CommandPart(theNbArgs, theArgVec, 3);
theDI << "List given by " << compart.ToCString() << " : ";
- list = XSDRAWBase::GetList(compart.ToCString());
+ list = XSDRAWBase::Session()->GiveList(compart.ToCString());
}
if (list.IsNull())
{
else
{
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; }
}
Standard_Integer nbt = 0;
Handle(XSControl_WorkSession) thesession = Reader.WS();
- XSDRAWBase::SetTransferProcess(thesession->TransferReader()->TransientProcess());
aPSRoot.SetName("Translation");
progress->Show(aPSRoot);
return 0;
}
-////=======================================================================
-////function : testread
-////purpose :
-////=======================================================================
-//static Standard_Integer testread(Draw_Interpretor& theDI,
-// Standard_Integer theNbArgs,
-// const char** theArgVec)
-//{
-// if (theNbArgs != 3)
-// {
-// theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
-// theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n";
-// return 1;
-// }
-// IGESControl_Reader Reader;
-// Standard_CString filename = theArgVec[1];
-// IFSelect_ReturnStatus readstat = Reader.ReadFile(filename);
-// theDI << "Status from reading IGES file " << filename << " : ";
-// switch (readstat)
-// {
-// case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; }
-// case IFSelect_RetDone: { theDI << "file read\n"; break; }
-// case IFSelect_RetError: { theDI << "file not found\n"; return 1; }
-// case IFSelect_RetFail: { theDI << "error during read\n"; return 1; }
-// default: { theDI << "failure\n"; return 1; }
-// }
-// Reader.TransferRoots();
-// TopoDS_Shape shape = Reader.OneShape();
-// DBRep::Set(theArgVec[2], shape);
-// theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n";
-// return 0;
-//}
+//=======================================================================
+//function : testread
+//purpose :
+//=======================================================================
+static Standard_Integer testread(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
+{
+ if (theNbArgs != 3)
+ {
+ theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
+ theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n";
+ return 1;
+ }
+ IGESControl_Reader Reader;
+ Standard_CString filename = theArgVec[1];
+ IFSelect_ReturnStatus readstat = Reader.ReadFile(filename);
+ theDI << "Status from reading IGES file " << filename << " : ";
+ switch (readstat)
+ {
+ case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; }
+ case IFSelect_RetDone: { theDI << "file read\n"; break; }
+ case IFSelect_RetError: { theDI << "file not found\n"; return 1; }
+ case IFSelect_RetFail: { theDI << "error during read\n"; return 1; }
+ default: { theDI << "failure\n"; return 1; }
+ }
+ Reader.TransferRoots();
+ TopoDS_Shape shape = Reader.OneShape();
+ DBRep::Set(theArgVec[2], shape);
+ theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n";
+ return 0;
+}
//=======================================================================
//function : brepiges
Standard_Integer theNbArgs,
const char** theArgVec)
{
- XSDRAWBase::SetNorm("IGES");
+ Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session();
+ aWS->SelectNorm("IGES");
// ecriture dans le model d'une entite :
// - model_AddEntity(ent) : ecriture de l`entite seule
// - model->AddWithRefs(ent, protocol): ecriture de l`entite et eventuellement
Message_ProgressScope aPSRoot(progress->Start(), "Translating", 100);
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++)
{
const char* nomvar = theArgVec[i];
else if (ICW.AddGeom(DrawTrSurf::GetSurface(nomvar))) npris++;
}
ICW.ComputeModel();
- XSDRAWBase::SetModel(ICW.Model());
- XSDRAWBase::SetTransferProcess(ICW.TransferProcess());
if (aPSRoot.UserBreak())
return 1;
aPSRoot.SetName("Writing");
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
{
}
// write file
- if (!ICW.Write(nomfic)) theDI << " Error: could not write file " << nomfic;
- else theDI << " File " << nomfic << " written";
+ if (!ICW.Write(nomfic))
+ {
+ theDI << " Error: could not write file " << nomfic << "\n";
+ return 1;
+ }
+ theDI << " File " << nomfic << " written\n";
+ aWS->SetModel(ICW.Model());
return 0;
}
-////=======================================================================
-////function : testwrite
-////purpose :
-////=======================================================================
-//static Standard_Integer testwrite(Draw_Interpretor& theDI,
-// Standard_Integer theNbArgs,
-// const char** theArgVec)
-//{
-// if (theNbArgs != 3)
-// {
-// theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
-// theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n";
-// return 1;
-// }
-// IGESControl_Writer Writer;
-// Standard_CString filename = theArgVec[1];
-// TopoDS_Shape shape = DBRep::Get(theArgVec[2]);
-// Standard_Boolean ok = Writer.AddShape(shape);
-// if (!ok)
-// {
-// theDI << "Shape not add\n";
-// return 1;
-// }
-//
-// if (!(Writer.Write(filename)))
-// {
-// theDI << "Error on writing file\n";
-// return 1;
-// }
-// theDI << "File Is Written\n";
-// return 0;
-//}
-
-////=======================================================================
-////function : igesparam
-////purpose :
-////=======================================================================
-//static Standard_Integer igesparam(Draw_Interpretor& theDI,
-// Standard_Integer,
-// 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 : testwrite
+//purpose :
+//=======================================================================
+static Standard_Integer testwrite(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
+{
+ if (theNbArgs != 3)
+ {
+ theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
+ theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n";
+ return 1;
+ }
+ IGESControl_Writer Writer;
+ Standard_CString filename = theArgVec[1];
+ TopoDS_Shape shape = DBRep::Get(theArgVec[2]);
+ Standard_Boolean ok = Writer.AddShape(shape);
+ if (!ok)
+ {
+ theDI << "Shape not add\n";
+ return 1;
+ }
+
+ if (!(Writer.Write(filename)))
+ {
+ theDI << "Error on writing file\n";
+ return 1;
+ }
+ theDI << "File Is Written\n";
+ return 0;
+}
+
+//=======================================================================
+//function : igesparam
+//purpose :
+//=======================================================================
+static Standard_Integer igesparam(Draw_Interpretor& theDI,
+ Standard_Integer,
+ 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
Standard_Integer theNbArgs,
const char** theArgVec)
{
- Handle(IFSelect_SessionPilot) pilot = XSDRAWBase::Pilot();
-
- // Standard_Integer narg = pilot->NbWords();
- Standard_Integer narg = theNbArgs;
-
- const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
+ Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session();
+ const Handle(Transfer_TransientProcess)& TP = aWS->TransferReader()->TransientProcess();
TColStd_Array1OfAsciiString strarg(1, 3);
TColStd_Array1OfAsciiString typarg(1, 3);
strarg.SetValue(1, "xst-type(CurveOnSurface)");
typarg.SetValue(3, "IGESSolid_Face");
if (TP.IsNull()) { theDI << "No Transfer Read\n"; return 1; }
Standard_Integer nbFaces = 0, totFaces = 0;
- Handle(IFSelect_WorkSession) WS = pilot->Session();
Transfer_IteratorOfProcessForTransient itrp = TP->AbnormalResult();
Standard_Integer k = 0;
- if (narg > 1)
+ if (theNbArgs > 1)
{
// TCollection_AsciiString Arg = pilot->Word(1);
TCollection_AsciiString Arg(theArgVec[1]);
for (Standard_Integer j = 1; j <= 3; j++)
{
TColStd_MapOfTransient aMap;
- if (narg == 1) k = j;
- Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList(pilot->Session(), strarg.Value(k).ToCString());
+ if (theNbArgs == 1) k = j;
+ Handle(TColStd_HSequenceOfTransient) list = aWS->GiveList(strarg.Value(k).ToCString());
if (!list.IsNull()) itrp.Filter(list);
else
{
for (itrp.Start(); itrp.More(); itrp.Next())
{
Handle(Standard_Transient) ent = itrp.Starting();
- Handle(TColStd_HSequenceOfTransient) super = WS->Sharings(ent);
+ Handle(TColStd_HSequenceOfTransient) super = aWS->Sharings(ent);
if (!super.IsNull())
{
Standard_Integer nb = super->Length();
Standard_SStream aTmpStream;
for (itmap.Initialize(aMap); itmap.More(); itmap.Next())
{
- XSDRAWBase::Model()->Print(itmap.Key(), aTmpStream);
+ aWS->Model()->Print(itmap.Key(), aTmpStream);
aTmpStream << " ";
}
theDI << aTmpStream.str().c_str();
theDI << "\nNumber:" << nbFaces << "\n";
totFaces += nbFaces;
}
- if (narg > 1) break;
+ if (theNbArgs > 1) break;
nbFaces = 0;
}
return 0;
}
-////=======================================================================
-////function : XSDRAWIGES_TPSTAT
-////purpose :
-////=======================================================================
-//static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& theDI,
-// Standard_Integer theNbArgs,
-// const char** theArgVec)
-//{
-// Handle(IFSelect_SessionPilot) pilot = XSDRAWBase::Pilot();
-// Standard_Integer theNbArgs = theNbArgs;//= pilot->NbWords();
-// const Standard_CString arg1 = theArgVec[1];//pilot->Arg(1);
-// const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
-// IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
-//// **** tpent ****
-// Handle(Interface_InterfaceModel) model = TP->Model();
-// if (model.IsNull()) { theDI << "No Transfer Read\n"; return -1; }
-// Handle(XSControl_WorkSession) thesession = read.WS();
-// thesession->SetMapReader(TP);
-// Standard_Integer mod1 = 0;
-// if (theNbArgs > 1)
-// {
-// 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 'C': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ListByItem); break;
-// case 'r': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ResultCount); break;
-// case 's': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_Mapping); break;
-// case '?': mod1 = -1; break;
-// default: mod1 = -2; break;
-// }
-// }
-// if (mod1 < -1) theDI << "Unknown Mode\n";
-// if (mod1 < 0)
-// {
-// theDI << "Modes available :\n"
-// << "g : general c : checks (count) C (list)\n"
-// << "r : number of CasCade resulting shapes\n"
-// << "s : mapping between IGES entities and CasCade shapes\n";
-// if (mod1 < -1) return -1;
-// return 0;
-// }
-// return 0;
-//}
-
-////=======================================================================
-////function : etest
-////purpose :
-////=======================================================================
-//static Standard_Integer etest(Draw_Interpretor& theDI,
-// Standard_Integer theNbArgs,
-// const char** theArgVec)
-//{
-// if (theNbArgs < 3)
-// {
-// theDI << "etest igesfile shape\n";
-// return 0;
-// }
-// IGESControl_Reader aReader;
-// aReader.ReadFile(theArgVec[1]);
-// aReader.SetReadVisible(Standard_True);
-// aReader.TransferRoots();
-// TopoDS_Shape shape = aReader.OneShape();
-// DBRep::Set(theArgVec[2], shape);
-// return 0;
-//}
+//=======================================================================
+//function : XSDRAWIGES_TPSTAT
+//purpose :
+//=======================================================================
+static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
+{
+ Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session();
+ const Standard_CString arg1 = theArgVec[1];
+ const Handle(Transfer_TransientProcess)& TP = aWS->TransferReader()->TransientProcess();
+ IGESControl_Reader read;
+ Handle(Interface_InterfaceModel) model = TP->Model();
+ if (model.IsNull()) { theDI << "No Transfer Read\n"; return -1; }
+ Handle(XSControl_WorkSession) thesession = read.WS();
+ thesession->SetMapReader(TP);
+ Standard_Integer mod1 = 0;
+ if (theNbArgs > 1)
+ {
+ 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 'C': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ListByItem); break;
+ case 'r': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ResultCount); break;
+ case 's': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_Mapping); break;
+ case '?': mod1 = -1; break;
+ default: mod1 = -2; break;
+ }
+ }
+ if (mod1 < -1) theDI << "Unknown Mode\n";
+ if (mod1 < 0)
+ {
+ theDI << "Modes available :\n"
+ << "g : general c : checks (count) C (list)\n"
+ << "r : number of CasCade resulting shapes\n"
+ << "s : mapping between IGES entities and CasCade shapes\n";
+ if (mod1 < -1) return -1;
+ return 0;
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : etest
+//purpose :
+//=======================================================================
+static Standard_Integer etest(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
+{
+ if (theNbArgs < 3)
+ {
+ theDI << "etest igesfile shape\n";
+ return 0;
+ }
+ IGESControl_Reader aReader;
+ aReader.ReadFile(theArgVec[1]);
+ aReader.SetReadVisible(Standard_True);
+ aReader.TransferRoots();
+ TopoDS_Shape shape = aReader.OneShape();
+ DBRep::Set(theArgVec[2], shape);
+ return 0;
+}
//=======================================================================
//function : ReadIges
return 0;
}
-
//=======================================================================
//function : InitToBRep
//purpose :
//=======================================================================
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";
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("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("TPSTAT", " ", __FILE__, XSDRAWIGES_TPSTAT, aGroup);
- //theDI.Add("etest", "test of eviewer", __FILE__, etest, 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("igesparam", "igesparam ->list, + name ->one param, + name val->change", __FILE__, igesparam, aGroup);
+ theDI.Add("TPSTAT", " ", __FILE__, XSDRAWIGES_TPSTAT, 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("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("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("testwriteiges", "testwriteiges filename.igs shape", __FILE__, testwrite, aGroup);
+ theDI.Add("brepiges", "brepiges sh1 [+sh2 [+sh3 ..]] filename.igs", __FILE__, brepiges, aGroup);
+ theDI.Add("testwriteiges", "testwriteiges filename.igs shape", __FILE__, testwrite, aGroup);
}
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWIGES)
\ No newline at end of file
#include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <RWObj_ConfigurationNode.hxx>
#include <RWObj_Provider.hxx>
//=======================================================================
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
theDI.Add("ReadObj",
"ReadObj Doc file [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]"
"writeobj shape file",
__FILE__, WriteObj, g);
}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWOBJ)
#include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <BRep_Builder.hxx>
#include <BRepLib_PointCloudShape.hxx>
//=======================================================================
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
//XSDRAW::LoadDraw(theCommands);
theDI.Add("WritePly", R"(
"writeply shape file",
__FILE__, WritePly, g);
}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWPLY)
#include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <OSD_OpenFile.hxx>
#include <OSD_Path.hxx>
#include <TopoDS_Shape.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
//purpose :
STEPControl_Reader sr(XSDRAWBase::Session(), Standard_False);
TCollection_AsciiString fnom, rnom;
- Standard_Boolean modfic = XSDRAWBase::FileAndVar
- (theArgVec[1], theArgVec[2], "STEP", fnom, rnom);
+ Standard_Boolean modfic = FileAndVar
+ (XSDRAWBase::Session(), theArgVec[1], theArgVec[2], "STEP", fnom, rnom);
if (modfic) theDI << " File STEP to read : " << fnom.ToCString() << "\n";
else theDI << " Model taken from the session : " << fnom.ToCString() << "\n";
theDI << " -- Names of variables BREP-DRAW prefixed by : " << rnom.ToCString() << "\n";
sr.WS()->SetModeStat(aFullMode);
-
if (modfic) readstat = sr.ReadFile(fnom.ToCString());
else if (XSDRAWBase::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
}
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))
theDI << "Transfer entity n0 " << num << " : no result\n";
else
if (theArgVec[k][0] == '*' && theArgVec[k][1] == '\0')
{
theDI << "Transferrable Roots : ";
- list = XSDRAWBase::GetList("xst-transferrable-roots");
+ list = XSDRAWBase::Session()->GiveList("xst-transferrable-roots");
//list = new TColStd_HSequenceOfTransient;
//for(Standard_Integer j=1; j<=num; j++)
// list->Append(sr.RootForTransfer(j));
theDI << "List given by " << theArgVec[k];
if (theNbArgs > k + 1) theDI << " " << theArgVec[k + 1];
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; }
}
else
{
std::cout << "Name of Selection :" << std::flush;
- list = XSDRAWBase::GetList();
+ list = XSDRAWBase::Session()->GiveList("");
if (list.IsNull()) { theDI << "No list defined\n"; continue; }
}
return 0;
}
-////=======================================================================
-////function : testreadstep
-////purpose :
-////=======================================================================
-//static Standard_Integer testreadstep(Draw_Interpretor& theDI,
-// Standard_Integer theNbArgs,
-// const char** theArgVec)
-//{
-// if (theNbArgs < 3 || theNbArgs > 4)
-// {
-// theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
-// theDI << " Usage : " << theArgVec[0] << " file_name shape_name [-stream]\n";
-// theDI << " Option -stream forces usage of API accepting stream\n";
-// return 1;
-// }
-//
-// Standard_Boolean useStream = (theNbArgs > 3 && !strcasecmp(theArgVec[3], "-stream"));
-//
-// STEPControl_Reader Reader;
-// Standard_CString filename = theArgVec[1];
-// IFSelect_ReturnStatus readstat;
-// if (useStream)
-// {
-// std::ifstream aStream;
-// OSD_OpenStream(aStream, filename, std::ios::in | std::ios::binary);
-// TCollection_AsciiString aFolder, aFileNameShort;
-// OSD_Path::FolderAndFileFromPath(filename, aFolder, aFileNameShort);
-// readstat = Reader.ReadStream(aFileNameShort.ToCString(), aStream);
-// }
-// else
-// {
-// readstat = Reader.ReadFile(filename);
-// }
-// theDI << "Status from reading STEP file " << filename << " : ";
-// switch (readstat)
-// {
-// case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; }
-// case IFSelect_RetDone: { theDI << "file read\n"; break; }
-// case IFSelect_RetError: { theDI << "file not found\n"; return 1; }
-// case IFSelect_RetFail: { theDI << "error during read\n"; return 1; }
-// default: { theDI << "failure\n"; return 1; }
-// }
-// XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
-// Reader.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
-// Reader.TransferRoots();
-// TopoDS_Shape shape = Reader.OneShape();
-// DBRep::Set(theArgVec[2], shape);
-// theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n";
-// return 0;
-//}
+//=======================================================================
+//function : testreadstep
+//purpose :
+//=======================================================================
+static Standard_Integer testreadstep(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
+{
+ if (theNbArgs < 3 || theNbArgs > 4)
+ {
+ theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
+ theDI << " Usage : " << theArgVec[0] << " file_name shape_name [-stream]\n";
+ theDI << " Option -stream forces usage of API accepting stream\n";
+ return 1;
+ }
+
+ Standard_Boolean useStream = (theNbArgs > 3 && !strcasecmp(theArgVec[3], "-stream"));
+
+ STEPControl_Reader Reader;
+ Standard_CString filename = theArgVec[1];
+ IFSelect_ReturnStatus readstat;
+ if (useStream)
+ {
+ std::ifstream aStream;
+ OSD_OpenStream(aStream, filename, std::ios::in | std::ios::binary);
+ TCollection_AsciiString aFolder, aFileNameShort;
+ OSD_Path::FolderAndFileFromPath(filename, aFolder, aFileNameShort);
+ readstat = Reader.ReadStream(aFileNameShort.ToCString(), aStream);
+ }
+ else
+ {
+ readstat = Reader.ReadFile(filename);
+ }
+ theDI << "Status from reading STEP file " << filename << " : ";
+ switch (readstat)
+ {
+ case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; }
+ case IFSelect_RetDone: { theDI << "file read\n"; break; }
+ case IFSelect_RetError: { theDI << "file not found\n"; return 1; }
+ case IFSelect_RetFail: { theDI << "error during read\n"; return 1; }
+ default: { theDI << "failure\n"; return 1; }
+ }
+ XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
+ Reader.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
+ Reader.TransferRoots();
+ TopoDS_Shape shape = Reader.OneShape();
+ DBRep::Set(theArgVec[2], shape);
+ theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n";
+ return 0;
+}
//=======================================================================
//function : steptrans
theDI << "give shape-name new-shape + entity-n0 entity-n0: AXIS2\n";
return 1;
}
+ Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session();
TopoDS_Shape shape = DBRep::Get(theArgVec[1]);
if (shape.IsNull())
{
}
Handle(StepGeom_Axis2Placement3d) ax1, ax2;
Standard_Integer n1 = 0, n2 = 0;
- n1 = XSDRAWBase::GetEntityNumber(theArgVec[3]);
- if (theNbArgs > 4) n2 = XSDRAWBase::GetEntityNumber(theArgVec[4]);
+ n1 = GiveEntityNumber(aWS, theArgVec[3]);
+ if (theNbArgs > 4) n2 = GiveEntityNumber(aWS, theArgVec[4]);
if (n1 > 0) ax1 = Handle(StepGeom_Axis2Placement3d)::DownCast
- (XSDRAWBase::Entity(n1));
+ (aWS->StartingEntity(n1));
if (n2 > 0) ax2 = Handle(StepGeom_Axis2Placement3d)::DownCast
- (XSDRAWBase::Entity(n2));
+ (aWS->StartingEntity(n2));
StepToTopoDS_MakeTransformed mktrans;
if (mktrans.Compute(ax1, ax2))
{
return 0;
}
-// ######## COMMANDE stepwrite : teste le Writer #########
-
//=======================================================================
//function : stepwrite
-//purpose :
+//purpose :
//=======================================================================
static Standard_Integer stepwrite(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
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)
{
- 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"
<< "m ou 3 : ManifoldSolidBrep w ou 4 : GeometricCurveSet/WireFrame\n";
return 1;
}
- char modeshape = theArgVec[1][0];
STEPControl_StepModelType mode;
- switch (modeshape)
+ switch (theArgVec[1][0])
{
case 'a':
case '0': mode = STEPControl_AsIs; break;
case '3': mode = STEPControl_ManifoldSolidBrep; break;
case 'w':
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)::DownCast(ctl->ActorWrite());
+ Handle(STEPControl_ActorWrite)::DownCast(aWS->NormAdaptor()->ActorWrite());
if (!ActWrite.IsNull())
ActWrite->SetGroupMode(Interface_Static::IVal("write.step.assembly"));
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();
Standard_Integer nbavant = (stepmodel.IsNull() ? 0 : stepmodel->NbEntities());
{
theDI << "Error: translation failed, status = " << stat << "\n";
}
-
if (aPSRoot.UserBreak())
return 1;
aPSRoot.SetName("Writing");
theDI << " Now, to write a file, command : writeall filename\n";
return 0;
}
-
const char* nomfic = theArgVec[3];
stat = sw.Write(nomfic);
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_RetStop: theDI << "Error on writing file: no space on disk or destination is write protected\n"; break;
- default: theDI << "Error: File " << nomfic << " written with fail messages\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"; return 1;
}
-
+ XSDRAWBase::CollectActiveWorkSessions(aWS, nomfic, XSDRAWBase::WorkSessionList());
return 0;
}
-////=======================================================================
-////function : testwritestep
-////purpose :
-////=======================================================================
-//static Standard_Integer testwrite(Draw_Interpretor& theDI,
-// Standard_Integer theNbArgs,
-// const char** theArgVec)
-//{
-// TCollection_AsciiString aFilePath;
-// TopoDS_Shape aShape;
-// bool toTestStream = false;
-// for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
-// {
-// TCollection_AsciiString anArgCase(theArgVec[anArgIter]);
-// anArgCase.LowerCase();
-// if (anArgCase == "-stream")
-// {
-// toTestStream = true;
-// }
-// else if (aFilePath.IsEmpty())
-// {
-// aFilePath = theArgVec[anArgIter];
-// }
-// else if (aShape.IsNull())
-// {
-// aShape = DBRep::Get(theArgVec[anArgIter]);
-// if (aShape.IsNull())
-// {
-// theDI << "Syntax error: '" << theArgVec[anArgIter] << "' is not a shape";
-// return 1;
-// }
-// }
-// else
-// {
-// theDI << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'";
-// return 1;
-// }
-// }
-// if (aShape.IsNull())
-// {
-// theDI << "Syntax error: wrong number of arguments";
-// return 1;
-// }
-//
-// STEPControl_Writer aWriter;
-// IFSelect_ReturnStatus aStat = aWriter.Transfer(aShape, STEPControl_AsIs);
-// if (aStat != IFSelect_RetDone)
-// {
-// theDI << "Error on transferring shape";
-// return 1;
-// }
-//
-// if (toTestStream)
-// {
-// std::ofstream aStream;
-// OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary);
-// aStat = aWriter.WriteStream(aStream);
-// aStream.close();
-// if (!aStream.good()
-// && aStat == IFSelect_RetDone)
-// {
-// aStat = IFSelect_RetFail;
-// }
-// }
-// else
-// {
-// aStat = aWriter.Write(aFilePath.ToCString());
-// }
-// if (aStat != IFSelect_RetDone)
-// {
-// theDI << "Error on writing file";
-// return 1;
-// }
-// theDI << "File Is Written";
-// return 0;
-//}
+//=======================================================================
+//function : testwrite
+//purpose :
+//=======================================================================
+static Standard_Integer testwrite(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
+{
+ TCollection_AsciiString aFilePath;
+ TopoDS_Shape aShape;
+ bool toTestStream = false;
+ for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+ {
+ TCollection_AsciiString anArgCase(theArgVec[anArgIter]);
+ anArgCase.LowerCase();
+ if (anArgCase == "-stream")
+ {
+ toTestStream = true;
+ }
+ else if (aFilePath.IsEmpty())
+ {
+ aFilePath = theArgVec[anArgIter];
+ }
+ else if (aShape.IsNull())
+ {
+ aShape = DBRep::Get(theArgVec[anArgIter]);
+ if (aShape.IsNull())
+ {
+ theDI << "Syntax error: '" << theArgVec[anArgIter] << "' is not a shape\n";
+ return 1;
+ }
+ }
+ else
+ {
+ theDI << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
+ return 1;
+ }
+ }
+ if (aShape.IsNull())
+ {
+ theDI << "Syntax error: wrong number of arguments\n";
+ return 1;
+ }
+
+ STEPControl_Writer aWriter;
+ IFSelect_ReturnStatus aStat = aWriter.Transfer(aShape, STEPControl_AsIs);
+ if (aStat != IFSelect_RetDone)
+ {
+ theDI << "Error on transferring shape\n";
+ return 1;
+ }
+
+ if (toTestStream)
+ {
+ std::ofstream aStream;
+ OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary);
+ aStat = aWriter.WriteStream(aStream);
+ aStream.close();
+ if (!aStream.good()
+ && aStat == IFSelect_RetDone)
+ {
+ aStat = IFSelect_RetFail;
+ }
+ }
+ else
+ {
+ aStat = aWriter.Write(aFilePath.ToCString());
+ }
+ if (aStat != IFSelect_RetDone)
+ {
+ theDI << "Error on writing file\n";
+ return 1;
+ }
+ theDI << "File Is Written\n";
+ return 0;
+}
//=======================================================================
//function : countexpected
Standard_Integer theNbArgs,
const char** theArgVec)
{
-
if (theNbArgs < 2)
{
theDI << "Error: Invalid number of parameters. Should be: getfileunits name_file\n";
return 1;
}
STEPControl_Reader aStepReader;
-
IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
readstat = aStepReader.ReadFile(theArgVec[1]);
-
if (readstat != IFSelect_RetDone)
{
-
theDI << "No model loaded\n";
return 1;
}
{
std::ifstream aStream;
OSD_OpenStream(aStream, aFilePath.ToCString(), std::ios::in | std::ios::binary);
- TCollection_AsciiString aFolder, aFileNameShort;
- OSD_Path::FolderAndFileFromPath(aFilePath, aFolder, aFileNameShort);
aReadStat =
aProvider->Read(aStream, aDoc, aFilePath, aWS, aProgress->Start());
}
{
std::ofstream aStream;
OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary);
- TCollection_AsciiString aFolder, aFileNameShort;
- OSD_Path::FolderAndFileFromPath(aFilePath, aFolder, aFileNameShort);
aReadStat =
aProvider->Write(aStream, aDoc, aWS, aProgress->Start());
}
//=======================================================================
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
- theDI.Add("stepwrite", "stepwrite [mode[0-4 afsmw]] shape", __FILE__, stepwrite, g);
- //theDI.Add("testwritestep", "testwritestep filename.stp shape [-stream]",
- // __FILE__, testwrite, 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("stepwrite", "stepwrite mode[0-4 afsmw] shape", __FILE__, stepwrite, g);
+ theDI.Add("testwritestep", "testwritestep filename.stp shape [-stream]",
+ __FILE__, testwrite, 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("steptrans", "steptrans shape stepax1 stepax2", __FILE__, steptrans, g);
theDI.Add("countexpected", "TEST", __FILE__, countexpected, g);
theDI.Add("dumpassembly", "TEST", __FILE__, dumpassembly, g);
"\n\t\t: -stream read using ostream writing interface (testing)",
__FILE__, WriteStep, g);
}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWSTEP)
DEFINE_STANDARD_ALLOC
public:
- Standard_EXPORT static void Init();
-
//! Loads all Draw commands of XSDRAWSTEP. Used for plugin.
Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
};
#include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <RWStl_ConfigurationNode.hxx>
#include <RWStl_Provider.hxx>
//=============================================================================
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
theDI.Add("writestl", "shape file [ascii/binary (0/1) : 1 by default] [InParallel (0/1) : 0 by default]", __FILE__, writestl, g);
"\n\t\t: -multi creates a face per solid in multi-domain files; ignored when -brep is set.",
__FILE__, readstl, g);
}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWSTL)
return 0;
}
-
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
if (aMesh.IsNull())
aMesh->AddBuilder(aBuilder, Standard_True);
}
-
if (aMode.IsEqual("nodal"))
{
Handle(MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder(
//=======================================================================
void XSDRAWSTLVRML::Factory(Draw_Interpretor& theDI)
{
- XSDRAWIGES::InitSelect();
- XSDRAWIGES::InitToBRep(theDI);
- XSDRAWIGES::InitFromBRep(theDI);
- XSDRAWSTEP::InitCommands(theDI);
XSDRAWSTLVRML::InitCommands(theDI);
- XSDRAW::LoadDraw(theDI);
#ifdef OCCT_DEBUG
theDI << "Draw Plugin : All TKXSDRAW commands are loaded\n";
#endif
#include <Draw_Interpretor.hxx>
-
-
class XSDRAWSTLVRML
{
public:
typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerReal,TColStd_MapIntegerHasher> XSDRAWSTLVRML_CoordsMap;
typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerReal,TColStd_MapIntegerHasher>::Iterator XSDRAWSTLVRML_DataMapIteratorOfCoordsMap;
-
#endif
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
#ifndef XSDRAWSTLVRML_DataMapIteratorOfCoordsMap_HeaderFile
#define XSDRAWSTLVRML_DataMapIteratorOfCoordsMap_HeaderFile
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
#ifndef XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap_HeaderFile
#define XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap_HeaderFile
#include <TColStd_Array1OfInteger.hxx>
#include <Poly_Triangulation.hxx>
-
class XSDRAWSTLVRML_DataSource;
DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource, MeshVS_DataSource)
//! The sample DataSource for working with STLMesh_Mesh
class XSDRAWSTLVRML_DataSource : public MeshVS_DataSource
{
-
public:
//! 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;
-
-
-
DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource,MeshVS_DataSource)
protected:
-
-
-
private:
-
Handle(Poly_Triangulation) myMesh;
TColStd_PackedMapOfInteger myNodes;
TColStd_PackedMapOfInteger myElements;
Handle(TColStd_HArray2OfReal) myNodeCoords;
Handle(TColStd_HArray2OfReal) myElemNormals;
-
};
-
-
-
-
-
-
#endif // _XSDRAWSTLVRML_DataSource_HeaderFile
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
#include <Standard_Type.hxx>
#include <TColgp_SequenceOfXYZ.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <Standard_Address.hxx>
#include <TColStd_Array1OfInteger.hxx>
-
class XSDRAWSTLVRML_DataSource3D;
DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource3D, MeshVS_DataSource)
//! The sample DataSource3D for working with STLMesh_Mesh
class XSDRAWSTLVRML_DataSource3D : public MeshVS_DataSource
{
-
public:
//! 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;
-
-
-
DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource3D,MeshVS_DataSource)
protected:
-
-
-
private:
-
TColStd_PackedMapOfInteger myNodes;
TColStd_PackedMapOfInteger myElements;
Handle(TColStd_HArray1OfInteger) myElemNbNodes;
Handle(TColStd_HArray2OfReal) myNodeCoords;
Handle(TColStd_HArray2OfInteger) myElemNodes;
-
};
-
-
-
-
-
-
#endif // _XSDRAWSTLVRML_DataSource3D_HeaderFile
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
#include <Draw_Display.hxx>
#include <MeshVS_Mesh.hxx>
#include <Standard_Type.hxx>
class MeshVS_Mesh;
class Draw_Display;
-
class XSDRAWSTLVRML_DrawableMesh;
DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DrawableMesh, Draw_Drawable3D)
-
class XSDRAWSTLVRML_DrawableMesh : public Draw_Drawable3D
{
-
public:
Standard_EXPORT Handle(MeshVS_Mesh) GetMesh() const;
-
-
-
DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DrawableMesh,Draw_Drawable3D)
protected:
-
-
-
private:
-
Handle(MeshVS_Mesh) myMesh;
-
};
-
-
-
-
-
-
#endif // _XSDRAWSTLVRML_DrawableMesh_HeaderFile
typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerInteger,TColStd_MapIntegerHasher> XSDRAWSTLVRML_ElemNodesMap;
typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerInteger,TColStd_MapIntegerHasher>::Iterator XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap;
-
#endif
#include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <Vrml_ConfigurationNode.hxx>
#include <Vrml_Provider.hxx>
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);
}
+
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWVRML)
puts "# Load IGES file which is known to generate the message, and check it"
puts "REQUIRED 14673 ALL: $message"
-pload XSDRAW
+pload XSDRAW IGES
igesbrep [locate_data_file hammer.iges] a *
tpstat c
-pload XSDRAW
+pload XDE
set subgroup heal
# Mesh generation hangs then crashes
###########################################
-pload DATAEXCHANGEKERNEL
+pload DATAEXCHANGE
testreadstep [locate_data_file bug28118_18547.stp] result
vclear
puts "======="
puts ""
-if {[info commands stepread] == ""} {pload XSDRAW}
+pload XSDRAW STEP
stepread [locate_data_file bug29715_slow.stp] a *
renamevar a_1 a
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
cpulimit 500
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
set BugNumber OCC8842
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+pload XSDRAW IGES
proc myoffset {result sh val tan} {
if {$tan == 1} {
# 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 *
# 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
puts "==============================================================="
puts ""
-pload XSDRAW
+pload XSDRAW STEP
stepread [locate_data_file bug30595_UC1.stp] s *
incmesh s_1 0.1
puts "========"
puts ""
-pload XSDRAW
+pload XSDRAW STL
box b 10 10 10
pcylinder c 5 10
puts "===================================="
puts ""
-pload OCAF XDEDRAW
+pload OCAF XDEDRAW STEP
box b 1 1 1
reset b
-pload XSDRAW
+pload XSDRAW STL VRML
set subgroup stlvrml