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