0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[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)
04232180 136 std::cout<<"Full model for translation with additional info will be used \n"<<std::flush;
bc650d41 137 else
04232180 138 std::cout<<"Reduced model for translation without additional info will be used \n"<<std::flush;
bc650d41
G
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. ";
0ebe5b0a 165 Standard_SStream aTmpStream;
166 sr.Model()->Print (sr.RootForTransfer(i), aTmpStream);
167 di << aTmpStream.str().c_str();
bc650d41 168 di<<" Type:"<<sr.RootForTransfer(i)->DynamicType()->Name()<<"\n";
7fd59977 169 }
170
04232180 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;
7fd59977 173 }
174
586db386 175 if (modepri == 0) { di<<"End Reading STEP\n"; return 0; }
7fd59977 176 if (modepri <= 2) {
177 num = 1;
178 if (modepri == 2) {
04232180 179 std::cout<<"Root N0 : "<<std::flush; std::cin>>num;
7fd59977 180 }
181
182 progress->NewScope ( 80, "Translation" );
183 progress->Show();
7f56eba8 184 sr.WS()->TransferReader()->TransientProcess()->SetProgress ( progress );
7fd59977 185
586db386 186 if (!sr.TransferRoot (num)) di<<"Transfer root n0 "<<num<<" : no result\n";
7fd59977 187 else {
bc650d41 188 nbs = sr.NbShapes();
91322f44 189 char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
bc650d41 190 di<<"Transfer root n0 "<<num<<" OK -> DRAW Shape: "<<shname<<"\n";
586db386 191 di<<"Now, "<<nbs<<" Shapes produced\n";
bc650d41
G
192 TopoDS_Shape sh = sr.Shape(nbs);
193 DBRep::Set (shname,sh);
7fd59977 194 }
195
7f56eba8 196 sr.WS()->TransferReader()->TransientProcess()->SetProgress ( 0 );
7fd59977 197 progress->EndScope();
198 progress->Show();
199 }
200 else if (modepri == 3) {
04232180 201 std::cout<<"Entity : "<<std::flush; num = XSDRAW::GetEntityNumber();
586db386 202 if (!sr.TransferOne (num)) di<<"Transfer entity n0 "<<num<<" : no result\n";
7fd59977 203 else {
bc650d41 204 nbs = sr.NbShapes();
91322f44 205 char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),num);
bc650d41 206 di<<"Transfer entity n0 "<<num<<" OK -> DRAW Shape: "<<shname<<"\n";
586db386 207 di<<"Now, "<<nbs<<" Shapes produced\n";
bc650d41
G
208 TopoDS_Shape sh = sr.Shape(nbs);
209 DBRep::Set (shname,sh);
7fd59977 210 }
211 }
212 else if (modepri == 4) {
bc650d41 213 // char snm[100]; Standard_Integer answer = 1;
7fd59977 214 Handle(TColStd_HSequenceOfTransient) list;
215
bc650d41
G
216 // Selection, nommee ou via tcl. tcl : raccourcis admis
217 // * donne xst-transferrable-roots
7fd59977 218 if (fromtcl) {
bc650d41
G
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");
7fd59977 223 //list = new TColStd_HSequenceOfTransient;
224 //for(Standard_Integer j=1; j<=num; j++)
225 // list->Append(sr.RootForTransfer(j));
bc650d41 226 }
7fd59977 227 else {
bc650d41
G
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 }
586db386 233 if (list.IsNull()) { di<<"No list defined. Give a selection name or * for all transferrable roots\n"; continue; }
7fd59977 234 } else {
04232180 235 std::cout<<"Name of Selection :"<<std::flush;
bc650d41 236 list = XSDRAW::GetList();
586db386 237 if (list.IsNull()) { di<<"No list defined\n"; continue; }
7fd59977 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();
7f56eba8 246 sr.WS()->TransferReader()->TransientProcess()->SetProgress ( progress );
7fd59977 247
248 Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
249 for (ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
bc650d41
G
250 num = sr.Model()->Number(list->Value(ill));
251 if (num == 0) continue;
586db386 252 if (!sr.TransferOne(num)) di<<"Transfer entity n0 "<<num<<" : no result\n";
bc650d41
G
253 else {
254 nbs = sr.NbShapes();
91322f44 255 char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
bc650d41 256 di<<"Transfer entity n0 "<<num<<" OK -> DRAW Shape: "<<shname<<"\n";
586db386 257 di<<"Now, "<<nbs<<" Shapes produced\n";
bc650d41
G
258 TopoDS_Shape sh = sr.Shape(nbs);
259 DBRep::Set (shname,sh);
260 }
7fd59977 261 }
7f56eba8 262 sr.WS()->TransferReader()->TransientProcess()->SetProgress ( 0 );
7fd59977 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//=======================================================================
275static Standard_Integer testread (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
276{
277 if (argc != 3)
278 {
586db386 279 di << "ERROR in " << argv[0] << "Wrong Number of Arguments.\n";
280 di << " Usage : " << argv[0] <<" file_name shape_name\n";
7fd59977 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) {
586db386 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; }
7fd59977 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
7fd59977 301// ######## COMMANDE steptrans : teste les transformations #########
302//=======================================================================
303//function : steptrans
304//purpose :
305//=======================================================================
306
307static Standard_Integer steptrans (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
308{
586db386 309 if (argc < 5) { di<<"give shape-name new-shape + entity-n0 entity-n0: AXIS2\n";
7fd59977 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 }
586db386 329 else di<<"No transformation computed\n";
7fd59977 330 return 0;
331}
332
333// ######## COMMANDE stepwrite : teste le Writer #########
334
335//=======================================================================
336//function : stepwrite
337//purpose :
338//=======================================================================
339
340static 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) {
586db386 351 di<<"Give mode[1-4] and Shape name + optional file. Mode possible\n";
7fd59977 352 di<<"f ou 1 : FacettedBRep s ou 2 : ShellBasedSurfaceModel\n"
586db386 353 <<"m ou 3 : ManifoldSolidBrep w ou 4 : GeometricCurveSet/WireFrame\n";
7fd59977 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;
586db386 368 default : di<<"1st arg = mode, incorrect [give fsmw]\n"; return 1;
7fd59977 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);
2857a8ac 388 if (stat == IFSelect_RetDone)
389 {
390 di << "Translation: OK\n";
391 }
392 else
393 {
394 di << "Error: translation failed, status = " << stat << "\n";
395 }
7fd59977 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());
586db386 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; }
7fd59977 409
7fd59977 410 if (argc <= 3) {
586db386 411 di<<" Now, to write a file, command : writeall filename\n";
2857a8ac 412 return 0;
7fd59977 413 }
7fd59977 414
2857a8ac 415 const char *nomfic = argv[3];
7fd59977 416 stat = sw.Write(nomfic);
417 switch (stat) {
586db386 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;
7fd59977 422 }
423
424 progress->EndScope();
425 progress->Show();
426
427 return 0;
428}
429//=======================================================================
430//function : testwritestep
431//purpose :
432//=======================================================================
433static Standard_Integer testwrite (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
434{
435 if (argc != 3)
436 {
586db386 437 di << "ERROR in " << argv[0] << "Wrong Number of Arguments.\n";
438 di << " Usage : " << argv[0] <<" file_name shape_name \n";
7fd59977 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){
586db386 447 di<<"Error on writing file\n";
7fd59977 448 return 1;
449 }
586db386 450 di<<"File Is Written\n";
7fd59977 451 return 0;
452}
453
454//=======================================================================
455//function : countexpected
456//purpose :
457//=======================================================================
458
459static 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
488static 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);
04232180 496 exp.Dump(std::cout);
7fd59977 497 return 0;
498}
499
d402d481 500static Standard_Integer stepfileunits (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
501{
502
503 if( argc < 2)
504 {
04232180 505 std::cout<<"Error: Invalid number of parameters. Should be: getfileunits name_file"<<std::endl;
d402d481 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
586db386 515 di<<"No model loaded\n";
d402d481 516 return 1;
517 }
518
519 TColStd_SequenceOfAsciiString anUnitLengthNames;
520 TColStd_SequenceOfAsciiString anUnitAngleNames;
521 TColStd_SequenceOfAsciiString anUnitSolidAngleNames;
522 aStepReader.FileUnits( anUnitLengthNames,anUnitAngleNames,anUnitSolidAngleNames);
523
302f96fb 524 Standard_Integer i =1;
d402d481 525 di<<"=====================================================\n";
586db386 526 di<<"LENTH Unit\n";
d402d481 527 for( ; i <= anUnitLengthNames.Length() ; i++)
528 di<<anUnitLengthNames(i).ToCString()<<"\n";
529
530 di<<"=====================================================\n";
586db386 531 di<<"Angle Unit\n";
d402d481 532 for( i =1 ; i <= anUnitAngleNames.Length() ; i++)
533 di<<anUnitAngleNames(i).ToCString()<<"\n";
534
535 di<<"=====================================================\n";
586db386 536 di<<"Solid Angle Unit\n";
d402d481 537 for( i =1 ; i <= anUnitSolidAngleNames.Length() ; i++)
538 di<<anUnitSolidAngleNames(i).ToCString()<<"\n";
539
540 return 0;
541}
7fd59977 542// ######## COMMANDE stepwrite : teste le Writer #########
543
544void 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);
bc650d41 551 theCommands.Add("stepread", "stepread [file] [f or r (type of model full or reduced)]",__FILE__, stepread, g);
7fd59977 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);
d402d481 556 theCommands.Add("stepfileunits" , "stepfileunits name_file", __FILE__, stepfileunits, g);
7fd59977 557}