0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / XSDRAWSTEP / XSDRAWSTEP.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 //:k8 abv 6 Jan 98: using parameter "step.group" for writing assemblies/shapes
15
16 #include <DBRep.hxx>
17 #include <Draw_Appli.hxx>
18 #include <Draw_Interpretor.hxx>
19 #include <Draw_ProgressIndicator.hxx>
20 #include <IFSelect_SessionPilot.hxx>
21 #include <Interface_InterfaceModel.hxx>
22 #include <Interface_Macros.hxx>
23 #include <Interface_Static.hxx>
24 #include <Message.hxx>
25 #include <Message_Messenger.hxx>
26 #include <Message_ProgressSentry.hxx>
27 #include <STEPControl_ActorWrite.hxx>
28 #include <STEPControl_Controller.hxx>
29 #include <STEPControl_Reader.hxx>
30 #include <STEPControl_StepModelType.hxx>
31 #include <STEPControl_Writer.hxx>
32 #include <StepData_StepModel.hxx>
33 #include <StepGeom_Axis2Placement3d.hxx>
34 #include <StepSelect_Activator.hxx>
35 #include <STEPSelections_AssemblyExplorer.hxx>
36 #include <STEPSelections_Counter.hxx>
37 #include <StepShape_ShapeRepresentation.hxx>
38 #include <StepToTopoDS_MakeTransformed.hxx>
39 #include <TCollection_HAsciiString.hxx>
40 #include <TColStd_HSequenceOfTransient.hxx>
41 #include <TopExp_Explorer.hxx>
42 #include <TopoDS.hxx>
43 #include <Transfer_FinderProcess.hxx>
44 #include <Transfer_TransientProcess.hxx>
45 #include <TransferBRep_ShapeMapper.hxx>
46 #include <XSControl_Controller.hxx>
47 #include <XSControl_TransferReader.hxx>
48 #include <XSControl_TransferWriter.hxx>
49 #include <XSControl_WorkSession.hxx>
50 #include <XSDRAW.hxx>
51 #include <XSDRAWSTEP.hxx>
52
53 #include <stdio.h>
54 //  Pour le transfert (write)
55 //  Pour NewModel et Write : definition de produit (temporaire ...)
56 // steptrans
57 extern "C" {
58 static void cleanpilot ()
59 {
60   XSDRAW::Session()->ClearData(1);
61 }
62 }
63
64
65 //=======================================================================
66 //function : Init
67 //purpose  : 
68 //=======================================================================
69
70 void XSDRAWSTEP::Init ()
71 {
72   Handle(StepSelect_Activator)   stepact = new StepSelect_Activator;
73   if (STEPControl_Controller::Init()) // XSDRAW::SetNorm("STEP AP-214"); trop tot
74     XSDRAW::SetController(XSControl_Controller::Recorded("STEP"));
75   
76   atexit (cleanpilot);
77 }
78
79 //  ########  COMMANDE stepread  : teste le Reader  #########
80
81 //=======================================================================
82 //function : stepread
83 //purpose  : 
84 //=======================================================================
85
86 static Standard_Integer stepread (Draw_Interpretor& di/*theCommands*/, Standard_Integer argc, const char** argv) 
87 {
88   if (argc < 3) {
89     di << "Use: stepread  [file] [f or r (type of model full or reduced)]\n";
90     return 1;
91   }
92   //  On admet le controller AP214 ou une variante
93   DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller());
94   if (ctl.IsNull()) XSDRAW::SetNorm("STEP");
95
96
97   // Progress indicator
98   Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
99   progress->SetScale ( 0, 100, 1 );
100   progress->Show();
101
102   STEPControl_Reader sr (XSDRAW::Session(),Standard_False);
103   TCollection_AsciiString fnom,rnom;
104   Standard_Boolean modfic = XSDRAW::FileAndVar
105     (argv[1],argv[2],"STEP",fnom,rnom);
106   if (modfic) di<<" File STEP to read : "<<fnom.ToCString()<<"\n";
107   else        di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
108   di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
109   IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
110
111   progress->NewScope ( 20, "Loading" ); // On average loading takes 20% 
112   progress->Show();
113
114   Standard_Boolean fromtcl = Standard_False;
115   Standard_Boolean aFullMode = Standard_False;
116   Standard_Integer k = 3;
117   if(argc > k )
118   {
119     if(argv[k][0] == 'f' || argv[3][0] == 'F')
120     {
121       aFullMode = Standard_True;
122       k++;
123     }
124     else if(argv[k][0] == 'r' || argv[3][0] == 'R')
125     {
126       aFullMode = Standard_False;
127       k++;
128     }
129     else
130       fromtcl = Standard_True;
131    
132   }
133   if(!fromtcl)
134     fromtcl = argc > k;
135   if(aFullMode)
136     std::cout<<"Full model for translation with additional info will be used \n"<<std::flush;
137   else
138     std::cout<<"Reduced model for translation without additional info will be used \n"<<std::flush;
139   
140   sr.WS()->SetModeStat(aFullMode);
141
142
143   if (modfic) readstat = sr.ReadFile (fnom.ToCString());
144   else  if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
145
146   progress->EndScope();
147   progress->Show();
148
149   if (readstat != IFSelect_RetDone) {
150     if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
151     else di<<"No model loaded\n";
152     return 1;
153   }
154   
155
156   //   nom = "." -> fichier deja lu
157   Standard_Integer i, num, nbs, modepri = 1;
158   if (fromtcl) modepri = 4;
159   while (modepri) {
160     num = sr.NbRootsForTransfer();
161     if (!fromtcl) {
162       di<<"NbRootsForTransfer="<<num<<" :\n";
163       for (i = 1; i <= num; i ++) {
164         di<<"Root."<<i<<", Ent. ";
165         Standard_SStream aTmpStream;
166         sr.Model()->Print (sr.RootForTransfer(i), aTmpStream);
167         di << aTmpStream.str().c_str();
168         di<<" Type:"<<sr.RootForTransfer(i)->DynamicType()->Name()<<"\n";
169       }
170
171       std::cout<<"Mode (0 End, 1 root n0 1, 2 one root/n0, 3 one entity/n0, 4 Selection) : "<<std::flush;
172       std::cin>>modepri;
173     }
174
175     if (modepri == 0) { di<<"End Reading STEP\n"; return 0; }
176     if (modepri <= 2) {
177       num = 1;
178       if (modepri == 2) {
179         std::cout<<"Root N0 : "<<std::flush;  std::cin>>num;
180       }
181
182       progress->NewScope ( 80, "Translation" );
183       progress->Show();
184       sr.WS()->TransferReader()->TransientProcess()->SetProgress ( progress );
185
186       if (!sr.TransferRoot (num)) di<<"Transfer root n0 "<<num<<" : no result\n";
187       else {
188         nbs = sr.NbShapes();
189         char shname[30];  Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
190         di<<"Transfer root n0 "<<num<<" OK  -> DRAW Shape: "<<shname<<"\n";
191         di<<"Now, "<<nbs<<" Shapes produced\n";
192         TopoDS_Shape sh = sr.Shape(nbs);
193         DBRep::Set (shname,sh);
194       }
195
196       sr.WS()->TransferReader()->TransientProcess()->SetProgress ( 0 );
197       progress->EndScope();
198       progress->Show();
199     }
200     else if (modepri == 3) {
201       std::cout<<"Entity : "<<std::flush;  num = XSDRAW::GetEntityNumber();
202       if (!sr.TransferOne (num)) di<<"Transfer entity n0 "<<num<<" : no result\n";
203       else {
204         nbs = sr.NbShapes();
205         char shname[30];  Sprintf (shname,"%s_%d",rnom.ToCString(),num);
206         di<<"Transfer entity n0 "<<num<<" OK  -> DRAW Shape: "<<shname<<"\n";
207         di<<"Now, "<<nbs<<" Shapes produced\n";
208         TopoDS_Shape sh = sr.Shape(nbs);
209         DBRep::Set (shname,sh);
210       }
211     }
212     else if (modepri == 4) {
213       //      char snm[100];  Standard_Integer answer = 1;
214       Handle(TColStd_HSequenceOfTransient)  list;
215
216       //  Selection, nommee ou via tcl. tcl : raccourcis admis
217       //   * donne xst-transferrable-roots
218       if (fromtcl) {
219         modepri = 0;    // d ioffice une seule passe
220         if (argv[k][0] == '*' && argv[k][1] == '\0') {
221           di<<"Transferrable Roots : ";
222           list = XSDRAW::GetList("xst-transferrable-roots");
223           //list = new TColStd_HSequenceOfTransient;
224           //for(Standard_Integer j=1; j<=num; j++)
225           //  list->Append(sr.RootForTransfer(j));
226         }
227         else {
228           di<<"List given by "<<argv[k];
229           if (argc > k+1) di<<" "<<argv[k+1];
230           di<<" : ";
231           list = XSDRAW::GetList (argv[k], ( argc > (k+1) ? argv[k+1] : 0 ) );
232         }
233         if (list.IsNull()) { di<<"No list defined. Give a selection name or * for all transferrable roots\n"; continue; }
234       } else {
235         std::cout<<"Name of Selection :"<<std::flush;
236         list = XSDRAW::GetList();
237         if (list.IsNull()) { di<<"No list defined\n"; continue; }
238       }
239
240       Standard_Integer ill, nbl = list->Length();
241       di<<"Nb entities selected : "<<nbl<<"\n";
242       if (nbl == 0) continue;
243
244       progress->NewScope ( 80, "Translation" );
245       progress->Show();
246       sr.WS()->TransferReader()->TransientProcess()->SetProgress ( progress );
247
248       Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
249       for (ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
250         num = sr.Model()->Number(list->Value(ill));
251         if (num == 0) continue;
252         if (!sr.TransferOne(num)) di<<"Transfer entity n0 "<<num<<" : no result\n";
253         else {
254           nbs = sr.NbShapes();
255           char shname[30];  Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
256           di<<"Transfer entity n0 "<<num<<" OK  -> DRAW Shape: "<<shname<<"\n";
257           di<<"Now, "<<nbs<<" Shapes produced\n";
258           TopoDS_Shape sh = sr.Shape(nbs);
259           DBRep::Set (shname,sh);
260         }
261       }
262       sr.WS()->TransferReader()->TransientProcess()->SetProgress ( 0 );
263       progress->EndScope();
264       progress->Show();
265     }
266     else di<<"Unknown mode n0 "<<modepri<<"\n";
267   }
268   return 0;
269 }
270
271 //=======================================================================
272 //function : testreadstep
273 //purpose  : 
274 //=======================================================================
275 static Standard_Integer testread (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
276 {
277   if (argc != 3)                                                                                      
278     {                                                                                             
279       di << "ERROR in " << argv[0] << "Wrong Number of Arguments.\n";                     
280       di << " Usage : " << argv[0] <<" file_name shape_name\n";                          
281       return 1;                                                                                 
282     }
283   STEPControl_Reader Reader;
284   Standard_CString filename = argv[1];
285   IFSelect_ReturnStatus readstat = Reader.ReadFile(filename);
286   di<<"Status from reading STEP file "<<filename<<" : ";  
287   switch(readstat) {                                                              
288     case IFSelect_RetVoid  : { di<<"empty file\n"; return 1; }            
289     case IFSelect_RetDone  : { di<<"file read\n";    break; }             
290     case IFSelect_RetError : { di<<"file not found\n";   return 1; }      
291     case IFSelect_RetFail  : { di<<"error during read\n";  return 1; }    
292     default  :  { di<<"failure\n";   return 1; }                          
293   }  
294   Reader.TransferRoots();
295   TopoDS_Shape shape = Reader.OneShape();
296   DBRep::Set(argv[2],shape); 
297   di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
298   return 0;
299 }
300  
301 //  ########  COMMANDE steptrans  : teste les transformations  #########
302 //=======================================================================
303 //function : steptrans
304 //purpose  : 
305 //=======================================================================
306
307 static Standard_Integer steptrans (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
308 {
309   if (argc < 5) { di<<"give shape-name new-shape + entity-n0 entity-n0: AXIS2\n";
310                   return 1; }
311   TopoDS_Shape shape = DBRep::Get(argv[1]);
312   if (shape.IsNull()) { di<<"Not a shape : "<<argv[1]<<"\n"; return 1; }
313   Handle(StepGeom_Axis2Placement3d) ax1,ax2;
314   Standard_Integer n1 = 0, n2 = 0;
315   n1 = XSDRAW::GetEntityNumber(argv[3]);
316   if (argc > 4) n2 = XSDRAW::GetEntityNumber(argv[4]);
317   if (n1 > 0) ax1 = Handle(StepGeom_Axis2Placement3d)::DownCast
318     (XSDRAW::Entity(n1));
319   if (n2 > 0) ax2 = Handle(StepGeom_Axis2Placement3d)::DownCast
320     (XSDRAW::Entity(n2));
321   StepToTopoDS_MakeTransformed mktrans;
322   if (mktrans.Compute (ax1,ax2)) {
323     TopLoc_Location loc (mktrans.Transformation());
324     shape.Move (loc);
325 //    mktrans.Transform (shape);
326     DBRep::Set (argv[2],shape);
327     di<<"Transformed Shape as "<<argv[2]<<"\n";
328   }
329   else di<<"No transformation computed\n";
330   return 0;
331 }
332
333 //  ########  COMMANDE stepwrite : teste le Writer  #########
334
335 //=======================================================================
336 //function : stepwrite
337 //purpose  : 
338 //=======================================================================
339
340 static Standard_Integer stepwrite (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
341 {
342 //  On admet le controller AP214 ou une variante
343   DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller());
344   if (ctl.IsNull()) {
345     XSDRAW::SetNorm("STEP");
346     //sln 14.01.2002 OCC51: assign new value to ctl in order to avoid exception during using one in the function
347     ctl = Handle(STEPControl_Controller)::DownCast(XSDRAW::Controller());
348   }
349
350   if (argc < 3) {
351     di<<"Give mode[1-4] and Shape name + optional file. Mode possible\n";
352     di<<"f ou 1 : FacettedBRep        s ou 2 : ShellBasedSurfaceModel\n"
353         <<"m ou 3 : ManifoldSolidBrep   w ou 4 : GeometricCurveSet/WireFrame\n";
354     return 1; }
355   char modeshape = argv[1][0];
356   STEPControl_StepModelType mode;
357   switch (modeshape) {
358     case 'a' :
359     case '0' : mode = STEPControl_AsIs;                    break;
360     case 'f' :
361     case '1' : mode = STEPControl_FacetedBrep;             break;
362     case 's' :
363     case '2' : mode = STEPControl_ShellBasedSurfaceModel;  break;
364     case 'm' :
365     case '3' : mode = STEPControl_ManifoldSolidBrep;       break;
366     case 'w' :
367     case '4' : mode = STEPControl_GeometricCurveSet;       break;
368     default :  di<<"1st arg = mode, incorrect [give fsmw]\n"; return 1;
369   }
370
371   //:k8 abv 6 Jan 98: using parameter for writing mode (assemblies/shapes)
372   Handle(STEPControl_ActorWrite) ActWrite = 
373     Handle(STEPControl_ActorWrite)::DownCast ( ctl->ActorWrite() );
374   if ( ! ActWrite.IsNull() ) 
375     ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
376
377   TopoDS_Shape shape = DBRep::Get(argv[2]);
378   STEPControl_Writer sw (XSDRAW::Session(),Standard_False);
379   Handle(Interface_InterfaceModel) stepmodel = sw.Model();
380   Standard_Integer nbavant = (stepmodel.IsNull() ? 0 : stepmodel->NbEntities());
381
382   Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
383   progress->NewScope(90,"Translating");
384   progress->Show();
385   sw.WS()->TransferWriter()->FinderProcess()->SetProgress(progress);
386
387   Standard_Integer stat = sw.Transfer (shape,mode);
388   if (stat == IFSelect_RetDone)
389   {
390     di << "Translation: OK\n";
391   } 
392   else 
393   {
394     di << "Error: translation failed, status = " << stat << "\n";
395   }
396
397   sw.WS()->TransferWriter()->FinderProcess()->SetProgress(0);
398   progress->EndScope();
399   progress->Show();
400   progress->NewScope(10,"Writing");
401   progress->Show();
402
403 //   Que s est-il passe
404   stepmodel = sw.Model();
405   Standard_Integer nbapres = (stepmodel.IsNull() ? 0 : stepmodel->NbEntities());
406   if (nbavant > 0) di<<"Beware : Model not empty before transferring\n";
407   if (nbapres <= nbavant) di<<"Beware : No data produced by this transfer\n";
408   if (nbapres == 0) { di<<"No data to write\n"; return 0; }
409
410   if (argc <= 3) {
411     di<<" Now, to write a file, command : writeall filename\n";
412     return 0;
413   }
414
415   const char *nomfic = argv[3];
416   stat = sw.Write(nomfic);
417   switch (stat) {
418   case IFSelect_RetVoid : di<<"Error: No file written\n"; break;
419     case IFSelect_RetDone : di<<"File "<<nomfic<<" written\n"; break;
420     case IFSelect_RetStop : di<<"Error on writing file: no space on disk or destination is write protected\n"; break;
421     default : di<<"Error: File "<<nomfic<<" written with fail messages\n"; break;
422   }
423
424   progress->EndScope();
425   progress->Show();
426
427   return 0;
428 }
429 //=======================================================================
430 //function : testwritestep
431 //purpose  : 
432 //=======================================================================
433 static Standard_Integer testwrite (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
434 {
435   if (argc != 3)                                                                                      
436     {                                                                                             
437       di << "ERROR in " << argv[0] << "Wrong Number of Arguments.\n";                     
438       di << " Usage : " << argv[0] <<" file_name shape_name \n"; 
439       return 1;                                                                                 
440     }
441   STEPControl_Writer Writer;
442   Standard_CString filename = argv[1];
443   TopoDS_Shape shape = DBRep::Get(argv[2]); 
444   IFSelect_ReturnStatus stat = Writer.Transfer(shape,STEPControl_AsIs);
445   stat = Writer.Write(filename);
446   if(stat != IFSelect_RetDone){
447     di<<"Error on writing file\n";                                                               
448     return 1; 
449   }
450   di<<"File Is Written\n";
451   return 0;
452 }
453
454 //=======================================================================
455 //function : countexpected
456 //purpose  : 
457 //=======================================================================
458
459 static Standard_Integer countexpected
460   (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
461 {
462   Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
463   Handle(IFSelect_WorkSession) WS = pilot->Session();
464    const Interface_Graph& graph = WS->Graph();
465   
466   Handle(TColStd_HSequenceOfTransient) roots = WS->GiveList("xst-transferrable-roots", "");
467   STEPSelections_Counter cnt;
468   
469   for (Standard_Integer i =1 ; i <= roots->Length(); i++) {
470     cnt.Count(graph,roots->Value(i));
471   }
472   
473   di<< "Instances of Faces \t: "<<cnt.NbInstancesOfFaces()<<"\n";
474   di<< "Instances of Shells\t: "<<cnt.NbInstancesOfShells()<<"\n";
475   di<< "Instances of Solids\t: "<<cnt.NbInstancesOfSolids()<<"\n";
476   di<< "Instances of Wires in GS\t: "<<cnt.NbInstancesOfWires()<<"\n";
477   di<< "Instances of Edges in GS\t: "<<cnt.NbInstancesOfEdges()<<"\n";
478   
479   di<< "Source Faces \t: "<<cnt.NbSourceFaces()<<"\n";
480   di<< "Source Shells\t: "<<cnt.NbSourceShells()<<"\n";
481   di<< "Source Solids\t: "<<cnt.NbSourceSolids()<<"\n";
482   di<< "Source Wires in GS\t: "<<cnt.NbSourceWires()<<"\n";
483   di<< "Source Edges in GS\t: "<<cnt.NbSourceEdges()<<"\n";
484   
485   return 1;
486 }
487
488 static Standard_Integer dumpassembly
489   (Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char** /*argv*/)
490 {
491   Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
492   Handle(IFSelect_WorkSession) WS = pilot->Session();
493   const Interface_Graph& graph = WS->Graph();
494   
495   STEPSelections_AssemblyExplorer exp(graph);
496   exp.Dump(std::cout);
497   return 0;
498 }
499
500 static Standard_Integer stepfileunits (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
501 {
502
503   if(  argc < 2)
504   {
505     std::cout<<"Error: Invalid number of parameters. Should be: getfileunits name_file"<<std::endl;
506     return 1;
507   }
508   STEPControl_Reader aStepReader;
509   
510   IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
511   readstat = aStepReader.ReadFile (argv[1]);
512  
513   if (readstat != IFSelect_RetDone) {
514     
515     di<<"No model loaded\n";
516     return 1;
517   }
518
519   TColStd_SequenceOfAsciiString anUnitLengthNames;
520   TColStd_SequenceOfAsciiString anUnitAngleNames;
521   TColStd_SequenceOfAsciiString anUnitSolidAngleNames;
522   aStepReader.FileUnits( anUnitLengthNames,anUnitAngleNames,anUnitSolidAngleNames);
523                                    
524   Standard_Integer i =1;
525   di<<"=====================================================\n";
526   di<<"LENTH Unit\n";
527   for( ; i <= anUnitLengthNames.Length() ; i++)
528     di<<anUnitLengthNames(i).ToCString()<<"\n";
529   
530   di<<"=====================================================\n";
531   di<<"Angle Unit\n";
532   for( i =1 ; i <= anUnitAngleNames.Length() ; i++)
533     di<<anUnitAngleNames(i).ToCString()<<"\n";
534
535   di<<"=====================================================\n";
536   di<<"Solid Angle Unit\n";
537   for( i =1 ; i <= anUnitSolidAngleNames.Length() ; i++)
538     di<<anUnitSolidAngleNames(i).ToCString()<<"\n";
539   
540   return 0;
541 }
542 //  ########  COMMANDE stepwrite : teste le Writer  #########
543
544 void XSDRAWSTEP::InitCommands (Draw_Interpretor& theCommands)
545 {
546   const char* g = "DE: STEP";  // Step transfer file commands
547   XSDRAWSTEP::Init();
548   XSDRAW::LoadDraw(theCommands);
549   theCommands.Add("stepwrite" ,    "stepwrite mode[0-4 afsmw] shape",  __FILE__, stepwrite,     g);
550   theCommands.Add("testwritestep", "testwritestep filename.stp shape", __FILE__, testwrite,     g);
551   theCommands.Add("stepread",      "stepread  [file] [f or r (type of model full or reduced)]",__FILE__, stepread,      g);
552   theCommands.Add("testreadstep",  "testreadstep [file] [name DRAW]",  __FILE__, testread,      g);
553   theCommands.Add("steptrans",     "steptrans shape stepax1 stepax2",  __FILE__, steptrans,     g);
554   theCommands.Add("countexpected","TEST",                              __FILE__, countexpected, g);
555   theCommands.Add("dumpassembly", "TEST",                              __FILE__, dumpassembly,  g);
556   theCommands.Add("stepfileunits" , "stepfileunits name_file", __FILE__, stepfileunits,      g);
557 }