//gka 06.01.99 S3767 new function TPSTAT (first version)
//pdn 11.01.99 putting "return" statement for compilation on NT
+#include <BRepTools.hxx>
#include <DBRep.hxx>
#include <Draw_Appli.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <Transfer_TransientProcess.hxx>
#include <XSControl.hxx>
#include <XSControl_WorkSession.hxx>
+#include <XSControl_TransferReader.hxx>
#include <XSDRAW.hxx>
-#include <XSDRAW_Commands.hxx>
#include <XSDRAWIGES.hxx>
#include <stdio.h>
-// #include <IGESData_IGESWriter.hxx>
-// pour igeslist
-//#include <GeometryTest.hxx> essai CKY 4-AUT-1998
-//#include <BRepTest.hxx> essai CKY 4-AUT-1998
-//#include <MeshTest.hxx> essai CKY 4-AUT-1998
-// Init functions
-// + tplosttrim
+
+namespace {
+
+ //=======================================================================
+//function : WriteShape
+//purpose : Creates a file Shape_'number'
+//=======================================================================
+void WriteShape(const TopoDS_Shape& shape, const Standard_Integer number)
+{
+ char fname[110];
+ sprintf(fname, "Shape_%d",number);
+ std::ofstream f(fname,std::ios::out);
+ std::cout << "Output file name : " << fname << std::endl;
+ f << "DBRep_DrawableShape\n";
+
+ BRepTools::Write(shape, f);
+ f.close();
+}
+
+TCollection_AsciiString XSDRAW_CommandPart
+ (Standard_Integer argc, const char** argv, const Standard_Integer argf)
+{
+ TCollection_AsciiString res;
+ for (Standard_Integer i = argf; i < argc; i ++) {
+ if (i > argf) res.AssignCat(" ");
+ res.AssignCat (argv[i]);
+ }
+ return res;
+}
+}
+
//--------------------------------------------------------------
// Function : igesbrep
//--------------------------------------------------------------
//mode OnlyVisible does not work.
// nent = Reader.NbRootsForTransfer();
if (!fromtcl) {
- cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<flush;
+ std::cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<std::flush;
modepri = -1;
// amv 26.09.2003 : this is used to avoid error of enter's simbol
char str[80];
- cin>>str;
+ std::cin>>str;
modepri = Draw::Atoi(str);
}
di<<" To modify : command param read.iges.bspline.continuity\n";
Handle(XSControl_WorkSession) thesession = Reader.WS();
thesession->ClearContext();
- XSDRAW::SetTransferProcess (thesession->MapReader());
+ XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
- thesession->MapReader()->SetProgress ( progress );
+ thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
if (modepri == 1) Reader.SetReadVisible (Standard_True);
Reader.TransferRoots();
- thesession->MapReader()->SetProgress ( 0 );
+ thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
// result in only one shape for all the roots
di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
Standard_Integer answer = 1;
if (Reader.NbShapes() > 1) {
- cout << " pass(0) one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << flush;
+ std::cout << " pass(0) one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << std::flush;
answer = -1;
//amv 26.09.2003
char str_a[80];
- cin >> str_a;
+ std::cin >> str_a;
answer = Draw::Atoi(str_a);
}
if ( answer == 0) continue;
char fname[110];
Sprintf(fname, "%s", rnom.ToCString());
di << "Saving shape in variable Draw : " << fname << "\n";
- if (answer == 3) IGESToBRep::WriteShape (shape,1);
+ if (answer == 3) WriteShape (shape,1);
try {
OCC_CATCH_SIGNALS
DBRep::Set(fname,shape);
}
- catch(Standard_Failure) {
+ catch(Standard_Failure const& anException) {
di << "** Exception : ";
- di << Standard_Failure::Caught()->GetMessageString();
+ di << anException.GetMessageString();
di<<" ** Skip\n";
di << "Saving shape in variable Draw : " << fname << "\n";
- IGESToBRep::WriteShape (shape,1);
+ WriteShape (shape,1);
}
}
char fname[110];
Sprintf(fname, "%s_%d", rnom.ToCString(),inum);
di << "Saving shape in variable Draw : " << fname << "\n";
- if (answer == 4) IGESToBRep::WriteShape (shape,inum);
+ if (answer == 4) WriteShape (shape,inum);
try {
OCC_CATCH_SIGNALS
DBRep::Set(fname,shape);
}
- catch(Standard_Failure) {
+ catch(Standard_Failure const& anException) {
di << "** Exception : ";
- di << Standard_Failure::Caught()->GetMessageString();
+ di << anException.GetMessageString();
di<<" ** Skip\n";
}
}
}
else if (modepri == 3) { // One Entity
- cout << "Only One Entity"<<endl;
- cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<endl;
- cout<<" To modify : command param read.iges.bspline.continuity"<<endl;
- cout << " give the number of the Entity : " << flush;
+ std::cout << "Only One Entity"<<std::endl;
+ std::cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<std::endl;
+ std::cout<<" To modify : command param read.iges.bspline.continuity"<<std::endl;
+ std::cout << " give the number of the Entity : " << std::flush;
nent = XSDRAW::GetEntityNumber();
if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result\n";
di<<" To modify : command param read.iges.bspline.continuity\n";
Handle(XSControl_WorkSession) thesession = Reader.WS();
thesession->ClearContext();
- XSDRAW::SetTransferProcess (thesession->MapReader());
+ XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
- thesession->MapReader()->SetProgress ( progress );
+ thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
Reader.SetReadVisible (Standard_True);
Reader.TransferRoots();
- thesession->MapReader()->SetProgress ( 0 );
+ thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
OCC_CATCH_SIGNALS
DBRep::Set(fname,shape);
}
- catch(Standard_Failure) {
+ catch(Standard_Failure const& anException) {
di << "** Exception : ";
- di << Standard_Failure::Caught()->GetMessageString();
+ di << anException.GetMessageString();
di<<" ** Skip\n";
di << "Saving shape in variable Draw : " << fname << "\n";
- IGESToBRep::WriteShape (shape,1);
+ WriteShape (shape,1);
}
return 0;
}
}
}
else {
- cout<<"Name of Selection :"<<flush;
+ std::cout<<"Name of Selection :"<<std::flush;
list = XSDRAW::GetList();
- if (list.IsNull()) { cout<<"No list defined"<<endl; continue; }
+ if (list.IsNull()) { std::cout<<"No list defined"<<std::endl; continue; }
}
Standard_Integer nbl = list->Length();
if (nbl == 0) continue;
while (answer) {
if (!fromtcl) {
- cout<<"Choice: 0 abandon 1 transfer all 2 with confirmation 3 list n0s ents :"<<flush;
+ std::cout<<"Choice: 0 abandon 1 transfer all 2 with confirmation 3 list n0s ents :"<<std::flush;
answer = -1;
// anv 26.09.2003
char str_answer[80];
- cin>>str_answer;
+ std::cin>>str_answer;
answer = Draw::Atoi(str_answer);
}
if (answer <= 0 || answer > 3) continue;
Standard_Integer nbt = 0;
Handle(XSControl_WorkSession) thesession = Reader.WS();
- XSDRAW::SetTransferProcess (thesession->MapReader());
+ XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
- thesession->MapReader()->SetProgress ( progress );
+ thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
nbt++;
}
}
- thesession->MapReader()->SetProgress ( 0 );
+ thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
// Standard_Integer narg = pilot->NbWords();
Standard_Integer narg = n;
- Handle(Transfer_TransientProcess) TP = XSControl::Session(pilot)->MapReader();
+ const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
TColStd_Array1OfAsciiString strarg(1, 3);
TColStd_Array1OfAsciiString typarg(1, 3);
strarg.SetValue(1,"xst-type(CurveOnSurface)");
}
TColStd_MapIteratorOfMapOfTransient itmap;
+ Standard_SStream aTmpStream;
for(itmap.Initialize(aMap); itmap.More(); itmap.Next()) {
- XSDRAW::Model()->Print (itmap.Key(), Message::DefaultMessenger());
- di << " ";
+ XSDRAW::Model()->Print (itmap.Key(), aTmpStream);
+ aTmpStream << " ";
}
+ di << aTmpStream.str().c_str();
di << "\n";
di << "\nNumber:"<< nbFaces << "\n";
totFaces += nbFaces;
Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
Standard_Integer argc = n;//= pilot->NbWords();
const Standard_CString arg1 = a[1];//pilot->Arg(1);
- //IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
- Handle(Transfer_TransientProcess) TP= XSControl::Session(pilot)->MapReader();
- IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
- //read.SetTransientProcess(TP);
+ const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
+ IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
// **** tpent ****
-// if (TP.IsNull()) { di<<"No Transfer Read\n"; return IFSelect_RetError;}
Handle(Interface_InterfaceModel) model = TP->Model();
- //Handle(Interface_InterfaceModel) model = read.Model();
if (model.IsNull()) {di<<"No Transfer Read\n"; return -1;}
- //DeclareAndCast(IGESData_IGESModel,modelig,model);
- // read.SetModel(modelig);
Handle(XSControl_WorkSession) thesession = read.WS();
thesession->SetMapReader(TP);
- //read.SetModel(model);
Standard_Integer mod1 = 0;
if (argc > 1) {
char a2 = arg1[1]; if (a2 == '\0') a2 = '!';