From: dpasukhi Date: Tue, 10 Jan 2023 00:03:23 +0000 (+0000) Subject: // updating X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=df7e4ec6956a3f4c7b846a30b8147f6e0f664634;p=occt.git // updating --- diff --git a/src/XDEDRAW/XDEDRAW.hxx b/src/XDEDRAW/XDEDRAW.hxx index e40d1de911..f7a4c641e3 100644 --- a/src/XDEDRAW/XDEDRAW.hxx +++ b/src/XDEDRAW/XDEDRAW.hxx @@ -25,18 +25,15 @@ //! Provides DRAW commands for work with DECAF data structures class XDEDRAW { -public: - DEFINE_STANDARD_ALLOC +public: - //! Provides common commands for work XDE //! Initializes all the functions Standard_EXPORT static void Init (Draw_Interpretor& di); //! Loads all Draw commands of TKXDEDRAW. Used for plugin. Standard_EXPORT static void Factory (Draw_Interpretor& theDI); - }; #endif // _XDEDRAW_HeaderFile diff --git a/src/XDEDRAW/XDEDRAW_Colors.hxx b/src/XDEDRAW/XDEDRAW_Colors.hxx index efa03676db..7f4ee89267 100644 --- a/src/XDEDRAW/XDEDRAW_Colors.hxx +++ b/src/XDEDRAW/XDEDRAW_Colors.hxx @@ -21,38 +21,13 @@ #include - //! Contains commands to work with colors class XDEDRAW_Colors { -public: - DEFINE_STANDARD_ALLOC +public: - Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands); - - - - -protected: - - - - - -private: - - - - - }; - - - - - - #endif // _XDEDRAW_Colors_HeaderFile diff --git a/src/XDEDRAW/XDEDRAW_Common.hxx b/src/XDEDRAW/XDEDRAW_Common.hxx index 2597713404..5193f683a8 100644 --- a/src/XDEDRAW/XDEDRAW_Common.hxx +++ b/src/XDEDRAW/XDEDRAW_Common.hxx @@ -23,34 +23,10 @@ class XDEDRAW_Common { -public: - DEFINE_STANDARD_ALLOC - - +public: + Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands); - - - - -protected: - - - - - -private: - - - - - }; - - - - - - #endif // _XDEDRAW_Common_HeaderFile diff --git a/src/XDEDRAW/XDEDRAW_GDTs.hxx b/src/XDEDRAW/XDEDRAW_GDTs.hxx index 5826894ce6..5e16b74768 100644 --- a/src/XDEDRAW/XDEDRAW_GDTs.hxx +++ b/src/XDEDRAW/XDEDRAW_GDTs.hxx @@ -22,32 +22,13 @@ #include - //! Contains commands to work with GDTs class XDEDRAW_GDTs { -public: - DEFINE_STANDARD_ALLOC +public: - Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands); - - - - -protected: - - - - - -private: - - - - - }; #endif // _XDEDRAW_GDTs_HeaderFile diff --git a/src/XDEDRAW/XDEDRAW_Layers.hxx b/src/XDEDRAW/XDEDRAW_Layers.hxx index 47ae83163a..e7e5945aa6 100644 --- a/src/XDEDRAW/XDEDRAW_Layers.hxx +++ b/src/XDEDRAW/XDEDRAW_Layers.hxx @@ -21,38 +21,13 @@ #include - //! Contains commands to work with layers class XDEDRAW_Layers { -public: - DEFINE_STANDARD_ALLOC +public: - Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands); - - - - -protected: - - - - - -private: - - - - - }; - - - - - - #endif // _XDEDRAW_Layers_HeaderFile diff --git a/src/XDEDRAW/XDEDRAW_Notes.hxx b/src/XDEDRAW/XDEDRAW_Notes.hxx index bed8e76321..9bfa7af397 100644 --- a/src/XDEDRAW/XDEDRAW_Notes.hxx +++ b/src/XDEDRAW/XDEDRAW_Notes.hxx @@ -24,9 +24,8 @@ //! Contains commands to work with notes class XDEDRAW_Notes { -public: - DEFINE_STANDARD_ALLOC +public: Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands); }; diff --git a/src/XDEDRAW/XDEDRAW_Props.hxx b/src/XDEDRAW/XDEDRAW_Props.hxx index 59665563da..277e3dab79 100644 --- a/src/XDEDRAW/XDEDRAW_Props.hxx +++ b/src/XDEDRAW/XDEDRAW_Props.hxx @@ -21,39 +21,14 @@ #include - //! Contains commands to work with geometric validation //! properties of shapes class XDEDRAW_Props { -public: - DEFINE_STANDARD_ALLOC +public: - Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands); - - - - -protected: - - - - - -private: - - - - - }; - - - - - - #endif // _XDEDRAW_Props_HeaderFile diff --git a/src/XDEDRAW/XDEDRAW_Shapes.hxx b/src/XDEDRAW/XDEDRAW_Shapes.hxx index c78fc577b2..ef15b82893 100644 --- a/src/XDEDRAW/XDEDRAW_Shapes.hxx +++ b/src/XDEDRAW/XDEDRAW_Shapes.hxx @@ -21,38 +21,13 @@ #include - //! Contains commands to work with shapes and assemblies class XDEDRAW_Shapes { -public: - DEFINE_STANDARD_ALLOC +public: - Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands); - - - - -protected: - - - - - -private: - - - - - }; - - - - - - #endif // _XDEDRAW_Shapes_HeaderFile diff --git a/src/XDEDRAW/XDEDRAW_Views.hxx b/src/XDEDRAW/XDEDRAW_Views.hxx index feb5d4d10f..c0fbb15457 100644 --- a/src/XDEDRAW/XDEDRAW_Views.hxx +++ b/src/XDEDRAW/XDEDRAW_Views.hxx @@ -22,13 +22,11 @@ #include - //! Contains commands to work with GDTs class XDEDRAW_Views { -public: - DEFINE_STANDARD_ALLOC +public: Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands); }; diff --git a/src/XSDRAW/XSDRAW_Functions.cxx b/src/XSDRAW/XSDRAW_Functions.cxx index b701b32821..1c084a87af 100644 --- a/src/XSDRAW/XSDRAW_Functions.cxx +++ b/src/XSDRAW/XSDRAW_Functions.cxx @@ -84,8 +84,8 @@ static Standard_Integer XSControl_xnorm(Draw_Interpretor& theDI, else { Message::SendInfo() << " Long Name (complete) : " - << control->Name(Standard_False) << std::endl - << " Short name (resource) : " << control->Name(Standard_True) << std::endl; + << control->Name(Standard_False) + << " Short name (resource) : " << control->Name(Standard_True); } if (theNbArgs == 1) { @@ -95,12 +95,12 @@ static Standard_Integer XSControl_xnorm(Draw_Interpretor& theDI, control = XSControl_Controller::Recorded(theArgVec[1]); if (control.IsNull()) { - Message::SendInfo() << " No norm named : " << theArgVec[1] << std::endl; + Message::SendInfo() << " No norm named : " << theArgVec[1]; return 1; } WS->SetController(control); - Message::SendInfo() << "new norm : " << control->Name() << std::endl; + Message::SendInfo() << "new norm : " << control->Name(); return 0; } @@ -116,7 +116,7 @@ static Standard_Integer XSControl_newmodel(Draw_Interpretor& theDI, { return 0; } - Message::SendInfo() << "No new Model produced" << std::endl; + Message::SendInfo() << "No new Model produced"; return 1; } @@ -137,14 +137,14 @@ static Standard_Integer XSControl_tpclear(Draw_Interpretor& theDI, if (modew) { if (!FP.IsNull()) FP->Clear(); - else Message::SendInfo() << "No Transfer Write" << std::endl; + else Message::SendInfo() << "No Transfer Write"; } else { if (!TP.IsNull()) TP->Clear(); else - Message::SendInfo() << "No Transfer Read" << std::endl; + Message::SendInfo() << "No Transfer Read"; } return 0; } @@ -163,7 +163,8 @@ static Standard_Integer XSControl_tpstat(Draw_Interpretor& theDI, WS->TransferReader()->TransientProcess(); if (TP.IsNull()) { - Message::SendInfo() << "No Transfer Read" << std::endl; return 1; + Message::SendInfo() << "No Transfer Read"; + return 1; } // **** tpstat **** @@ -222,7 +223,8 @@ static Standard_Integer XSControl_tpstat(Draw_Interpretor& theDI, << " *n *s *b *t *r *l *L : idem on ALL recorded items\n" << " ?n ?s ?b ?t ... : idem on abnormal items\n" << " n select : n applied on a selection idem for s b t r l"; - if (mod1 < -1) return 1; + if (mod1 < -1) + return 1; return 0; } @@ -231,11 +233,11 @@ static Standard_Integer XSControl_tpstat(Draw_Interpretor& theDI, Message::SendInfo() << "TransferRead :"; if (TP->Model() != WS->Model()) Message::SendInfo() << "Model differs from the session"; Handle(TColStd_HSequenceOfTransient) list = - IFSelect_Functions::GiveList(pilot->Session(), pilot->CommandPart(2)); + IFSelect_Functions::GiveList(WS, pilot->CommandPart(2)); XSControl_TransferReader::PrintStatsOnList(TP, list, mod1, mod2); // TP->PrintStats (1,Message::SendInfo()); } - else Message::SendInfo() << "TransferRead : not defined" << std::endl; + else Message::SendInfo() << "TransferRead : not defined"; return 0; } @@ -320,38 +322,45 @@ static Standard_Integer XSControl_trecord(Draw_Interpretor& theDI, const char** theArgVec) { const Standard_CString arg1 = theArgVec[1]; - const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + const Handle(Transfer_TransientProcess)& TP = WS->TransferReader()->TransientProcess(); // **** trecord : TransferReader **** Standard_Boolean tous = (theNbArgs == 1); Standard_Integer num = -1; - const Handle(Interface_InterfaceModel)& mdl = XSControl::Session(pilot)->Model(); - const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader(); + const Handle(Interface_InterfaceModel)& mdl = WS->Model(); + const Handle(XSControl_TransferReader)& TR = WS->TransferReader(); Handle(Standard_Transient) ent; - Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo(); if (mdl.IsNull() || TR.IsNull() || TP.IsNull()) { - Message::SendInfo() << " init not done" << std::endl; return 1; + Message::SendInfo() << " init not done"; + return 1; } - if (!tous) num = atoi(arg1); + if (!tous) + num = atoi(arg1); // Enregistrer les racines if (tous) { Standard_Integer nb = TP->NbRoots(); - Message::SendInfo() << " Recording " << nb << " Roots" << std::endl; + Message::SendInfo() << " Recording " << nb << " Roots"; for (Standard_Integer i = 1; i <= nb; i++) { ent = TP->Root(i); - if (TR->RecordResult(ent)) Message::SendInfo() << " Root n0." << i << std::endl; - else Message::SendInfo() << " Root n0." << i << " not recorded" << std::endl; + if (TR->RecordResult(ent)) + Message::SendInfo() << " Root n0." << i; + else + Message::SendInfo() << " Root n0." << i << " not recorded"; } } else { - if (num < 1 || num > mdl->NbEntities()) Message::SendInfo() << "incorrect number:" << num << std::endl; - else if (TR->RecordResult(mdl->Value(num))) Message::SendInfo() << " Entity n0." << num << std::endl; - else Message::SendInfo() << " Entity n0." << num << " not recorded" << std::endl; + if (num < 1 || num > mdl->NbEntities()) + Message::SendInfo() << "incorrect number:" << num; + else if (TR->RecordResult(mdl->Value(num))) + Message::SendInfo() << " Entity n0." << num; + else + Message::SendInfo() << " Entity n0." << num << " not recorded"; } - return IFSelect_RetDone; + return 0; } //======================================================================= @@ -362,21 +371,22 @@ static Standard_Integer XSControl_trstat(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - Standard_Integer theNbArgs = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo(); + const Standard_CString arg1 = theArgVec[1]; // **** trstat : TransferReader **** - const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + const Handle(XSControl_TransferReader)& TR = WS->TransferReader(); if (TR.IsNull()) { - Message::SendInfo() << " init not done" << std::endl; return 1; + Message::SendInfo() << " init not done"; + return 1; } Handle(Interface_InterfaceModel) mdl = TR->Model(); if (mdl.IsNull()) { - Message::SendInfo() << " No model" << std::endl; return 1; + Message::SendInfo() << " No model"; + return 1; } - Message::SendInfo() << " Statistics : FileName : " << TR->FileName() << std::endl; + Message::SendInfo() << " Statistics : FileName : " << TR->FileName(); if (theNbArgs == 1) { // stats generales @@ -388,28 +398,31 @@ static Standard_Integer XSControl_trstat(Draw_Interpretor& theDI, Standard_Integer num = atoi(arg1); if (num < 1 || num > mdl->NbEntities()) { - Message::SendInfo() << " incorrect number:" << arg1 << std::endl; return 1; + Message::SendInfo() << " incorrect number:" << arg1; + return 1; } Handle(Standard_Transient) ent = mdl->Value(num); if (!TR->IsRecorded(ent)) { - Message::SendInfo() << " Entity " << num << " not recorded" << std::endl; return 1; + Message::SendInfo() << " 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.:"; + if (nb > 0) + Message::SendInfo() << " Entities implied by Check/Result :" << nb << " i.e.:"; for (i = 1; i <= nb; i++) { Message::SendInfo() << " "; mdl->Print(list->Value(i), Message::SendInfo()); } - Message::SendInfo() << std::endl; if (RM.IsNull()) { - Message::SendInfo() << " no other info" << std::endl; return 0; + Message::SendInfo() << " no other info"; + return 0; } Interface_CheckIterator chl = RM->CheckList(Standard_False); - pilot->Session()->PrintCheckList(Message::SendInfo(), chl, Standard_False, IFSelect_EntitiesByItem); + WS->PrintCheckList(Message::SendInfo(), chl, Standard_False, IFSelect_EntitiesByItem); } return 0; } @@ -423,25 +436,25 @@ static Standard_Integer XSControl_trbegin(Draw_Interpretor& theDI, const char** theArgVec) { // **** trbegin : TransferReader **** - Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->TransferReader(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Handle(XSControl_TransferReader) TR = WS->TransferReader(); Standard_Boolean init = TR.IsNull(); - if (pilot->NbWords() > 1) + if (theNbArgs > 1) { - if (pilot->Arg(1)[0] == 'i') init = Standard_True; + if (theArgVec[1][0] == 'i') init = Standard_True; } if (init) { - XSControl::Session(pilot)->InitTransferReader(0); - TR = XSControl::Session(pilot)->TransferReader(); + WS->InitTransferReader(0); + TR = WS->TransferReader(); if (TR.IsNull()) { - Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo(); - Message::SendInfo() << " init not done or failed" << std::endl; + Message::SendInfo() << " init not done or failed"; return 1; } } TR->BeginTransfer(); - return IFSelect_RetDone; + return 0; } //======================================================================= @@ -452,40 +465,43 @@ static Standard_Integer XSControl_tread(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - Standard_Integer theNbArgs = pilot->NbWords(); + Standard_Integer theNbArgs = theNbArgs; //const Standard_CString arg1 = pilot->Arg(1); // **** tread : TransferReader **** - Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo(); - const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Handle(XSControl_TransferReader) TR = WS->TransferReader(); if (TR.IsNull()) { - Message::SendInfo() << " init not done" << std::endl; return 1; + Message::SendInfo() << " init not done"; + return 1; } const Handle(Interface_InterfaceModel)& mdl = TR->Model(); if (mdl.IsNull()) { - Message::SendInfo() << " No model" << std::endl; return 1; + Message::SendInfo() << " No model"; + return 1; } if (theNbArgs < 2) { // DeclareAndCast(IFSelect_Selection,sel,pilot->Session()->NamedItem("xst-model-roots")); - Handle(Standard_Transient) sel = pilot->Session()->NamedItem("xst-model-roots"); + Handle(Standard_Transient) sel = WS->NamedItem("xst-model-roots"); if (sel.IsNull()) { - Message::SendInfo() << "Select Roots absent" << std::endl; return 1; + Message::SendInfo() << "Select Roots absent"; + return 1; } - Handle(TColStd_HSequenceOfTransient) list = pilot->Session()->GiveList(sel); - Message::SendInfo() << " Transferring all roots i.e. : " << TR->TransferList(list) << std::endl; + Handle(TColStd_HSequenceOfTransient) list = WS->GiveList(sel); + Message::SendInfo() << " Transferring all roots i.e. : " << TR->TransferList(list); } else { Handle(TColStd_HSequenceOfTransient) list = - IFSelect_Functions::GiveList(pilot->Session(), pilot->CommandPart(1)); - Message::SendInfo() << " Transfer of " << list->Length() << " entities" << std::endl; + IFSelect_Functions::GiveList(WS, pilot->CommandPart(1)); + Message::SendInfo() << " Transfer of " << list->Length() << " entities"; Standard_Integer nb = TR->TransferList(list); - Message::SendInfo() << " Gives " << nb << " results" << std::endl; + Message::SendInfo() << " Gives " << nb << " results"; } - return IFSelect_RetDone; + return 0; } //======================================================================= @@ -497,10 +513,12 @@ static Standard_Integer XSControl_trtp(Draw_Interpretor& theDI, const char** theArgVec) { // **** TReader -> TProcess **** - const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader(); - Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo(); - if (TR.IsNull()) Message::SendInfo() << " No TransferReader" << std::endl; - else if (TR->TransientProcess().IsNull()) Message::SendInfo() << " Transfer Reader without Process" << std::endl; + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + const Handle(XSControl_TransferReader)& TR = WS->TransferReader(); + if (TR.IsNull()) + Message::SendInfo() << " No TransferReader"; + else if (TR->TransientProcess().IsNull()) + Message::SendInfo() << " Transfer Reader without Process"; return 0; } @@ -513,8 +531,8 @@ static Standard_Integer XSControl_tptr(Draw_Interpretor& theDI, const char** theArgVec) { // **** TProcess -> TReader **** - XSControl::Session(pilot)->InitTransferReader(3); - return IFSelect_RetDone; + XSDRAWBase::Session()->InitTransferReader(3); + return 0; } //======================================================================= @@ -525,28 +543,30 @@ static Standard_Integer XSControl_twmode(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - Standard_Integer theNbArgs = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** twmode **** - Handle(XSControl_TransferWriter) TW = XSControl::Session(pilot)->TransferWriter(); - Handle(XSControl_Controller) control = XSControl::Session(pilot)->NormAdaptor(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); + Handle(XSControl_Controller) control = WS->NormAdaptor(); Standard_Integer modemin, modemax; - Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo(); if (control->ModeWriteBounds(modemin, modemax)) { - Message::SendInfo() << "Write Mode : allowed values " << modemin << " to " << modemax << std::endl; + Message::SendInfo() << "Write Mode : allowed values " << modemin << " to " << modemax; for (Standard_Integer modd = modemin; modd <= modemax; modd++) { - Message::SendInfo() << modd << " : " << control->ModeWriteHelp(modd) << std::endl; + Message::SendInfo() << modd << " : " << control->ModeWriteHelp(modd); } } - Message::SendInfo() << "Write Mode : actual = " << TW->TransferMode() << std::endl; - if (theNbArgs <= 1) return 0; + Message::SendInfo() << "Write Mode : actual = " << TW->TransferMode(); + if (theNbArgs <= 1) + return 0; Standard_Integer mod = atoi(arg1); - Message::SendInfo() << "New value -> " << arg1 << std::endl; + Message::SendInfo() << "New value -> " << arg1; TW->SetTransferMode(mod); - if (!control->IsModeWrite(mod)) Message::SendInfo() << "Warning : this new value is not supported" << std::endl; - return IFSelect_RetDone; + if (!control->IsModeWrite(mod)) + Message::SendInfo() << "Warning : this new value is not supported"; + return 0; } //======================================================================= @@ -557,20 +577,21 @@ static Standard_Integer XSControl_twstat(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - //Standard_Integer theNbArgs = pilot->NbWords(); + //Standard_Integer theNbArgs = theNbArgs; //const Standard_CString arg1 = pilot->Arg(1); //const Standard_CString arg2 = pilot->Arg(2); - const Handle(Transfer_FinderProcess)& FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + const Handle(Transfer_FinderProcess)& FP = WS->TransferWriter()->FinderProcess(); // **** twstat **** // Pour Write - Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo(); if (!FP.IsNull()) { Message::SendInfo() << "TransferWrite:"; // XSControl_TransferWriter::PrintStatsProcess (FP,mod1,mod2); FP->PrintStats(1, Message::SendInfo()); } - else Message::SendInfo() << "TransferWrite: not defined" << std::endl; + else + Message::SendInfo() << "TransferWrite: not defined"; return 0; } @@ -583,10 +604,9 @@ static Standard_Integer XSControl_settransfert(Draw_Interpretor& theDI, const char** theArgVec) { // **** SelectForTransfer **** - return pilot->RecordItem(new XSControl_SelectForTransfer(XSControl::Session(pilot)->TransferReader())); + return pilot->RecordItem(new XSControl_SelectForTransfer(XSDRAWBase::Session()->TransferReader())); } - //======================================================================= //function : Init //purpose : diff --git a/src/XSDRAW/XSDRAW_FunctionsSession.cxx b/src/XSDRAW/XSDRAW_FunctionsSession.cxx index 82c7bd5553..5e23f906cf 100644 --- a/src/XSDRAW/XSDRAW_FunctionsSession.cxx +++ b/src/XSDRAW/XSDRAW_FunctionsSession.cxx @@ -11,6 +11,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include + #include #include #include @@ -50,7 +52,7 @@ #include #include #include -#include +#include #include #include #include @@ -67,14 +69,16 @@ #include #include #include +#include -#include -// 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) +//======================================================================= +//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); @@ -90,9 +94,13 @@ static void SplitFileName if (nomfin <= nomlon) suffix = resfile.SubString(nomfin, nomlon); } -Handle(TColStd_HSequenceOfTransient) GiveList -(const Handle(IFSelect_WorkSession)& WS, - const Standard_CString first, const Standard_CString second) +//======================================================================= +//function : GiveList +//purpose : +//======================================================================= +Handle(TColStd_HSequenceOfTransient) GiveList(const Handle(XSControl_WorkSession)& WS, + const Standard_CString first, + const Standard_CString second) { return WS->GiveList(first, second); } @@ -104,9 +112,13 @@ Handle(TColStd_HSequenceOfTransient) GiveList // Or a name of dispatch + a parameter : dispatch-name(param-value) // According to type of Dispatch : integer , signature name -Handle(IFSelect_Dispatch) GiveDispatch -(const Handle(IFSelect_WorkSession)& WS, - const Standard_CString name, const Standard_Boolean mode) +//======================================================================= +//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 @@ -121,14 +133,13 @@ Handle(IFSelect_Dispatch) GiveDispatch if (disp.IsNull()) return disp; // KO anyway // According to the type of dispatch : - Message_Messenger::StreamBuffer sout = Message::SendInfo(); DeclareAndCast(IFSelect_DispPerCount, dc, disp); if (!dc.IsNull()) { Standard_Integer nb = atoi(&(nam.ToCString())[paro]); if (nb <= 0) { - sout << " DispPerCount, count is not positive" << std::endl; + Message::SendInfo() << " DispPerCount, count is not positive"; disp.Nullify(); return disp; } @@ -146,7 +157,7 @@ Handle(IFSelect_Dispatch) GiveDispatch Standard_Integer nb = atoi(&(nam.ToCString())[paro]); if (nb <= 0) { - sout << " DispPerFiles, count is not positive" << std::endl; + Message::SendInfo() << " DispPerFiles, count is not positive"; disp.Nullify(); return disp; } @@ -164,14 +175,14 @@ Handle(IFSelect_Dispatch) GiveDispatch DeclareAndCast(IFSelect_Signature, sg, WS->NamedItem(&(nam.ToCString())[paro])); if (sg.IsNull()) { - sout << "DispPerSignature " << nam << " , Signature not valid : " << &(nam.ToCString())[paro] << std::endl; + Message::SendInfo() << "DispPerSignature " << nam << " , Signature not valid : " << &(nam.ToCString())[paro]; disp.Nullify(); return disp; } if (mode) ds->SetSignCounter(new IFSelect_SignCounter(sg)); return ds; } - sout << "Dispatch : " << name << " , Parameter : " << &(nam.ToCString())[paro] << std::endl; + Message::SendInfo() << "Dispatch : " << name << " , Parameter : " << &(nam.ToCString())[paro]; return disp; } @@ -181,51 +192,66 @@ Handle(IFSelect_Dispatch) GiveDispatch // Les definitions -static IFSelect_ReturnStatus funstatus -(const Handle(IFSelect_SessionPilot)&) +//======================================================================= +//function : funstatus +//purpose : +//======================================================================= +static Standard_Integer funstatus(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { // **** Version & cie **** //#58 rln - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - sout << "Processor Version : " << XSTEP_PROCESSOR_VERSION << std::endl; - sout << "OL Version : " << XSTEP_SYSTEM_VERSION << std::endl; - sout << "Configuration : " << XSTEP_Config << std::endl; - sout << "UL Names : " << XSTEP_ULNames << std::endl; - return IFSelect_RetVoid; -} - -static IFSelect_ReturnStatus fun1 -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); + 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; + return 0; +} + +//======================================================================= +//function : fun1 +//purpose : +//======================================================================= +static Standard_Integer fun1(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) +{ + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** ToggleHandler **** Standard_Boolean hand = !WS->ErrorHandle(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (hand) sout << " -- Mode Catch Error now Active" << std::endl; - else sout << " -- Mode Catch Error now Inactive" << std::endl; + if (hand) Message::SendInfo() << " -- Mode Catch Error now Active"; + else Message::SendInfo() << " -- Mode Catch Error now Inactive"; WS->SetErrorHandle(hand); - return IFSelect_RetDone; + return 0; } -static IFSelect_ReturnStatus fun3 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun3 +//purpose : +//======================================================================= +static Standard_Integer fun3(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** XRead / Load **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Read/Load : give file name !" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Read/Load : give file name !"; + return 1; } if (WS->Protocol().IsNull()) { - sout << "Protocol not defined" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Protocol not defined"; + return 1; } if (WS->WorkLibrary().IsNull()) { - sout << "WorkLibrary not defined" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "WorkLibrary not defined"; + return 1; } IFSelect_ReturnStatus status = WS->ReadFile(arg1); @@ -233,164 +259,199 @@ static IFSelect_ReturnStatus fun3 // -1 fichier non trouve, -2 lecture faite mais resultat vide switch (status) { - case IFSelect_RetVoid: sout << "file:" << arg1 << " gives empty result" << std::endl; break; - case IFSelect_RetError: sout << "file:" << arg1 << " could not be opened" << std::endl; break; - case IFSelect_RetDone: sout << "file:" << arg1 << " read" << std::endl; break; - case IFSelect_RetFail: sout << "file:" << arg1 << " : error while reading" << std::endl; break; - case IFSelect_RetStop: sout << "file:" << arg1 << " : EXCEPTION while reading" << std::endl; break; - default: sout << "file:" << arg1 << " could not be read" << std::endl; break; + 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; } if (status != IFSelect_RetDone) return status; - // sout<<" - clearing list of already written files"<BeginSentFiles(Standard_True); return status; } -static IFSelect_ReturnStatus fun4 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun4 +//purpose : +//======================================================================= +static Standard_Integer fun4(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Write All **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Write All : give file name !" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Write All : give file name !"; + return 1; } return WS->SendAll(arg1); } -static IFSelect_ReturnStatus fun5 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun5 +//purpose : +//======================================================================= +static Standard_Integer fun5(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - // const Standard_CString arg2 = pilot->Arg(2); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + // const Standard_CString arg2 = theArgVec[2]; // **** Write Selected **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "Write Selected : give file name + givelist !" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Write Selected : give file name + givelist !"; + return 1; } Handle(TColStd_HSequenceOfTransient) result = XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart(2)); if (result.IsNull()) { - sout << "No entity selected" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "No entity selected"; + return 1; } - else sout << "Nb Entities selected : " << result->Length() << std::endl; + else Message::SendInfo() << "Nb Entities selected : " << result->Length(); Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; sp->SetList(result); return WS->SendSelected(arg1, sp); } -static IFSelect_ReturnStatus fun6 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun6 +//purpose : +//======================================================================= +static Standard_Integer fun6(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Write Entite(s) **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "Write Entitie(s) : give file name + n0s entitie(s)!" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "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 < argc; ia++) + for (Standard_Integer ia = 2; ia < theNbArgs; ia++) { Standard_Integer id = pilot->Number(pilot->Arg(ia)); if (id > 0) { Handle(Standard_Transient) item = WS->StartingEntity(id); - if (sp->Add(item)) sout << "Added:no." << id << std::endl; + if (sp->Add(item)) Message::SendInfo() << "Added:no." << id; else { - sout << " Fail Add n0." << id << std::endl; ko++; + Message::SendInfo() << " Fail Add n0." << id; ko++; } } else { - sout << "Not an entity number:" << pilot->Arg(ia) << std::endl; ko++; + Message::SendInfo() << "Not an entity number:" << pilot->Arg(ia); ko++; } } if (ko > 0) { - sout << ko << " bad arguments, abandon" << std::endl; return IFSelect_RetError; + Message::SendInfo() << ko << " bad arguments, abandon"; + return 1; } return WS->SendSelected(arg1, sp); } -static IFSelect_ReturnStatus fun7 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun7 +//purpose : +//======================================================================= +static Standard_Integer fun7(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Entity Label **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Give entity number" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Give entity number"; + return 1; } if (!WS->HasModel()) { - sout << "No loaded model, abandon" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "No loaded model, abandon"; + return 1; } Standard_Integer nument = WS->NumberFromLabel(arg1); if (nument <= 0 || nument > WS->NbStartingEntities()) { - sout << "Not a suitable number: " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Not a suitable number: " << arg1; + return 1; } - sout << "N0." << nument << " ->Label in Model : "; - WS->Model()->PrintLabel(WS->StartingEntity(nument), sout); - sout << std::endl; - return IFSelect_RetVoid; + Message::SendInfo() << "N0." << nument << " ->Label in Model : "; + WS->Model()->PrintLabel(WS->StartingEntity(nument), Message::SendInfo()); + Message::SendInfo(); + return 0; } -static IFSelect_ReturnStatus fun8 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun8 +//purpose : +//======================================================================= +static Standard_Integer fun8(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Entity Number **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Give label to search" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Give label to search"; + return 1; } if (!WS->HasModel()) { - sout << "No loaded model, abandon" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "No loaded model, abandon"; + return 1; } const Handle(Interface_InterfaceModel)& model = WS->Model(); Standard_Integer i, cnt = 0; Standard_Boolean exact = Standard_False; - sout << " ** Search Entity Number for Label : " << arg1 << std::endl; + Message::SendInfo() << " ** Search Entity Number for Label : " << arg1; for (i = model->NextNumberForLabel(arg1, 0, exact); i != 0; i = model->NextNumberForLabel(arg1, i, exact)) { cnt++; - sout << " ** Found n0/id:"; - model->Print(model->Value(i), sout); - sout << std::endl; + Message::SendInfo() << " ** Found n0/id:"; + model->Print(model->Value(i), Message::SendInfo()); + Message::SendInfo(); } - if (cnt == 0) sout << " ** No Match" << std::endl; - else if (cnt == 1) sout << " ** 1 Match" << std::endl; - else sout << cnt << " Matches" << std::endl; - return IFSelect_RetVoid; + if (cnt == 0) Message::SendInfo() << " ** No Match"; + else if (cnt == 1) Message::SendInfo() << " ** 1 Match"; + else Message::SendInfo() << cnt << " Matches"; + return 0; } -static IFSelect_ReturnStatus fun9 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun9 +//purpose : +//======================================================================= +static Standard_Integer fun9(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { // **** List Types **** - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(IFSelect_Signature) signtype = WS->SignType(); if (signtype.IsNull()) signtype = new IFSelect_SignType; Handle(IFSelect_SignCounter) counter = @@ -398,24 +459,28 @@ static IFSelect_ReturnStatus fun9 return pilot->ExecuteCounter(counter, 1); } -static IFSelect_ReturnStatus funcount -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : funcount +//purpose : +//======================================================================= +static Standard_Integer funcount(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg0 = pilot->Arg(0); - const Standard_CString arg1 = pilot->Arg(1); + 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 **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Designer signature ou compteur, + facultatif selection + facultatif entite" << std::endl; - sout << " signature/compteur seul -> tout le modele" << std::endl - << " sign/compteur + selection -> cette selection, evaluation normale" << std::endl - << " sign/compteur + sel + num -> cette selection evaluee sur entite n0 num" << std::endl; - return IFSelect_RetError; + 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()) @@ -424,21 +489,21 @@ static IFSelect_ReturnStatus funcount if (!signa.IsNull()) counter = new IFSelect_SignCounter(signa, Standard_False, listmode); } // Handle(IFSelect_Selection) sel; - // Standard_Integer n3 = 0; if (argc > 3) n3 = WS->NumberFromLabel(arg3); - // if (argc > 2) sel = GetCasted(IFSelect_Selection,WS->NamedItem(arg2)); - // if (counter.IsNull() || (argc > 2 && n3 <= 0 && sel.IsNull()) ) { - // sout<<"Nom:"< 2) sout<<" et/ou "< 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:"< 2) Message::SendInfo()<<" et/ou "<Arg(i), "on")) + if (!strcmp(theArgVec[i], "on")) { onflag = i; break; } @@ -454,11 +519,11 @@ static IFSelect_ReturnStatus funcount Handle(IFSelect_SelectSuite) suite = new IFSelect_SelectSuite; for (i = 1; i < onflag; i++) { - sel = WS->GiveSelection(pilot->Arg(i)); + sel = WS->GiveSelection(theArgVec[i]); if (!suite->AddInput(sel)) { - sout << "Incorrect definition for applied selection" << std::endl; - return IFSelect_RetError; + Message::SendInfo() << "Incorrect definition for applied selection"; + return 1; } } seld = suite; @@ -471,8 +536,8 @@ static IFSelect_ReturnStatus funcount if (counter.IsNull()) { - sout << "Neither Counter nor Signature : " << arg1 << std::endl; - return IFSelect_RetError; + Message::SendInfo() << "Neither Counter nor Signature : " << arg1; + return 1; } if (onflag == 0) onflag = 1; @@ -482,129 +547,146 @@ static IFSelect_ReturnStatus funcount return pilot->ExecuteCounter(counter, onflag + 1, pcm); } -static IFSelect_ReturnStatus funsigntype -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : funsigntype +//purpose : +//======================================================================= +static Standard_Integer funsigntype(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Sign Type **** Handle(IFSelect_Signature) signtype = WS->SignType(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (signtype.IsNull()) sout << "signtype actually undefined" << std::endl; + if (signtype.IsNull()) Message::SendInfo() << "signtype actually undefined"; else { Handle(TCollection_HAsciiString) str = WS->Name(signtype); Standard_Integer id = WS->ItemIdent(signtype); - sout << signtype->Label() << std::endl; + Message::SendInfo() << signtype->Label(); if (str.IsNull()) { - if (id > 0) sout << "signtype : item n0 " << id << std::endl; + if (id > 0) Message::SendInfo() << "signtype : item n0 " << id; } else { - sout << "signtype : also named as " << str->ToCString() << std::endl; + Message::SendInfo() << "signtype : also named as " << str->ToCString(); } } - if (argc < 2) sout << "signtype newitem to change, signtype . to clear" << std::endl; + if (theNbArgs < 2) Message::SendInfo() << "signtype newitem to change, signtype . to clear"; else { if (arg1[0] == '.' && arg1[1] == '\0') { signtype.Nullify(); - sout << "signtype now cleared" << std::endl; + Message::SendInfo() << "signtype now cleared"; } else { signtype = GetCasted(IFSelect_Signature, WS->NamedItem(arg1)); if (signtype.IsNull()) { - sout << "Not a Signature : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Not a Signature : " << arg1; + return 1; } - else sout << "signtype now set to " << arg1 << std::endl; + else Message::SendInfo() << "signtype now set to " << arg1; } WS->SetSignType(signtype); - return IFSelect_RetDone; + return 0; } - return IFSelect_RetVoid; + return 0; } -static IFSelect_ReturnStatus funsigncase -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : funsigncase +//purpose : +//======================================================================= +static Standard_Integer funsigncase(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + const Standard_CString arg1 = theArgVec[1]; // **** Sign Case **** Handle(IFSelect_Signature) signcase = GetCasted(IFSelect_Signature, WS->NamedItem(arg1)); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (signcase.IsNull()) sout << "Not a Signature : " << arg1 << std::endl; + if (signcase.IsNull()) Message::SendInfo() << "Not a Signature : " << arg1; else { Standard_Boolean hasmin, hasmax; Standard_Integer valmin, valmax; if (signcase->IsIntCase(hasmin, valmin, hasmax, valmax)) { - sout << "Signature " << arg1 << " : Integer Case"; - if (hasmin) sout << " - Mini:" << valmin; - if (hasmax) sout << " - Maxi:" << valmax; - sout << std::endl; + Message::SendInfo() << "Signature " << arg1 << " : Integer Case"; + if (hasmin) Message::SendInfo() << " - Mini:" << valmin; + if (hasmax) Message::SendInfo() << " - Maxi:" << valmax; + Message::SendInfo(); } Handle(TColStd_HSequenceOfAsciiString) caselist = signcase->CaseList(); - if (caselist.IsNull()) sout << "Signature " << arg1 << " : no predefined case, see command count " << arg1 << std::endl; + if (caselist.IsNull()) Message::SendInfo() << "Signature " << arg1 << " : no predefined case, see command count " << arg1; else { Standard_Integer i, nb = caselist->Length(); - sout << "Signature " << arg1 << " : " << nb << " basic cases :" << std::endl; - for (i = 1; i <= nb; i++) sout << " " << caselist->Value(i); - sout << std::endl; + Message::SendInfo() << "Signature " << arg1 << " : " << nb << " basic cases :"; + for (i = 1; i <= nb; i++) Message::SendInfo() << " " << caselist->Value(i); + Message::SendInfo(); } } - return IFSelect_RetVoid; + return 0; } - -static IFSelect_ReturnStatus fun10 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun10 +//purpose : +//======================================================================= +static Standard_Integer fun10(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Entity Status **** Standard_Integer i, nb; - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { nb = Interface_Category::NbCategories(); - sout << " Categories defined :" << nb << " i.e. :\n"; + Message::SendInfo() << " Categories defined :" << nb << " i.e. :\n"; for (i = 0; i <= nb; i++) - sout << "Cat." << i << " : " << Interface_Category::Name(i) << "\n"; - sout << " On a given entity : give its number" << std::endl; - return IFSelect_RetVoid; + Message::SendInfo() << "Cat." << i << " : " << Interface_Category::Name(i) << "\n"; + Message::SendInfo() << " On a given entity : give its number"; + return 0; } Standard_Integer num = pilot->Number(arg1); if (num <= 0 || num > WS->NbStartingEntities()) { - sout << "Not a suitable entity number : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Not a suitable entity number : " << arg1; + return 1; } Handle(Standard_Transient) ent = WS->StartingEntity(num); - WS->PrintEntityStatus(ent, sout); - return IFSelect_RetVoid; + WS->PrintEntityStatus(ent, Message::SendInfo()); + return 0; } -static IFSelect_ReturnStatus fun11 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun11 +//purpose : +//======================================================================= +static Standard_Integer fun11(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - // Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + // Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** DumpModel (Data) **** Standard_Integer niv = 0; // char arg10 = arg1[0]; - // if (argc < 2) arg10 = '?'; - Message_Messenger::StreamBuffer sout = Message::SendInfo(); + // if (theNbArgs < 2) arg10 = '?'; switch (arg1[0]) { case '?': - sout << "? for this help, else give a listing mode (first letter suffices) :\n" + Message::SendInfo() << "? 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" @@ -613,8 +695,8 @@ static IFSelect_ReturnStatus fun11 << " check CheckList (complete) per message (counting)\n" << " totalcheck CheckList (complete) per message (listing n0 ents)\n" << " FAILS CheckList (fails) per message (listing complete)\n" - << " TOTALCHECK CheckList (complete) per message (listing complete)" << std::endl; - return IFSelect_RetVoid; + << " TOTALCHECK CheckList (complete) per message (listing complete)"; + return 0; case 'g': niv = 0; break; case 'r': niv = 1; break; case 'e': niv = 2; break; @@ -625,242 +707,301 @@ static IFSelect_ReturnStatus fun11 case 'T': niv = 7; break; case 'f': niv = 8; break; case 'F': niv = 10; break; - default: sout << "Unknown Mode . data tout court pour help" << std::endl; return IFSelect_RetError; + default: Message::SendInfo() << "Unknown Mode . data tout court pour help"; + return 1; } WS->TraceDumpModel(niv); - return IFSelect_RetVoid; + return 0; } -static IFSelect_ReturnStatus fundumpent -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fundumpent +//purpose : +//======================================================================= +static Standard_Integer fundumpent(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; Handle(IFSelect_WorkLibrary) WL = WS->WorkLibrary(); Standard_Integer levdef = 0, levmax = 10, level; WL->DumpLevels(levdef, levmax); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2 || (argc == 2 && levmax < 0)) + if (theNbArgs < 2 || (theNbArgs == 2 && levmax < 0)) { - sout << "Give n0 or id of entity"; - if (levmax < 0) sout << " and dump level" << std::endl; - else sout << " + optional, dump level in [0 - " << levmax << "] , default = " << levdef << std::endl; + 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; for (level = 0; level <= levmax; level++) { Standard_CString help = WL->DumpHelp(level); - if (help[0] != '\0') sout << level << " : " << help << std::endl; + if (help[0] != '\0') Message::SendInfo() << level << " : " << help; } - return IFSelect_RetError; + return 1; } - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; Standard_Integer num = pilot->Number(arg1); - if (num == 0) return IFSelect_RetError; + if (num == 0) + return 1; level = levdef; - if (argc > 2) level = atoi(arg2); + if (theNbArgs > 2) level = atoi(arg2); Handle(Standard_Transient) ent = WS->StartingEntity(num); if (ent.IsNull()) { - sout << "No entity with given id " << arg1 << " (" << num << ") is found in the current model" << std::endl; + Message::SendInfo() << "No entity with given id " << arg1 << " (" << num << ") is found in the current model"; } else { - sout << " -- DUMP Entity n0 " << num << " level " << level << std::endl; - WL->DumpEntity(WS->Model(), WS->Protocol(), ent, sout, level); + Message::SendInfo() << " -- DUMP Entity n0 " << num << " level " << level; + WL->DumpEntity(WS->Model(), WS->Protocol(), ent, Message::SendInfo(), level); Interface_CheckIterator chl = WS->CheckOne(ent); - if (!chl.IsEmpty(Standard_False)) chl.Print(sout, WS->Model(), Standard_False); + if (!chl.IsEmpty(Standard_False)) chl.Print(Message::SendInfo(), WS->Model(), Standard_False); } - // sout << std::flush; + // Message::SendInfo() << std::flush; - return IFSelect_RetVoid; + return 0; } -static IFSelect_ReturnStatus funsign -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : funsign +//purpose : +//======================================================================= +static Standard_Integer funsign(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + 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) { - sout << " Give signature name + n0 or id of entity" << std::endl; return IFSelect_RetError; + Message::SendInfo() << " Give signature name + n0 or id of entity"; + return 1; } DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1)); if (sign.IsNull()) { - sout << "Not a signature : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Not a signature : " << arg1; + return 1; } Standard_Integer num = pilot->Number(arg2); Handle(Standard_Transient) ent = WS->StartingEntity(num); - if (num == 0) return IFSelect_RetError; - sout << "Entity n0 " << num << " : " << WS->SignValue(sign, ent) << std::endl; - return IFSelect_RetVoid; + if (num == 0) + return 1; + Message::SendInfo() << "Entity n0 " << num << " : " << WS->SignValue(sign, ent); + return 0; } -static IFSelect_ReturnStatus funqp -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : funqp +//purpose : +//======================================================================= +static Standard_Integer funqp(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + 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) { - sout << " Give 2 numeros or labels : dad son" << std::endl; return IFSelect_RetError; + Message::SendInfo() << " Give 2 numeros or labels : dad son"; + return 1; } Standard_Integer n1 = WS->NumberFromLabel(arg1); Standard_Integer n2 = WS->NumberFromLabel(arg2); - sout << "QueryParent for dad:" << arg1 << ":" << n1 << " and son:" << arg2 << ":" << n2 << std::endl; + Message::SendInfo() << "QueryParent for dad:" << arg1 << ":" << n1 << " and son:" << arg2 << ":" << n2; Standard_Integer qp = WS->QueryParent(WS->StartingEntity(n1), WS->StartingEntity(n2)); - if (qp < 0) sout << arg1 << " is not super-entity of " << arg2 << std::endl; - else if (qp == 0) sout << arg1 << " is same as " << arg2 << std::endl; - else sout << arg1 << " is super-entity of " << arg2 << " , max level found=" << qp << std::endl; - // sout<<" Trouve "<Session(); + 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 "<DumpShare(); return IFSelect_RetVoid; + WS->DumpShare(); return 0; } -static IFSelect_ReturnStatus fun13 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun13 +//purpose : +//======================================================================= +static Standard_Integer fun13(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** ListItems **** - WS->ListItems(pilot->Arg(1)); return IFSelect_RetVoid; + WS->ListItems(theArgVec[1]); return 0; } -static IFSelect_ReturnStatus fun14 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun14 +//purpose : +//======================================================================= +static Standard_Integer fun14(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** NewInt **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 1) + if (theNbArgs < 1) { - sout << "Donner la valeur entiere pour IntParam" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner la valeur entiere pour IntParam"; + return 1; } Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam; - if (argc >= 1) intpar->SetValue(atoi(arg1)); + if (theNbArgs >= 1) intpar->SetValue(atoi(arg1)); return pilot->RecordItem(intpar); } -static IFSelect_ReturnStatus fun15 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun15 +//purpose : +//======================================================================= +static Standard_Integer fun15(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; // **** SetInt **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "Donner 2 arguments : nom Parametre et Valeur" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner 2 arguments : nom Parametre et Valeur"; + return 1; } Standard_Integer val = atoi(arg2); DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1)); - if (!WS->SetIntValue(par, val)) return IFSelect_RetFail; - return IFSelect_RetDone; -} - -static IFSelect_ReturnStatus fun16 -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + if (!WS->SetIntValue(par, val)) + return 1; + 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 **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 1) + if (theNbArgs < 1) { - sout << "Donner la valeur texte pour TextParam" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner la valeur texte pour TextParam"; + return 1; } Handle(TCollection_HAsciiString) textpar = new TCollection_HAsciiString(); - if (argc >= 1) textpar->AssignCat(arg1); + if (theNbArgs >= 1) textpar->AssignCat(arg1); return pilot->RecordItem(textpar); } -static IFSelect_ReturnStatus fun17 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun17 +//purpose : +//======================================================================= +static Standard_Integer fun17(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; // **** SetText **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "Donner 2 arguments : nom Parametre et Valeur" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner 2 arguments : nom Parametre et Valeur"; + return 1; } DeclareAndCast(TCollection_HAsciiString, par, WS->NamedItem(arg1)); - if (!WS->SetTextValue(par, arg2)) return IFSelect_RetFail; - return IFSelect_RetDone; -} - -static IFSelect_ReturnStatus fun19 -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + if (!WS->SetTextValue(par, arg2)) + return 1; + return 0; +} + +//======================================================================= +//function : fun19 +//purpose : +//======================================================================= +static Standard_Integer fun19(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]; // **** DumpSel **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Give 1 argument : Selection Name" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Give 1 argument : Selection Name"; + return 1; } WS->DumpSelection(GetCasted(IFSelect_Selection, WS->NamedItem(arg1))); - return IFSelect_RetVoid; + return 0; } -static IFSelect_ReturnStatus fun20 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun20 +//purpose : +//======================================================================= +static Standard_Integer fun20(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; // **** EvalSel **** // **** GiveList **** // **** GiveShort GivePointed **** // **** MakeList **** - char mode = pilot->Arg(0)[0]; // givelist/makelist - if (mode == 'g') mode = pilot->Arg(0)[4]; // l list s short p pointed - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + char mode = theArgVec[0][0]; // givelist/makelist + if (mode == 'g') mode = theArgVec[0][4]; // l list s short p pointed + if (theNbArgs < 2) { - sout << "Give Entity ID, or Selection Name [+ optional other selection or entity]" << std::endl; return IFSelect_RetError; + 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 = pilot->Arg(1); + const Standard_CString arg1 = theArgVec[1]; Handle(Standard_Transient) item = WS->NamedItem(arg1); pnt = GetCasted(IFSelect_SelectPointed, item); if (!pnt.IsNull()) { - sout << arg1 << ":Already existing Selection for List, cleared then filled" << std::endl; + Message::SendInfo() << arg1 << ":Already existing Selection for List, cleared then filled"; pnt->Clear(); } else if (!item.IsNull()) { - sout << arg1 << ":Already existing Item not for a List, command ignored" << std::endl; - return IFSelect_RetFail; + Message::SendInfo() << arg1 << ":Already existing Item not for a List, command ignored"; + return 1; } else { @@ -871,94 +1012,111 @@ static IFSelect_ReturnStatus fun20 Handle(TColStd_HSequenceOfTransient) result = XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart((mode == 'm' ? 2 : 1))); - if (result.IsNull()) return IFSelect_RetError; + if (result.IsNull()) + return 1; Interface_EntityIterator iter(result); - sout << pilot->CommandPart((mode == 'm' ? 2 : 1)) << " : "; - if (mode == 'l') WS->ListEntities(iter, 0, sout); - else if (mode == 's' || mode == 'm') WS->ListEntities(iter, 2, sout); + 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') { - sout << iter.NbEntities() << " Entities : "; + Message::SendInfo() << iter.NbEntities() << " Entities : "; for (iter.Start(); iter.More(); iter.Next()) - sout << " +" << WS->StartingNumber(iter.Value()); - sout << std::endl; + Message::SendInfo() << " +" << WS->StartingNumber(iter.Value()); + Message::SendInfo(); } if (!pnt.IsNull()) { pnt->SetList(result); - sout << "List set to a SelectPointed : " << pilot->Arg(1) << std::endl; - sout << "Later editable by command setlist" << std::endl; + Message::SendInfo() << "List set to a SelectPointed : " << theArgVec[1]; + Message::SendInfo() << "Later editable by command setlist"; } - return IFSelect_RetVoid; + return 0; } -static IFSelect_ReturnStatus fun20c -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun20c +//purpose : +//======================================================================= +static Standard_Integer fun20c(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; // **** GiveCount **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Give Entity ID, or Selection Name [+ optional other selection or entity]" << std::endl; return IFSelect_RetError; + 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 IFSelect_RetError; - sout << pilot->CommandPart(1) << " : List of " << result->Length() << " Entities" << std::endl; - return IFSelect_RetVoid; + if (result.IsNull()) + return 1; + Message::SendInfo() << pilot->CommandPart(1) << " : List of " << result->Length() << " Entities"; + return 0; } -static IFSelect_ReturnStatus funselsuite -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : funselsuite +//purpose : +//======================================================================= +static Standard_Integer funselsuite(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; // **** SelSuite **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Give Entity ID, or Selection Name [+ optional other selection or entity]" << std::endl; return IFSelect_RetError; + 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 < argc; i++) + for (Standard_Integer i = 1; i < theNbArgs; i++) { - Handle(IFSelect_Selection) sel = WS->GiveSelection(pilot->Arg(i)); + Handle(IFSelect_Selection) sel = WS->GiveSelection(theArgVec[i]); if (!selsuite->AddInput(sel)) { - sout << pilot->Arg(i - 1) << " : not a SelectDeduct, no more can be added. Abandon" << std::endl; - return IFSelect_RetError; + 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); } - -static IFSelect_ReturnStatus fun21 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun21 +//purpose : +//======================================================================= +static Standard_Integer fun21(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** ClearItems **** WS->ClearItems(); WS->ClearFinalModifiers(); WS->ClearShareOut(Standard_False); - return IFSelect_RetDone; + return 0; } -static IFSelect_ReturnStatus fun22 -(const Handle(IFSelect_SessionPilot)& pilot) +static Standard_Integer fun22(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** ClearData **** Standard_Integer mode = -1; - if (argc >= 2) + if (theNbArgs >= 2) { if (arg1[0] == 'a') mode = 1; if (arg1[0] == 'g') mode = 2; @@ -967,109 +1125,128 @@ static IFSelect_ReturnStatus fun22 if (arg1[0] == '?') mode = -1; } else mode = 0; - Message_Messenger::StreamBuffer sout = Message::SendInfo(); if (mode <= 0) { - if (mode < 0) sout << "Give a suitable mode"; - sout << " Available Modes :\n" - << " a : all data g : graph+check c : check p : selectpointed" << std::endl; + if (mode < 0) Message::SendInfo() << "Give a suitable mode"; + Message::SendInfo() << " Available Modes :\n" + << " a : all data g : graph+check c : check p : selectpointed"; return (mode < 0 ? IFSelect_RetError : IFSelect_RetVoid); } WS->ClearData(mode); - return IFSelect_RetDone; + return 0; } -static IFSelect_ReturnStatus fun24 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun24 +//purpose : +//======================================================================= +static Standard_Integer fun24(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; // **** Item Label **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); TCollection_AsciiString label; - if (argc < 2) + if (theNbArgs < 2) { - sout << " Give label to search" << std::endl; return IFSelect_RetError; + Message::SendInfo() << " Give label to search"; + return 1; } - for (int i = 1; i < argc; i++) + for (int i = 1; i < theNbArgs; i++) { - label.AssignCat(pilot->Arg(i)); - if (i < argc - 1) label.AssignCat(" "); + label.AssignCat(theArgVec[i]); + if (i < theNbArgs - 1) label.AssignCat(" "); } for (int mode = 0; mode <= 2; mode++) { int nbitems = 0; int id; - sout << "Searching label : " << label << ". in mode "; - if (mode == 0) sout << " exact" << std::endl; - if (mode == 1) sout << " same head" << std::endl; - if (mode == 2) sout << " search if present" << std::endl; + 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"; for (id = WS->NextIdentForLabel(label.ToCString(), 0, mode); id != 0; id = WS->NextIdentForLabel(label.ToCString(), id, mode)) { - sout << " " << id; nbitems++; + Message::SendInfo() << " " << id; nbitems++; } - sout << " -- giving " << nbitems << " found" << std::endl; + Message::SendInfo() << " -- giving " << nbitems << " found"; } - return IFSelect_RetVoid; + return 0; } -static IFSelect_ReturnStatus fun25 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun25 +//purpose : +//======================================================================= +static Standard_Integer fun25(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Save (Dump) **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner nom du Fichier" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner nom du Fichier"; + return 1; } IFSelect_SessionFile dumper(WS, arg1); - if (!dumper.IsDone()) return IFSelect_RetFail; - return IFSelect_RetDone; -} - -static IFSelect_ReturnStatus fun26 -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + if (!dumper.IsDone()) + return 1; + return 0; +} + +//======================================================================= +//function : fun26 +//purpose : +//======================================================================= +static Standard_Integer fun26(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]; // **** Restore (Dump) **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner nom du Fichier" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner nom du Fichier"; + return 1; } IFSelect_SessionFile dumper(WS); Standard_Integer readstat = dumper.Read(arg1); - if (readstat == 0) return IFSelect_RetDone; - else if (readstat > 0) sout << "-- Erreur Lecture Fichier " << arg1 << std::endl; - else sout << "-- Pas pu ouvrir Fichier " << arg1 << std::endl; - return IFSelect_RetDone; -} - -static IFSelect_ReturnStatus fun27 -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Standard_Integer argc = pilot->NbWords(); - Handle(IFSelect_WorkSession) WS = pilot->Session(); - const Standard_CString arg1 = pilot->Arg(1); - Standard_CString arg2 = pilot->Arg(2); + if (readstat == 0) return 0; + else if (readstat > 0) Message::SendInfo() << "-- Erreur Lecture Fichier " << arg1; + else Message::SendInfo() << "-- Pas pu ouvrir Fichier " << arg1; + return 0; +} + +//======================================================================= +//function : fun27 +//purpose : +//======================================================================= +static Standard_Integer fun27(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) +{ + Standard_Integer theNbArgs = theNbArgs; + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + const Standard_CString arg1 = theArgVec[1]; + Standard_CString arg2 = theArgVec[2]; const Standard_CString anEmptyStr = ""; if (arg2 && strlen(arg2) == 2 && arg2[0] == '"' && arg2[1] == '"') { arg2 = anEmptyStr; } // **** Param(Value) **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2 || (argc == 3 && strcmp(arg1, "-p") == 0)) + if (theNbArgs < 2 || (theNbArgs == 3 && strcmp(arg1, "-p") == 0)) { Handle(TColStd_HSequenceOfHAsciiString) li = Interface_Static::Items(); Standard_Integer i, nb = li->Length(), aPatternNb = 0; size_t aPatternLen = strlen(arg2); - if (argc == 3) + if (theNbArgs == 3) { for (i = 1; i <= nb; i++) { @@ -1083,17 +1260,17 @@ static IFSelect_ReturnStatus fun27 { aPatternNb = nb; } - sout << " List of parameters : " << aPatternNb << " items : " << std::endl; + Message::SendInfo() << " List of parameters : " << aPatternNb << " items : "; for (i = 1; i <= nb; i++) { - if (argc == 3 && strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) != 0) + if (theNbArgs == 3 && strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) != 0) { continue; } - sout << li->Value(i)->String(); - sout << " : " << Interface_Static::CVal(li->Value(i)->ToCString()) << std::endl; + Message::SendInfo() << li->Value(i)->String(); + Message::SendInfo() << " : " << Interface_Static::CVal(li->Value(i)->ToCString()); } - return IFSelect_RetVoid; + return 0; } else if (atoi(arg1) > 0) { @@ -1102,152 +1279,182 @@ static IFSelect_ReturnStatus fun27 } else { - if (argc > 2) sout << " FORMER STATUS of Static Parameter " << arg1 << std::endl; - else sout << " ACTUAL STATUS of Static Parameter " << arg1 << std::endl; + if (theNbArgs > 2) Message::SendInfo() << " FORMER STATUS of Static Parameter " << arg1; + else Message::SendInfo() << " ACTUAL STATUS of Static Parameter " << arg1; if (!Interface_Static::IsPresent(arg1)) { - sout << " Parameter " << arg1 << " undefined" << std::endl; return IFSelect_RetError; + Message::SendInfo() << " Parameter " << arg1 << " undefined"; + return 1; } - if (!Interface_Static::IsSet(arg1)) sout << " Parameter " << arg1 << " not valued" << std::endl; - else if (argc == 2) Interface_Static::Static(arg1)->Print(sout); - else sout << " Value : " << Interface_Static::CVal(arg1) << std::endl; + 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 (argc == 2) sout << "To modify, param name_param new_val" << std::endl; + if (theNbArgs == 2) Message::SendInfo() << "To modify, param name_param new_val"; else { if (strlen(arg2) != 0) { - sout << " New demanded value : " << arg2; + Message::SendInfo() << " New demanded value : " << arg2; } else { - sout << " New demanded value : not valued"; + Message::SendInfo() << " New demanded value : not valued"; } if (Interface_Static::SetCVal(arg1, arg2)) { - sout << " OK" << std::endl; return IFSelect_RetDone; + Message::SendInfo() << " OK"; + return 0; } else { - sout << " , refused" << std::endl; return IFSelect_RetError; + Message::SendInfo() << " , refused"; + return 1; } } } - return IFSelect_RetVoid; + return 0; } -static IFSelect_ReturnStatus fun29 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun29 +//purpose : +//======================================================================= +static Standard_Integer fun29(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** SentFiles **** Handle(TColStd_HSequenceOfHAsciiString) list = WS->SentFiles(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); if (list.IsNull()) { - sout << "List of Sent Files not enabled" << std::endl; return IFSelect_RetVoid; + Message::SendInfo() << "List of Sent Files not enabled"; return 0; } Standard_Integer i, nb = list->Length(); - sout << " Sent Files : " << nb << " : " << std::endl; + Message::SendInfo() << " Sent Files : " << nb << " : "; for (i = 1; i <= nb; i++) - sout << list->Value(i)->ToCString() << std::endl; - return IFSelect_RetVoid; + Message::SendInfo() << list->Value(i)->ToCString(); + return 0; } -static IFSelect_ReturnStatus fun30 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun30 +//purpose : +//======================================================================= +static Standard_Integer fun30(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** FilePrefix **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - if (WS->FilePrefix().IsNull()) sout << "Pas de prefixe defini" << std::endl; - else sout << "Prefixe : " << WS->FilePrefix()->ToCString() << std::endl; - sout << "Pour changer : filepref newprefix" << std::endl; - return IFSelect_RetVoid; + if (WS->FilePrefix().IsNull()) Message::SendInfo() << "Pas de prefixe defini"; + else Message::SendInfo() << "Prefixe : " << WS->FilePrefix()->ToCString(); + Message::SendInfo() << "Pour changer : filepref newprefix"; + return 0; } WS->SetFilePrefix(arg1); - return IFSelect_RetDone; + return 0; } -static IFSelect_ReturnStatus fun31 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun31 +//purpose : +//======================================================================= +static Standard_Integer fun31(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** FileExtension **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - if (WS->FileExtension().IsNull()) sout << "Pas d extension definie" << std::endl; - else sout << "Extension : " << WS->FileExtension()->ToCString() << std::endl; - sout << "Pour changer : fileext newext" << std::endl; - return IFSelect_RetVoid; + if (WS->FileExtension().IsNull()) Message::SendInfo() << "Pas d extension definie"; + else Message::SendInfo() << "Extension : " << WS->FileExtension()->ToCString(); + Message::SendInfo() << "Pour changer : fileext newext"; + return 0; } WS->SetFileExtension(arg1); - return IFSelect_RetDone; + return 0; } -static IFSelect_ReturnStatus fun32 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun32 +//purpose : +//======================================================================= +static Standard_Integer fun32(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; // **** FileRoot **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner Dispatch et nom de Root" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner Dispatch et nom de Root"; + return 1; } DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1)); - if (argc < 3) + if (theNbArgs < 3) { - if (WS->FileRoot(disp).IsNull()) sout << "Pas de racine definie pour " << arg1 << std::endl; - else sout << "Racine pour " << arg1 << " : " << WS->FileRoot(disp)->ToCString() << std::endl; - sout << "Pour changer : fileroot nomdisp newroot" << std::endl; - return IFSelect_RetVoid; + 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"; + return 0; } - if (!WS->SetFileRoot(disp, arg2)) return IFSelect_RetFail; - return IFSelect_RetDone; + if (!WS->SetFileRoot(disp, arg2)) + return 1; + return 0; } -static IFSelect_ReturnStatus fun33 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun33 +//purpose : +//======================================================================= +static Standard_Integer fun33(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Default File Root **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - if (WS->DefaultFileRoot().IsNull()) sout << "Pas de racine par defaut definie" << std::endl; - else sout << "Racine par defaut : " << WS->DefaultFileRoot()->ToCString() << std::endl; - sout << "Pour changer : filedef newdef" << std::endl; - return IFSelect_RetVoid; + 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"; + return 0; } WS->SetDefaultFileRoot(arg1); - return IFSelect_RetDone; + return 0; } -static IFSelect_ReturnStatus fun34 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun34 +//purpose : +//======================================================================= +static Standard_Integer fun34(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** EvalFile **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); if (!WS->HasModel()) { - sout << "Pas de Modele charge, abandon" << std::endl; return IFSelect_RetFail; + Message::SendInfo() << "Pas de Modele charge, abandon"; + return 1; } - sout << "Evaluation avec Memorisation des resultats" << std::endl; + Message::SendInfo() << "Evaluation avec Memorisation des resultats"; WS->EvaluateFile(); Standard_Integer nbf = WS->NbFiles(); for (Standard_Integer i = 1; i <= nbf; i++) @@ -1255,41 +1462,51 @@ static IFSelect_ReturnStatus fun34 Handle(Interface_InterfaceModel) mod = WS->FileModel(i); if (mod.IsNull()) { - sout << "Modele " << i << " Model non genere ..." << std::endl; continue; + Message::SendInfo() << "Modele " << i << " Model non genere ..."; continue; } TCollection_AsciiString name = WS->FileName(i); - sout << "Fichier n0 " << i << " Nb Entites : " << mod->NbEntities() << " Nom: "; - sout << name << std::endl; + Message::SendInfo() << "Fichier n0 " << i << " Nb Entites : " << mod->NbEntities() << " Nom: "; + Message::SendInfo() << name; } - return IFSelect_RetDone; + return 0; } -static IFSelect_ReturnStatus fun35 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun35 +//purpose : +//======================================================================= +static Standard_Integer fun35(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** ClearFile **** - WS->ClearFile(); return IFSelect_RetDone; + WS->ClearFile(); + return 0; } -static IFSelect_ReturnStatus fun36 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun36 +//purpose : +//======================================================================= +static Standard_Integer fun36(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; // **** Split **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); IFSelect_ReturnStatus stat = IFSelect_RetVoid; - if (argc < 2) sout << "Split : derniere liste de dispatches definie" << std::endl; + if (theNbArgs < 2) Message::SendInfo() << "Split : derniere liste de dispatches definie"; else { WS->ClearShareOut(Standard_True); - for (Standard_Integer i = 1; i < argc; i++) + for (Standard_Integer i = 1; i < theNbArgs; i++) { - DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(pilot->Arg(i))); + DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i])); if (disp.IsNull()) { - sout << "Pas un dispatch:" << pilot->Arg(i) << ", Splitt abandonne" << std::endl; + Message::SendInfo() << "Pas un dispatch:" << theArgVec[i] << ", Splitt abandonne"; stat = IFSelect_RetError; } else WS->SetActive(disp, Standard_True); @@ -1297,138 +1514,166 @@ static IFSelect_ReturnStatus fun36 } if (stat == IFSelect_RetError) return stat; WS->BeginSentFiles(Standard_True); - if (!WS->SendSplit()) return IFSelect_RetFail; - return IFSelect_RetDone; -} - -static IFSelect_ReturnStatus fun37 -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + if (!WS->SendSplit()) + return 1; + return 0; +} + +//======================================================================= +//function : fun37 +//purpose : +//======================================================================= +static Standard_Integer fun37(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]; // **** Remaining Data **** char mode = '?'; IFSelect_RemainMode numod = IFSelect_RemainDisplay; - if (argc >= 2) mode = arg1[0]; + if (theNbArgs >= 2) mode = arg1[0]; if (mode == 'u') numod = IFSelect_RemainUndo; else if (mode == 'l') numod = IFSelect_RemainDisplay; else if (mode == 'c') numod = IFSelect_RemainCompute; else if (mode == 'f') numod = IFSelect_RemainForget; else { - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) sout << "Donner un Mode - "; - sout << "Modes possibles : l list, c compute, u undo, f forget" << std::endl; - if (mode == '?') return IFSelect_RetDone; else return IFSelect_RetError; + 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 (!WS->SetRemaining(numod)) return IFSelect_RetVoid; - return IFSelect_RetDone; + if (!WS->SetRemaining(numod)) return 0; + return 0; } -static IFSelect_ReturnStatus fun38 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun38 +//purpose : +//======================================================================= +static Standard_Integer fun38(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; // **** SetModelContent **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "Donner nom selection et mode (k=keep,r=remove)" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner nom selection et mode (k=keep,r=remove)"; + return 1; } Standard_Boolean keepmode; DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); if (sel.IsNull()) { - sout << "Pas de Selection de Nom : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Pas de Selection de Nom : " << arg1; + return 1; } if (arg2[0] == 'k') { - sout << " -- SetContent keep ..."; keepmode = Standard_True; + Message::SendInfo() << " -- SetContent keep ..."; keepmode = Standard_True; } else if (arg2[0] == 'r') { - sout << " -- SetContent remove ..."; keepmode = Standard_False; + Message::SendInfo() << " -- SetContent remove ..."; keepmode = Standard_False; } else { - sout << "Donner nom selection et mode (k=keep,r=remove)" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner nom selection et mode (k=keep,r=remove)"; + return 1; } - if (WS->SetModelContent(sel, keepmode)) sout << " Done" << std::endl; - else sout << " Result empty, ignored" << std::endl; - return IFSelect_RetDone; + if (WS->SetModelContent(sel, keepmode)) Message::SendInfo() << " Done"; + else Message::SendInfo() << " Result empty, ignored"; + return 0; } -static IFSelect_ReturnStatus fun40 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun40 +//purpose : +//======================================================================= +static Standard_Integer fun40(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** ListModif **** WS->ListFinalModifiers(Standard_True); - WS->ListFinalModifiers(Standard_False); return IFSelect_RetVoid; + WS->ListFinalModifiers(Standard_False); return 0; } -static IFSelect_ReturnStatus fun41 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun41 +//purpose : +//======================================================================= +static Standard_Integer fun41(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Modifier **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner Nom du Modifier" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner Nom du Modifier"; + return 1; } DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1)); if (modif.IsNull()) { - sout << "Pas de Modifier de Nom : " << arg1 << std::endl; return IFSelect_RetVoid; + Message::SendInfo() << "Pas de Modifier de Nom : " << arg1; return 0; } Handle(IFSelect_IntParam) low, up; Handle(IFSelect_Dispatch) disp = modif->Dispatch(); - sout << "Modifier : " << arg1 << " Label : " << modif->Label() << std::endl; + Message::SendInfo() << "Modifier : " << arg1 << " Label : " << modif->Label(); Standard_Integer rank = WS->ModifierRank(modif); if (modif->IsKind(STANDARD_TYPE(IFSelect_Modifier))) - sout << "Model Modifier n0." << rank; - else sout << "File Modifier n0." << rank; - if (disp.IsNull()) sout << " Applique a tous les Dispatchs" << std::endl; + Message::SendInfo() << "Model Modifier n0." << rank; + else Message::SendInfo() << "File Modifier n0." << rank; + if (disp.IsNull()) Message::SendInfo() << " Applique a tous les Dispatchs"; else { - sout << " Dispatch : " << disp->Label(); - if (WS->HasName(disp)) sout << " - Nom:" << WS->Name(disp)->ToCString(); - sout << std::endl; + Message::SendInfo() << " Dispatch : " << disp->Label(); + if (WS->HasName(disp)) Message::SendInfo() << " - Nom:" << WS->Name(disp)->ToCString(); + Message::SendInfo(); } Handle(IFSelect_Selection) sel = modif->Selection(); - if (!sel.IsNull()) sout << " Selection : " << sel->Label(); - if (WS->HasName(sel)) sout << " - Nom:" << WS->Name(sel)->ToCString(); - sout << std::endl; - return IFSelect_RetVoid; -} - -static IFSelect_ReturnStatus fun42 -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + if (!sel.IsNull()) Message::SendInfo() << " Selection : " << sel->Label(); + if (WS->HasName(sel)) Message::SendInfo() << " - Nom:" << WS->Name(sel)->ToCString(); + Message::SendInfo(); + return 0; +} + +//======================================================================= +//function : fun42 +//purpose : +//======================================================================= +static Standard_Integer fun42(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]; // **** ModifSel **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner Nom Modifier; + Nom Selection optionnel\n" - << "Selection pour Mettre une Selection, sinon Annule" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "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()) { - sout << "Pas un nom de Modifier : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Pas un nom de Modifier : " << arg1; + return 1; } Handle(IFSelect_Selection) sel; if (arg2[0] != '\0') @@ -1436,33 +1681,40 @@ static IFSelect_ReturnStatus fun42 sel = GetCasted(IFSelect_Selection, WS->NamedItem(arg2)); if (sel.IsNull()) { - sout << "Pas un nom de Selection : " << arg2 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Pas un nom de Selection : " << arg2; + return 1; } } - if (!WS->SetItemSelection(modif, sel)) return IFSelect_RetFail; - return IFSelect_RetDone; + if (!WS->SetItemSelection(modif, sel)) + return 1; + return 0; } -static IFSelect_ReturnStatus fun43 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun43 +//purpose : +//======================================================================= +static Standard_Integer fun43(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; // **** SetAppliedModifier **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner Nom Modifier; + Nom Dispatch ou Transformer optionnel :\n" + Message::SendInfo() << "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" << std::endl; - return IFSelect_RetError; + << " - Transformer : pas un Dispatch mais un Transformer"; + return 1; } DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1)); if (modif.IsNull()) { - sout << "Pas un nom de Modifier : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Pas un nom de Modifier : " << arg1; + return 1; } Handle(Standard_Transient) item; if (arg2[0] != '\0') @@ -1470,300 +1722,371 @@ static IFSelect_ReturnStatus fun43 item = WS->NamedItem(arg2); if (item.IsNull()) { - sout << "Pas un nom connu : " << arg2 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Pas un nom connu : " << arg2; + return 1; } } else item = WS->ShareOut(); - if (!WS->SetAppliedModifier(modif, item)) return IFSelect_RetFail; - return IFSelect_RetDone; -} - -static IFSelect_ReturnStatus fun44 -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + if (!WS->SetAppliedModifier(modif, item)) + return 1; + return 0; +} + +//======================================================================= +//function : fun44 +//purpose : +//======================================================================= +static Standard_Integer fun44(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]; // **** ResetApplied (modifier) **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Designer un modifier" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Designer un modifier"; + return 1; } DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1)); if (modif.IsNull()) { - sout << "Pas un nom de Modifier : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Pas un nom de Modifier : " << arg1; + return 1; } - if (!WS->ResetAppliedModifier(modif)) return IFSelect_RetFail; - return IFSelect_RetDone; + if (!WS->ResetAppliedModifier(modif)) + return 1; + return 0; } -static IFSelect_ReturnStatus fun45 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun45 +//purpose : +//======================================================================= +static Standard_Integer fun45(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - 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); + 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 **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 4) + if (theNbArgs < 4) { - sout << "modifmove MF rang1 rang2, M pour Model F pour File" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "modifmove MF rang1 rang2, M pour Model F pour File"; + return 1; } Standard_Boolean formodel; if (arg1[0] == 'm' || arg1[0] == 'M') formodel = Standard_True; else if (arg1[0] == 'f' || arg1[0] == 'F') formodel = Standard_False; else { - sout << "preciser M pour Model, F pour File" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "preciser M pour Model, F pour File"; + return 1; } Standard_Integer before = atoi(arg2); Standard_Integer after = atoi(arg3); if (before == 0 || after == 0) { - sout << "Donner 2 Entiers Positifs" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner 2 Entiers Positifs"; + return 1; } - if (!WS->ChangeModifierRank(formodel, before, after)) return IFSelect_RetFail; - return IFSelect_RetDone; + if (!WS->ChangeModifierRank(formodel, before, after)) + return 1; + return 0; } -static IFSelect_ReturnStatus fun51 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun51 +//purpose : +//======================================================================= +static Standard_Integer fun51(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; // **** DispSel **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "Donner Noms Dispatch et Selection Finale" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner Noms Dispatch et Selection Finale"; + return 1; } DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1)); if (disp.IsNull()) { - sout << "Pas un nom de Dispatch : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Pas un nom de Dispatch : " << arg1; + return 1; } DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg2)); if (sel.IsNull()) { - sout << "Pas un nom de Selection : " << arg2 << std::endl; return IFSelect_RetError; - } - if (!WS->SetItemSelection(disp, sel)) return IFSelect_RetFail; - return IFSelect_RetDone; -} - -static IFSelect_ReturnStatus fun_dispone -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - // **** DispOne **** - Handle(IFSelect_DispPerOne) disp = new IFSelect_DispPerOne; - return pilot->RecordItem(disp); -} - -static IFSelect_ReturnStatus fun_dispglob -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - // **** DispGlob **** - Handle(IFSelect_DispGlobal) disp = new IFSelect_DispGlobal; - return pilot->RecordItem(disp); -} - -static IFSelect_ReturnStatus fun_dispcount -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Message::SendInfo() << "Pas un nom de Selection : " << arg2; + return 1; + } + if (!WS->SetItemSelection(disp, sel)) + return 1; + 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 +//purpose : +//======================================================================= +static Standard_Integer fun_dispcount(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]; // **** DispCount **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner Nom IntParam pour Count" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner Nom IntParam pour Count"; + return 1; } DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1)); if (par.IsNull()) { - sout << "Pas un nom de IntParam : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Pas un nom de IntParam : " << arg1; + return 1; } Handle(IFSelect_DispPerCount) disp = new IFSelect_DispPerCount; disp->SetCount(par); return pilot->RecordItem(disp); } -static IFSelect_ReturnStatus fun_dispfiles -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun_dispfiles +//purpose : +//======================================================================= +static Standard_Integer fun_dispfiles(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** DispFiles **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner Nom IntParam pour NbFiles" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner Nom IntParam pour NbFiles"; + return 1; } DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1)); if (par.IsNull()) { - sout << "Pas un nom de IntParam : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Pas un nom de IntParam : " << arg1; + return 1; } Handle(IFSelect_DispPerFiles) disp = new IFSelect_DispPerFiles; disp->SetCount(par); return pilot->RecordItem(disp); } - -static IFSelect_ReturnStatus fun_dispsign -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun_dispsign +//purpose : +//======================================================================= +static Standard_Integer fun_dispsign(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** DispFiles **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner Nom Signature" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner Nom Signature"; + return 1; } DeclareAndCast(IFSelect_Signature, sig, WS->NamedItem(arg1)); if (sig.IsNull()) { - sout << "Pas un nom de Signature : " << arg1 << std::endl; return IFSelect_RetError; + 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); } - -static IFSelect_ReturnStatus fun56 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun56 +//purpose : +//======================================================================= +static Standard_Integer fun56(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Dispatch **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner Nom du Dispatch" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner Nom du Dispatch"; + return 1; } DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1)); if (disp.IsNull()) { - sout << "Pas un dispatch : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Pas un dispatch : " << arg1; + return 1; } Standard_Integer num = WS->DispatchRank(disp); - sout << "Dispatch de Nom : " << arg1 << " , en ShareOut, Numero " << num << " : "; + 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()) sout << "Pas de Selection Finale" << std::endl; - else if (selname.IsNull()) sout << "Selection Finale : #" << WS->ItemIdent(sel) << std::endl; - else sout << "Selection Finale : " << selname->ToCString() << std::endl; - if (disp->HasRootName()) sout << "-- Racine nom de fichier : " - << disp->RootName()->ToCString() << std::endl; - return IFSelect_RetVoid; -} - -static IFSelect_ReturnStatus fun57 -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + 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 **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Give Name to Remove !" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Give Name to Remove !"; + return 1; } - if (!WS->RemoveNamedItem(arg1)) return IFSelect_RetFail; - return IFSelect_RetDone; + if (!WS->RemoveNamedItem(arg1)) + return 1; + return 0; } -static IFSelect_ReturnStatus fun58 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun58 +//purpose : +//======================================================================= +static Standard_Integer fun58(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** EvalDisp **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "evaldisp mode disp [disp ...] : Mode + Name(s) of Dispatch(es). Mode:\n" - << " 0 brief 1 +forgotten ents 2 +duplicata 3 1+2" << std::endl - << "See also : evaladisp writedisp xsplit" << std::endl; - return IFSelect_RetVoid; + Message::SendInfo() << "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); sout << " Mode " << mode << "\n"; - for (i = 2; i < argc; i++) + Standard_Integer i, mode = atoi(arg1); Message::SendInfo() << " Mode " << mode << "\n"; + for (i = 2; i < theNbArgs; i++) { - DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(pilot->Arg(i))); + DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i])); if (disp.IsNull()) { - sout << "Not a dispatch:" << pilot->Arg(i) << std::endl; OK = Standard_False; + Message::SendInfo() << "Not a dispatch:" << theArgVec[i]; OK = Standard_False; } } if (!OK) { - sout << "Some of the parameters are not correct" << std::endl; - return IFSelect_RetError; + Message::SendInfo() << "Some of the parameters are not correct"; + return 1; } WS->ClearShareOut(Standard_True); - for (i = 2; i < argc; i++) + for (i = 2; i < theNbArgs; i++) { - DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(pilot->Arg(i))); + DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i])); WS->SetActive(disp, Standard_True); } // WS->EvaluateDispatch(disp,mode); WS->EvaluateComplete(mode); - return IFSelect_RetVoid; + return 0; } - -static IFSelect_ReturnStatus fun_evaladisp -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun_evaladisp +//purpose : +//======================================================================= +static Standard_Integer fun_evaladisp(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** EvalADisp [GiveList] **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "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" << std::endl - << "See also : writedisp" << std::endl; - return IFSelect_RetVoid; + 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') { - sout << "first parameter : mode, must be a number between 0 and 3" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "first parameter : mode, must be a number between 0 and 3"; + return 1; } - Standard_Integer mode = atoi(arg1); sout << " Mode " << mode << "\n"; - // DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(2))); - Handle(IFSelect_Dispatch) disp = XSDRAW_FunctionsSession::GiveDispatch(WS, pilot->Arg(2), Standard_True); + 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()) { - sout << "Not a dispatch:" << pilot->Arg(2) << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Not a dispatch:" << theArgVec[2]; + return 1; } Handle(IFSelect_Selection) selsav = disp->FinalSelection(); Handle(IFSelect_Selection) sel; - if (argc > 3) + if (theNbArgs > 3) { Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; Handle(TColStd_HSequenceOfTransient) list = XSDRAW_FunctionsSession::GiveList - (pilot->Session(), pilot->CommandPart(3)); + (XSDRAWBase::Session(), pilot->CommandPart(3)); Standard_Integer nb = (list.IsNull() ? 0 : list->Length()); if (nb > 0) { @@ -1773,11 +2096,12 @@ static IFSelect_ReturnStatus fun_evaladisp if (sel.IsNull() && selsav.IsNull()) { - sout << "No Selection nor GiveList defined" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "No Selection nor GiveList defined"; + return 1; } if (sel.IsNull() && !selsav.IsNull()) { - if (argc > 3) sout << "GiveList is empty, hence computed from the Selection of the Dispatch" << std::endl; + if (theNbArgs > 3) Message::SendInfo() << "GiveList is empty, hence computed from the Selection of the Dispatch"; sel = selsav; } disp->SetFinalSelection(sel); @@ -1786,46 +2110,51 @@ static IFSelect_ReturnStatus fun_evaladisp WS->EvaluateDispatch(disp, mode); disp->SetFinalSelection(selsav); - return IFSelect_RetVoid; + return 0; } -static IFSelect_ReturnStatus fun_writedisp -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun_writedisp +//purpose : +//======================================================================= +static Standard_Integer fun_writedisp(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** EvalADisp [GiveList] **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "writedisp filename disp [givelist] : FileName + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch.\n" + 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" << std::endl; - return IFSelect_RetVoid; + << "See also : evaladisp"; + return 0; } TCollection_AsciiString prefix, rootname, suffix; SplitFileName(arg1, prefix, rootname, suffix); if (rootname.Length() == 0 || suffix.Length() == 0) { - sout << "Empty Root Name or Extension" << std::endl; - return IFSelect_RetError; + Message::SendInfo() << "Empty Root Name or Extension"; + return 1; } - // DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(2))); - Handle(IFSelect_Dispatch) disp = XSDRAW_FunctionsSession::GiveDispatch(WS, pilot->Arg(2), Standard_True); + // DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(theArgVec[2])); + Handle(IFSelect_Dispatch) disp = XSDRAW_FunctionsSession::GiveDispatch(WS, theArgVec[2], Standard_True); if (disp.IsNull()) { - sout << "Not a dispatch:" << pilot->Arg(2) << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Not a dispatch:" << theArgVec[2]; + return 1; } Handle(IFSelect_Selection) selsav = disp->FinalSelection(); Handle(IFSelect_Selection) sel; - if (argc > 3) + if (theNbArgs > 3) { Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; Handle(TColStd_HSequenceOfTransient) list = XSDRAW_FunctionsSession::GiveList - (pilot->Session(), pilot->CommandPart(3)); + (XSDRAWBase::Session(), pilot->CommandPart(3)); Standard_Integer nb = (list.IsNull() ? 0 : list->Length()); if (nb > 0) { @@ -1835,11 +2164,12 @@ static IFSelect_ReturnStatus fun_writedisp if (sel.IsNull() && selsav.IsNull()) { - sout << "No Selection nor GiveList defined" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "No Selection nor GiveList defined"; + return 1; } if (sel.IsNull() && !selsav.IsNull()) { - if (argc > 3) sout << "GiveList is empty, hence computed from the Selection of the Dispatch" << std::endl; + if (theNbArgs > 3) Message::SendInfo() << "GiveList is empty, hence computed from the Selection of the Dispatch"; sel = selsav; } @@ -1857,96 +2187,123 @@ static IFSelect_ReturnStatus fun_writedisp return (OK ? IFSelect_RetDone : IFSelect_RetFail); } - -static IFSelect_ReturnStatus fun59 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun59 +//purpose : +//======================================================================= +static Standard_Integer fun59(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** EvalComplete **** Standard_Integer mode = 0; - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) sout << " -- mode par defaut 0\n"; + if (theNbArgs < 2) Message::SendInfo() << " -- mode par defaut 0\n"; else { - mode = atoi(arg1); sout << " -- mode : " << mode << std::endl; + mode = atoi(arg1); Message::SendInfo() << " -- mode : " << mode; } - WS->EvaluateComplete(mode); return IFSelect_RetVoid; + WS->EvaluateComplete(mode); return 0; } -static IFSelect_ReturnStatus fun60 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun60 +//purpose : +//======================================================================= +static Standard_Integer fun60(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + 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); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - counter->PrintCount(sout); - return IFSelect_RetVoid; + counter->PrintCount(Message::SendInfo()); + return 0; } -static IFSelect_ReturnStatus fun61 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun61 +//purpose : +//======================================================================= +static Standard_Integer fun61(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** RunTransformer **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner Nom de Transformer" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner Nom de Transformer"; + return 1; } DeclareAndCast(IFSelect_Transformer, tsf, WS->NamedItem(arg1)); Standard_Integer effect = WS->RunTransformer(tsf); switch (effect) { - case -4: sout << "Edition sur place, nouveau Protocole, erreur recalcul graphe" << std::endl; break; - case -3: sout << "Erreur, Transformation ignoree" << std::endl; break; - case -2: sout << "Erreur sur edition sur place, risque de corruption (verifier)" << std::endl; break; - case -1: sout << "Erreur sur edition locale, risque de corruption (verifier)" << std::endl; break; + 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 (tsf.IsNull()) sout << "Erreur, pas un Transformer: " << arg1 << std::endl; - else sout << "Execution non faite" << std::endl; + if (tsf.IsNull()) Message::SendInfo() << "Erreur, pas un Transformer: " << arg1; + else Message::SendInfo() << "Execution non faite"; break; - case 1: sout << "Transformation locale (graphe non touche)" << std::endl; break; - case 2: sout << "Edition sur place (graphe recalcule)" << std::endl; break; - case 3: sout << "Modele reconstruit" << std::endl; break; - case 4: sout << "Edition sur place, nouveau Protocole" << std::endl; break; - case 5: sout << "Nouveau Modele avec nouveau Protocole" << std::endl; 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); } -static IFSelect_ReturnStatus fun62 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun62 +//purpose : +//======================================================================= +static Standard_Integer fun62(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** TransformStandard Copy **** return pilot->RecordItem(WS->NewTransformStandard(Standard_True)); } -static IFSelect_ReturnStatus fun63 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun63 +//purpose : +//======================================================================= +static Standard_Integer fun63(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** TransformStandard OntheSpot **** return pilot->RecordItem(WS->NewTransformStandard(Standard_False)); } -static IFSelect_ReturnStatus fun6465 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun6465 +//purpose : +//======================================================================= +static Standard_Integer fun6465(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + 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 = (pilot->Arg(0)[3] == 'c'); + 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) @@ -1957,15 +2314,16 @@ static IFSelect_ReturnStatus fun6465 pilot->Perform(); modif = GetCasted(IFSelect_Modifier, pilot->RecordedItem()); } - Message_Messenger::StreamBuffer sout = Message::SendInfo(); + Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo(); if (modif.IsNull()) { - sout << "Pas un nom de Modifier : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Pas un nom de Modifier : " << arg1; + return 1; } Handle(TColStd_HSequenceOfTransient) list; Handle(IFSelect_SelectPointed) sp; - if (argc > 2) + if (theNbArgs > 2) { list = XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart(2)); sp = new IFSelect_SelectPointed; @@ -1974,116 +2332,142 @@ static IFSelect_ReturnStatus fun6465 Standard_Integer effect = 0; effect = WS->RunModifierSelected(modif, sp, runcopy); - // sout<<"Modifier applique sur TransformStandard #"<ItemIdent(tsf)<ItemIdent(tsf)< 0) ? IFSelect_RetDone : IFSelect_RetFail); } -static IFSelect_ReturnStatus fun66 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun66 +//purpose : +//======================================================================= +static Standard_Integer fun66(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { // **** (xset) ModifReorder **** char opt = ' '; - Standard_Integer argc = pilot->NbWords(); - if (argc >= 2) opt = pilot->Word(1).Value(1); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); + Standard_Integer theNbArgs = theNbArgs; + if (theNbArgs >= 2) opt = pilot->Word(1).Value(1); if (opt != 'f' && opt != 'l') { - sout << "Donner option : f -> root-first l -> root-last" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner option : f -> root-first l -> root-last"; + return 1; } return pilot->RecordItem(new IFSelect_ModifReorder(opt == 'l')); } -static IFSelect_ReturnStatus fun70 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun70 +//purpose : +//======================================================================= +static Standard_Integer fun70(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** SelToggle **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner Nom de Selection" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner Nom de Selection"; + return 1; } DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); if (!WS->ToggleSelectExtract(sel)) { - sout << "Pas une SelectExtract : " << arg1 << std::endl; return IFSelect_RetFail; + Message::SendInfo() << "Pas une SelectExtract : " << arg1; + return 1; } - if (WS->IsReversedSelectExtract(sel)) sout << arg1 << " a present Reversed" << std::endl; - else sout << arg1 << " a present Directe" << std::endl; - return IFSelect_RetDone; + if (WS->IsReversedSelectExtract(sel)) Message::SendInfo() << arg1 << " a present Reversed"; + else Message::SendInfo() << arg1 << " a present Directe"; + return 0; } -static IFSelect_ReturnStatus fun71 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun71 +//purpose : +//======================================================================= +static Standard_Integer fun71(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; // **** SelInput **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "Donner Noms Selections cible et input" << std::endl; return IFSelect_RetError; + 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()) { - sout << "Incorrect : " << arg1 << "," << arg2 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Incorrect : " << arg1 << "," << arg2; + return 1; } if (!WS->SetInputSelection(sel, sou)) { - sout << "Nom incorrect ou Selection " << arg1 << " ni Extract ni Deduct" << std::endl; - return IFSelect_RetFail; + Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " ni Extract ni Deduct"; + return 1; } - return IFSelect_RetDone; + return 0; } -static IFSelect_ReturnStatus fun72 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun72 +//purpose : +//======================================================================= +static Standard_Integer fun72(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** SelModelRoots **** return pilot->RecordItem(new IFSelect_SelectModelRoots); } -static IFSelect_ReturnStatus fun73 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun73 +//purpose : +//======================================================================= +static Standard_Integer fun73(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; // **** SelRange **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc >= 2 && arg1[0] == '?') argc = 1; - if (argc < 2) + if (theNbArgs >= 2 && arg1[0] == '?') theNbArgs = 1; + if (theNbArgs < 2) { - sout << "Donner la description du SelectRange" + Message::SendInfo() << "Donner la description du SelectRange" << " Formes admises :\n : Range de a \n" << " tout seul : Range n0 \n from : Range From \n" - << " until : Range Until " << std::endl; - return IFSelect_RetVoid; + << " until : Range Until "; + return 0; } Handle(IFSelect_IntParam) low, up; @@ -2091,9 +2475,10 @@ static IFSelect_ReturnStatus fun73 // Range From if (pilot->Word(1).IsEqual("from")) { - if (argc < 3) + if (theNbArgs < 3) { - sout << "Forme admise : from " << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Forme admise : from "; + return 1; } low = GetCasted(IFSelect_IntParam, WS->NamedItem(arg2)); sel = new IFSelect_SelectRange; @@ -2102,16 +2487,17 @@ static IFSelect_ReturnStatus fun73 } else if (pilot->Word(1).IsEqual("until")) { - if (argc < 3) + if (theNbArgs < 3) { - sout << "Forme admise : until " << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Forme admise : until "; + return 1; } up = GetCasted(IFSelect_IntParam, WS->NamedItem(arg2)); sel = new IFSelect_SelectRange; sel->SetUntil(up); // Range One (n-th) } - else if (argc < 3) + else if (theNbArgs < 3) { low = GetCasted(IFSelect_IntParam, WS->NamedItem(arg1)); sel = new IFSelect_SelectRange; @@ -2128,144 +2514,189 @@ static IFSelect_ReturnStatus fun73 return pilot->RecordItem(sel); } -static IFSelect_ReturnStatus fun74 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun74 +//purpose : +//======================================================================= +static Standard_Integer fun74(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** SelRoots **** return pilot->RecordItem(new IFSelect_SelectRoots); } -static IFSelect_ReturnStatus fun75 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun75 +//purpose : +//======================================================================= +static Standard_Integer fun75(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** SelShared **** return pilot->RecordItem(new IFSelect_SelectShared); } -static IFSelect_ReturnStatus fun76 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun76 +//purpose : +//======================================================================= +static Standard_Integer fun76(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + 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 IFSelect_RetFail; - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) sout << "Diff sans input : ne pas oublier de les definir (ctlmain, ctlsec)!" << std::endl; + 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 (argc >= 2) + if (theNbArgs >= 2) if (!WS->SetControl(sel, selmain, Standard_True)) - sout << "Echec ControlMain:" << arg1 << " , a refaire (ctlmain)" << std::endl; - if (argc >= 3) + Message::SendInfo() << "Echec ControlMain:" << arg1 << " , a refaire (ctlmain)"; + if (theNbArgs >= 3) if (!WS->SetControl(sel, selsec, Standard_False)) - sout << "Echec ControlSecond:" << arg2 << " , a refaire (ctlsec)" << std::endl; + Message::SendInfo() << "Echec ControlSecond:" << arg2 << " , a refaire (ctlsec)"; return pilot->RecordItem(sel); } -static IFSelect_ReturnStatus fun77 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun77 +//purpose : +//======================================================================= +static Standard_Integer fun77(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; // **** SelControlMain **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "Donner Noms de Control et MainInput" << std::endl; return IFSelect_RetError; + 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 IFSelect_RetDone; - sout << "Nom incorrect ou Selection " << arg1 << " pas de type Control" << std::endl; - return IFSelect_RetFail; -} - -static IFSelect_ReturnStatus fun78 -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + 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 **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "Donner Noms de Control et SecondInput" << std::endl; return IFSelect_RetError; + 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 IFSelect_RetDone; - sout << "Nom incorrect ou Selection " << arg1 << " pas de type Control" << std::endl; - return IFSelect_RetFail; + if (WS->SetControl(sel, seldif, Standard_False)) return 0; + Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " pas de type Control"; + return 1; } -static IFSelect_ReturnStatus fun79 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun79 +//purpose : +//======================================================================= +static Standard_Integer fun79(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** SelModelAll **** return pilot->RecordItem(new IFSelect_SelectModelEntities); } -static IFSelect_ReturnStatus fun80 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun80 +//purpose : +//======================================================================= +static Standard_Integer fun80(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; // **** SelCombAdd **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "Donner n0 Combine et une Input" << std::endl; return IFSelect_RetError; + 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 IFSelect_RetDone; - sout << "Nom incorrect ou Selection " << arg1 << " pas Combine" << std::endl; - return IFSelect_RetFail; -} - -static IFSelect_ReturnStatus fun81 -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + 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 **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "Donner n0 Combine et RANG a supprimer" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner n0 Combine et RANG a supprimer"; + return 1; } DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); DeclareAndCast(IFSelect_Selection, inp, WS->NamedItem(arg2)); - if (WS->CombineRemove(sel, inp)) return IFSelect_RetDone; - sout << "Nom incorrect ou Selection " << arg1 << " ni Union ni Intersection" << std::endl; - return IFSelect_RetFail; -} - -static IFSelect_ReturnStatus fun82 -(const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + if (WS->CombineRemove(sel, inp)) return 0; + Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " ni Union ni Intersection"; + return 1; +} + +//======================================================================= +//function : fun82 +//purpose : +//======================================================================= +static Standard_Integer fun82(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]; // **** SelEntNumber **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner Nom IntParam pour n0 Entite" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner Nom IntParam pour n0 Entite"; + return 1; } DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1)); Handle(IFSelect_SelectEntityNumber) sel = new IFSelect_SelectEntityNumber; @@ -2273,199 +2704,254 @@ static IFSelect_ReturnStatus fun82 return pilot->RecordItem(sel); } -static IFSelect_ReturnStatus fun83 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun83 +//purpose : +//======================================================================= +static Standard_Integer fun83(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** SelUnion **** return pilot->RecordItem(new IFSelect_SelectUnion); } -static IFSelect_ReturnStatus fun84 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun84 +//purpose : +//======================================================================= +static Standard_Integer fun84(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** SelIntersection **** return pilot->RecordItem(new IFSelect_SelectIntersection); } -static IFSelect_ReturnStatus fun85 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun85 +//purpose : +//======================================================================= +static Standard_Integer fun85(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** SelTextType Exact **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner le TYPE a selectionner" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner le TYPE a selectionner"; + return 1; } return pilot->RecordItem(new IFSelect_SelectSignature (new IFSelect_SignType, arg1, Standard_True)); } -static IFSelect_ReturnStatus fun86 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun86 +//purpose : +//======================================================================= +static Standard_Integer fun86(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { // **** SelErrorEntities **** return pilot->RecordItem(new IFSelect_SelectErrorEntities); } -static IFSelect_ReturnStatus fun87 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun87 +//purpose : +//======================================================================= +static Standard_Integer fun87(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { // **** SelUnknownEntities ** return pilot->RecordItem(new IFSelect_SelectUnknownEntities); } -static IFSelect_ReturnStatus fun88 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun88 +//purpose : +//======================================================================= +static Standard_Integer fun88(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { // **** SelSharing **** return pilot->RecordItem(new IFSelect_SelectSharing); } -static IFSelect_ReturnStatus fun89 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun89 +//purpose : +//======================================================================= +static Standard_Integer fun89(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** SelTextType Contain ** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner le TYPE a selectionner" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner le TYPE a selectionner"; + return 1; } return pilot->RecordItem(new IFSelect_SelectSignature (new IFSelect_SignType, arg1, Standard_False)); } -static IFSelect_ReturnStatus fun90 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun90 +//purpose : +//======================================================================= +static Standard_Integer fun90(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { // **** SelPointed **** Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; - if (pilot->NbWords() > 1) + if (theNbArgs > 1) { - Handle(TColStd_HSequenceOfTransient) list = XSDRAW_FunctionsSession::GiveList - (pilot->Session(), pilot->CommandPart(1)); - if (list.IsNull()) return IFSelect_RetFail; - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - sout << "SelectPointed : " << list->Length() << " entities" << std::endl; + Handle(TColStd_HSequenceOfTransient) list = GiveList + (XSDRAWBase::Session(), pilot->CommandPart(1)); + if (list.IsNull()) + return 1; + Message::SendInfo() << "SelectPointed : " << list->Length() << " entities"; sp->AddList(list); } return pilot->RecordItem(sp); } -static IFSelect_ReturnStatus fun91 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun91 +//purpose : +//======================================================================= +static Standard_Integer fun91(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** SetPointed (edit) / SetList (edit) **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner NOM SelectPointed + Option(s) :\n" + Message::SendInfo() << "Donner NOM SelectPointed + Option(s) :\n" << " aucune : liste des entites pointees\n" - << " 0: Clear +nn ajout entite nn -nn enleve nn /nn toggle nn" << std::endl; - return IFSelect_RetError; + << " 0: Clear +nn ajout entite nn -nn enleve nn /nn toggle nn"; + return 1; } DeclareAndCast(IFSelect_SelectPointed, sp, WS->NamedItem(arg1)); if (sp.IsNull()) { - sout << "Pas une SelectPointed:" << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Pas une SelectPointed:" << arg1; + return 1; } const Handle(Interface_InterfaceModel)& model = WS->Model(); // pour Print - if (argc == 2) + if (theNbArgs == 2) { // listage simple Standard_Integer nb = sp->NbItems(); - sout << " SelectPointed : " << arg1 << " : " << nb << " Items :" << std::endl; + Message::SendInfo() << " 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) sout << " (inconnu)"; + if (id == 0) Message::SendInfo() << " (inconnu)"; else { - sout << " "; model->Print(pointed, sout); + Message::SendInfo() << " "; model->Print(pointed, Message::SendInfo()); } } - if (nb > 0) sout << std::endl; - return IFSelect_RetDone; + if (nb > 0) Message::SendInfo(); + return 0; } - for (Standard_Integer ia = 2; ia < argc; ia++) + for (Standard_Integer ia = 2; ia < theNbArgs; ia++) { const TCollection_AsciiString argi = pilot->Word(ia); Standard_Integer id = pilot->Number(&(argi.ToCString())[1]); if (id == 0) { - if (!argi.IsEqual("0")) sout << "Incorrect,ignore:" << argi << std::endl; + if (!argi.IsEqual("0")) Message::SendInfo() << "Incorrect,ignore:" << argi; else { - sout << "Clear SelectPointed" << std::endl; sp->Clear(); + Message::SendInfo() << "Clear SelectPointed"; sp->Clear(); } } else if (argi.Value(1) == '-') { Handle(Standard_Transient) item = WS->StartingEntity(id); - if (sp->Remove(item)) sout << "Removed:no." << id; - else sout << " Echec Remove " << id; - sout << ": " << std::endl; - model->Print(item, sout); + if (sp->Remove(item)) Message::SendInfo() << "Removed:no." << id; + else Message::SendInfo() << " Echec Remove " << id; + Message::SendInfo() << ": "; + model->Print(item, Message::SendInfo()); } else if (argi.Value(1) == '/') { Handle(Standard_Transient) item = WS->StartingEntity(id); - if (sp->Remove(item)) sout << "Toggled:n0." << id; - else sout << " Echec Toggle " << id; - sout << ": " << std::endl; - model->Print(item, sout); + if (sp->Remove(item)) Message::SendInfo() << "Toggled:n0." << id; + else Message::SendInfo() << " Echec Toggle " << id; + Message::SendInfo() << ": "; + model->Print(item, Message::SendInfo()); } else if (argi.Value(1) == '+') { Handle(Standard_Transient) item = WS->StartingEntity(id); - if (sp->Add(item)) sout << "Added:no." << id; - else sout << " Echec Add " << id; - sout << ": " << std::endl; - model->Print(item, sout); + if (sp->Add(item)) Message::SendInfo() << "Added:no." << id; + else Message::SendInfo() << " Echec Add " << id; + Message::SendInfo() << ": "; + model->Print(item, Message::SendInfo()); } else { - sout << "Ignore:" << argi << " , donner n0 PRECEDE de + ou - ou /" << std::endl; + Message::SendInfo() << "Ignore:" << argi << " , donner n0 PRECEDE de + ou - ou /"; } } - return IFSelect_RetDone; + return 0; } -static IFSelect_ReturnStatus fun92 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun92 +//purpose : +//======================================================================= +static Standard_Integer fun92(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** SelIncorrectEntities **** WS->ComputeCheck(); return pilot->RecordItem(new IFSelect_SelectIncorrectEntities); } -static IFSelect_ReturnStatus fun93 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun93 +//purpose : +//======================================================================= +static Standard_Integer fun93(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); - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** SelSignature **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + if (theNbArgs < 3) { - sout << "Give name of Signature or Counter, text + option exact(D) else contains" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Give name of Signature or Counter, text + option exact(D) else contains"; + return 1; } Standard_Boolean exact = Standard_True; - if (argc > 3) + if (theNbArgs > 3) { - if (pilot->Arg(3)[0] == 'c') exact = Standard_False; + if (theArgVec[3][0] == 'c') exact = Standard_False; } DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1)); @@ -2476,72 +2962,85 @@ static IFSelect_ReturnStatus fun93 else if (!cnt.IsNull()) sel = new IFSelect_SelectSignature(cnt, arg2, exact); else { - sout << arg1 << ":neither Signature nor Counter" << std::endl; return IFSelect_RetError; + Message::SendInfo() << arg1 << ":neither Signature nor Counter"; + return 1; } return pilot->RecordItem(sel); } -static IFSelect_ReturnStatus fun94 -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun94 +//purpose : +//======================================================================= +static Standard_Integer fun94(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** SignCounter **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner nom signature" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner nom signature"; + return 1; } DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1)); if (sign.IsNull()) { - sout << arg1 << ":pas une signature" << std::endl; return IFSelect_RetError; + Message::SendInfo() << arg1 << ":pas une signature"; + return 1; } Handle(IFSelect_SignCounter) cnt = new IFSelect_SignCounter(sign, Standard_True, Standard_True); return pilot->RecordItem(cnt); } -static IFSelect_ReturnStatus funbselected -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : funbselected +//purpose : +//======================================================================= +static Standard_Integer funbselected(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** NbSelected = GraphCounter **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner nom selection (deduction) a appliquer" << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Donner nom selection (deduction) a appliquer"; + return 1; } DeclareAndCast(IFSelect_SelectDeduct, applied, WS->GiveSelection(arg1)); if (applied.IsNull()) { - sout << arg1 << ":pas une SelectDeduct" << std::endl; return IFSelect_RetError; + 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); } -// ######################################### -// #### EDITOR - EDITFORM #### -// ######################################### - -static IFSelect_ReturnStatus fun_editlist -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun_editlist +//purpose : +//======================================================================= +static Standard_Integer fun_editlist(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + Standard_Integer theNbArgs = theNbArgs; + if (theNbArgs < 2) { - sout << "Give the name of an EditForm or an Editor" << std::endl; - return IFSelect_RetError; + Message::SendInfo() << "Give the name of an EditForm or an Editor"; + return 1; } - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); - Handle(IFSelect_WorkSession) WS = pilot->Session(); + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // EditForm @@ -2549,28 +3048,28 @@ static IFSelect_ReturnStatus fun_editlist Handle(IFSelect_Editor) edt; if (!edf.IsNull()) { - sout << "Print EditForm " << arg1 << std::endl; + Message::SendInfo() << "Print EditForm " << arg1; edt = edf->Editor(); - if (argc < 3) + if (theNbArgs < 3) { // DEFINITIONS : Editor (direct ou via EditForm) if (edt.IsNull()) edt = GetCasted(IFSelect_Editor, WS->NamedItem(arg1)); - if (edt.IsNull()) return IFSelect_RetVoid; + if (edt.IsNull()) return 0; - sout << "Editor, Label : " << edt->Label() << std::endl; - sout << std::endl << " -- Names (short - complete) + Labels of Values" << std::endl; - edt->PrintNames(sout); - sout << std::endl << " -- Definitions --" << std::endl; - edt->PrintDefs(sout); + 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()); if (!edf.IsNull()) { - edf->PrintDefs(sout); - sout << std::endl << "To display values, add an option : o original f final m modified" << std::endl; + edf->PrintDefs(Message::SendInfo()); + Message::SendInfo() << "To display values, add an option : o original f final m modified"; } - return IFSelect_RetVoid; + return 0; } else @@ -2580,64 +3079,70 @@ static IFSelect_ReturnStatus fun_editlist if (opt == 'o') what = -1; else if (opt == 'f') what = 1; - edf->PrintValues(sout, what, Standard_False); + edf->PrintValues(Message::SendInfo(), what, Standard_False); } } - return IFSelect_RetVoid; + return 0; } -static IFSelect_ReturnStatus fun_editvalue -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun_editvalue +//purpose : +//======================================================================= +static Standard_Integer fun_editvalue(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 3) + Standard_Integer theNbArgs = theNbArgs; + if (theNbArgs < 3) { - sout << "Give the name of an EditForm + name of Value [+ newvalue or . to nullify]" << std::endl; - return IFSelect_RetError; + Message::SendInfo() << "Give the name of an EditForm + name of Value [+ newvalue or . to nullify]"; + return 1; } - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); - Handle(IFSelect_WorkSession) WS = pilot->Session(); + 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()) { - sout << "Not an EditForm : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Not an EditForm : " << arg1; + return 1; } Standard_Integer num = edf->NameNumber(arg2); - if (num == 0) sout << "Unknown Value Name : " << arg2 << std::endl; - if (num < 0) sout << "Not Extracted Value Name : " << arg2 << std::endl; - if (num <= 0) return IFSelect_RetError; + 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; - sout << "Value Name : " << name << (edf->IsModified(num) ? "(already edited) : " : " : "); + Message::SendInfo() << "Value Name : " << name << (edf->IsModified(num) ? "(already edited) : " : " : "); if (islist) { listr = edf->EditedList(num); - if (listr.IsNull()) sout << "(NULL LIST)" << std::endl; + if (listr.IsNull()) Message::SendInfo() << "(NULL LIST)"; else { Standard_Integer ilist, nblist = listr->Length(); - sout << "(List : " << nblist << " Items)" << std::endl; + Message::SendInfo() << "(List : " << nblist << " Items)"; for (ilist = 1; ilist <= nblist; ilist++) { str = listr->Value(ilist); - sout << " [" << ilist << "] " << (str.IsNull() ? "(NULL)" : str->ToCString()) << std::endl; + Message::SendInfo() << " [" << ilist << "] " << (str.IsNull() ? "(NULL)" : str->ToCString()); } } - if (argc < 4) sout << "To Edit, options by editval edit-form value-name ?" << std::endl; + if (theNbArgs < 4) Message::SendInfo() << "To Edit, options by editval edit-form value-name ?"; } else { str = edf->EditedValue(num); - sout << (str.IsNull() ? "(NULL)" : str->ToCString()) << std::endl; + Message::SendInfo() << (str.IsNull() ? "(NULL)" : str->ToCString()); } - if (argc < 4) return IFSelect_RetVoid; + if (theNbArgs < 4) return 0; // Valeur simple ou liste ? Standard_Integer numarg = 3; @@ -2648,15 +3153,16 @@ static IFSelect_ReturnStatus fun_editvalue { if (argval[0] == '?') { - sout << "To Edit, options" << std::endl << " + val : add value at end (blanks allowed)" - << std::endl << " +nn text : insert val before item nn" << std::endl - << " nn text : replace item nn with a new value" << std::endl - << " -nn : remove item nn" << std::endl << " . : clear the list" << std::endl; - return IFSelect_RetVoid; + 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 IFSelect_RetError; + if (listed.IsNull()) + return 1; if (argval[0] == '.') { listr.Nullify(); stated = listed->LoadEdited(listr); @@ -2679,8 +3185,8 @@ static IFSelect_ReturnStatus fun_editvalue (new TCollection_HAsciiString(pilot->CommandPart(numarg + 1)), numset); } if (stated) stated = edf->ModifyList(num, listed, Standard_True); - if (stated) sout << "List Edition done" << std::endl; - else sout << "List Edition not done, option" << argval << std::endl; + if (stated) Message::SendInfo() << "List Edition done"; + else Message::SendInfo() << "List Edition not done, option" << argval; } else { @@ -2688,154 +3194,171 @@ static IFSelect_ReturnStatus fun_editvalue else str = new TCollection_HAsciiString(pilot->CommandPart(numarg)); if (edf->Modify(num, str, Standard_True)) { - sout << "Now set to " << (str.IsNull() ? "(NULL)" : str->ToCString()) << std::endl; + Message::SendInfo() << "Now set to " << (str.IsNull() ? "(NULL)" : str->ToCString()); } else { - sout << "Modify not done" << std::endl; return IFSelect_RetFail; + Message::SendInfo() << "Modify not done"; + return 1; } } - return IFSelect_RetDone; + return 0; } -static IFSelect_ReturnStatus fun_editclear -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun_editclear +//purpose : +//======================================================================= +static Standard_Integer fun_editclear(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Give the name of an EditForm [+ name of Value else all]" << std::endl; - return IFSelect_RetError; + Message::SendInfo() << "Give the name of an EditForm [+ name of Value else all]"; + return 1; } - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); - Handle(IFSelect_WorkSession) WS = pilot->Session(); + 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()) { - sout << "Not an EditForm : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Not an EditForm : " << arg1; + return 1; } - if (argc < 3) + if (theNbArgs < 3) { - edf->ClearEdit(); sout << "All Modifications Cleared" << std::endl; + edf->ClearEdit(); Message::SendInfo() << "All Modifications Cleared"; } else { Standard_Integer num = edf->NameNumber(arg2); - if (num == 0) sout << "Unknown Value Name : " << arg2 << std::endl; - if (num < 0) sout << "Not Extracted Value Name : " << arg2 << std::endl; - if (num <= 0) return IFSelect_RetError; + if (num == 0) Message::SendInfo() << "Unknown Value Name : " << arg2; + if (num < 0) Message::SendInfo() << "Not Extracted Value Name : " << arg2; + if (num <= 0) + return 1; if (!edf->IsModified(num)) { - sout << "Value " << arg2 << " was not modified" << std::endl; return IFSelect_RetVoid; + Message::SendInfo() << "Value " << arg2 << " was not modified"; return 0; } edf->ClearEdit(num); - sout << "Modification on Value " << arg2 << " Cleared" << std::endl; + Message::SendInfo() << "Modification on Value " << arg2 << " Cleared"; } - return IFSelect_RetDone; + return 0; } -static IFSelect_ReturnStatus fun_editapply -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun_editapply +//purpose : +//======================================================================= +static Standard_Integer fun_editapply(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Give the name of an EditForm [+ option keep to re-apply edited values]" << std::endl; - return IFSelect_RetError; + Message::SendInfo() << "Give the name of an EditForm [+ option keep to re-apply edited values]"; + return 1; } - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); - Handle(IFSelect_WorkSession) WS = pilot->Session(); + 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()) { - sout << "Not an EditForm : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Not an EditForm : " << arg1; + return 1; } Handle(Standard_Transient) ent = edf->Entity(); Handle(Interface_InterfaceModel) model = edf->Model(); if (!model.IsNull()) { - if (ent.IsNull()) sout << "Applying modifications on loaded model" << std::endl; + if (ent.IsNull()) Message::SendInfo() << "Applying modifications on loaded model"; else { - sout << "Applying modifications on loaded entity : "; - model->PrintLabel(ent, sout); + Message::SendInfo() << "Applying modifications on loaded entity : "; + model->PrintLabel(ent, Message::SendInfo()); } } - else sout << "Applying modifications" << std::endl; + else Message::SendInfo() << "Applying modifications"; if (!edf->ApplyData(edf->Entity(), edf->Model())) { - sout << "Modifications could not be applied" << std::endl; - return IFSelect_RetFail; + Message::SendInfo() << "Modifications could not be applied"; + return 1; } - sout << "Modifications have been applied" << std::endl; + Message::SendInfo() << "Modifications have been applied"; Standard_Boolean stat = Standard_True; - if (argc > 2 && arg2[0] == 'k') stat = Standard_False; + if (theNbArgs > 2 && arg2[0] == 'k') stat = Standard_False; if (stat) { edf->ClearEdit(); - sout << "Edited values are cleared" << std::endl; + Message::SendInfo() << "Edited values are cleared"; } - else sout << "Edited values are kept for another loading/applying" << std::endl; + else Message::SendInfo() << "Edited values are kept for another loading/applying"; - return IFSelect_RetDone; + return 0; } -static IFSelect_ReturnStatus fun_editload -(const Handle(IFSelect_SessionPilot)& pilot) +//======================================================================= +//function : fun_editload +//purpose : +//======================================================================= +static Standard_Integer fun_editload(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Give the name of an EditForm [+ Entity-Ident]" << std::endl; - return IFSelect_RetError; + Message::SendInfo() << "Give the name of an EditForm [+ Entity-Ident]"; + return 1; } - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); - Handle(IFSelect_WorkSession) WS = pilot->Session(); + 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()) { - sout << "Not an EditForm : " << arg1 << std::endl; return IFSelect_RetError; + Message::SendInfo() << "Not an EditForm : " << arg1; + return 1; } - Standard_Integer num = (argc < 3 ? 0 : pilot->Number(arg2)); + Standard_Integer num = (theNbArgs < 3 ? 0 : pilot->Number(arg2)); Standard_Boolean stat = Standard_False; - if (argc < 3) + if (theNbArgs < 3) { - sout << "EditForm " << arg1 << " : Loading Model" << std::endl; + Message::SendInfo() << "EditForm " << arg1 << " : Loading Model"; stat = edf->LoadModel(WS->Model()); } else if (num <= 0) { - sout << "Not an entity ident : " << arg2 << std::endl; - return IFSelect_RetError; + Message::SendInfo() << "Not an entity ident : " << arg2; + return 1; } else { - sout << "EditForm " << arg1 << " : Loading Entity " << arg2 << std::endl; + Message::SendInfo() << "EditForm " << arg1 << " : Loading Entity " << arg2; stat = edf->LoadData(WS->StartingEntity(num), WS->Model()); } if (!stat) { - sout << "Loading not done" << std::endl; - return IFSelect_RetFail; + Message::SendInfo() << "Loading not done"; + return 1; } - sout << "Loading done" << std::endl; - return IFSelect_RetDone; + Message::SendInfo() << "Loading done"; + return 0; } -Handle(Standard_Transient) GiveEntity -(const Handle(IFSelect_WorkSession)& WS, - const Standard_CString name) +//======================================================================= +//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); @@ -2843,9 +3366,12 @@ Handle(Standard_Transient) GiveEntity return ent; } -Standard_Integer GiveEntityNumber -(const Handle(IFSelect_WorkSession)& WS, - const Standard_CString name) +//======================================================================= +//function : GiveEntityNumber +//purpose : +//======================================================================= +Standard_Integer GiveEntityNumber(const Handle(XSControl_WorkSession)& WS, + const Standard_CString name) { Standard_Integer num = 0; if (!name || name[0] == '\0') @@ -2860,7 +3386,11 @@ Standard_Integer GiveEntityNumber return num; } -void XSDRAW_FunctionsSession::Init() +//======================================================================= +//function : Init +//purpose : +//======================================================================= +void XSDRAW_FunctionsSession::Init(Draw_Interpretor& theDI) { static int THE_XSDRAW_FunctionsSession_initactor = 0; if (THE_XSDRAW_FunctionsSession_initactor) @@ -2869,128 +3399,128 @@ void XSDRAW_FunctionsSession::Init() } THE_XSDRAW_FunctionsSession_initactor = 1; - IFSelect_Act::SetGroup("DE: General"); - IFSelect_Act::AddFunc("xstatus", "Lists XSTEP Status : Version, System Name ...", funstatus); - IFSelect_Act::AddFunc("handler", "Toggle status catch Handler Error of the session", fun1); - IFSelect_Act::AddFunc("xload", "file:string : Read File -> Load Model", fun3); - IFSelect_Act::AddFunc("xread", "file:string : Read File -> Load Model", fun3); - IFSelect_Act::AddFunc("writeall", "file:string : Write all model (no split)", fun4); - IFSelect_Act::AddFunc("writesel", "file:string sel:Selection : Write Selected (no split)", fun5); - IFSelect_Act::AddFunc("writeent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)", fun6); - IFSelect_Act::AddFunc("writent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)", fun6); - IFSelect_Act::AddFunc("elabel", "nument:integer : Displays Label Model of an entity", fun7); - IFSelect_Act::AddFunc("enum", "label:string : Displays entities n0.s of which Label Model ends by..", fun8); - - IFSelect_Act::AddFunc("listtypes", "List nb entities per type. Optional selection name else all model", fun9); - IFSelect_Act::AddFunc("count", "Count : counter [selection]", funcount); - IFSelect_Act::AddFunc("listcount", "List Counted : counter [selection [nument]]", funcount); - IFSelect_Act::AddFunc("sumcount", "Summary Counted : counter [selection [nument]]", funcount); - IFSelect_Act::AddFunc("signtype", "Sign Type [newone]", funsigntype); - IFSelect_Act::AddFunc("signcase", "signature : displays possible cases", funsigncase); - - IFSelect_Act::AddFunc("estatus", "ent/nument : displays status of an entity", fun10); - IFSelect_Act::AddFunc("data", "Data (DumpModel); whole help : data tout court", fun11); - IFSelect_Act::AddFunc("entity", "give n0 ou id of entity [+ level]", fundumpent); - IFSelect_Act::AddFunc("signature", "signature name + n0/ident entity", funsign); - IFSelect_Act::AddFunc("queryparent", " give 2 n0s/labels of entities : dad son", funqp); - - IFSelect_Act::AddFunc("dumpshare", "Dump Share (dispatches, IntParams)", fun12); - IFSelect_Act::AddFunc("listitems", "List Items [label else all] ->Type,Label[,Name]", fun13); - IFSelect_Act::AddFSet("integer", "value:integer : cree un IntParam", fun14); - IFSelect_Act::AddFunc("setint", "name:IntParam newValue:integer : Change valeur IntParam", fun15); - IFSelect_Act::AddFSet("text", "value:string : cree un TextParam", fun16); - IFSelect_Act::AddFunc("settext", "Name:TextParam newValue:string : Change valeur TextParam", fun17); - IFSelect_Act::AddFunc("dumpsel", "Dump Selection suivi du Nom de la Selection a dumper", fun19); - IFSelect_Act::AddFunc("evalsel", "name:Selection [num/sel] : Evalue une Selection", fun20); - IFSelect_Act::AddFunc("givelist", "num/sel [num/sel ...] : Evaluates GiveList", fun20); - IFSelect_Act::AddFunc("giveshort", "num/sel [num/sel ...] : GiveList in short form", fun20); - IFSelect_Act::AddFunc("givepointed", "num/sel [num/sel ...] : GiveList to fill a SelectPointed", fun20); - IFSelect_Act::AddFunc("makelist", "listname [givelist] : Makes a List(SelectPointed) from GiveList", fun20); - IFSelect_Act::AddFunc("givecount", "num/sel [num/sel ...] : Counts GiveList", fun20c); - IFSelect_Act::AddFSet("selsuite", "sel sel ... : Creates a SelectSuite", funselsuite); - IFSelect_Act::AddFunc("clearitems", "Clears all items (selections, dispatches, etc)", fun21); - IFSelect_Act::AddFunc("cleardata", "mode:a-g-c-p : Clears all or some data (model, check...)", fun22); - - IFSelect_Act::AddFunc("itemlabel", "xxx xxx : liste items having this label", fun24); - IFSelect_Act::AddFunc("xsave", "filename:string : sauve items-session", fun25); - IFSelect_Act::AddFunc("xrestore", "filename:string : restaure items-session", fun26); - IFSelect_Act::AddFunc("param", "[-p Pattern] - displays all parameters or filtered by pattern;\n" - "par_name - displays parameter;\n" - "par_name par_value - changes parameter's value", fun27); - - IFSelect_Act::AddFunc("sentfiles", "Lists files sent from last Load", fun29); - IFSelect_Act::AddFunc("fileprefix", "prefix:string : definit File Prefix", fun30); - IFSelect_Act::AddFunc("fileext", "extent:string : definit File Extension", fun31); - IFSelect_Act::AddFunc("fileroot", "disp:Dispatch root:string : definit File Root sur un Dispatch", fun32); - IFSelect_Act::AddFunc("filedef", "defroot:string : definit File DefaultRoot", fun33); - IFSelect_Act::AddFunc("evalfile", "Evaluation du FileNaming et memorisation", fun34); - IFSelect_Act::AddFunc("clearfile", "Efface la liste d'EvalFile", fun35); - IFSelect_Act::AddFunc("xsplit", "[disp:Dispatch sinon tout] : Split, la grande affaire !", fun36); - IFSelect_Act::AddFunc("remaining", "options... : Remaining Entities, help complet par remaining ?", fun37); - IFSelect_Act::AddFunc("setcontent", "sel:Selection mode:k ou r : Restreint contenu du modele", fun38); - - IFSelect_Act::AddFunc("listmodif", "List Final Modifiers", fun40); - IFSelect_Act::AddFunc("dumpmodif", "modif:Modifier : Affiche le Statut d'un Modifier", fun41); - IFSelect_Act::AddFunc("modifsel", "modif:Modifier [sel:Selection] : Change/Annule Selection de Modifier", fun42); - IFSelect_Act::AddFunc("setapplied", "modif:Modifier [name:un item sinon sortie fichier] : Applique un Modifier", fun43); - IFSelect_Act::AddFunc("resetapplied", "modif:Modifier : Enleve un Modifier de la sortie fichier", fun44); - IFSelect_Act::AddFunc("modifmove", "modif:Modifier M(model)/F(file) avant,apres:integer : Deplace un Modifier (sortie fichier)", fun45); - - IFSelect_Act::AddFunc("dispsel", "disp:Dispatch sel:Selection -> Selection Finale de Dispatch", fun51); - IFSelect_Act::AddFSet("dispone", "cree DispPerOne", fun_dispone); - IFSelect_Act::AddFSet("dispglob", "cree DispGlobal", fun_dispglob); - IFSelect_Act::AddFSet("dispcount", "count:IntParam : cree DispPerCount", fun_dispcount); - IFSelect_Act::AddFSet("dispfile", "files:IntParam : cree DispPerFiles", fun_dispfiles); - IFSelect_Act::AddFSet("dispsign", "sign:Signature : cree DispPerSignature", fun_dispsign); - IFSelect_Act::AddFunc("dumpdisp", "disp:Dispatch : Affiche le Statut d'un Dispatch", fun56); - - IFSelect_Act::AddFunc("xremove", "nom : Remove a Control Item de la Session", fun57); - IFSelect_Act::AddFunc("evaldisp", "mode=[0-3] disp:Dispatch : Evaluates one or more Dispatch(es)", fun58); - IFSelect_Act::AddFunc("evaladisp", "mode=[0-3] disp:Dispatch [givelist] : Evaluates a Dispatch (on a GiveList)", fun_evaladisp); - IFSelect_Act::AddFunc("writedisp", "filepattern disp:Dispatch [givelist] : Writes Entities by Splitting by a Dispatch", fun_writedisp); - IFSelect_Act::AddFunc("evalcomplete", "Evaluation Complete de la Repartition", fun59); - - IFSelect_Act::AddFunc("runcheck", "affiche LastRunCheckList (write,modif)", fun60); - IFSelect_Act::AddFunc("runtranformer", "transf:Transformer : Applique un Transformer", fun61); - IFSelect_Act::AddFSet("copy", "cree TransformStandard, option Copy, vide", fun62); - IFSelect_Act::AddFSet("onthespot", "cree TransformStandard, option OntheSpot, vide", fun63); - IFSelect_Act::AddFunc("runcopy", "modif:ModelModifier [givelist] : Run via TransformStandard option Copy", fun6465); - IFSelect_Act::AddFunc("runonthespot", "modif:ModelModifier [givelist] : Run via TransformStandard option OnTheSpot", fun6465); - IFSelect_Act::AddFSet("reorder", "[f ou t] reordonne le modele", fun66); - - IFSelect_Act::AddFunc("toggle", "sel:Selection genre Extract : Toggle Direct/Reverse", fun70); - IFSelect_Act::AddFunc("input", "sel:Selection genre Deduct ou Extract input:Selection : Set Input", fun71); - IFSelect_Act::AddFSet("modelroots", "cree SelectModelRoots", fun72); - IFSelect_Act::AddFSet("range", "options... : cree SelectRange ...; tout court pour help", fun73); - IFSelect_Act::AddFSet("roots", "cree SelectRoots (local roots)", fun74); - IFSelect_Act::AddFSet("shared", "cree SelectShared", fun75); - IFSelect_Act::AddFSet("diff", "[main:Selection diff:Selection] : cree SelectDiff", fun76); - IFSelect_Act::AddFunc("selmain", "sel:Selection genre Control main:Selection : Set Main Input", fun77); - IFSelect_Act::AddFunc("selsecond", "sel:Selection genre Control sec:Selection : Set Second Input", fun78); - IFSelect_Act::AddFSet("modelall", "cree SelectModelAll", fun79); - IFSelect_Act::AddFunc("seladd", "sel:Selection genre Combine input:Selection : Add Selection", fun80); - IFSelect_Act::AddFunc("selrem", "sel:Selection genre Combine input:Selection : Remove Selection", fun81); - IFSelect_Act::AddFSet("number", "num:IntParam : Cree SelectEntityNumber", fun82); - - IFSelect_Act::AddFSet("union", "cree SelectUnion (vide), cf aussi combadd, combrem", fun83); - IFSelect_Act::AddFSet("intersect", "cree SelectIntersection (vide), cf aussi combadd, combrem", fun84); - IFSelect_Act::AddFSet("typexact", "type:string : cree SelectTextType Exact", fun85); - IFSelect_Act::AddFSet("errors", "cree SelectErrorEntities (from file)", fun86); - IFSelect_Act::AddFSet("unknown", "cree SelectUnknownEntities", fun87); - IFSelect_Act::AddFSet("sharing", "cree SelectSharing", fun88); - IFSelect_Act::AddFSet("typecontain", "type:string : cree SelectTextType Contains", fun89); - IFSelect_Act::AddFSet("pointed", "cree SelectPointed [num/sel num/sel]", fun90); - IFSelect_Act::AddFunc("setpointed", "sel:SelectPointed : edition SelectPointed. tout court pour help", fun91); - IFSelect_Act::AddFunc("setlist", "sel:SelectPointed : edition SelectPointed. tout court pour help", fun91); - IFSelect_Act::AddFSet("incorrect", "cree SelectIncorrectEntities (computed)", fun92); - - IFSelect_Act::AddFSet("signsel", "sign:Signature|cnt:Counter text:string [e(D)|c] : cree SelectSignature", fun93); - IFSelect_Act::AddFSet("signcounter", "sign:Signature : cree SignCounter", fun94); - IFSelect_Act::AddFSet("nbselected", "applied:Selection : cree GraphCounter(=NbSelected)", funbselected); - - IFSelect_Act::AddFunc("editlist", "editor or editform : lists defs + values", fun_editlist); - IFSelect_Act::AddFunc("editvalue", "editform paramname [newval or .] : lists-changes a value", fun_editvalue); - IFSelect_Act::AddFunc("editclear", "editform [paramname] : clears edition on all or one param", fun_editclear); - IFSelect_Act::AddFunc("editload", "editform [entity-id] : loads from model or an entity", fun_editload); - IFSelect_Act::AddFunc("editapply", "editform [keep] : applies on loaded data", fun_editapply); + Standard_CString aGroup = "DE: General"; + theDI.Add("xstatus", "Lists XSTEP Status : Version, System Name ...", __FILE__, funstatus, aGroup); + theDI.Add("handler", "Toggle status catch Handler Error of the session", __FILE__, fun1, aGroup); + 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("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("signtype", "Sign Type [newone]", __FILE__, funsigntype, aGroup); + theDI.Add("signcase", "signature : displays possible cases", __FILE__, funsigncase, aGroup); + + theDI.Add("estatus", "ent/nument : displays status of an entity", __FILE__, fun10, aGroup); + theDI.Add("data", "Data (DumpModel); whole help : data tout court", __FILE__, fun11, aGroup); + theDI.Add("entity", "give n0 ou id of entity [+ level]", __FILE__, fundumpent, aGroup); + theDI.Add("signature", "signature name + n0/ident entity", __FILE__, funsign, aGroup); + theDI.Add("queryparent", " give 2 n0s/labels of entities : dad son", __FILE__, funqp, 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("setint", "name:IntParam newValue:integer : Change valeur IntParam", __FILE__, fun15, 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("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("itemlabel", "xxx xxx : liste items having this label", __FILE__, fun24, aGroup); + theDI.Add("xsave", "filename:string : sauve items-session", __FILE__, fun25, aGroup); + theDI.Add("xrestore", "filename:string : restaure items-session", __FILE__, fun26, aGroup); + theDI.Add("param", "[-p Pattern] - displays all parameters or filtered by pattern;\n" + "par_name - displays parameter;\n" + "par_name par_value - changes parameter's value", __FILE__, fun27, aGroup); + + theDI.Add("sentfiles", "Lists files sent from last Load", __FILE__, fun29, aGroup); + theDI.Add("fileprefix", "prefix:string : definit File Prefix", __FILE__, fun30, aGroup); + theDI.Add("fileext", "extent:string : definit File Extension", __FILE__, fun31, aGroup); + theDI.Add("fileroot", "disp:Dispatch root:string : definit File Root sur un Dispatch", __FILE__, fun32, aGroup); + theDI.Add("filedef", "defroot:string : definit File DefaultRoot", __FILE__, fun33, aGroup); + theDI.Add("evalfile", "Evaluation du FileNaming et memorisation", __FILE__, fun34, aGroup); + theDI.Add("clearfile", "Efface la liste d'EvalFile", __FILE__, fun35, aGroup); + theDI.Add("xsplit", "[disp:Dispatch sinon tout] : Split, la grande affaire !", __FILE__, fun36, aGroup); + theDI.Add("remaining", "options... : Remaining Entities, help complet par remaining ?", __FILE__, fun37, aGroup); + theDI.Add("setcontent", "sel:Selection mode:k ou r : Restreint contenu du modele", __FILE__, fun38, aGroup); + + theDI.Add("listmodif", "List Final Modifiers", __FILE__, fun40, aGroup); + theDI.Add("dumpmodif", "modif:Modifier : Affiche le Statut d'un Modifier", __FILE__, fun41, aGroup); + theDI.Add("modifsel", "modif:Modifier [sel:Selection] : Change/Annule Selection de Modifier", __FILE__, fun42, aGroup); + theDI.Add("setapplied", "modif:Modifier [name:un item sinon sortie fichier] : Applique un Modifier", __FILE__, fun43, aGroup); + theDI.Add("resetapplied", "modif:Modifier : Enleve un Modifier de la sortie fichier", __FILE__, fun44, 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("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("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 via TransformStandard option Copy", __FILE__, fun6465, aGroup); + theDI.Add("runonthespot", "modif:ModelModifier [givelist] : Run 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("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("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("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("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("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); } diff --git a/src/XSDRAW/XSDRAW_FunctionsSession.hxx b/src/XSDRAW/XSDRAW_FunctionsSession.hxx index 855c945063..d0a2ceb17b 100644 --- a/src/XSDRAW/XSDRAW_FunctionsSession.hxx +++ b/src/XSDRAW/XSDRAW_FunctionsSession.hxx @@ -18,6 +18,8 @@ #include #include +#include + //! Functions gives access to all the actions which can be //! commanded with the resources provided by IFSelect : especially //! WorkSession and various types of Selections and Dispatches @@ -29,7 +31,7 @@ class XSDRAW_FunctionsSession public: //! Defines and loads all basic functions (as ActFunc) - Standard_EXPORT static void Init(); + Standard_EXPORT static void Init(Draw_Interpretor& theDI); }; #endif // _XSDRAW_FunctionsSession_HeaderFile diff --git a/src/XSDRAW/XSDRAW_FunctionsShape.cxx b/src/XSDRAW/XSDRAW_FunctionsShape.cxx index 5c0c2bfa93..52a5c19748 100644 --- a/src/XSDRAW/XSDRAW_FunctionsShape.cxx +++ b/src/XSDRAW/XSDRAW_FunctionsShape.cxx @@ -11,11 +11,12 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include + #include #include #include #include -#include #include #include #include @@ -50,8 +51,8 @@ //function : XSControl_tpdraw //purpose : //======================================================================= -static IFSelect_ReturnStatus XSControl_tpdraw -(const Handle(IFSelect_SessionPilot)& pilot) +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); @@ -271,8 +272,8 @@ static IFSelect_ReturnStatus XSControl_tpdraw //function : XSControl_tpcompound //purpose : //======================================================================= -static IFSelect_ReturnStatus XSControl_tpcompound -(const Handle(IFSelect_SessionPilot)& pilot) +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); @@ -317,8 +318,8 @@ static IFSelect_ReturnStatus XSControl_tpcompound //function : XSControl_traccess //purpose : //======================================================================= -static IFSelect_ReturnStatus XSControl_traccess -(const Handle(IFSelect_SessionPilot)& pilot) +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); @@ -418,8 +419,8 @@ static Standard_Boolean XSControl_IsEqualSubShape(const TopoDS_Shape& Shape, //function : XSControl_fromshape //purpose : //======================================================================= -static IFSelect_ReturnStatus XSControl_fromshape -(const Handle(IFSelect_SessionPilot)& pilot) +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); @@ -614,8 +615,8 @@ static IFSelect_ReturnStatus XSControl_fromshape //function : XSControl_trconnexentities //purpose : //======================================================================= -static IFSelect_ReturnStatus XSControl_trconnexentities -(const Handle(IFSelect_SessionPilot)& pilot) +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); @@ -660,8 +661,8 @@ static IFSelect_ReturnStatus XSControl_trconnexentities //function : XSControl_trimport //purpose : //======================================================================= -static IFSelect_ReturnStatus XSControl_trimport -(const Handle(IFSelect_SessionPilot)& pilot) +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 @@ -791,8 +792,8 @@ static IFSelect_ReturnStatus XSControl_trimport //function : XSControl_twrite //purpose : //======================================================================= -static IFSelect_ReturnStatus XSControl_twrite -(const Handle(IFSelect_SessionPilot)& pilot) +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); @@ -828,14 +829,13 @@ static IFSelect_ReturnStatus XSControl_twrite //function : Init //purpose : //======================================================================= -void XSDRAW_FunctionsShape::Init() +void XSDRAW_FunctionsShape::Init(Draw_Interpretor& theDI) { static int THE_XSDRAW_FunctionsShape_initactor = 0; if (THE_XSDRAW_FunctionsShape_initactor) { return; } - THE_XSDRAW_FunctionsShape_initactor = 1; IFSelect_Act::SetGroup("DE: General"); diff --git a/src/XSDRAW/XSDRAW_FunctionsShape.hxx b/src/XSDRAW/XSDRAW_FunctionsShape.hxx index fb27c6a383..a7cd3caabb 100644 --- a/src/XSDRAW/XSDRAW_FunctionsShape.hxx +++ b/src/XSDRAW/XSDRAW_FunctionsShape.hxx @@ -18,6 +18,8 @@ #include #include +#include + //! Defines additional commands for XSControl to : //! - control of initialisation (xinit, xnorm, newmodel) //! - analyse of the result of a transfer (recorded in a @@ -33,7 +35,7 @@ class XSDRAW_FunctionsShape DEFINE_STANDARD_ALLOC public: //! Defines and loads all functions which work on shapes for XSControl (as ActFunc) - Standard_EXPORT static void Init(); + Standard_EXPORT static void Init(Draw_Interpretor& theDI); }; #endif // _XSDRAW_FunctionsShape_HeaderFile diff --git a/src/XSDRAWBase/XSDRAWBase.cxx b/src/XSDRAWBase/XSDRAWBase.cxx index bc4840e85d..e8d1f7fb73 100644 --- a/src/XSDRAWBase/XSDRAWBase.cxx +++ b/src/XSDRAWBase/XSDRAWBase.cxx @@ -11,604 +11,5 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include -#include -// Pour le transfert (write) -// Pour NewModel et Write : definition de produit (temporaire ...) -// steptrans -extern "C" { -static void cleanpilot () -{ - XSDRAW::Session()->ClearData(1); -} -} - - -//======================================================================= -//function : Init -//purpose : -//======================================================================= - -void XSDRAWSTEP::Init () -{ - Handle(StepSelect_Activator) stepact = new StepSelect_Activator; - if (STEPControl_Controller::Init()) // XSDRAW::SetNorm("STEP AP-214"); trop tot - XSDRAW::SetController(XSControl_Controller::Recorded("STEP")); - - atexit (cleanpilot); -} - -// ######## COMMANDE stepread : teste le Reader ######### - -//======================================================================= -//function : stepread -//purpose : -//======================================================================= - -static Standard_Integer stepread (Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - if (argc < 3) { - di << "Use: stepread [file] [f or r (type of model full or reduced)]\n"; - return 1; - } - // On admet le controller AP214 ou une variante - DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller()); - if (ctl.IsNull()) XSDRAW::SetNorm("STEP"); - - - // Progress indicator - Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 ); - Message_ProgressScope aPSRoot (progress->Start(), "Reading", 100); - - STEPControl_Reader sr (XSDRAW::Session(),Standard_False); - TCollection_AsciiString fnom,rnom; - Standard_Boolean modfic = XSDRAW::FileAndVar - (argv[1],argv[2],"STEP",fnom,rnom); - if (modfic) di<<" File STEP to read : "<Show(aPSRoot); - - Standard_Boolean fromtcl = Standard_False; - Standard_Boolean aFullMode = Standard_False; - Standard_Integer k = 3; - if(argc > k ) - { - if(argv[k][0] == 'f' || argv[3][0] == 'F') - { - aFullMode = Standard_True; - k++; - } - else if(argv[k][0] == 'r' || argv[3][0] == 'R') - { - aFullMode = Standard_False; - k++; - } - else - fromtcl = Standard_True; - - } - if(!fromtcl) - fromtcl = argc > k; - if(aFullMode) - std::cout<<"Full model for translation with additional info will be used \n"<SetModeStat(aFullMode); - - - if (modfic) readstat = sr.ReadFile (fnom.ToCString()); - else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone; - - aPSRoot.Next(20); // On average loading takes 20% - if (aPSRoot.UserBreak()) - return 1; - - if (readstat != IFSelect_RetDone) { - if (modfic) di<<"Could not read file "<PrepareForTransfer(); // update unit info - sr.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit()); - - // nom = "." -> fichier deja lu - Standard_Integer i, num, nbs, modepri = 1; - if (fromtcl) modepri = 4; - while (modepri) { - num = sr.NbRootsForTransfer(); - if (!fromtcl) { - di<<"NbRootsForTransfer="<Print (sr.RootForTransfer(i), aTmpStream); - di << aTmpStream.str().c_str(); - di<<" Type:"<DynamicType()->Name()<<"\n"; - } - - std::cout<<"Mode (0 End, 1 root n0 1, 2 one root/n0, 3 one entity/n0, 4 Selection) : "<>modepri; - } - - if (modepri == 0) { di<<"End Reading STEP\n"; return 0; } - if (modepri <= 2) { - num = 1; - if (modepri == 2) { - std::cout<<"Root N0 : "<>num; - } - aPSRoot.SetName("Translation"); - progress->Show(aPSRoot); - - if (!sr.TransferRoot (num, aPSRoot.Next(80))) - di<<"Transfer root n0 "< DRAW Shape: "< DRAW Shape: "<Append(sr.RootForTransfer(j)); - } - else { - di<<"List given by "< k+1) di<<" "< (k+1) ? argv[k+1] : 0 ) ); - } - if (list.IsNull()) { di<<"No list defined. Give a selection name or * for all transferrable roots\n"; continue; } - } else { - std::cout<<"Name of Selection :"<Length(); - di<<"Nb entities selected : "<Show(aPSRoot); - - Message_ProgressScope aPS(aPSRoot.Next(80), "Root", nbl); - for (ill = 1; ill <= nbl && aPS.More(); ill++) { - num = sr.Model()->Number(list->Value(ill)); - if (num == 0) continue; - if (!sr.TransferOne(num, aPS.Next())) - di<<"Transfer entity n0 "< DRAW Shape: "< 4) - { - di << "ERROR in " << argv[0] << "Wrong Number of Arguments.\n"; - di << " Usage : " << argv[0] << " file_name shape_name [-stream]\n"; - di << " Option -stream forces usage of API accepting stream\n"; - return 1; - } - - Standard_Boolean useStream = (argc > 3 && ! strcasecmp (argv[3], "-stream")); - - STEPControl_Reader Reader; - Standard_CString filename = argv[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); - } - di<<"Status from reading STEP file "<PrepareForTransfer(); // update unit info - Reader.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit()); - Reader.TransferRoots(); - TopoDS_Shape shape = Reader.OneShape(); - DBRep::Set(argv[2],shape); - di<<"Count of shapes produced : "< 4) n2 = XSDRAW::GetEntityNumber(argv[4]); - if (n1 > 0) ax1 = Handle(StepGeom_Axis2Placement3d)::DownCast - (XSDRAW::Entity(n1)); - if (n2 > 0) ax2 = Handle(StepGeom_Axis2Placement3d)::DownCast - (XSDRAW::Entity(n2)); - StepToTopoDS_MakeTransformed mktrans; - if (mktrans.Compute (ax1,ax2)) { - TopLoc_Location loc (mktrans.Transformation()); - shape.Move (loc); -// mktrans.Transform (shape); - DBRep::Set (argv[2],shape); - di<<"Transformed Shape as "<ActorWrite() ); - if ( ! ActWrite.IsNull() ) - ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly")); - - TopoDS_Shape shape = DBRep::Get(argv[2]); - STEPControl_Writer sw (XSDRAW::Session(),Standard_False); - Handle(Interface_InterfaceModel) stepmodel = sw.Model(); - Standard_Integer nbavant = (stepmodel.IsNull() ? 0 : stepmodel->NbEntities()); - - Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 ); - Message_ProgressScope aPSRoot (progress->Start(), "Translating", 100); - progress->Show(aPSRoot); - - Standard_Integer stat = sw.Transfer (shape, mode, Standard_True, aPSRoot.Next(90)); - if (stat == IFSelect_RetDone) - { - di << "Translation: OK\n"; - } - else - { - di << "Error: translation failed, status = " << stat << "\n"; - } - - if (aPSRoot.UserBreak()) - return 1; - aPSRoot.SetName("Writing"); - progress->Show(aPSRoot); - -// Que s est-il passe - stepmodel = sw.Model(); - Standard_Integer nbapres = (stepmodel.IsNull() ? 0 : stepmodel->NbEntities()); - if (nbavant > 0) di<<"Beware : Model not empty before transferring\n"; - if (nbapres <= nbavant) di<<"Beware : No data produced by this transfer\n"; - if (nbapres == 0) { di<<"No data to write\n"; return 0; } - - if (argc <= 3) { - di<<" Now, to write a file, command : writeall filename\n"; - return 0; - } - - const char *nomfic = argv[3]; - stat = sw.Write(nomfic); - switch (stat) { - case IFSelect_RetVoid : di<<"Error: No file written\n"; break; - case IFSelect_RetDone : di<<"File "<Session(); - const Interface_Graph& graph = WS->Graph(); - - Handle(TColStd_HSequenceOfTransient) roots = WS->GiveList("xst-transferrable-roots", ""); - STEPSelections_Counter cnt; - - for (Standard_Integer i =1 ; i <= roots->Length(); i++) { - cnt.Count(graph,roots->Value(i)); - } - - di<< "Instances of Faces \t: "<Session(); - const Interface_Graph& graph = WS->Graph(); - - STEPSelections_AssemblyExplorer exp(graph); - exp.Dump(std::cout); - return 0; -} - -static Standard_Integer stepfileunits (Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - - if( argc < 2) - { - di << "Error: Invalid number of parameters. Should be: getfileunits name_file\n"; - return 1; - } - STEPControl_Reader aStepReader; - - IFSelect_ReturnStatus readstat = IFSelect_RetVoid; - readstat = aStepReader.ReadFile (argv[1]); - - if (readstat != IFSelect_RetDone) { - - di<<"No model loaded\n"; - return 1; - } - - TColStd_SequenceOfAsciiString anUnitLengthNames; - TColStd_SequenceOfAsciiString anUnitAngleNames; - TColStd_SequenceOfAsciiString anUnitSolidAngleNames; - aStepReader.FileUnits( anUnitLengthNames,anUnitAngleNames,anUnitSolidAngleNames); - - Standard_Integer i =1; - di<<"=====================================================\n"; - di<<"LENGTH Unit\n"; - for( ; i <= anUnitLengthNames.Length() ; i++) - di<xset name command ... - //! Other commands can be accessed directly or under command xstep - //! SDS>command ... and SDS>xstep command ... are equivalent - //! - //! Only the command xinit is accessed directly only : - //! SDS>xinit (from the already defined Controller) - //! SDS>xinit iges (first defines the Controller as for "iges") - //! - //! It also records the function to be called by DRAW (not - //! declared because specific). - //! And it defines the context variables, i.e. a WorkSession, then - //! it calls SetController with the currently defined Controller - //! Remark : at least, the standard commands are recorded - //! - //! See also Controller : it is part of the Context, but it must - //! be precised separately - Standard_EXPORT static void LoadDraw(Draw_Interpretor& theCommands); - - //! Allows to execute a xstep-draw command from C++ program - //! Fixed form : Execute("command args..."); - //! Form with a variable text part : add %s for the variable : - //! Execute ("command args %s args..",var) [var is a CString] - //! Returns the same value as returned by call from DRAW - Standard_EXPORT static Standard_Integer Execute(const Standard_CString command, const Standard_CString var = ""); - - //! Returns the SessionPilot (can be used for direct call) - Standard_EXPORT static Handle(IFSelect_SessionPilot) Pilot(); - //! Returns the WorkSession defined in AddDraw (through Pilot) //! It is from XSControl, it brings functionalities for Transfers Standard_EXPORT static Handle(XSControl_WorkSession) Session(); - //! Defines a Controller for the command "xinit" and applies it - //! (i.e. calls its method Customise) - Standard_EXPORT static void SetController(const Handle(XSControl_Controller)& control); - - //! Returns the Controller, a Null Handle if not yet defined - Standard_EXPORT static Handle(XSControl_Controller) Controller(); - - //! Sets a norm by its name (controller recorded as ) - //! Returns True if done, False if this norm is unknown - Standard_EXPORT static Standard_Boolean SetNorm(const Standard_CString normname); - - //! Returns the actually defined Protocol - Standard_EXPORT static Handle(Interface_Protocol) Protocol(); - - //! Returns the Model of the Session (it is Session()->Model() ) - Standard_EXPORT static Handle(Interface_InterfaceModel) Model(); - - //! Sets a Model in session (it is Session()->SetModel(model) ) - //! If is defined, SetLoadedFile is also done - Standard_EXPORT static void SetModel(const Handle(Interface_InterfaceModel)& model, const Standard_CString file = ""); - - //! Produces a new model (from the Controller), can be Null - //! Does not set it in the session - Standard_EXPORT static Handle(Interface_InterfaceModel) NewModel(); - - //! Returns the entity n0 of the Model of the Session - //! (it is StartingEntity) - //! Null Handle if is not suitable - Standard_EXPORT static Handle(Standard_Transient) Entity(const Standard_Integer num); - - //! Returns the number of an entity in the Model (StartingNumber) - //! 0 if unknown in the model, or null - Standard_EXPORT static Standard_Integer Number(const Handle(Standard_Transient)& ent); - - //! Sets a TransferProcess in order to analyse it (see Activator) - //! It can be either a FinderProcess or a TransientProcess, in - //! that case a new TransferReader is created on it - Standard_EXPORT static void SetTransferProcess(const Handle(Standard_Transient)& TP); - - //! Returns the TransferProcess : TransientProcess detained by - //! the TransferReader - Standard_EXPORT static Handle(Transfer_TransientProcess) TransientProcess(); - - //! Returns the FinderProcess, detained by the TransferWriter - Standard_EXPORT static Handle(Transfer_FinderProcess) FinderProcess(); - - //! Initialises a TransferReader, according to mode : - //! 0 nullifies it, 1 clears it (not nullify) - //! 2 sets it with TransientProcess & Model - //! 3 idem plus roots of TransientProcess - //! Remark : called with 0 at least at each SetModel/NewModel - Standard_EXPORT static void InitTransferReader(const Standard_Integer mode); - - //! Returns the current TransferReader, can be null - //! It detains the TransientProcess - Standard_EXPORT static Handle(XSControl_TransferReader) TransferReader(); - - //! Takes the name of an entity, either as argument, or (if - //! is empty) on keyboard, and returns the entity - //! name can be a label or a number (in alphanumeric), it is - //! searched by NumberFromLabel from WorkSession. - //! If doesn't match en entity, a Null Handle is returned - Standard_EXPORT static Handle(Standard_Transient) GetEntity(const Standard_CString name = ""); - - //! Same as GetEntity, but returns the number in the model of the - //! entity. Returns 0 for null handle - Standard_EXPORT static Standard_Integer GetEntityNumber(const Standard_CString name = ""); - //! Evaluates and returns a list of entity, from : //! keyboard if and are empty, see below //! first if second is empty : can be a number/label of an entity @@ -180,36 +60,14 @@ public: //! Standard_EXPORT static Standard_Real GetLengthUnit(const Handle(TDocStd_Document)& theDoc = nullptr); + //! + Standard_EXPORT static XSControl_WorkSessionMap& WorkSessionList(); + //! Standard_EXPORT static void CollectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS, const TCollection_AsciiString& theName, XSControl_WorkSessionMap& theMap, const Standard_Boolean theIsFirst = Standard_True); - - //! Analyses given file name and variable name, with a default - //! name for variables. Returns resulting file name and variable - //! name plus status "file to read"(True) or "already read"(False) - //! In the latter case, empty resfile means no file available - //! - //! If is null or empty or equates ".", considers Session - //! and returned status is False - //! Else, returns resfile = file and status is True - //! If is neither null nor empty, resvar = var - //! Else, the root part of is considered, if defined - //! Else, is taken - Standard_EXPORT static Standard_Boolean FileAndVar(const Standard_CString file, const Standard_CString var, const Standard_CString def, TCollection_AsciiString& resfile, TCollection_AsciiString& resvar); - - //! Analyses a name as designating Shapes from DRAW variables or - //! XSTEP transfer (last Transfer on Reading). can be : - //! "*" : all the root shapes produced by last Transfer (Read) - //! i.e. considers roots of the TransientProcess - //! a name : a name of a variable DRAW - //! - //! Returns the count of designated Shapes. Their list is put in - //! . If is null, it is firstly created. Then it is - //! completed (Append without Clear) by the Shapes found - //! Returns 0 if no Shape could be found - Standard_EXPORT static Standard_Integer MoreShapes(Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name); }; #endif // _XSDRAWBase_HeaderFile diff --git a/src/XSDRAWDEWrapper/XSDRAWDEWrapper.cxx b/src/XSDRAWDEWrapper/XSDRAWDEWrapper.cxx index af6f49e9df..7363f0fb5e 100644 --- a/src/XSDRAWDEWrapper/XSDRAWDEWrapper.cxx +++ b/src/XSDRAWDEWrapper/XSDRAWDEWrapper.cxx @@ -269,7 +269,7 @@ static Standard_Integer ReadFile(Draw_Interpretor& theDI, { DBRep::Set(aDocShapeName.ToCString(), aShape); } - XSDRAWBase::CollectActiveWorkSessions(aWS, aFilePath, THE_PREVIOUS_WORK_SESSIONS); + XSDRAWBase::CollectActiveWorkSessions(aWS, aFilePath, XSDRAWBase::WorkSessionList()); } if (!aStat) { @@ -364,10 +364,14 @@ static Standard_Integer WriteFile(Draw_Interpretor& theDI, { return 1; } - XSDRAWBase::CollectActiveWorkSessions(aWS, aFilePath, THE_PREVIOUS_WORK_SESSIONS); + XSDRAWBase::CollectActiveWorkSessions(aWS, aFilePath, XSDRAWBase::WorkSessionList()); return 0; } +//======================================================================= +//function : Factory +//purpose : +//======================================================================= void XSDRAWDEWrapper::Factory(Draw_Interpretor& theDI) { static Standard_Boolean initactor = Standard_False; @@ -377,7 +381,7 @@ void XSDRAWDEWrapper::Factory(Draw_Interpretor& theDI) } initactor = Standard_True; - Standard_CString g = "XDE translation commands"; + Standard_CString aGroup = "XDE translation commands"; theDI.Add("DumpConfiguration", "DumpConfiguration [-path ] [-recursive {on|off}] [-format fmt1 fmt2 ...] [-vendor vend1 vend2 ...]\n" "\n\t\t: Dump special resource generated from global configuration." @@ -385,33 +389,33 @@ void XSDRAWDEWrapper::Factory(Draw_Interpretor& theDI) "\n\t\t: '-recursive' - flag to generate a resource from providers. Default is On. Off disables other options" "\n\t\t: '-format' - flag to generate a resource for choosen formats. If list is empty, generate it for all" "\n\t\t: '-vendor' - flag to generate a resource for choosen vendors. If list is empty, generate it for all", - __FILE__, DumpConfiguration, g); + __FILE__, DumpConfiguration, aGroup); theDI.Add("LoadConfiguration", "LoadConfiguration conf [-recursive {on|off}]\n" "\n\t\t: 'conf' - path to the resouce file or string value in the special format" "\n\t\t: '-recursive' - flag to generate a resource for all providers. Default is true" "\n\t\t: Configure global configuration according special resource", - __FILE__, LoadConfiguration, g); + __FILE__, LoadConfiguration, aGroup); theDI.Add("CompareConfiguration", "CompareConfiguration conf1 conf2\n" "\n\t\t: 'conf1' - path to the first resouce file or string value in the special format" "\n\t\t: 'conf2' - path to the second resouce file or string value in the special format" "\n\t\t: Compare two configurations", - __FILE__, CompareConfiguration, g); + __FILE__, CompareConfiguration, aGroup); theDI.Add("ReadFile", "ReadFile docName filePath [-conf ]\n" "\n\t\t: Read CAD file to document with registered format's providers. Use global configuration by default.", - __FILE__, ReadFile, g); + __FILE__, ReadFile, aGroup); theDI.Add("readfile", "readfile shapeName filePath [-conf ]\n" "\n\t\t: Read CAD file to shape with registered format's providers. Use global configuration by default.", - __FILE__, ReadFile, g); + __FILE__, ReadFile, aGroup); theDI.Add("WriteFile", "WriteFile docName filePath [-conf ]\n" "\n\t\t: Write CAD file to document with registered format's providers. Use global configuration by default.", - __FILE__, WriteFile, g); + __FILE__, WriteFile, aGroup); theDI.Add("writefile", "writefile shapeName filePath [-conf ]\n" "\n\t\t: Write CAD file to shape with registered format's providers. Use global configuration by default.", - __FILE__, WriteFile, g); + __FILE__, WriteFile, aGroup); } diff --git a/src/XSDRAWDEWrapper/XSDRAWDEWrapper.hxx b/src/XSDRAWDEWrapper/XSDRAWDEWrapper.hxx index 33612282e7..5f8ffc6f6e 100644 --- a/src/XSDRAWDEWrapper/XSDRAWDEWrapper.hxx +++ b/src/XSDRAWDEWrapper/XSDRAWDEWrapper.hxx @@ -24,8 +24,6 @@ class XSDRAWDEWrapper 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); }; diff --git a/src/XSDRAWGLTF/XSDRAWGLTF.cxx b/src/XSDRAWGLTF/XSDRAWGLTF.cxx index 18d2a1020f..c0b582963a 100644 --- a/src/XSDRAWGLTF/XSDRAWGLTF.cxx +++ b/src/XSDRAWGLTF/XSDRAWGLTF.cxx @@ -485,7 +485,7 @@ static Standard_Integer WriteGltf(Draw_Interpretor& theDI, //======================================================================= void XSDRAWGLTF::Factory(Draw_Interpretor& theDI) { - const char* g = "XSTEP-STL/VRML"; // Step transfer file commands + const char* aGroup = "XSTEP-STL/VRML"; // Step transfer file commands theDI.Add("ReadGltf", "ReadGltf Doc file [-parallel {on|off}] [-listExternalFiles] [-noCreateDoc] [-doublePrecision {on|off}] [-assetInfo]" @@ -501,11 +501,11 @@ void XSDRAWGLTF::Factory(Draw_Interpretor& theDI) "\n\t\t: -allScenes load all scenes defined in the document instead of default one (false by default)" "\n\t\t: -toPrintDebugInfo print additional debug information during data reading" "\n\t\t: -assetInfo print asset information", - __FILE__, ReadGltf, g); + __FILE__, ReadGltf, aGroup); theDI.Add("readgltf", "readgltf shape file" "\n\t\t: Same as ReadGltf but reads glTF file into a shape instead of a document.", - __FILE__, ReadGltf, g); + __FILE__, ReadGltf, aGroup); theDI.Add("WriteGltf", "WriteGltf Doc file [-trsfFormat {compact|TRS|mat4}]=compact" "\n\t\t: [-systemCoordSys {Zup|Yup}]=Zup" @@ -535,12 +535,8 @@ void XSDRAWGLTF::Factory(Draw_Interpretor& theDI) "\n and custom attributes when using Draco compression (by default 12)" "\n\t\t: -unifiedQuantization quantization is applied on each primitive separately if this option is false" "\n\t\t: -parallel use multithreading for Draco compression", - __FILE__, WriteGltf, g); + __FILE__, WriteGltf, aGroup); theDI.Add("writegltf", "writegltf shape file", - __FILE__, WriteGltf, g); - XSDRAWBase::LoadDraw(theDI); -#ifdef OCCT_DEBUG - theDI << "Draw Plugin : All XSDRAWGLTF commands are loaded\n"; -#endif + __FILE__, WriteGltf, aGroup); } diff --git a/src/XSDRAWGLTF/XSDRAWGLTF.hxx b/src/XSDRAWGLTF/XSDRAWGLTF.hxx index 468b1c52ed..092c3add23 100644 --- a/src/XSDRAWGLTF/XSDRAWGLTF.hxx +++ b/src/XSDRAWGLTF/XSDRAWGLTF.hxx @@ -24,8 +24,6 @@ class XSDRAWGLTF DEFINE_STANDARD_ALLOC public: - Standard_EXPORT static void Init(); - //! Loads all Draw commands of XSDRAWGLTF. Used for plugin. Standard_EXPORT static void Factory(Draw_Interpretor& theDI); }; diff --git a/src/XSDRAWIGES/XSDRAWIGES.cxx b/src/XSDRAWIGES/XSDRAWIGES.cxx index 022d690c47..85e3a5486e 100644 --- a/src/XSDRAWIGES/XSDRAWIGES.cxx +++ b/src/XSDRAWIGES/XSDRAWIGES.cxx @@ -364,38 +364,38 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI, 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 @@ -462,56 +462,56 @@ static Standard_Integer brepiges(Draw_Interpretor& theDI, 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 @@ -612,73 +612,73 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI, 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(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 : ReadIges @@ -730,7 +730,7 @@ static Standard_Integer ReadIges(Draw_Interpretor& theDI, theDI << "Error: Can't read IGES file\n"; return 1; } - XSDRAWBase::CollectActiveWorkSessions(aWS, theArgVec[2], THE_PREVIOUS_WORK_SESSIONS); + XSDRAWBase::CollectActiveWorkSessions(aWS, theArgVec[2], XSDRAWBase::WorkSessionList()); Message::SendInfo() << "Document saved with name " << theArgVec[1]; return 0; } @@ -783,7 +783,7 @@ static Standard_Integer WriteIges(Draw_Interpretor& theDI, theDI << "Error: Can't write IGES file\n"; return 1; } - XSDRAWBase::CollectActiveWorkSessions(aWS, aPath, THE_PREVIOUS_WORK_SESSIONS); + XSDRAWBase::CollectActiveWorkSessions(aWS, aPath, XSDRAWBase::WorkSessionList()); return 0; } @@ -794,18 +794,20 @@ static Standard_Integer WriteIges(Draw_Interpretor& theDI, //======================================================================= void XSDRAWIGES::Factory(Draw_Interpretor& theDI) { - const char* g = "DE: IGES"; - theDI.Add("igesbrep", "igesbrep [file else already loaded model] [name DRAW]", __FILE__, igesbrep, g); - theDI.Add("testreadiges", "testreadiges [file else already loaded model] [name DRAW]", __FILE__, testread, g); - theDI.Add("igesread", "igesread [file else already loaded model] [name DRAW]", __FILE__, igesbrep, g); - theDI.Add("igesparam", "igesparam ->list, + name ->one param, + name val->change", __FILE__, igesparam, g); - theDI.Add("TPSTAT", " ", __FILE__, XSDRAWIGES_TPSTAT, g); - theDI.Add("tplosttrim", "number of untrimmed faces during last transfer", __FILE__, XSDRAWIGES_tplosttrim, g); - theDI.Add("etest", "test of eviewer", __FILE__, etest, g); - - theDI.Add("ReadIges", "Doc filename: Read IGES file to DECAF document", __FILE__, ReadIges, g); - theDI.Add("WriteIges", "Doc filename: Write DECAF document to IGES file", __FILE__, WriteIges, g); - theDI.Add("brepiges", "brepiges sh1 [+sh2 [+sh3 ..]] filename.igs", __FILE__, brepiges, g); - theDI.Add("testwriteiges", "testwriteiges filename.igs shape", __FILE__, testwrite, g); + 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("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); } diff --git a/src/XSDRAWIGES/XSDRAWIGES.hxx b/src/XSDRAWIGES/XSDRAWIGES.hxx index 3d1e322b3c..19a0a447e2 100644 --- a/src/XSDRAWIGES/XSDRAWIGES.hxx +++ b/src/XSDRAWIGES/XSDRAWIGES.hxx @@ -24,9 +24,7 @@ class XSDRAWIGES DEFINE_STANDARD_ALLOC public: - Standard_EXPORT static void Init(); - - //! Loads all Draw commands of XSDRAWSTL. Used for plugin. + //! Loads all Draw commands of XSDRAWIGES. Used for plugin. Standard_EXPORT static void Factory(Draw_Interpretor& theDI); }; diff --git a/src/XSDRAWOBJ/XSDRAWOBJ.hxx b/src/XSDRAWOBJ/XSDRAWOBJ.hxx index 897bcdaf4d..d935601004 100644 --- a/src/XSDRAWOBJ/XSDRAWOBJ.hxx +++ b/src/XSDRAWOBJ/XSDRAWOBJ.hxx @@ -24,9 +24,7 @@ class XSDRAWOBJ DEFINE_STANDARD_ALLOC public: - Standard_EXPORT static void Init(); - - //! Loads all Draw commands of XSDRAWSTL. Used for plugin. + //! Loads all Draw commands of XSDRAWOBJ. Used for plugin. Standard_EXPORT static void Factory(Draw_Interpretor& theDI); }; diff --git a/src/XSDRAWPLY/XSDRAWPLY.cxx b/src/XSDRAWPLY/XSDRAWPLY.cxx index 10f8bdaf49..762f937102 100644 --- a/src/XSDRAWPLY/XSDRAWPLY.cxx +++ b/src/XSDRAWPLY/XSDRAWPLY.cxx @@ -11,205 +11,30 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include -#include -//#include -//#include -#include -#include #include #include #include #include #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include -//#include -//#include -//#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include -//#include -#include -#include -//#include -//#include +#include #include #include -//#include -#include -//#include -//#include -//#include -//#include -//#include -//#include -#include -#include -#include -#include #include #include -#include -#include -#include +#include #include #include -#include -#include -#include -#include -#include -//#include -//#include -//#include -//#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef _STDIO_H -#include -#endif - -extern Standard_Boolean VDisplayAISObject(const TCollection_AsciiString& theName, - const Handle(AIS_InteractiveObject)& theAISObj, - Standard_Boolean theReplaceIfExists = Standard_True); - -//============================================================================= -//function : parseNameFormat -//purpose : Parse RWMesh_NameFormat enumeration -//============================================================================= -static bool parseNameFormat(const char* theArg, - RWMesh_NameFormat& theFormat) -{ - TCollection_AsciiString aName(theArg); - aName.LowerCase(); - if (aName == "empty") - { - theFormat = RWMesh_NameFormat_Empty; - } - else if (aName == "product" - || aName == "prod") - { - theFormat = RWMesh_NameFormat_Product; - } - else if (aName == "instance" - || aName == "inst") - { - theFormat = RWMesh_NameFormat_Instance; - } - else if (aName == "instanceorproduct" - || aName == "instance||product" - || aName == "instance|product" - || aName == "instorprod" - || aName == "inst||prod" - || aName == "inst|prod") - { - theFormat = RWMesh_NameFormat_InstanceOrProduct; - } - else if (aName == "productorinstance" - || aName == "product||instance" - || aName == "product|instance" - || aName == "prodorinst" - || aName == "prod||inst" - || aName == "prod|inst") - { - theFormat = RWMesh_NameFormat_ProductOrInstance; - } - else if (aName == "productandinstance" - || aName == "prodandinst" - || aName == "product&instance" - || aName == "prod&inst") - { - theFormat = RWMesh_NameFormat_ProductAndInstance; - } - else if (aName == "productandinstanceandocaf" - || aName == "verbose" - || aName == "debug") - { - theFormat = RWMesh_NameFormat_ProductAndInstanceAndOcaf; - } - else - { - return false; - } - return true; -} - -//============================================================================= -//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 : 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 : writeply @@ -226,8 +51,6 @@ static Standard_Integer WritePly(Draw_Interpretor& theDI, Standard_Real aDist = 0.0; Standard_Real aDens = Precision::Infinite(); Standard_Real aTol = Precision::Confusion(); - //bool hasColors = true, hasNormals = true, hasTexCoords = false, hasPartId = true, hasFaceId = false; - //TColStd_IndexedDataMapOfStringString aFileInfo; bool isPntSet = false, isDensityPoints = false; for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter) { @@ -378,7 +201,7 @@ static Standard_Integer WritePly(Draw_Interpretor& theDI, theDI << "Syntax error: wrong number of arguments\n"; return 1; } - aNode->GlobalParameters.LengthUnit = GetLengthUnit(aDoc); + aNode->GlobalParameters.LengthUnit = XSDRAWBase::GetLengthUnit(aDoc); if (isPntSet) { @@ -486,12 +309,13 @@ static Standard_Integer WritePly(Draw_Interpretor& theDI, { Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI, 1); Handle(RWPly_Provider) aProvider = new RWPly_Provider(aNode); - Handle(XSControl_WorkSession) aWS = XSDRAW::Session(); + Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session(); if (!aProvider->Write(theArgVec[2], aDoc, aWS, aProgress->Start())) { theDI << "Error: file writing failed '" << theArgVec[2] << "'\n"; return 1; } + XSDRAWBase::CollectActiveWorkSessions(aWS, theArgVec[2], XSDRAWBase::WorkSessionList()); } return 0; } @@ -500,11 +324,11 @@ static Standard_Integer WritePly(Draw_Interpretor& theDI, //function : InitCommands //purpose : //======================================================================= -void XSDRAWSTLVRML::InitCommands(Draw_Interpretor& theCommands) +void XSDRAWPLY::Factory(Draw_Interpretor& theDI) { const char* g = "XSTEP-STL/VRML"; // Step transfer file commands //XSDRAW::LoadDraw(theCommands); - theCommands.Add("WritePly", R"( + theDI.Add("WritePly", R"( WritePly Doc file [-normals {0|1}]=1 [-colors {0|1}]=1 [-uv {0|1}]=0 [-partId {0|1}]=1 [-faceId {0|1}]=0 [-pointCloud {0|1}]=0 [-distance Value]=0.0 [-density Value] [-tolerance Value] Write document or triangulated shape into PLY file. @@ -520,23 +344,7 @@ Generate point cloud out of the shape and write it into PLY file. -density sets density of points to generate randomly on surface; -tolerance sets tolerance; default value is Precision::Confusion(); )", __FILE__, WritePly, g); - theCommands.Add("writeply", - "writeply shape file", - __FILE__, WritePly, g); -} - -//======================================================================= -//function : Factory -//purpose : -//======================================================================= -void XSDRAWPLY::Factory(Draw_Interpretor& theDI) -{ - XSDRAWIGES::InitSelect(); - XSDRAWIGES::InitToBRep(theDI); - XSDRAWIGES::InitFromBRep(theDI); - XSDRAWSTLVRML::InitCommands(theDI); - XSDRAW::LoadDraw(theDI); -#ifdef OCCT_DEBUG - theDI << "Draw Plugin : All TKXSDRAW commands are loaded\n"; -#endif + theDI.Add("writeply", + "writeply shape file", + __FILE__, WritePly, g); } diff --git a/src/XSDRAWPLY/XSDRAWPLY.hxx b/src/XSDRAWPLY/XSDRAWPLY.hxx index 385b605560..0802003255 100644 --- a/src/XSDRAWPLY/XSDRAWPLY.hxx +++ b/src/XSDRAWPLY/XSDRAWPLY.hxx @@ -24,9 +24,7 @@ class XSDRAWPLY DEFINE_STANDARD_ALLOC public: - Standard_EXPORT static void Init(); - - //! Loads all Draw commands of XSDRAWSTL. Used for plugin. + //! Loads all Draw commands of XSDRAWPLY. Used for plugin. Standard_EXPORT static void Factory(Draw_Interpretor& theDI); }; diff --git a/src/XSDRAWSTEP/XSDRAWSTEP.cxx b/src/XSDRAWSTEP/XSDRAWSTEP.cxx index c28e28ae79..3daa2fdb2c 100644 --- a/src/XSDRAWSTEP/XSDRAWSTEP.cxx +++ b/src/XSDRAWSTEP/XSDRAWSTEP.cxx @@ -59,10 +59,6 @@ static Standard_Integer stepread(Draw_Interpretor& theDI, theDI << "Use: stepread [file] [f or r (type of model full or reduced)]\n"; return 1; } - // On admet le controller AP214 ou une variante - DeclareAndCast(STEPControl_Controller, ctl, XSDRAWBase::Controller()); - if (ctl.IsNull()) XSDRAWBase::SetNorm("STEP"); - // Progress indicator Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator(theDI, 1); @@ -97,7 +93,6 @@ static Standard_Integer stepread(Draw_Interpretor& theDI, } else fromtcl = Standard_True; - } if (!fromtcl) fromtcl = theNbArgs > k; @@ -254,56 +249,56 @@ static Standard_Integer stepread(Draw_Interpretor& theDI, 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 @@ -319,7 +314,11 @@ static Standard_Integer steptrans(Draw_Interpretor& theDI, return 1; } TopoDS_Shape shape = DBRep::Get(theArgVec[1]); - if (shape.IsNull()) { theDI << "Not a shape : " << theArgVec[1] << "\n"; return 1; } + if (shape.IsNull()) + { + theDI << "Not a shape : " << theArgVec[1] << "\n"; + return 1; + } Handle(StepGeom_Axis2Placement3d) ax1, ax2; Standard_Integer n1 = 0, n2 = 0; n1 = XSDRAWBase::GetEntityNumber(theArgVec[3]); @@ -337,7 +336,8 @@ static Standard_Integer steptrans(Draw_Interpretor& theDI, DBRep::Set(theArgVec[2], shape); theDI << "Transformed Shape as " << theArgVec[2] << "\n"; } - else theDI << "No transformation computed\n"; + else + theDI << "No transformation computed\n"; return 0; } @@ -351,15 +351,6 @@ static Standard_Integer stepwrite(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - // On admet le controller AP214 ou une variante - DeclareAndCast(STEPControl_Controller, ctl, XSDRAWBase::Controller()); - if (ctl.IsNull()) - { - XSDRAWBase::SetNorm("STEP"); - //sln 14.01.2002 OCC51: assign new value to ctl in order to avoid exception during using one in the function - ctl = Handle(STEPControl_Controller)::DownCast(XSDRAWBase::Controller()); - } - if (theNbArgs < 3) { theDI << "Give mode[1-4] and Shape name + optional file. Mode possible\n"; @@ -440,82 +431,82 @@ static Standard_Integer stepwrite(Draw_Interpretor& theDI, 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 : 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 : countexpected @@ -525,8 +516,7 @@ static Standard_Integer countexpected(Draw_Interpretor& theDI, Standard_Integer /*theNbArgs*/, const char** /*theArgVec*/) { - Handle(IFSelect_SessionPilot) pilot = XSDRAWBase::Pilot(); - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(IFSelect_WorkSession) WS = XSDRAWBase::Session(); const Interface_Graph& graph = WS->Graph(); Handle(TColStd_HSequenceOfTransient) roots = WS->GiveList("xst-transferrable-roots", ""); @@ -560,8 +550,7 @@ static Standard_Integer dumpassembly(Draw_Interpretor& /*theDI*/, Standard_Integer /*theNbArgs*/, const char** /*theArgVec*/) { - Handle(IFSelect_SessionPilot) pilot = XSDRAWBase::Pilot(); - Handle(IFSelect_WorkSession) WS = pilot->Session(); + Handle(IFSelect_WorkSession) WS = XSDRAWBase::Session(); const Interface_Graph& graph = WS->Graph(); STEPSelections_AssemblyExplorer exp(graph); @@ -627,7 +616,6 @@ static Standard_Integer ReadStep(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - Standard_CString aDocName = NULL; TCollection_AsciiString aFilePath, aModeStr; bool aToTestStream = false; @@ -717,7 +705,7 @@ static Standard_Integer ReadStep(Draw_Interpretor& theDI, } Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument(aDoc); Draw::Set(aDocName, aDrawDoc); - XSDRAWBase::CollectActiveWorkSessions(aWS, aFilePath, THE_PREVIOUS_WORK_SESSIONS); + XSDRAWBase::CollectActiveWorkSessions(aWS, aFilePath, XSDRAWBase::WorkSessionList()); Message::SendInfo() << "Document saved with name " << aDocName; return 0; } @@ -850,7 +838,7 @@ static Standard_Integer WriteStep(Draw_Interpretor& theDI, theDI << "Cannot write any relevant data to the STEP file\n"; return 1; } - XSDRAWBase::CollectActiveWorkSessions(aWS, aFilePath, THE_PREVIOUS_WORK_SESSIONS); + XSDRAWBase::CollectActiveWorkSessions(aWS, aFilePath, XSDRAWBase::WorkSessionList()); return 0; } @@ -861,11 +849,11 @@ static Standard_Integer WriteStep(Draw_Interpretor& theDI, void XSDRAWSTEP::Factory(Draw_Interpretor& theDI) { 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); diff --git a/src/XSDRAWSTL/XSDRAWSTL.cxx b/src/XSDRAWSTL/XSDRAWSTL.cxx index 690683e7e3..0d345d657b 100644 --- a/src/XSDRAWSTL/XSDRAWSTL.cxx +++ b/src/XSDRAWSTL/XSDRAWSTL.cxx @@ -39,26 +39,25 @@ static Standard_Integer writestl(Draw_Interpretor& theDI, { theDI << "Use: " << theArgVec[0] << " shape file [ascii/binary (0/1) : 1 by default]\n"; + return 1; } - else + TopoDS_Shape aShape = DBRep::Get(theArgVec[1]); + Standard_Boolean isASCIIMode = Standard_False; + if (theNbArgs == 4) { - TopoDS_Shape aShape = DBRep::Get(theArgVec[1]); - Standard_Boolean isASCIIMode = Standard_False; - if (theNbArgs == 4) - { - isASCIIMode = (Draw::Atoi(theArgVec[3]) == 0); - } - Handle(RWStl_ConfigurationNode) aNode = new RWStl_ConfigurationNode(); - aNode->GlobalParameters.LengthUnit = XSDRAWBase::GetLengthUnit(); - Handle(RWStl_Provider) aProvider = new RWStl_Provider(aNode); - aNode->InternalParameters.WriteAscii = isASCIIMode; - Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session(); - Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI); - if (!aProvider->Write(theArgVec[2], aShape, aWS, aProgress->Start())) - { - theDI << "Error: Mesh writing has been failed.\n"; - } + isASCIIMode = (Draw::Atoi(theArgVec[3]) == 0); + } + Handle(RWStl_ConfigurationNode) aNode = new RWStl_ConfigurationNode(); + aNode->GlobalParameters.LengthUnit = XSDRAWBase::GetLengthUnit(); + Handle(RWStl_Provider) aProvider = new RWStl_Provider(aNode); + aNode->InternalParameters.WriteAscii = isASCIIMode; + Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session(); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI); + if (!aProvider->Write(theArgVec[2], aShape, aWS, aProgress->Start())) + { + theDI << "Error: Mesh writing has been failed.\n"; } + XSDRAWBase::CollectActiveWorkSessions(aWS, theArgVec[2], XSDRAWBase::WorkSessionList()); return 0; } @@ -159,6 +158,7 @@ static Standard_Integer readstl(Draw_Interpretor& theDI, return 1; } DBRep::Set(aShapeName.ToCString(), aShape); + XSDRAWBase::CollectActiveWorkSessions(aWS, aFilePath, XSDRAWBase::WorkSessionList()); return 0; } diff --git a/src/XSDRAWSTL/XSDRAWSTL.hxx b/src/XSDRAWSTL/XSDRAWSTL.hxx index 6e217031ab..32b4ca7c80 100644 --- a/src/XSDRAWSTL/XSDRAWSTL.hxx +++ b/src/XSDRAWSTL/XSDRAWSTL.hxx @@ -24,8 +24,6 @@ class XSDRAWSTL DEFINE_STANDARD_ALLOC public: - Standard_EXPORT static void Init(); - //! Loads all Draw commands of XSDRAWSTL. Used for plugin. Standard_EXPORT static void Factory(Draw_Interpretor& theDI); }; diff --git a/src/XSDRAWVRML/XSDRAWVRML.cxx b/src/XSDRAWVRML/XSDRAWVRML.cxx index 440a57741b..bff471d557 100644 --- a/src/XSDRAWVRML/XSDRAWVRML.cxx +++ b/src/XSDRAWVRML/XSDRAWVRML.cxx @@ -164,7 +164,7 @@ static Standard_Integer ReadVrml(Draw_Interpretor& theDI, TDataStd_Name::Set(aDoc->GetData()->Root(), aDocName); Handle(DDocStd_DrawDocument) aDD = new DDocStd_DrawDocument(aDoc); Draw::Set(aDocName, aDD); - XSDRAWBase::CollectActiveWorkSessions(aWS, aFilePath, THE_PREVIOUS_WORK_SESSIONS); + XSDRAWBase::CollectActiveWorkSessions(aWS, aFilePath, XSDRAWBase::WorkSessionList()); return 0; } @@ -208,7 +208,7 @@ static Standard_Integer WriteVrml(Draw_Interpretor& theDI, theDI << "Error: file writing failed '" << theArgVec[2] << "'\n"; return 1; } - XSDRAWBase::CollectActiveWorkSessions(aWS, theArgVec[2], THE_PREVIOUS_WORK_SESSIONS); + XSDRAWBase::CollectActiveWorkSessions(aWS, theArgVec[2], XSDRAWBase::WorkSessionList()); return 0; } @@ -296,14 +296,14 @@ static Standard_Integer writevrml(Draw_Interpretor& theDI, //============================================================================= void XSDRAWVRML::Factory(Draw_Interpretor& theDI) { - static Standard_Boolean initactor = Standard_False; - if (initactor) + static Standard_Boolean anInitActor = Standard_False; + if (anInitActor) { return; } - initactor = Standard_True; + anInitActor = Standard_True; - Standard_CString g = "XDE translation commands"; + Standard_CString aGroup = "XDE translation commands"; theDI.Add("ReadVrml", "ReadVrml docName filePath [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]" @@ -315,10 +315,10 @@ void XSDRAWVRML::Factory(Draw_Interpretor& theDI) "\n\t\t: -noCreateDoc read into existing XDE document." "\n\t\t: -fillIncomplete fill the document with partially retrieved data even if reader has failed with " "error; true when not specified", - __FILE__, ReadVrml, g); + __FILE__, ReadVrml, aGroup); theDI.Add("WriteVrml", "WriteVrml Doc filename [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 0 by default]", - __FILE__, WriteVrml, g); - theDI.Add("loadvrml", "shape file", __FILE__, loadvrml, g); - 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, g); + __FILE__, WriteVrml, aGroup); + theDI.Add("loadvrml", "shape file", __FILE__, loadvrml, aGroup); + theDI.Add("writevrml", "shape file [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 1 by default]", __FILE__, writevrml, aGroup); } diff --git a/src/XSDRAWVRML/XSDRAWVRML.hxx b/src/XSDRAWVRML/XSDRAWVRML.hxx index eb53a85efc..bc969ff83e 100644 --- a/src/XSDRAWVRML/XSDRAWVRML.hxx +++ b/src/XSDRAWVRML/XSDRAWVRML.hxx @@ -24,8 +24,6 @@ class XSDRAWVRML DEFINE_STANDARD_ALLOC public: - Standard_EXPORT static void Init(); - //! Loads all Draw commands of XSDRAWVRML. Used for plugin. Standard_EXPORT static void Factory(Draw_Interpretor& theDI); };