-// Copyright (c) 1999-2014 OPEN CASCADE SAS
+// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
-// Created on: 1995-03-14
-// Created by: Christian CAILLET
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
+// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
#include <Standard_Handle.hxx>
#include <Draw_Interpretor.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
-class IFSelect_SessionPilot;
-class XSControl_WorkSession;
-class XSControl_Controller;
-class Interface_Protocol;
-class Interface_InterfaceModel;
-class Standard_Transient;
-class Transfer_TransientProcess;
-class Transfer_FinderProcess;
-class XSControl_TransferReader;
-class TCollection_AsciiString;
-
//! Basic package to work functions of X-STEP (IFSelect & Co)
//! under control of DRAW
//! FinderProcess
class XSDRAW
{
- public:
+ DEFINE_STANDARD_ALLOC
+public:
+
+ Standard_EXPORT static void Init();
- //! Takes variables to/from the DRAW session
- //! Implements ProgressIndicator for DRAW
- //! Changes the name under which a command of xstep is known by
- //! Draw. This allows to avoid collisions
- //! To be called before LoadDraw or any other xstep initialisation
- Standard_EXPORT static void ChangeCommand (const Standard_CString oldname, const Standard_CString newname);
-
- //! Removes a command from the interpretation list of Draw
- //! To be called before LoadDraw or any other xstep initialisation
- Standard_EXPORT static void RemoveCommand (const Standard_CString oldname);
-
- //! Defines the basic context to work with a X-STEP Session :
- //! it performs the basic inits, also records the Controller
- //! If the Controller is not yet set, it must be set after
- //! (call to SetController)
- //! LoadSession is called by LoadDraw
- //! Returns True the first time, False if already called
- Standard_EXPORT static Standard_Boolean LoadSession();
-
- //! Defines the context for using a X-STEP Session under DRAW
- //! Once the various INITs have been done, a call to LoadDraw
- //! records the defined commands for the X-STEP SessionPilot,
- //! into the DRAW interpretation list.
- //! "Set" commands are accessed under command xset
- //! SDS>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 <normname> )
- //! 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 <file> 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 <num> of the Model of the Session
- //! (it is StartingEntity)
- //! Null Handle if <num> 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 <ent> 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 <name>
- //! 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 <name> 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 <first> and <second> are empty, see below
- //! first if second is empty : can be a number/label of an entity
- //! or the name of a selection to be evaluated (standard)
- //! first : name of a selection, evaluated from a list defined by
- //! second
- //! In case of failure, returns a Null Handle
- Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) GetList (const Standard_CString first = "", const Standard_CString second = "");
-
- //! 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 <file> is null or empty or equates ".", considers Session
- //! and returned status is False
- //! Else, returns resfile = file and status is True
- //! If <var> is neither null nor empty, resvar = var
- //! Else, the root part of <resfile> is considered, if defined
- //! Else, <def> 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). <name> 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
- //! <list>. If <list> 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);
+ //! Loads all Draw commands of XSDRAWDEWrapper. Used for plugin.
+ Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
};
#endif // _XSDRAW_HeaderFile
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
+// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <XSDRAW_Functions.hxx>
#include <IFSelect_Act.hxx>
#include <IFSelect_CheckCounter.hxx>
-#include <IFSelect_Functions.hxx>
#include <IFSelect_SessionPilot.hxx>
#include <Interface_Static.hxx>
#include <Message.hxx>
#include <Transfer_TransientProcess.hxx>
#include <XSControl.hxx>
#include <XSControl_Controller.hxx>
-#include <XSDRAW_Functions.hxx>
+#include <XSDRAWBase.hxx>
#include <XSControl_SelectForTransfer.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_TransferWriter.hxx>
#include <XSControl_WorkSession.hxx>
//=======================================================================
-//function : xinit
+//function : XSControl_xinit
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_xinit(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_xinit(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- // **** xinit ****
- if (argc > 1) return (XSControl::Session(pilot)->SelectNorm(arg1) ?
- IFSelect_RetDone : IFSelect_RetFail);
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout << "Selected Norm:" << XSControl::Session(pilot)->SelectedNorm() << std::endl;
- return IFSelect_RetVoid;
+ if (theNbArgs != 2 && theNbArgs != 1)
+ {
+ theDI << "Error:";
+ return 1;
+ }
+ if (theNbArgs > 1)
+ {
+ if (!XSDRAWBase::Session()->SelectNorm(theArgVec[1]));
+ {
+ theDI << "Error:";
+ return 1;
+ }
+ }
+ else
+ {
+ Message::SendInfo() << "Selected Norm:";
+ theDI << XSDRAWBase::Session()->SelectedNorm() << "\n";
+ }
+ return 0;
}
//=======================================================================
-//function : xnorm
+//function : XSControl_xnorm
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_xnorm(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_xnorm(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- // **** xnorm ****
- Handle(XSControl_WorkSession) WS = XSControl::Session(pilot);
+ Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
Handle(XSControl_Controller) control = WS->NormAdaptor();
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc == 1)
- sout << "Current Norm. xnorm newnorm to change" << std::endl;
- else sout << "Current Norm :" << std::endl;
- if (control.IsNull()) sout << "no norm currently defined" << std::endl;
+ if (theNbArgs == 1)
+ {
+ Message::SendInfo() << "Current Norm. xnorm newnorm to change";
+ }
else
- sout << " Long Name (complete) : " << control->Name(Standard_False) << std::endl
- << " Short name (resource) : " << control->Name(Standard_True) << std::endl;
- if (argc == 1) return IFSelect_RetVoid;
+ {
+ Message::SendInfo() << "Selected Norm:";
+ }
+ if (control.IsNull())
+ {
+ Message::SendInfo() << "no norm currently defined";
+ }
+ else
+ {
+ Message::SendInfo() << " Long Name (complete) : "
+ << control->Name(Standard_False) << std::endl
+ << " Short name (resource) : " << control->Name(Standard_True) << std::endl;
+ }
+ if (theNbArgs == 1)
+ {
+ return 0;
+ }
- control = XSControl_Controller::Recorded(arg1);
+ control = XSControl_Controller::Recorded(theArgVec[1]);
if (control.IsNull())
{
- sout << " No norm named : " << arg1 << std::endl;
- return IFSelect_RetError;
+ Message::SendInfo() << " No norm named : " << theArgVec[1] << std::endl;
+ return 1;
}
WS->SetController(control);
- sout << "new norm : " << control->Name() << std::endl;
- return IFSelect_RetDone;
+ Message::SendInfo() << "new norm : " << control->Name() << std::endl;
+ return 0;
}
//=======================================================================
-//function : newmodel
+//function : XSControl_newmodel
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_newmodel(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_newmodel(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- // **** newmodel ****
- if (!XSControl::Session(pilot)->NewModel().IsNull()) return IFSelect_RetDone;
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout << "No new Model produced" << std::endl;
- return IFSelect_RetFail;
+ if (!XSDRAWBase::Session()->NewModel().IsNull())
+ {
+ return 0;
+ }
+ Message::SendInfo() << "No new Model produced" << std::endl;
+ return 1;
}
//=======================================================================
-//function : tpclear
+//function : XSControl_tpclear
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpclear(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_tpclear(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- // **** tpclear/twclear ****
- const Standard_Boolean modew = (pilot->Word(0).Value(2) == 'w');
- const Handle(Transfer_FinderProcess)& FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess();
- const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (modew) { if (!FP.IsNull()) FP->Clear(); else sout << "No Transfer Write" << std::endl; }
- else { if (!TP.IsNull()) TP->Clear(); else sout << "No Transfer Read" << std::endl; }
- return IFSelect_RetDone;
+ const Standard_Boolean modew = (theArgVec[0][2] == 'w');
+ Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+ const Handle(Transfer_FinderProcess)& FP =
+ WS->TransferWriter()->FinderProcess();
+ const Handle(Transfer_TransientProcess)& TP =
+ WS->TransferReader()->TransientProcess();
+ if (modew)
+ {
+ if (!FP.IsNull()) FP->Clear();
+ else Message::SendInfo() << "No Transfer Write" << std::endl;
+ }
+ else
+ {
+ if (!TP.IsNull())
+ TP->Clear();
+ else
+ Message::SendInfo() << "No Transfer Read" << std::endl;
+ }
+ return 0;
}
//=======================================================================
-//function : tpstat
+//function : XSControl_tpstat
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpstat(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_tpstat(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- //const Standard_CString arg2 = pilot->Arg(2);
- const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (TP.IsNull()) { sout << "No Transfer Read" << std::endl; return IFSelect_RetError; }
+ const Standard_CString arg1 = theArgVec[1];
+ Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+ const Handle(Transfer_TransientProcess)& TP =
+ WS->TransferReader()->TransientProcess();
+ if (TP.IsNull())
+ {
+ Message::SendInfo() << "No Transfer Read" << std::endl; return 1;
+ }
// **** tpstat ****
Standard_Integer mod1 = -1;
// ?n etc.. : idem sur resultats anormaux
// ? tout court pour help
- if (argc > 1)
+ if (theNbArgs > 1)
{
char a2 = arg1[1]; if (a2 == '\0') a2 = '!';
switch (arg1[0])
case 'F': mod1 = 5; mod2 = 2; break;
case '*': mod1 = 2; break;
case '?': mod1 = 3; break;
- default: mod1 = 1; if (argc > 2) mod1 = 2; a2 = arg1[0]; break;
+ default: mod1 = 1; if (theNbArgs > 2) mod1 = 2; a2 = arg1[0]; break;
}
if (mod1 < 1 || mod1 > 3) a2 = '!';
switch (a2)
}
}
// A present help eventuel
- if (mod1 < -1) sout << "Unknown Mode" << std::endl;
+ if (mod1 < -1)
+ Message::SendInfo() << "Unknown Mode";
if (mod1 < 0)
{
- sout << "Modes available :\n"
+ Message::SendInfo() << "Modes available :\n"
<< "g : general c : checks (count) C (list)\n"
<< " f : fails (count) F (list)\n"
<< " n : numbers of transferred entities (on TRANSFER ROOTS)\n"
<< " L : list per couple type entity/result\n"
<< " *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" << std::endl;
- if (mod1 < -1) return IFSelect_RetError;
- return IFSelect_RetVoid;
+ << " n select : n applied on a selection idem for s b t r l";
+ if (mod1 < -1) return 1;
+ return 0;
}
if (!TP.IsNull())
{
- sout << "TransferRead :";
- if (TP->Model() != pilot->Session()->Model()) sout << "Model differs from the session";
+ 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));
XSControl_TransferReader::PrintStatsOnList(TP, list, mod1, mod2);
- // TP->PrintStats (1,sout);
+ // TP->PrintStats (1,Message::SendInfo());
}
- else sout << "TransferRead : not defined" << std::endl;
- return IFSelect_RetVoid;
+ else Message::SendInfo() << "TransferRead : not defined" << std::endl;
+ return 0;
}
//=======================================================================
-//function : tpent
+//function : XSControl_tpent
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpent(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_tpent(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
+ const Standard_CString arg1 = theArgVec[1];
+ Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+ const Handle(Transfer_TransientProcess)& TP =
+ WS->TransferReader()->TransientProcess();
// **** tpent ****
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (TP.IsNull()) { sout << "No Transfer Read" << std::endl; return IFSelect_RetError; }
+ if (TP.IsNull())
+ {
+ Message::SendInfo() << "No Transfer Read";
+ return 1;
+ }
Handle(Interface_InterfaceModel) model = TP->Model();
- if (model.IsNull()) return IFSelect_RetFail;
+ if (model.IsNull())
+ return 1;
- if (argc < 2) { sout << "Give ENTITY NUMBER (IN MODEL TransferProcess)" << std::endl; return IFSelect_RetError; }
+ if (theNbArgs < 2)
+ {
+ Message::SendInfo() << "Give ENTITY NUMBER (IN MODEL TransferProcess)";
+ return 1;
+ }
Standard_Integer num = atoi(arg1);
- if (num <= 0 || num > model->NbEntities()) { sout << "Number not in [1 - " << model->NbEntities() << "]" << std::endl; return IFSelect_RetError; }
+ if (num <= 0 || num > model->NbEntities())
+ {
+ Message::SendInfo() << "Number not in [1 - "
+ << model->NbEntities() << "]";
+ return 1;
+ }
Handle(Standard_Transient) ent = model->Value(num);
Standard_Integer index = TP->MapIndex(ent);
- if (index == 0) sout << "Entity " << num << " not recorded in transfer" << std::endl;
- else XSControl::Session(pilot)->PrintTransferStatus(index, Standard_False, sout);
- return IFSelect_RetVoid;
+ if (index == 0)
+ Message::SendInfo() << "Entity " << num << " not recorded in transfer";
+ else
+ WS->PrintTransferStatus(index, Standard_False, Message::SendInfo());
+ return 0;
}
//=======================================================================
-//function : tpitem
+//function : XSControl_tpitem
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpitem(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_tpitem(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg1 = theArgVec[1];
// **** tpitem/tproot/twitem/twroot ****
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Give ITEM NUMBER (in TransferProcess)" << std::endl; return IFSelect_RetError; }
+ if (theNbArgs < 2)
+ {
+ Message::SendInfo() << "Give ITEM NUMBER (in TransferProcess)";
+ return 1;
+ }
Standard_Integer num = atoi(arg1);
- if (pilot->Word(0).Value(3) == 'r') num = -num;
+ if (theArgVec[0][3] == 'r') num = -num;
Standard_Boolean modew = Standard_False;
- if (pilot->Word(0).Value(2) == 'w') modew = Standard_True;
+ if (theArgVec[0][2] == 'w') modew = Standard_True;
Handle(Transfer_Binder) binder;
Handle(Transfer_Finder) finder;
Handle(Standard_Transient) ent;
- if (!XSControl::Session(pilot)->PrintTransferStatus(num, modew, sout))
+ if (!XSDRAWBase::Session()->PrintTransferStatus(num, modew, Message::SendInfo()))
{
- sout << " - Num=" << num << " incorrect" << std::endl;
+ Message::SendInfo() << " - Num=" << num << " incorrect";
}
- return IFSelect_RetVoid;
+ return 0;
}
//=======================================================================
-//function : trecord
+//function : XSControl_trecord
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_trecord(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_trecord(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg1 = theArgVec[1];
const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
// **** trecord : TransferReader ****
- Standard_Boolean tous = (argc == 1);
+ 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();
Handle(Standard_Transient) ent;
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo();
if (mdl.IsNull() || TR.IsNull() || TP.IsNull())
{
- sout << " init not done" << std::endl; return IFSelect_RetError;
+ Message::SendInfo() << " init not done" << std::endl; return 1;
}
if (!tous) num = atoi(arg1);
// Enregistrer les racines
if (tous)
{
Standard_Integer nb = TP->NbRoots();
- sout << " Recording " << nb << " Roots" << std::endl;
+ Message::SendInfo() << " Recording " << nb << " Roots" << std::endl;
for (Standard_Integer i = 1; i <= nb; i++)
{
ent = TP->Root(i);
- if (TR->RecordResult(ent)) sout << " Root n0." << i << std::endl;
- else sout << " Root n0." << i << " not recorded" << std::endl;
+ if (TR->RecordResult(ent)) Message::SendInfo() << " Root n0." << i << std::endl;
+ else Message::SendInfo() << " Root n0." << i << " not recorded" << std::endl;
}
}
else
{
- if (num < 1 || num > mdl->NbEntities()) sout << "incorrect number:" << num << std::endl;
- else if (TR->RecordResult(mdl->Value(num))) sout << " Entity n0." << num << std::endl;
- else sout << " Entity n0." << num << " not recorded" << std::endl;
+ 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;
}
return IFSelect_RetDone;
}
//=======================================================================
-//function : trstat
+//function : XSControl_trstat
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_trstat(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_trstat(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
+ Standard_Integer theNbArgs = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo();
// **** trstat : TransferReader ****
const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader();
- if (TR.IsNull()) { sout << " init not done" << std::endl; return IFSelect_RetError; }
+ if (TR.IsNull())
+ {
+ Message::SendInfo() << " init not done" << std::endl; return 1;
+ }
Handle(Interface_InterfaceModel) mdl = TR->Model();
- if (mdl.IsNull()) { sout << " No model" << std::endl; return IFSelect_RetError; }
- sout << " Statistics : FileName : " << TR->FileName() << std::endl;
- if (argc == 1)
+ if (mdl.IsNull())
+ {
+ Message::SendInfo() << " No model" << std::endl; return 1;
+ }
+ Message::SendInfo() << " Statistics : FileName : " << TR->FileName() << std::endl;
+ if (theNbArgs == 1)
{
// stats generales
- TR->PrintStats(sout, 10, 0);
+ TR->PrintStats(Message::SendInfo(), 10, 0);
}
else
{
// stats unitaires
Standard_Integer num = atoi(arg1);
- if (num < 1 || num > mdl->NbEntities()) { sout << " incorrect number:" << arg1 << std::endl; return IFSelect_RetError; }
+ if (num < 1 || num > mdl->NbEntities())
+ {
+ Message::SendInfo() << " incorrect number:" << arg1 << std::endl; return 1;
+ }
Handle(Standard_Transient) ent = mdl->Value(num);
- if (!TR->IsRecorded(ent)) { sout << " Entity " << num << " not recorded" << std::endl; return IFSelect_RetError; }
+ if (!TR->IsRecorded(ent))
+ {
+ Message::SendInfo() << " Entity " << num << " not recorded" << std::endl; 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) sout << " Entities implied by Check/Result :" << nb << " i.e.:";
- for (i = 1; i <= nb; i++) { sout << " "; mdl->Print(list->Value(i), sout); }
- sout << std::endl;
- if (RM.IsNull()) { sout << " no other info" << std::endl; return IFSelect_RetVoid; }
+ 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;
+ }
Interface_CheckIterator chl = RM->CheckList(Standard_False);
- pilot->Session()->PrintCheckList(sout, chl, Standard_False, IFSelect_EntitiesByItem);
+ pilot->Session()->PrintCheckList(Message::SendInfo(), chl, Standard_False, IFSelect_EntitiesByItem);
}
- return IFSelect_RetVoid;
+ return 0;
}
//=======================================================================
-//function : trbegin
+//function : XSControl_trbegin
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_trbegin(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_trbegin(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
// **** trbegin : TransferReader ****
Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->TransferReader();
Standard_Boolean init = TR.IsNull();
- if (pilot->NbWords() > 1) { if (pilot->Arg(1)[0] == 'i') init = Standard_True; }
+ if (pilot->NbWords() > 1)
+ {
+ if (pilot->Arg(1)[0] == 'i') init = Standard_True;
+ }
if (init)
{
XSControl::Session(pilot)->InitTransferReader(0);
TR = XSControl::Session(pilot)->TransferReader();
if (TR.IsNull())
{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout << " init not done or failed" << std::endl;
- return IFSelect_RetError;
+ Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo();
+ Message::SendInfo() << " init not done or failed" << std::endl;
+ return 1;
}
}
TR->BeginTransfer();
}
//=======================================================================
-//function : tread
+//function : XSControl_tread
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tread(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_tread(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
+ Standard_Integer theNbArgs = pilot->NbWords();
//const Standard_CString arg1 = pilot->Arg(1);
// **** tread : TransferReader ****
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo();
const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader();
- if (TR.IsNull()) { sout << " init not done" << std::endl; return IFSelect_RetError; }
+ if (TR.IsNull())
+ {
+ Message::SendInfo() << " init not done" << std::endl; return 1;
+ }
const Handle(Interface_InterfaceModel)& mdl = TR->Model();
- if (mdl.IsNull()) { sout << " No model" << std::endl; return IFSelect_RetError; }
- if (argc < 2)
+ if (mdl.IsNull())
+ {
+ Message::SendInfo() << " No model" << std::endl; 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");
- if (sel.IsNull()) { sout << "Select Roots absent" << std::endl; return IFSelect_RetError; }
+ if (sel.IsNull())
+ {
+ Message::SendInfo() << "Select Roots absent" << std::endl; return 1;
+ }
Handle(TColStd_HSequenceOfTransient) list = pilot->Session()->GiveList(sel);
- sout << " Transferring all roots i.e. : " << TR->TransferList(list) << std::endl;
+ Message::SendInfo() << " Transferring all roots i.e. : " << TR->TransferList(list) << std::endl;
}
else
{
Handle(TColStd_HSequenceOfTransient) list =
IFSelect_Functions::GiveList(pilot->Session(), pilot->CommandPart(1));
- sout << " Transfer of " << list->Length() << " entities" << std::endl;
+ Message::SendInfo() << " Transfer of " << list->Length() << " entities" << std::endl;
Standard_Integer nb = TR->TransferList(list);
- sout << " Gives " << nb << " results" << std::endl;
+ Message::SendInfo() << " Gives " << nb << " results" << std::endl;
}
return IFSelect_RetDone;
}
//=======================================================================
-//function : trtp
+//function : XSControl_trtp
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_trtp(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_trtp(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
// **** TReader -> TProcess ****
const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader();
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (TR.IsNull()) sout << " No TransferReader" << std::endl;
- else if (TR->TransientProcess().IsNull()) sout << " Transfer Reader without Process" << std::endl;
- return IFSelect_RetVoid;
+ 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;
+ return 0;
}
//=======================================================================
-//function : tptr
+//function : XSControl_tptr
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tptr(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_tptr(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
// **** TProcess -> TReader ****
XSControl::Session(pilot)->InitTransferReader(3);
}
//=======================================================================
-//function : twmode
+//function : XSControl_twmode
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_twmode(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_twmode(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- Standard_Integer argc = pilot->NbWords();
+ Standard_Integer theNbArgs = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** twmode ****
Handle(XSControl_TransferWriter) TW = XSControl::Session(pilot)->TransferWriter();
Handle(XSControl_Controller) control = XSControl::Session(pilot)->NormAdaptor();
Standard_Integer modemin, modemax;
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo();
if (control->ModeWriteBounds(modemin, modemax))
{
- sout << "Write Mode : allowed values " << modemin << " to " << modemax << std::endl;
+ Message::SendInfo() << "Write Mode : allowed values " << modemin << " to " << modemax << std::endl;
for (Standard_Integer modd = modemin; modd <= modemax; modd++)
{
- sout << modd << " : " << control->ModeWriteHelp(modd) << std::endl;
+ Message::SendInfo() << modd << " : " << control->ModeWriteHelp(modd) << std::endl;
}
}
- sout << "Write Mode : actual = " << TW->TransferMode() << std::endl;
- if (argc <= 1) return IFSelect_RetVoid;
+ Message::SendInfo() << "Write Mode : actual = " << TW->TransferMode() << std::endl;
+ if (theNbArgs <= 1) return 0;
Standard_Integer mod = atoi(arg1);
- sout << "New value -> " << arg1 << std::endl;
+ Message::SendInfo() << "New value -> " << arg1 << std::endl;
TW->SetTransferMode(mod);
- if (!control->IsModeWrite(mod)) sout << "Warning : this new value is not supported" << std::endl;
+ if (!control->IsModeWrite(mod)) Message::SendInfo() << "Warning : this new value is not supported" << std::endl;
return IFSelect_RetDone;
}
//=======================================================================
-//function : twstat
+//function : XSControl_twstat
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_twstat(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_twstat(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- //Standard_Integer argc = pilot->NbWords();
+ //Standard_Integer theNbArgs = pilot->NbWords();
//const Standard_CString arg1 = pilot->Arg(1);
//const Standard_CString arg2 = pilot->Arg(2);
const Handle(Transfer_FinderProcess)& FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess();
// **** twstat ****
// Pour Write
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo();
if (!FP.IsNull())
{
- sout << "TransferWrite:";
+ Message::SendInfo() << "TransferWrite:";
// XSControl_TransferWriter::PrintStatsProcess (FP,mod1,mod2);
- FP->PrintStats(1, sout);
+ FP->PrintStats(1, Message::SendInfo());
}
- else sout << "TransferWrite: not defined" << std::endl;
- return IFSelect_RetVoid;
+ else Message::SendInfo() << "TransferWrite: not defined" << std::endl;
+ return 0;
}
//=======================================================================
-//function : settransfert
+//function : XSControl_settransfert
+//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_settransfert(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer XSControl_settransfert(Draw_Interpretor& theDI,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
// **** SelectForTransfer ****
return pilot->RecordItem(new XSControl_SelectForTransfer(XSControl::Session(pilot)->TransferReader()));
//function : Init
//purpose :
//=======================================================================
-void XSDRAW_Functions::Init()
+void XSDRAW_Functions::Init(Draw_Interpretor& theDI)
{
- static int THE_XSDRAW_Functions_initactor = 0;
- if (THE_XSDRAW_Functions_initactor)
+ static Standard_Boolean initactor = Standard_False;
+ if (initactor)
{
return;
}
-
- THE_XSDRAW_Functions_initactor = 1;
- IFSelect_Act::SetGroup("DE: General");
-
- IFSelect_Act::AddFunc("xinit", "[norm:string to change norme] reinitialises according to the norm", XSControl_xinit);
- IFSelect_Act::AddFunc("xnorm", "displays current norm +norm : changes it", XSControl_xnorm);
-
- IFSelect_Act::AddFunc("newmodel", "produces a new empty model, for the session", XSControl_newmodel);
-
- IFSelect_Act::AddFunc("tpclear", "Clears TransferProcess (READ)", XSControl_tpclear);
- IFSelect_Act::AddFunc("twclear", "Clears TransferProcess (WRITE)", XSControl_tpclear);
-
- IFSelect_Act::AddFunc("tpstat", "Statistics on TransferProcess (READ)", XSControl_tpstat);
-
- IFSelect_Act::AddFunc("tpent", "[num:integer] Statistics on an entity of the model (READ)", XSControl_tpent);
-
- IFSelect_Act::AddFunc("tpitem", "[num:integer] Statistics on ITEM of transfer (READ)", XSControl_tpitem);
- IFSelect_Act::AddFunc("tproot", "[num:integer] Statistics on a ROOT of transfert (READ)", XSControl_tpitem);
- IFSelect_Act::AddFunc("twitem", "[num:integer] Statistics on an ITEM of transfer (WRITE)", XSControl_tpitem);
- IFSelect_Act::AddFunc("twroot", "[num:integer] Statistics on a ROOT of transfer (WRITE)", XSControl_tpitem);
-
- IFSelect_Act::AddFunc("trecord", "record : all root results; or num : for entity n0.num", XSControl_trecord);
- IFSelect_Act::AddFunc("trstat", "general statistics; or num : stats on entity n0 num", XSControl_trstat);
- IFSelect_Act::AddFunc("trbegin", "begin-transfer-reader [init]", XSControl_trbegin);
- IFSelect_Act::AddFunc("tread", "transfers all roots, or num|sel|sel num : entity list, by transfer-reader", XSControl_tread);
-
- IFSelect_Act::AddFunc("trtp", "feeds commands tp... with results from tr...", XSControl_trtp);
- IFSelect_Act::AddFunc("tptr", "feeds tr... from tp... (may be incomplete)", XSControl_tptr);
-
- IFSelect_Act::AddFunc("twmode", "displays mode transfer write, + num changes it", XSControl_twmode);
- IFSelect_Act::AddFunc("twstat", "Statistics on TransferProcess (WRITE)", XSControl_twstat);
-
- IFSelect_Act::AddFSet("selecttransfer", "selection (recognize from transfer actor)", XSControl_settransfert);
+ initactor = Standard_True;
+ Standard_CString aGroup = "DE: General";
+
+ theDI.Add("xinit"
+ "[norm:string to change norme] reinitialises according to the norm", __FILE__, XSControl_xinit, aGroup);
+ theDI.Add("xnorm",
+ "displays current norm +norm : changes it", __FILE__, XSControl_xnorm, aGroup);
+
+ theDI.Add("newmodel",
+ "produces a new empty model, for the session", __FILE__, XSControl_newmodel, aGroup);
+
+ theDI.Add("tpclear",
+ "Clears TransferProcess (READ)", __FILE__, XSControl_tpclear, aGroup);
+ theDI.Add("twclear",
+ "Clears TransferProcess (WRITE)", __FILE__, XSControl_tpclear, aGroup);
+
+ theDI.Add("tpstat",
+ "Statistics on TransferProcess (READ)", __FILE__, XSControl_tpstat, aGroup);
+
+ theDI.Add("tpent",
+ "[num:integer] Statistics on an entity of the model (READ)", __FILE__, XSControl_tpent, aGroup);
+
+ theDI.Add("tpitem",
+ "[num:integer] Statistics on ITEM of transfer (READ)", __FILE__, XSControl_tpitem, aGroup);
+ theDI.Add("tproot",
+ "[num:integer] Statistics on a ROOT of transfert (READ)", __FILE__, XSControl_tpitem, aGroup);
+ theDI.Add("twitem",
+ "[num:integer] Statistics on an ITEM of transfer (WRITE)", __FILE__, XSControl_tpitem, aGroup);
+ theDI.Add("twroot",
+ "[num:integer] Statistics on a ROOT of transfer (WRITE)", __FILE__, XSControl_tpitem, aGroup);
+
+ theDI.Add("trecord",
+ "record : all root results; or num : for entity n0.num", __FILE__, XSControl_trecord, aGroup);
+ theDI.Add("trstat",
+ "general statistics; or num : stats on entity n0 num", __FILE__, XSControl_trstat, aGroup);
+ theDI.Add("trbegin",
+ "begin-transfer-reader [init]", __FILE__, XSControl_trbegin, aGroup);
+ theDI.Add("tread",
+ "transfers all roots, or num|sel|sel num : entity list, by transfer-reader", __FILE__, XSControl_tread, aGroup);
+
+ theDI.Add("trtp",
+ "feeds commands tp... with results from tr...", __FILE__, XSControl_trtp, aGroup);
+ theDI.Add("tptr",
+ "feeds tr... from tp... (may be incomplete)", __FILE__, XSControl_tptr, aGroup);
+
+ theDI.Add("twmode",
+ "displays mode transfer write, + num changes it", __FILE__, XSControl_twmode, aGroup);
+ theDI.Add("twstat",
+ "Statistics on TransferProcess (WRITE)", __FILE__, XSControl_twstat, aGroup);
+
+ theDI.Add("selecttransfer",
+ "selection (recognize from transfer actor)", __FILE__, XSControl_settransfert);
}
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
+#include <Draw_Interpretor.hxx>
+
//! Functions from XSControl gives access to actions which can be
//! commanded with the resources provided by XSControl: especially
//! Controller and Transfer
public:
//! Defines and loads all functions for XSControl (as ActFunc)
- Standard_EXPORT static void Init();
+ Standard_EXPORT static void Init(Draw_Interpretor& theDI);
};
#endif // _XSDRAW_Functions_HeaderFile
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
+// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-//#58 rln 28.12.98 Versioning
-
#include <IFSelect_Act.hxx>
#include <IFSelect_CheckCounter.hxx>
#include <IFSelect_DispGlobal.hxx>
const Standard_CString arg1 = pilot->Arg(1);
// **** XRead / Load ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Read/Load : give file name !" << std::endl; return IFSelect_RetError; }
- if (WS->Protocol().IsNull()) { sout << "Protocol not defined" << std::endl; return IFSelect_RetError; }
- if (WS->WorkLibrary().IsNull()) { sout << "WorkLibrary not defined" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Read/Load : give file name !" << std::endl; return IFSelect_RetError;
+ }
+ if (WS->Protocol().IsNull())
+ {
+ sout << "Protocol not defined" << std::endl; return IFSelect_RetError;
+ }
+ if (WS->WorkLibrary().IsNull())
+ {
+ sout << "WorkLibrary not defined" << std::endl; return IFSelect_RetError;
+ }
IFSelect_ReturnStatus status = WS->ReadFile(arg1);
// status : 0 OK, 1 erreur lecture, 2 Fail(try/catch),
const Standard_CString arg1 = pilot->Arg(1);
// **** Write All ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Write All : give file name !" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Write All : give file name !" << std::endl; return IFSelect_RetError;
+ }
return WS->SendAll(arg1);
}
// const Standard_CString arg2 = pilot->Arg(2);
// **** Write Selected ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 3) { sout << "Write Selected : give file name + givelist !" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << "Write Selected : give file name + givelist !" << std::endl; return IFSelect_RetError;
+ }
Handle(TColStd_HSequenceOfTransient) result =
XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart(2));
- if (result.IsNull()) { sout << "No entity selected" << std::endl; return IFSelect_RetError; }
+ if (result.IsNull())
+ {
+ sout << "No entity selected" << std::endl; return IFSelect_RetError;
+ }
else sout << "Nb Entities selected : " << result->Length() << std::endl;
Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
sp->SetList(result);
const Standard_CString arg1 = pilot->Arg(1);
// **** Write Entite(s) ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 3) { sout << "Write Entitie(s) : give file name + n0s entitie(s)!" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << "Write Entitie(s) : give file name + n0s entitie(s)!" << std::endl; return IFSelect_RetError;
+ }
int ko = 0;
Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
for (Standard_Integer ia = 2; ia < argc; ia++)
{
Handle(Standard_Transient) item = WS->StartingEntity(id);
if (sp->Add(item)) sout << "Added:no." << id << std::endl;
- else { sout << " Fail Add n0." << id << std::endl; ko++; }
+ else
+ {
+ sout << " Fail Add n0." << id << std::endl; ko++;
+ }
+ }
+ else
+ {
+ sout << "Not an entity number:" << pilot->Arg(ia) << std::endl; ko++;
}
- else { sout << "Not an entity number:" << pilot->Arg(ia) << std::endl; ko++; }
}
- if (ko > 0) { sout << ko << " bad arguments, abandon" << std::endl; return IFSelect_RetError; }
+ if (ko > 0)
+ {
+ sout << ko << " bad arguments, abandon" << std::endl; return IFSelect_RetError;
+ }
return WS->SendSelected(arg1, sp);
}
const Standard_CString arg1 = pilot->Arg(1);
// **** Entity Label ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Give entity number" << std::endl; return IFSelect_RetError; }
- if (!WS->HasModel()) { sout << "No loaded model, abandon" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Give entity number" << std::endl; return IFSelect_RetError;
+ }
+ if (!WS->HasModel())
+ {
+ sout << "No loaded model, abandon" << std::endl; return IFSelect_RetError;
+ }
Standard_Integer nument = WS->NumberFromLabel(arg1);
if (nument <= 0 || nument > WS->NbStartingEntities())
{
const Standard_CString arg1 = pilot->Arg(1);
// **** Entity Number ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Give label to search" << std::endl; return IFSelect_RetError; }
- if (!WS->HasModel()) { sout << "No loaded model, abandon" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Give label to search" << std::endl; return IFSelect_RetError;
+ }
+ if (!WS->HasModel())
+ {
+ sout << "No loaded model, abandon" << std::endl; return IFSelect_RetError;
+ }
const Handle(Interface_InterfaceModel)& model = WS->Model();
Standard_Integer i, cnt = 0;
Standard_Boolean exact = Standard_False;
Standard_Integer i; // svv Jan11 2000 : porting on DEC
for (i = 2; i < argc; i++)
{
- if (!strcmp(pilot->Arg(i), "on")) { onflag = i; break; }
+ if (!strcmp(pilot->Arg(i), "on"))
+ {
+ onflag = i; break;
+ }
}
Handle(IFSelect_Selection) sel = WS->GiveSelection(arg1);
else
{
signtype = GetCasted(IFSelect_Signature, WS->NamedItem(arg1));
- if (signtype.IsNull()) { sout << "Not a Signature : " << arg1 << std::endl; return IFSelect_RetError; }
+ if (signtype.IsNull())
+ {
+ sout << "Not a Signature : " << arg1 << std::endl; return IFSelect_RetError;
+ }
else sout << "signtype now set to " << arg1 << std::endl;
}
WS->SetSignType(signtype);
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 3) { sout << " Give signature name + n0 or id of entity" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << " Give signature name + n0 or id of entity" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1));
- if (sign.IsNull()) { sout << "Not a signature : " << arg1 << std::endl; return IFSelect_RetError; }
+ if (sign.IsNull())
+ {
+ sout << "Not a signature : " << arg1 << std::endl; return IFSelect_RetError;
+ }
Standard_Integer num = pilot->Number(arg2);
Handle(Standard_Transient) ent = WS->StartingEntity(num);
if (num == 0) return IFSelect_RetError;
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 3) { sout << " Give 2 numeros or labels : dad son" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << " Give 2 numeros or labels : dad son" << std::endl; return IFSelect_RetError;
+ }
Standard_Integer n1 = WS->NumberFromLabel(arg1);
Standard_Integer n2 = WS->NumberFromLabel(arg2);
sout << "QueryParent for dad:" << arg1 << ":" << n1 << " and son:" << arg2 << ":" << n2 << std::endl;
const Standard_CString arg1 = pilot->Arg(1);
// **** NewInt ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 1) { sout << "Donner la valeur entiere pour IntParam" << std::endl; return IFSelect_RetError; }
+ if (argc < 1)
+ {
+ sout << "Donner la valeur entiere pour IntParam" << std::endl; return IFSelect_RetError;
+ }
Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam;
if (argc >= 1) intpar->SetValue(atoi(arg1));
return pilot->RecordItem(intpar);
const Standard_CString arg1 = pilot->Arg(1);
// **** NewText ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 1) { sout << "Donner la valeur texte pour TextParam" << std::endl; return IFSelect_RetError; }
+ if (argc < 1)
+ {
+ sout << "Donner la valeur texte pour TextParam" << std::endl; return IFSelect_RetError;
+ }
Handle(TCollection_HAsciiString) textpar = new TCollection_HAsciiString();
if (argc >= 1) textpar->AssignCat(arg1);
return pilot->RecordItem(textpar);
const Standard_CString arg1 = pilot->Arg(1);
// **** DumpSel ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Give 1 argument : Selection Name" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Give 1 argument : Selection Name" << std::endl; return IFSelect_RetError;
+ }
WS->DumpSelection(GetCasted(IFSelect_Selection, WS->NamedItem(arg1)));
return IFSelect_RetVoid;
}
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) { sout << "Give Entity ID, or Selection Name [+ optional other selection or entity]" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Give Entity ID, or Selection Name [+ optional other selection or entity]" << std::endl; return IFSelect_RetError;
+ }
// MakeList : sur Pointed existante ou a creer
Handle(IFSelect_SelectPointed) pnt;
Standard_Integer argc = pilot->NbWords();
// **** GiveCount ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Give Entity ID, or Selection Name [+ optional other selection or entity]" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Give Entity ID, or Selection Name [+ optional other selection or entity]" << std::endl; return IFSelect_RetError;
+ }
// WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
Handle(TColStd_HSequenceOfTransient) result =
XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart(1));
Standard_Integer argc = pilot->NbWords();
// **** SelSuite ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Give Entity ID, or Selection Name [+ optional other selection or entity]" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Give Entity ID, or Selection Name [+ optional other selection or entity]" << std::endl; return IFSelect_RetError;
+ }
// WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
Handle(IFSelect_SelectSuite) selsuite = new IFSelect_SelectSuite;
// **** Item Label ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
TCollection_AsciiString label;
- if (argc < 2) { sout << " Give label to search" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << " Give label to search" << std::endl; return IFSelect_RetError;
+ }
for (int i = 1; i < argc; i++)
{
label.AssignCat(pilot->Arg(i));
const Standard_CString arg1 = pilot->Arg(1);
// **** Save (Dump) ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner nom du Fichier" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner nom du Fichier" << std::endl; return IFSelect_RetError;
+ }
IFSelect_SessionFile dumper(WS, arg1);
if (!dumper.IsDone()) return IFSelect_RetFail;
return IFSelect_RetDone;
const Standard_CString arg1 = pilot->Arg(1);
// **** Restore (Dump) ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner nom du Fichier" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner nom du Fichier" << std::endl; return IFSelect_RetError;
+ }
IFSelect_SessionFile dumper(WS);
Standard_Integer readstat = dumper.Read(arg1);
if (readstat == 0) return IFSelect_RetDone;
{
if (argc > 2) sout << " FORMER STATUS of Static Parameter " << arg1 << std::endl;
else sout << " ACTUAL STATUS of Static Parameter " << arg1 << std::endl;
- if (!Interface_Static::IsPresent(arg1)) { sout << " Parameter " << arg1 << " undefined" << std::endl; return IFSelect_RetError; }
+ if (!Interface_Static::IsPresent(arg1))
+ {
+ sout << " Parameter " << arg1 << " undefined" << std::endl; return IFSelect_RetError;
+ }
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;
{
sout << " OK" << std::endl; return IFSelect_RetDone;
}
- else { sout << " , refused" << std::endl; return IFSelect_RetError; }
+ else
+ {
+ sout << " , refused" << std::endl; return IFSelect_RetError;
+ }
}
}
return IFSelect_RetVoid;
const Standard_CString arg2 = pilot->Arg(2);
// **** FileRoot ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner Dispatch et nom de Root" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner Dispatch et nom de Root" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
if (argc < 3)
{
const Standard_CString arg2 = pilot->Arg(2);
// **** SetModelContent ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 3) { sout << "Donner nom selection et mode (k=keep,r=remove)" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << "Donner nom selection et mode (k=keep,r=remove)" << std::endl; return IFSelect_RetError;
+ }
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;
}
- if (arg2[0] == 'k') { sout << " -- SetContent keep ..."; keepmode = Standard_True; }
- else if (arg2[0] == 'r') { sout << " -- SetContent remove ..."; keepmode = Standard_False; }
- else { sout << "Donner nom selection et mode (k=keep,r=remove)" << std::endl; return IFSelect_RetError; }
+ if (arg2[0] == 'k')
+ {
+ sout << " -- SetContent keep ..."; keepmode = Standard_True;
+ }
+ else if (arg2[0] == 'r')
+ {
+ sout << " -- SetContent remove ..."; keepmode = Standard_False;
+ }
+ else
+ {
+ sout << "Donner nom selection et mode (k=keep,r=remove)" << std::endl; return IFSelect_RetError;
+ }
if (WS->SetModelContent(sel, keepmode)) sout << " Done" << std::endl;
else sout << " Result empty, ignored" << std::endl;
const Standard_CString arg1 = pilot->Arg(1);
// **** Modifier ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner Nom du Modifier" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner Nom du Modifier" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
if (modif.IsNull())
{
const Standard_CString arg1 = pilot->Arg(1);
// **** ResetApplied (modifier) ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Designer un modifier" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Designer un modifier" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
if (modif.IsNull())
{
const Standard_CString arg3 = pilot->Arg(3);
// **** ModifMove ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 4) { sout << "modifmove MF rang1 rang2, M pour Model F pour File" << std::endl; return IFSelect_RetError; }
+ if (argc < 4)
+ {
+ sout << "modifmove MF rang1 rang2, M pour Model F pour File" << std::endl; return IFSelect_RetError;
+ }
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; }
+ else
+ {
+ sout << "preciser M pour Model, F pour File" << std::endl; return IFSelect_RetError;
+ }
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; }
+ if (before == 0 || after == 0)
+ {
+ sout << "Donner 2 Entiers Positifs" << std::endl; return IFSelect_RetError;
+ }
if (!WS->ChangeModifierRank(formodel, before, after)) return IFSelect_RetFail;
return IFSelect_RetDone;
}
const Standard_CString arg2 = pilot->Arg(2);
// **** DispSel ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 3) { sout << "Donner Noms Dispatch et Selection Finale" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << "Donner Noms Dispatch et Selection Finale" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
if (disp.IsNull())
{
const Standard_CString arg1 = pilot->Arg(1);
// **** DispCount ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner Nom IntParam pour Count" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner Nom IntParam pour Count" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1));
if (par.IsNull())
{
const Standard_CString arg1 = pilot->Arg(1);
// **** DispFiles ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner Nom IntParam pour NbFiles" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner Nom IntParam pour NbFiles" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1));
if (par.IsNull())
{
const Standard_CString arg1 = pilot->Arg(1);
// **** DispFiles ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner Nom Signature" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner Nom Signature" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Signature, sig, WS->NamedItem(arg1));
if (sig.IsNull())
{
const Standard_CString arg1 = pilot->Arg(1);
// **** Dispatch ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner Nom du Dispatch" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner Nom du Dispatch" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
- if (disp.IsNull()) { sout << "Pas un dispatch : " << arg1 << std::endl; return IFSelect_RetError; }
+ if (disp.IsNull())
+ {
+ sout << "Pas un dispatch : " << arg1 << std::endl; return IFSelect_RetError;
+ }
Standard_Integer num = WS->DispatchRank(disp);
sout << "Dispatch de Nom : " << arg1 << " , en ShareOut, Numero " << num << " : ";
Handle(IFSelect_Selection) sel = WS->ItemSelection(disp);
const Standard_CString arg1 = pilot->Arg(1);
// **** Remove ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Give Name to Remove !" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Give Name to Remove !" << std::endl; return IFSelect_RetError;
+ }
if (!WS->RemoveNamedItem(arg1)) return IFSelect_RetFail;
return IFSelect_RetDone;
}
<< "See also : writedisp" << std::endl;
return IFSelect_RetVoid;
}
- if (arg1[1] != '\0') { sout << "first parameter : mode, must be a number between 0 and 3" << std::endl; return IFSelect_RetError; }
+ if (arg1[1] != '\0')
+ {
+ sout << "first parameter : mode, must be a number between 0 and 3" << std::endl; return IFSelect_RetError;
+ }
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);
Handle(TColStd_HSequenceOfTransient) list = XSDRAW_FunctionsSession::GiveList
(pilot->Session(), pilot->CommandPart(3));
Standard_Integer nb = (list.IsNull() ? 0 : list->Length());
- if (nb > 0) { sp->AddList(list); sel = sp; }
+ if (nb > 0)
+ {
+ sp->AddList(list); sel = sp;
+ }
}
if (sel.IsNull() && selsav.IsNull())
Handle(TColStd_HSequenceOfTransient) list = XSDRAW_FunctionsSession::GiveList
(pilot->Session(), pilot->CommandPart(3));
Standard_Integer nb = (list.IsNull() ? 0 : list->Length());
- if (nb > 0) { sp->AddList(list); sel = sp; }
+ if (nb > 0)
+ {
+ sp->AddList(list); sel = sp;
+ }
}
if (sel.IsNull() && selsav.IsNull())
Standard_Integer mode = 0;
Message_Messenger::StreamBuffer sout = Message::SendInfo();
if (argc < 2) sout << " -- mode par defaut 0\n";
- else { mode = atoi(arg1); sout << " -- mode : " << mode << std::endl; }
+ else
+ {
+ mode = atoi(arg1); sout << " -- mode : " << mode << std::endl;
+ }
WS->EvaluateComplete(mode); return IFSelect_RetVoid;
}
const Standard_CString arg1 = pilot->Arg(1);
// **** RunTransformer ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner Nom de Transformer" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner Nom de Transformer" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Transformer, tsf, WS->NamedItem(arg1));
Standard_Integer effect = WS->RunTransformer(tsf);
switch (effect)
const Standard_CString arg1 = pilot->Arg(1);
// **** SelToggle ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner Nom de Selection" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner Nom de Selection" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
if (!WS->ToggleSelectExtract(sel))
{
const Standard_CString arg2 = pilot->Arg(2);
// **** SelInput ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 3) { sout << "Donner Noms Selections cible et input" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << "Donner Noms Selections cible et input" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
DeclareAndCast(IFSelect_Selection, sou, WS->NamedItem(arg2));
if (sel.IsNull() || sou.IsNull())
// Range From
if (pilot->Word(1).IsEqual("from"))
{
- if (argc < 3) { sout << "Forme admise : from <i>" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << "Forme admise : from <i>" << std::endl; return IFSelect_RetError;
+ }
low = GetCasted(IFSelect_IntParam, WS->NamedItem(arg2));
sel = new IFSelect_SelectRange;
sel->SetFrom(low);
}
else if (pilot->Word(1).IsEqual("until"))
{
- if (argc < 3) { sout << "Forme admise : until <i>" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << "Forme admise : until <i>" << std::endl; return IFSelect_RetError;
+ }
up = GetCasted(IFSelect_IntParam, WS->NamedItem(arg2));
sel = new IFSelect_SelectRange;
sel->SetUntil(up);
const Standard_CString arg2 = pilot->Arg(2);
// **** SelControlMain ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 3) { sout << "Donner Noms de Control et MainInput" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << "Donner Noms de Control et MainInput" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
DeclareAndCast(IFSelect_Selection, selmain, WS->NamedItem(arg2));
if (WS->SetControl(sel, selmain, Standard_True)) return IFSelect_RetDone;
const Standard_CString arg2 = pilot->Arg(2);
// **** SelControlSecond ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 3) { sout << "Donner Noms de Control et SecondInput" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << "Donner Noms de Control et SecondInput" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
DeclareAndCast(IFSelect_Selection, seldif, WS->NamedItem(arg2));
if (WS->SetControl(sel, seldif, Standard_False)) return IFSelect_RetDone;
const Standard_CString arg2 = pilot->Arg(2);
// **** SelCombAdd ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 3) { sout << "Donner n0 Combine et une Input" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << "Donner n0 Combine et une Input" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
DeclareAndCast(IFSelect_Selection, seladd, WS->NamedItem(arg2));
if (WS->CombineAdd(sel, seladd)) return IFSelect_RetDone;
const Standard_CString arg2 = pilot->Arg(2);
// **** SelCombRem ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 3) { sout << "Donner n0 Combine et RANG a supprimer" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << "Donner n0 Combine et RANG a supprimer" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
DeclareAndCast(IFSelect_Selection, inp, WS->NamedItem(arg2));
if (WS->CombineRemove(sel, inp)) return IFSelect_RetDone;
const Standard_CString arg1 = pilot->Arg(1);
// **** SelEntNumber ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner Nom IntParam pour n0 Entite" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner Nom IntParam pour n0 Entite" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1));
Handle(IFSelect_SelectEntityNumber) sel = new IFSelect_SelectEntityNumber;
sel->SetNumber(par);
const Standard_CString arg1 = pilot->Arg(1);
// **** SelTextType Exact ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner le TYPE a selectionner" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner le TYPE a selectionner" << std::endl; return IFSelect_RetError;
+ }
return pilot->RecordItem(new IFSelect_SelectSignature
(new IFSelect_SignType, arg1, Standard_True));
}
const Standard_CString arg1 = pilot->Arg(1);
// **** SelTextType Contain **
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner le TYPE a selectionner" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner le TYPE a selectionner" << std::endl; return IFSelect_RetError;
+ }
return pilot->RecordItem(new IFSelect_SelectSignature
(new IFSelect_SignType, arg1, Standard_False));
}
return IFSelect_RetError;
}
DeclareAndCast(IFSelect_SelectPointed, sp, WS->NamedItem(arg1));
- if (sp.IsNull()) { sout << "Pas une SelectPointed:" << arg1 << std::endl; return IFSelect_RetError; }
+ if (sp.IsNull())
+ {
+ sout << "Pas une SelectPointed:" << arg1 << std::endl; return IFSelect_RetError;
+ }
const Handle(Interface_InterfaceModel)& model = WS->Model(); // pour Print
if (argc == 2)
{ // listage simple
Handle(Standard_Transient) pointed = sp->Item(i);
Standard_Integer id = WS->StartingNumber(pointed);
if (id == 0) sout << " (inconnu)";
- else { sout << " "; model->Print(pointed, sout); }
+ else
+ {
+ sout << " "; model->Print(pointed, sout);
+ }
}
if (nb > 0) sout << std::endl;
return IFSelect_RetDone;
if (id == 0)
{
if (!argi.IsEqual("0")) sout << "Incorrect,ignore:" << argi << std::endl;
- else { sout << "Clear SelectPointed" << std::endl; sp->Clear(); }
+ else
+ {
+ sout << "Clear SelectPointed" << std::endl; sp->Clear();
+ }
}
else if (argi.Value(1) == '-')
{
Handle(IFSelect_WorkSession) WS = pilot->Session();
// **** SelSignature ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 3) { sout << "Give name of Signature or Counter, text + option exact(D) else contains" << std::endl; return IFSelect_RetError; }
+ if (argc < 3)
+ {
+ sout << "Give name of Signature or Counter, text + option exact(D) else contains" << std::endl; return IFSelect_RetError;
+ }
Standard_Boolean exact = Standard_True;
- if (argc > 3) { if (pilot->Arg(3)[0] == 'c') exact = Standard_False; }
+ if (argc > 3)
+ {
+ if (pilot->Arg(3)[0] == 'c') exact = Standard_False;
+ }
DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1));
DeclareAndCast(IFSelect_SignCounter, cnt, WS->NamedItem(arg1));
if (!sign.IsNull()) sel = new IFSelect_SelectSignature(sign, arg2, exact);
else if (!cnt.IsNull()) sel = new IFSelect_SelectSignature(cnt, arg2, exact);
- else { sout << arg1 << ":neither Signature nor Counter" << std::endl; return IFSelect_RetError; }
+ else
+ {
+ sout << arg1 << ":neither Signature nor Counter" << std::endl; return IFSelect_RetError;
+ }
return pilot->RecordItem(sel);
}
Handle(IFSelect_WorkSession) WS = pilot->Session();
// **** SignCounter ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner nom signature" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner nom signature" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1));
- if (sign.IsNull()) { sout << arg1 << ":pas une signature" << std::endl; return IFSelect_RetError; }
+ if (sign.IsNull())
+ {
+ sout << arg1 << ":pas une signature" << std::endl; return IFSelect_RetError;
+ }
Handle(IFSelect_SignCounter) cnt = new IFSelect_SignCounter(sign, Standard_True, Standard_True);
return pilot->RecordItem(cnt);
}
Handle(IFSelect_WorkSession) WS = pilot->Session();
// **** NbSelected = GraphCounter ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (argc < 2) { sout << "Donner nom selection (deduction) a appliquer" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner nom selection (deduction) a appliquer" << std::endl; return IFSelect_RetError;
+ }
DeclareAndCast(IFSelect_SelectDeduct, applied, WS->GiveSelection(arg1));
- if (applied.IsNull()) { sout << arg1 << ":pas une SelectDeduct" << std::endl; return IFSelect_RetError; }
+ if (applied.IsNull())
+ {
+ sout << arg1 << ":pas une SelectDeduct" << std::endl; return IFSelect_RetError;
+ }
Handle(IFSelect_GraphCounter) cnt = new IFSelect_GraphCounter(Standard_True, Standard_True);
cnt->SetApplied(applied);
return pilot->RecordItem(cnt);
Standard_Boolean stated = Standard_False;
Handle(IFSelect_ListEditor) listed = edf->ListEditor(num);
if (listed.IsNull()) return IFSelect_RetError;
- if (argval[0] == '.') { listr.Nullify(); stated = listed->LoadEdited(listr); }
+ if (argval[0] == '.')
+ {
+ listr.Nullify(); stated = listed->LoadEdited(listr);
+ }
else if (argval[0] == '+')
{
Standard_Integer numadd = 0;
{
sout << "Not an EditForm : " << arg1 << std::endl; return IFSelect_RetError;
}
- if (argc < 3) { edf->ClearEdit(); sout << "All Modifications Cleared" << std::endl; }
+ if (argc < 3)
+ {
+ edf->ClearEdit(); sout << "All Modifications Cleared" << std::endl;
+ }
else
{
Standard_Integer num = edf->NameNumber(arg2);
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
+// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
const Standard_CString arg3 = pilot->Arg(3);
const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (TP.IsNull()) { sout << "No Transfer Read" << std::endl; return IFSelect_RetError; }
+ if (TP.IsNull())
+ {
+ sout << "No Transfer Read" << std::endl; return IFSelect_RetError;
+ }
// **** tpdraw ****
if (argc < 2)
{
Standard_Boolean tout = Standard_False;
if (mode == 0)
{
- if (argc < 2) { sout << "Donner au moins un NUMERO ou *" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Donner au moins un NUMERO ou *" << std::endl; return IFSelect_RetError;
+ }
if (arg1[0] == '*') tout = Standard_True;
else num = IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot), arg1);
}
return IFSelect_RetError;
}
}
- if (mode == 0) { sout << "Entite de modele"; max = model->NbEntities(); }
- if (mode == 1) { sout << "Item de transfert"; max = TP->NbMapped(); }
- if (mode == 2) { sout << "Racine de transfert"; max = TP->NbRoots(); }
+ if (mode == 0)
+ {
+ sout << "Entite de modele"; max = model->NbEntities();
+ }
+ if (mode == 1)
+ {
+ sout << "Item de transfert"; max = TP->NbMapped();
+ }
+ if (mode == 2)
+ {
+ sout << "Racine de transfert"; max = TP->NbRoots();
+ }
if (tout)
{
n1 = 1; n2 = max;
{
//sh = shb->Result();
nbvar++;
- if (sh.IsNull()) { sout << " (no Shape recorded)" << std::endl; continue; }
+ if (sh.IsNull())
+ {
+ sout << " (no Shape recorded)" << std::endl; continue;
+ }
if (tout) sout << "[ " << i << " ]:";
if (num == 0) sout << " pas dans le modele";
else sout << " ent.n0 " << num;
for (Standard_Integer j = 1; j <= nbs; j++)
{
sh = slb->Shape(j); if (nbvar < 0) nbvar = 0; nbvar++;
- if (sh.IsNull()) { sout << " (no Shape recorded)" << std::endl; continue; }
+ if (sh.IsNull())
+ {
+ sout << " (no Shape recorded)" << std::endl; continue;
+ }
if (argc > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar);
else if (argc > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar);
else sprintf(nomvar, "tp_%d_%d", i, nbvar);
}
DeclareAndCast(Geom_Geometry, geom, resu);
sout << "Entite n0 " << num << " : resultat " << resu->DynamicType()->Name();
- if (geom.IsNull()) { sout << std::endl; continue; }
+ if (geom.IsNull())
+ {
+ sout << std::endl; continue;
+ }
nbvar++;
if (nbvar == 0)
{
const Standard_CString arg1 = pilot->Arg(1);
const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (TP.IsNull()) { sout << "No Transfer Read" << std::endl; return IFSelect_RetError; }
+ if (TP.IsNull())
+ {
+ sout << "No Transfer Read" << std::endl; return IFSelect_RetError;
+ }
// **** tpcompound ****
- if (argc < 2) { sout << "Give a NAME for the Compound + optional givelist, else roots are taken" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << "Give a NAME for the Compound + optional givelist, else roots are taken" << std::endl; return IFSelect_RetError;
+ }
Handle(TopTools_HSequenceOfShape) list;
if (argc == 2) list = TransferBRep::Shapes(TP);
else
{
Handle(TColStd_HSequenceOfTransient) lise = IFSelect_Functions::GiveList(pilot->Session(), pilot->CommandPart(2));
- if (lise.IsNull()) { sout << "Not a valid entity list : " << pilot->CommandPart(2) << std::endl; return IFSelect_RetError; }
+ if (lise.IsNull())
+ {
+ sout << "Not a valid entity list : " << pilot->CommandPart(2) << std::endl; return IFSelect_RetError;
+ }
list = TransferBRep::Shapes(TP, lise);
sout << lise->Length() << " Entities, ";
}
- if (list.IsNull()) { sout << "No Shape listed" << std::endl; return IFSelect_RetError; }
+ if (list.IsNull())
+ {
+ sout << "No Shape listed" << std::endl; return IFSelect_RetError;
+ }
Standard_Integer nb = list->Length();
sout << nb << " Shape(s) listed" << std::endl;
TopoDS_Compound C;
TCollection_AsciiString nomsh, noms;
const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader();
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (TR.IsNull()) { sout << " manque init" << std::endl; return IFSelect_RetError; }
+ if (TR.IsNull())
+ {
+ sout << " manque init" << std::endl; return IFSelect_RetError;
+ }
const Handle(Interface_InterfaceModel)& mdl = TR->Model();
- if (mdl.IsNull()) { sout << " modele absent" << std::endl; return IFSelect_RetError; }
+ if (mdl.IsNull())
+ {
+ sout << " modele absent" << std::endl; return IFSelect_RetError;
+ }
Standard_Integer num = (argc > 1 ? IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot), arg1) : 0);
if (argc > 1) nomsh = arg1;
}
else
{
- if (num < 1 || num > mdl->NbEntities()) { sout << " incorrect:" << arg1 << std::endl; return IFSelect_RetError; }
+ if (num < 1 || num > mdl->NbEntities())
+ {
+ sout << " incorrect:" << arg1 << std::endl; return IFSelect_RetError;
+ }
TopoDS_Shape sh = TR->ShapeResult(mdl->Value(num));
- if (sh.IsNull()) { sout << " Pas de resultat pour " << arg1 << std::endl; return IFSelect_RetError; }
+ if (sh.IsNull())
+ {
+ sout << " Pas de resultat pour " << arg1 << std::endl; return IFSelect_RetError;
+ }
if (argc > 2) nomsh = arg2;
else nomsh = TCollection_AsciiString("TREAD_") + num;
if (!cascomp && !cassave) XSControl::Vars(pilot)->SetShape(nomsh.ToCString(), sh);
// IMPORT
const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader();
- if (TR.IsNull()) {} // sout<<"No read transfer (import) recorded"<<std::endl;
+ if (TR.IsNull())
+ {
+ } // sout<<"No read transfer (import) recorded"<<std::endl;
else
{
yena = Standard_True;
// ET EN EXPORT ?
const Handle(Transfer_FinderProcess)& FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess();
- if (FP.IsNull()) {}
+ if (FP.IsNull())
+ {
+ }
else
{
yena = Standard_True;
Handle(Transfer_TransientProcess) TP;
if (!TR.IsNull()) TP = TR->TransientProcess();
Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (TP.IsNull()) { sout << "no transfer map" << std::endl; return IFSelect_RetVoid; }
+ if (TP.IsNull())
+ {
+ sout << "no transfer map" << std::endl; return IFSelect_RetVoid;
+ }
if (argc < 2)
{
sout << "Give name of a DRAW Shape + optional shape type v-e-w-f(D)-s" << std::endl;
}
const char* a1 = (const char*)arg1;
TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(a1);
- if (Shape.IsNull()) { sout << "Not a DRAW Shape:" << arg1 << std::endl; return IFSelect_RetError; }
+ if (Shape.IsNull())
+ {
+ sout << "Not a DRAW Shape:" << arg1 << std::endl; return IFSelect_RetError;
+ }
sout << "Shape " << arg1 << " : ";
Handle(TColStd_HSequenceOfTransient) list =
sout << "List given by " << compart.ToCString() << " : ";
list = WS->GiveList(compart.ToCString());
}
- if (list.IsNull()) { sout << "No list defined. Abandon" << std::endl; return IFSelect_RetError; }
+ if (list.IsNull())
+ {
+ sout << "No list defined. Abandon" << std::endl; return IFSelect_RetError;
+ }
Standard_Integer nbl = list->Length();
sout << "Nb entities selected : " << nbl << std::endl;
WS->InitTransferReader(0);
const Handle(XSControl_TransferReader)& TR = WS->TransferReader();
- if (TR.IsNull()) { sout << " init not done or failed" << std::endl; return IFSelect_RetError; }
+ if (TR.IsNull())
+ {
+ sout << " init not done or failed" << std::endl; return IFSelect_RetError;
+ }
TR->BeginTransfer();
BRep_Builder B;
B.MakeCompound(C);
Handle(Interface_InterfaceModel) mdl = TR->Model();
- if (mdl.IsNull()) { sout << " modele absent" << std::endl; return IFSelect_RetError; }
+ if (mdl.IsNull())
+ {
+ sout << " modele absent" << std::endl; return IFSelect_RetError;
+ }
for (Standard_Integer il = 1; il <= nbl; il++)
{
Handle(Standard_Transient) ent = list->Value(il);
// **** twrite ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
Handle(XSControl_TransferWriter) TW = XSControl::Session(pilot)->TransferWriter();
- if (argc < 2) { sout << " donner nom de shape draw" << std::endl; return IFSelect_RetError; }
+ if (argc < 2)
+ {
+ sout << " donner nom de shape draw" << std::endl; return IFSelect_RetError;
+ }
sout << "Attention, on alimente le modele courant ..." << std::endl;
// Shape
{
const char* ai = (const char*)pilot->Arg(i);
TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(ai);
- if (Shape.IsNull()) { sout << "pas un nom de shape draw:" << arg1 << std::endl; continue; }
+ if (Shape.IsNull())
+ {
+ sout << "pas un nom de shape draw:" << arg1 << std::endl; continue;
+ }
sout << "Pour Shape : " << ai;
Standard_Integer stat = TW->TransferWriteShape(XSControl::Session(pilot)->Model(), Shape);
sout << " Transfer Write Status = " << stat << std::endl;
//=======================================================================
//function : DumpConfiguration
-//purpose :
+//purpose :
//=======================================================================
static Standard_Integer DumpConfiguration(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
//=======================================================================
//function : CompareConfiguration
-//purpose :
+//purpose :
//=======================================================================
static Standard_Integer CompareConfiguration(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
//=======================================================================
//function : LoadConfiguration
-//purpose :
+//purpose :
//=======================================================================
static Standard_Integer LoadConfiguration(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
//=======================================================================
//function : ReadFile
-//purpose :
+//purpose :
//=======================================================================
static Standard_Integer ReadFile(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
//=======================================================================
//function : WriteFile
-//purpose :
+//purpose :
//=======================================================================
static Standard_Integer WriteFile(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,