0022898: IGES import fails in german environment
[occt.git] / src / XDEDRAW / XDEDRAW.cxx
CommitLineData
b311480e 1// Created on: 2000-08-04
2// Created by: Pavel TELKOV
3// Copyright (c) 2000-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
7fd59977 20
21#include <XDEDRAW.ixx>
22#include <stdio.h>
23
24#include <TCollection_ExtendedString.hxx>
25#include <TCollection_AsciiString.hxx>
26#include <TColStd_HSequenceOfExtendedString.hxx>
27#include <TCollection_HAsciiString.hxx>
28#include <Quantity_Color.hxx>
29
30#include <TopoDS_Shape.hxx>
31
32#include <Draw.hxx>
33#include <DBRep.hxx>
34#include <V3d_Viewer.hxx>
35#include <V3d_View.hxx>
36#include <AIS_InteractiveContext.hxx>
37#include <ViewerTest_Tool.hxx>
38
39#include <DDF_Browser.hxx>
40#include <DDocStd.hxx>
41#include <DDocStd_DrawDocument.hxx>
42
02a0b964 43#include <STEPCAFControl_Controller.hxx>
44
7fd59977 45#include <TDF_Tool.hxx>
46#include <TDF_Data.hxx>
47#include <TDF_LabelSequence.hxx>
48#include <TDF_AttributeIterator.hxx>
f767df4e 49#include <TDF_Reference.hxx>
7fd59977 50#include <TDocStd_Document.hxx>
51#include <TDataStd_UAttribute.hxx>
52#include <TDataStd_TreeNode.hxx>
53#include <TDataStd_Integer.hxx>
54#include <TDataStd_Real.hxx>
55#include <TDataStd_Name.hxx>
f767df4e 56#include <TDataStd_Comment.hxx>
57#include <TDataStd_AsciiString.hxx>
7fd59977 58#include <TNaming_NamedShape.hxx>
f767df4e 59#include <TDataStd_IntegerArray.hxx>
7fd59977 60#include <TDataStd_RealArray.hxx>
f767df4e 61#include <TDataStd_ByteArray.hxx>
7fd59977 62#include <TPrsStd_AISPresentation.hxx>
63#include <TPrsStd_NamedShapeDriver.hxx>
64#include <TPrsStd_AISViewer.hxx>
65
66#include <XCAFDoc.hxx>
67#include <XCAFDoc_Color.hxx>
68#include <XCAFDoc_Volume.hxx>
69#include <XCAFDoc_Area.hxx>
70#include <XCAFDoc_Centroid.hxx>
71#include <XCAFDoc_ShapeTool.hxx>
72#include <XCAFDoc_ColorTool.hxx>
73#include <XCAFDoc_DocumentTool.hxx>
74#include <XCAFDoc_GraphNode.hxx>
75#include <XCAFDoc_LayerTool.hxx>
76#include <XCAFDoc_DimTol.hxx>
77#include <XCAFDoc_Material.hxx>
78#include <XCAFPrs_Driver.hxx>
79#include <XCAFApp_Application.hxx>
80
81#include <XDEDRAW_Shapes.hxx>
82#include <XDEDRAW_Colors.hxx>
83#include <XDEDRAW_Layers.hxx>
84#include <XDEDRAW_Props.hxx>
85#include <XDEDRAW_Common.hxx>
86#include <XSDRAWIGES.hxx>
87#include <XSDRAWSTEP.hxx>
88#include <SWDRAW.hxx>
89#include <XSDRAW.hxx>
90#include <XCAFPrs.hxx>
91#include <ViewerTest.hxx>
92#include <Draw_PluginMacro.hxx>
93
94#include <TColStd_HArray1OfInteger.hxx>
95#include <TColStd_HArray1OfReal.hxx>
96
a2d5ab2e 97#include <AIS_InteractiveObject.hxx>
98#include <AIS_Drawer.hxx>
99#include <Aspect_TypeOfLine.hxx>
100#include <Prs3d_LineAspect.hxx>
101
7fd59977 102#define ZVIEW_SIZE 1000000.0
103// avoid warnings on 'extern "C"' functions returning C++ classes
104#ifdef WNT
105#pragma warning(4:4190)
106#endif
107
108//=======================================================================
109// Section: General commands
110//=======================================================================
111
112//=======================================================================
113//function : newDoc
114//purpose :
115//=======================================================================
116static Standard_Integer newDoc (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
117{
118 if (argc < 2) {di<<"Give document name"<<"\n";return 1;}
119
120 Handle(TDocStd_Document) D;
121 Handle(DDocStd_DrawDocument) DD;
122 Handle(TDocStd_Application) A;
123
124 if (!DDocStd::Find(A)) return 1;
125
126 if (!DDocStd::GetDocument(argv[1],D,Standard_False)) {
127 A->NewDocument( "MDTV-XCAF" ,D);
128 DD = new DDocStd_DrawDocument(D);
129 TDataStd_Name::Set(D->GetData()->Root(),argv[1]);
130 Draw::Set(argv[1],DD);
131 di << "document " << argv[1] << " created" << "\n";
132 //DDocStd::ReturnLabel(di,D->Main());
133 }
134 else di << argv[1] << " is already a document" << "\n";
135
136 return 0;
137}
138
139
140//=======================================================================
141//function : saveDoc
142//purpose :
143//=======================================================================
144static Standard_Integer saveDoc (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
145{
146 Handle(TDocStd_Document) D;
147 Handle(TDocStd_Application) A;
148 if (!DDocStd::Find(A)) return 1;
149
150 if (argc == 1) {
151 if (A->NbDocuments() < 1) return 1;
152 A->GetDocument(1, D);
153 }
154 else {
155 if (!DDocStd::GetDocument(argv[1],D)) return 1;
156 }
157
158 if (argc == 3 ) {
159 TCollection_ExtendedString path (argv[2]);
160 A->SaveAs(D,path);
161 return 0;
162 }
163 if (!D->IsSaved()) {
164 di << "this document has never been saved" << "\n";
165 return 1;
166 }
167 A->Save(D);
168 return 0;
169}
170
02a0b964 171//=======================================================================
172//function : openDoc
173//purpose :
174//=======================================================================
175static Standard_Integer openDoc (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
176{
177 Handle(TDocStd_Document) D;
178 Handle(DDocStd_DrawDocument) DD;
179 Handle(TDocStd_Application) A;
180
181 if ( !DDocStd::Find(A) )
182 return 1;
183
184 if ( argc != 3 )
185 {
186 di << "invalid number of arguments. Usage:\t XOpen filename docname" << "\n";
187 return 1;
188 }
189
190 Standard_CString Filename = argv[1];
191 Standard_CString DocName = argv[2];
192
193 if ( DDocStd::GetDocument(DocName, D, Standard_False) )
194 {
195 di << "document with name " << DocName << " already exists" << "\n";
196 return 1;
197 }
198
199 if ( A->Open(Filename, D) != PCDM_RS_OK )
200 {
201 di << "cannot open XDE document" << "\n";
202 return 1;
203 }
204
205 DD = new DDocStd_DrawDocument(D);
206 TDataStd_Name::Set(D->GetData()->Root(), DocName);
207 Draw::Set(DocName, DD);
208
209 di << "document " << DocName << " opened" << "\n";
210
211 return 0;
212}
7fd59977 213
214//=======================================================================
215//function : dump
216//purpose :
217//=======================================================================
218static Standard_Integer dump (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
219{
220 if (argc<2) {
221 di<<"Use: "<<argv[0]<<" Doc [int deep (0/1)]"<<"\n";
222 return 1;
223 }
224 Handle(TDocStd_Document) Doc;
225 DDocStd::GetDocument(argv[1], Doc);
226 if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; }
227
228 Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
229 Standard_Boolean deep = Standard_False;
91322f44 230 if ( (argc==3) && (Draw::Atoi(argv[2])==1) ) deep = Standard_True;
7fd59977 231 myAssembly->Dump(deep);
232 return 0;
233}
234
235
236//=======================================================================
237//function : StatAssembly
238//purpose : recursive part of statistics
239//=======================================================================
240
241static void StatAssembly(const TDF_Label L,
242 const Standard_Integer level,
243 Handle(TColStd_HArray1OfInteger) &HAI,
244 Standard_Integer &NbCentroidProp,
245 Standard_Integer &NbVolumeProp,
246 Standard_Integer &NbAreaProp,
247 Standard_Integer &NbShapesWithName,
248 Standard_Integer &NbShapesWithColor,
249 Standard_Integer &NbShapesWithLayer,
250 Handle(TDocStd_Document) &aDoc,
251 Standard_Boolean &PrintStructMode,
252 Draw_Interpretor& di)
253{
254 if(PrintStructMode) {
255 for(Standard_Integer j=0; j<=level; j++)
256 di<<" ";
257 }
258 TCollection_AsciiString Entry;
259 TDF_Tool::Entry(L, Entry);
260 if(PrintStructMode) di<<Entry.ToCString();
261
262 Handle(TDataStd_Name) Name;
263 if(L.FindAttribute(TDataStd_Name::GetID(), Name)) {
264 NbShapesWithName++;
265 if(PrintStructMode) {
266 TCollection_AsciiString AsciiStringName(Name->Get(),'?');
267 di<<" "<<AsciiStringName.ToCString()<<" has attributes: ";
268 }
269 }
270 else {
271 if(PrintStructMode) di<<" NoName has attributes: ";
272 }
273
274 Handle(XCAFDoc_Centroid) aCentroid = new (XCAFDoc_Centroid);
275 if(L.FindAttribute(XCAFDoc_Centroid::GetID(), aCentroid)) {
276 if(PrintStructMode) di<<"Centroid ";
277 NbCentroidProp++;
278 }
279 Standard_Real tmp;
280 if(XCAFDoc_Volume::Get(L,tmp)) {
281 if(PrintStructMode) di<<"Volume("<<tmp<<") ";
282 NbVolumeProp++;
283 }
284 if(XCAFDoc_Area::Get(L,tmp)) {
285 if(PrintStructMode) di<<"Area("<<tmp<<") ";
286 NbAreaProp++;
287 }
288 Handle(XCAFDoc_ColorTool) CTool = XCAFDoc_DocumentTool::ColorTool(aDoc->Main());
289 Quantity_Color col;
290 Standard_Boolean IsColor = Standard_False;
291 if(CTool->GetColor(L,XCAFDoc_ColorGen,col))
292 IsColor = Standard_True;
293 else if(CTool->GetColor(L,XCAFDoc_ColorSurf,col))
294 IsColor = Standard_True;
295 else if(CTool->GetColor(L,XCAFDoc_ColorCurv,col))
296 IsColor = Standard_True;
297 if(IsColor) {
298 TCollection_AsciiString Entry1;
299 Entry1 = col.StringName(col.Name());
300 if(PrintStructMode) di<<"Color("<<Entry1.ToCString()<<") ";
301 NbShapesWithColor++;
302 }
303 Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool(aDoc->Main());
304 Handle(TColStd_HSequenceOfExtendedString) aLayerS;
305 LTool->GetLayers(L, aLayerS);
306 if(!aLayerS.IsNull() && aLayerS->Length()>0) {
307 if(PrintStructMode) {
308 di<<"Layer(";
309 for(Standard_Integer i=1; i<=aLayerS->Length(); i++) {
310 TCollection_AsciiString Entry2(aLayerS->Value(i),'?');
311 if(i==1)
312 di<<"\""<<Entry2.ToCString()<<"\"";
313 else
314 di<<" "<<"\""<<Entry2.ToCString()<<"\"";
315 }
316 di<<") ";
317 }
318 NbShapesWithLayer++;
319 }
320 if(PrintStructMode) di<<"\n";
321
322 HAI->SetValue(level, HAI->Value(level)+1 );
323 if(L.HasChild()) {
324 for(Standard_Integer i=1; i<=L.NbChildren(); i++) {
325 StatAssembly(L.FindChild(i), level+1, HAI, NbCentroidProp, NbVolumeProp,
326 NbAreaProp, NbShapesWithName, NbShapesWithColor,
327 NbShapesWithLayer, aDoc, PrintStructMode, di);
328 }
329 }
330
331}
332
333
334//=======================================================================
335//function : statdoc
336//purpose :
337//=======================================================================
338static Standard_Integer statdoc (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
339{
340 if (argc<2) {
341 di<<"Use: "<<argv[0]<<" Doc "<<"\n";
342 return 1;
343 }
344 Handle(TDocStd_Document) Doc;
345 DDocStd::GetDocument(argv[1], Doc);
346 if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; }
347
348 Standard_Boolean PrintStructMode = (argc==3);
349 Handle(XCAFDoc_ShapeTool) aTool = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
350
351 TDF_LabelSequence SeqLabels;
352 aTool->GetShapes(SeqLabels);
353 if(SeqLabels.Length()<=0) return 0;
354 if(PrintStructMode) di<<"\n"<<"Structure of shapes in the document:"<<"\n";
355 Standard_Integer level=0;
356 Standard_Integer NbCentroidProp=0, NbVolumeProp=0, NbAreaProp=0;
357 Standard_Integer NbShapesWithName=0, NbShapesWithColor=0, NbShapesWithLayer=0;
358 Handle(TColStd_HArray1OfInteger) HAI = new TColStd_HArray1OfInteger(0,20);
359 Standard_Integer i=0;
360 for(i=0; i<=20; i++) HAI->SetValue(i,0);
361 for(i=1; i<=SeqLabels.Length(); i++) {
362 StatAssembly(SeqLabels.Value(i), level, HAI, NbCentroidProp, NbVolumeProp,
363 NbAreaProp, NbShapesWithName, NbShapesWithColor,
364 NbShapesWithLayer, Doc, PrintStructMode, di);
365 }
366 Standard_Integer NbLabelsShape = 0;
367 di<<"\n"<<"Statistis of shapes in the document:"<<"\n";
368 for(i=0; i<=20; i++) {
369 if(HAI->Value(i)==0) break;
370 //di<<"level N "<<i<<" : number of labels with shape = "<<HAI->Value(i)<<"\n";
371 di<<"level N "<<i<<" : "<<HAI->Value(i)<<"\n";
372 NbLabelsShape = NbLabelsShape + HAI->Value(i);
373 }
374 di<<"Total number of labels for shapes in the document = "<<NbLabelsShape<<"\n";
375 di<<"Number of labels with name = "<<NbShapesWithName<<"\n";
376 di<<"Number of labels with color link = "<<NbShapesWithColor<<"\n";
377 di<<"Number of labels with layer link = "<<NbShapesWithLayer<<"\n";
378
379 di<<"\n"<<"Statistis of Props in the document:"<<"\n";
380 di<<"Number of Centroid Props = "<<NbCentroidProp<<"\n";
381 di<<"Number of Volume Props = "<<NbVolumeProp<<"\n";
382 di<<"Number of Area Props = "<<NbAreaProp<<"\n";
383
384 Handle(XCAFDoc_ColorTool) CTool = XCAFDoc_DocumentTool::ColorTool(Doc->Main());
385 TDF_LabelSequence CLabels;
386 CTool->GetColors(CLabels);
387 di<<"\n"<<"Number of colors = "<<CLabels.Length()<<"\n";
388 if(CLabels.Length()>0) {
389 for(i=1; i<=CLabels.Length(); i++) {
390 TDF_Label aLabel = CLabels.Value(i);
391 Quantity_Color col;
392 CTool->GetColor(aLabel, col);
393 di<<col.StringName(col.Name())<<" ";
394 }
395 di<<"\n";
396 }
397
398 Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool(Doc->Main());
399 TDF_LabelSequence LLabels;
400 LTool->GetLayerLabels(LLabels);
401 di<<"\n"<<"Number of layers = "<<LLabels.Length()<<"\n";
402 if(LLabels.Length()>0) {
403 for(i=1; i<=LLabels.Length(); i++) {
404 TDF_Label aLabel = LLabels.Value(i);
405 TCollection_ExtendedString layerName;
406 LTool->GetLayer(aLabel, layerName);
407 TCollection_AsciiString Entry(layerName,'?');
408 di<<"\""<<Entry.ToCString() <<"\" ";
409 }
410 di<<"\n";
411 }
412
413 di<<"\n";
414 return 0;
415}
416
417
418//=======================================================================
419//function : setPrs
420//purpose :
421//=======================================================================
422static Standard_Integer setPrs (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
423{
424 if (argc <2) {
425 di<<"Use: "<<argv[0]<<" DocName [label1 label2 ...] "<<"\n";
426 return 1;
427 }
428
429 Handle(TDocStd_Document) Doc;
430 DDocStd::GetDocument(argv[1], Doc);
431 if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; }
432
433 // collect sequence of labels to set presentation
434 Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
435 TDF_LabelSequence seq;
436 if ( argc >2 ) {
437 for ( Standard_Integer i=2; i < argc; i++ ) {
438 TDF_Label aLabel;
439 TDF_Tool::Label(Doc->GetData(), argv[i], aLabel);
440 if ( aLabel.IsNull() || ! shapes->IsShape ( aLabel ) ) {
441 di << argv[i] << " is not a valid shape label!";
442 continue;
443 }
444 seq.Append ( aLabel );
445 }
446 }
447 else {
448 shapes->GetShapes ( seq );
449 }
450
451 // set presentations
452 Handle(XCAFDoc_ColorTool) colors = XCAFDoc_DocumentTool::ColorTool(Doc->Main());
453 for ( Standard_Integer i=1; i <= seq.Length(); i++ ) {
454 Handle(TPrsStd_AISPresentation) prs;
455 if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) ) {
456 prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
457 prs->SetMaterial ( Graphic3d_NOM_PLASTIC );
458 }
459// Quantity_Color Col;
460// if ( colors.GetColor ( seq.Value(i), XCAFDoc_ColorSurf, Col ) )
461// prs->SetColor ( Col.Name() );
462// else if ( colors.GetColor ( seq.Value(i), XCAFDoc_ColorCurv, Col ) )
463// prs->SetColor ( Col.Name() );
464 }
465 return 0;
466}
467
468
469//=======================================================================
470//function : show
471//purpose :
472//=======================================================================
473static Standard_Integer show (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
474{
475 if (argc <2) {
476 di<<"Use: "<<argv[0]<<" DocName [label1 label2 ...] "<<"\n";
477 return 1;
478 }
479
480 Handle(TDocStd_Document) Doc;
481 DDocStd::GetDocument(argv[1], Doc);
482 if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; }
483
484 // init viewer
485// char string[260];
91322f44 486// Sprintf ( string, "AISInitViewer %s", argv[1] );
7fd59977 487// di.Eval ( string );
488 TDF_Label acces = Doc->GetData()->Root();
489 Handle(TPrsStd_AISViewer) viewer;
490 if (!TPrsStd_AISViewer::Find (acces,viewer)) {
491 TCollection_AsciiString title;
492 title.Prepend(argv[1]);
493 title.Prepend("_");
494 title.Prepend("Document");
495 Handle(V3d_Viewer) vw=ViewerTest_Tool::MakeViewer (title.ToCString());
496 viewer = TPrsStd_AISViewer::New (acces,vw);
497 }
498 ViewerTest_Tool::InitViewerTest (viewer->GetInteractiveContext());
499
500 //szv:CAX-TRJ7 c2-pe-214.stp was clipped
501 viewer->GetInteractiveContext()->CurrentViewer()->ActiveView()->SetZSize(ZVIEW_SIZE);
502 //DDF::ReturnLabel(di,viewer->Label());
503
504 // collect sequence of labels to display
505 Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
506 TDF_LabelSequence seq;
507 if ( argc >2 ) {
508 for ( Standard_Integer i=2; i < argc; i++ ) {
509 TDF_Label aLabel;
510 TDF_Tool::Label(Doc->GetData(), argv[i], aLabel);
511 if ( aLabel.IsNull() || ! shapes->IsShape ( aLabel ) ) {
512 di << argv[i] << " is not a valid shape label!";
513 continue;
514 }
515 seq.Append ( aLabel );
516 }
517 }
518 else {
519 shapes->GetFreeShapes ( seq );
520 }
521
522 // set presentations and show
523 //Handle(XCAFDoc_ColorTool) colors = XCAFDoc_DocumentTool::ColorTool(Doc->Main());
524 for ( Standard_Integer i=1; i <= seq.Length(); i++ ) {
525 Handle(TPrsStd_AISPresentation) prs;
526 if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) ) {
527 prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
528 prs->SetMaterial ( Graphic3d_NOM_PLASTIC );
529 }
530// Quantity_Color Col;
531// if ( colors.GetColor ( seq.Value(i), XCAFDoc_ColorSurf, Col ) )
532// prs->SetColor ( Col.Name() );
533// else if ( colors.GetColor ( seq.Value(i), XCAFDoc_ColorCurv, Col ) )
534// prs->SetColor ( Col.Name() );
535 prs->Display(Standard_True);
536 }
537 TPrsStd_AISViewer::Update(Doc->GetData()->Root());
538 return 0;
539}
540
541
542//=======================================================================
543//function : xwd
544//purpose :
545//=======================================================================
546static Standard_Integer xwd (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
547{
548 if (argc <3) {
549 di<<"Use: "<<argv[0]<<" DocName filename.{xwd|gif|bmp}"<<"\n";
550 return 1;
551 }
552
553 Handle(TDocStd_Document) Doc;
554 DDocStd::GetDocument(argv[1], Doc);
555 if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; }
556
557 Handle(AIS_InteractiveContext) IC;
558 if ( ! TPrsStd_AISViewer::Find ( Doc->GetData()->Root(), IC ) ) {
559 di << "Cannot find viewer for document " << argv[1] << "\n";
560 return 1;
561 }
562
563 Handle(V3d_Viewer) viewer = IC->CurrentViewer();
564 viewer->InitActiveViews();
565 if ( viewer->MoreActiveViews() ) {
566 viewer->ActiveView()->Dump ( argv[2] );
567 }
568 else {
569 di << "Cannot find an active view in a viewer " << argv[1] << "\n";
570 return 1;
571 }
572
573 return 0;
574}
575
576
577//=======================================================================
578//function : XAttributeValue
579//purpose :
580//=======================================================================
581static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
582{
583 if ( argc <4 ) { di << "ERROR: Too few args" << "\n"; return 0; }
584 Handle(DDF_Browser) browser =
585 Handle(DDF_Browser)::DownCast (Draw::Get(argv[1], Standard_True));
586 if ( browser.IsNull() ) { di << "ERROR: Not a browser: " << argv[1] << "\n"; return 0; }
587
588 TDF_Label lab;
589 TDF_Tool::Label(browser->Data(),argv[2],lab);
590 if ( lab.IsNull() ) { di << "ERROR: label is Null: " << argv[2] << "\n"; return 0; }
591
91322f44 592 Standard_Integer num = Draw::Atoi ( argv[3] );
7fd59977 593 TDF_AttributeIterator itr(lab,Standard_False);
594 for (Standard_Integer i=1; itr.More() && i < num; i++) itr.Next();
595
596 if ( ! itr.More() ) { di << "ERROR: Attribute #" << num << " not found" << "\n"; return 0; }
597
598 const Handle(TDF_Attribute)& att = itr.Value();
599 if ( att->IsKind(STANDARD_TYPE(TDataStd_TreeNode)) ) {
f767df4e 600 Standard_CString type = "";
7fd59977 601 if ( att->ID() == XCAFDoc::ShapeRefGUID() ) type = "Shape Instance Link";
602 else if ( att->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorGen) ) type = "Generic Color Link";
603 else if ( att->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorSurf) ) type = "Surface Color Link";
604 else if ( att->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorCurv) ) type = "Curve Color Link";
605 else if ( att->ID() == XCAFDoc::DimTolRefGUID() ) type = "DGT Link";
606 else if ( att->ID() == XCAFDoc::DatumRefGUID() ) type = "Datum Link";
607 else if ( att->ID() == XCAFDoc::MaterialRefGUID() ) type = "Material Link";
7fd59977 608 Handle(TDataStd_TreeNode) TN = Handle(TDataStd_TreeNode)::DownCast(att);
609 TCollection_AsciiString ref;
610 if ( TN->HasFather() ) {
611 TDF_Tool::Entry ( TN->Father()->Label(), ref );
612 di << type << " ==> " << ref.ToCString();
613 }
614 else {
615 di << type << " <== (" << ref.ToCString();
616 Handle(TDataStd_TreeNode) child = TN->First();
617 while ( ! child.IsNull() ) {
f767df4e 618 TDF_Tool::Entry ( child->Label(), ref );
619 if ( child != TN->First() ) di << ", ";
620 di << ref.ToCString();
621 child = child->Next();
7fd59977 622 }
623 di << ")";
624 }
625 }
f767df4e 626 else if ( att->IsKind(STANDARD_TYPE(TDF_Reference)) ) {
627 Handle(TDF_Reference) val = Handle(TDF_Reference)::DownCast ( att );
628 TCollection_AsciiString ref;
629 TDF_Tool::Entry ( val->Get(), ref );
630 di << "==> " << ref.ToCString();
631 }
7fd59977 632 else if ( att->IsKind(STANDARD_TYPE(TDataStd_Integer)) ) {
633 Handle(TDataStd_Integer) val = Handle(TDataStd_Integer)::DownCast ( att );
634 TCollection_AsciiString str ( val->Get() );
635 di << str.ToCString();
636 }
637 else if ( att->IsKind(STANDARD_TYPE(TDataStd_Real)) ) {
638 Handle(TDataStd_Real) val = Handle(TDataStd_Real)::DownCast ( att );
639 TCollection_AsciiString str ( val->Get() );
640 di << str.ToCString();
641 }
f767df4e 642 else if ( att->IsKind(STANDARD_TYPE(TDataStd_Name)) ) {
643 Handle(TDataStd_Name) val = Handle(TDataStd_Name)::DownCast ( att );
644 TCollection_AsciiString str ( val->Get(), '?' );
7fd59977 645 di << str.ToCString();
646 }
f767df4e 647 else if ( att->IsKind(STANDARD_TYPE(TDataStd_Comment)) ) {
648 Handle(TDataStd_Comment) val = Handle(TDataStd_Comment)::DownCast ( att );
649 TCollection_AsciiString str ( val->Get(), '?' );
7fd59977 650 di << str.ToCString();
651 }
f767df4e 652 else if ( att->IsKind(STANDARD_TYPE(TDataStd_AsciiString)) ) {
653 Handle(TDataStd_AsciiString) val = Handle(TDataStd_AsciiString)::DownCast ( att );
7fd59977 654 TCollection_AsciiString str ( val->Get(), '?' );
655 di << str.ToCString();
656 }
f767df4e 657 else if ( att->IsKind(STANDARD_TYPE(TDataStd_IntegerArray)) ) {
658 Handle(TDataStd_IntegerArray) val = Handle(TDataStd_IntegerArray)::DownCast ( att );
659 for ( Standard_Integer j=val->Lower(); j <= val->Upper(); j++ ) {
660 if ( j > val->Lower() ) di << ", ";
661 TCollection_AsciiString str ( val->Value(j) );
662 di << str.ToCString();
663 }
664 }
7fd59977 665 else if ( att->IsKind(STANDARD_TYPE(TDataStd_RealArray)) ) {
666 Handle(TDataStd_RealArray) val = Handle(TDataStd_RealArray)::DownCast ( att );
667 for ( Standard_Integer j=val->Lower(); j <= val->Upper(); j++ ) {
668 if ( j > val->Lower() ) di << ", ";
669 TCollection_AsciiString str ( val->Value(j) );
670 di << str.ToCString();
671 }
672 }
f767df4e 673 else if ( att->IsKind(STANDARD_TYPE(TDataStd_ByteArray)) ) {
674 Handle(TDataStd_ByteArray) val = Handle(TDataStd_ByteArray)::DownCast ( att );
675 for ( Standard_Integer j=val->Lower(); j <= val->Upper(); j++ ) {
676 if ( j > val->Lower() ) di << ", ";
677 TCollection_AsciiString str ( val->Value(j) );
678 di << str.ToCString();
679 }
680 }
7fd59977 681 else if ( att->IsKind(STANDARD_TYPE(TNaming_NamedShape)) ) {
682 Handle(TNaming_NamedShape) val = Handle(TNaming_NamedShape)::DownCast ( att );
683 TopoDS_Shape S = val->Get();
684 di << S.TShape()->DynamicType()->Name();
685 if ( ! S.Location().IsIdentity() ) di << "(located)";
686 }
f767df4e 687 else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_Volume)) ) {
688 Handle(XCAFDoc_Volume) val = Handle(XCAFDoc_Volume)::DownCast ( att );
689 TCollection_AsciiString str ( val->Get() );
690 di << str.ToCString();
691 }
692 else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_Area)) ) {
693 Handle(XCAFDoc_Area) val = Handle(XCAFDoc_Area)::DownCast ( att );
694 TCollection_AsciiString str ( val->Get() );
695 di << str.ToCString();
696 }
697 else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_Centroid)) ) {
698 Handle(XCAFDoc_Centroid) val = Handle(XCAFDoc_Centroid)::DownCast ( att );
699 gp_Pnt myCentroid = val->Get();
700 di << "(" ;
701 di << myCentroid.X();
702 di <<" , ";
703 di << myCentroid.Y();
704 di <<" , ";
705 di << myCentroid.Z();
706 di << ")";
707 }
7fd59977 708 else if ( att->IsKind(STANDARD_TYPE(TDataStd_UAttribute)) ) {
709 if ( att->ID() == XCAFDoc::AssemblyGUID() ) di << "is assembly";
710 if ( att->ID() == XCAFDoc::InvisibleGUID() ) di << "invisible";
711 }
712 else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_Color)) ) {
713 Handle(XCAFDoc_Color) val = Handle(XCAFDoc_Color)::DownCast ( att );
714 Quantity_Color C = val->GetColor();
715 char string[260];
91322f44 716 Sprintf ( string, "%s (%g, %g, %g)", C.StringName ( C.Name() ),
7fd59977 717 C.Red(), C.Green(), C.Blue() );
718 di << string;
719 }
720 else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_DimTol)) ) {
721 Handle(XCAFDoc_DimTol) val = Handle(XCAFDoc_DimTol)::DownCast ( att );
722 Standard_Integer kind = val->GetKind();
723 Handle(TColStd_HArray1OfReal) HAR = val->GetVal();
724 if(kind<20) { //dimension
725 di<<"Diameter (ValueRange["<<HAR->Value(1)<<","<<HAR->Value(2)<<"])";
726 }
727 else {
728 switch(kind) {
729 case 21: di << "GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol_1 (Value="<<HAR->Value(1)<<")"; break;
730 case 22: di << "GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol_2 (Value="<<HAR->Value(1)<<")"; break;
731 case 23: di << "GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol_3 (Value="<<HAR->Value(1)<<")"; break;
732 case 24: di << "AngularityTolerance (Value="<<HAR->Value(1)<<")"; break;
733 case 25: di << "CircularRunoutTolerance (Value="<<HAR->Value(1)<<")"; break;
734 case 26: di << "CoaxialityTolerance (Value="<<HAR->Value(1)<<")"; break;
735 case 27: di << "ConcentricityTolerance (Value="<<HAR->Value(1)<<")"; break;
736 case 28: di << "ParallelismTolerance (Value="<<HAR->Value(1)<<")"; break;
737 case 29: di << "PerpendicularityTolerance (Value="<<HAR->Value(1)<<")"; break;
738 case 30: di << "SymmetryTolerance (Value="<<HAR->Value(1)<<")"; break;
739 case 31: di << "TotalRunoutTolerance (Value="<<HAR->Value(1)<<")"; break;
740 case 35: di << "ModifiedGeometricTolerance_1 (Value="<<HAR->Value(1)<<")"; break;
741 case 36: di << "ModifiedGeometricTolerance_2 (Value="<<HAR->Value(1)<<")"; break;
742 case 37: di << "ModifiedGeometricTolerance_3 (Value="<<HAR->Value(1)<<")"; break;
743 case 38: di << "CylindricityTolerance (Value="<<HAR->Value(1)<<")"; break;
744 case 39: di << "FlatnessTolerance (Value="<<HAR->Value(1)<<")"; break;
745 case 40: di << "LineProfileTolerance (Value="<<HAR->Value(1)<<")"; break;
746 case 41: di << "PositionTolerance (Value="<<HAR->Value(1)<<")"; break;
747 case 42: di << "RoundnessTolerance (Value="<<HAR->Value(1)<<")"; break;
748 case 43: di << "StraightnessTolerance (Value="<<HAR->Value(1)<<")"; break;
749 case 44: di << "SurfaceProfileTolerance (Value="<<HAR->Value(1)<<")"; break;
750 }
751 }
752 }
753 else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_Material)) ) {
754 Handle(XCAFDoc_Material) val = Handle(XCAFDoc_Material)::DownCast ( att );
755 Standard_Real dens = val->GetDensity();
756 Standard_CString dimdens = "g/cu sm";
757 if(dens==0)
758 di<<val->GetName()->ToCString();
759 else
760 di<<val->GetName()->ToCString()<<"(density="<<dens<<dimdens<<")";
761 }
762 else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_GraphNode)) ) {
763 Standard_CString type;
764 if ( att->ID() == XCAFDoc::LayerRefGUID() ) {
765 type = "Layer Instance Link";
766 }
767 else if ( att->ID() == XCAFDoc::SHUORefGUID() ) {
768 type = "SHUO Instance Link";
769 }
770 else if ( att->ID() == XCAFDoc::DatumTolRefGUID() ) {
771 type = "DatumToler Link";
772 }
773 else return 0;
774
775 Handle(XCAFDoc_GraphNode) DETGN = Handle(XCAFDoc_GraphNode)::DownCast(att);
776 TCollection_AsciiString ref;
777 Standard_Integer ii = 1;
778 if (DETGN->NbFathers()!=0) {
779
780 TDF_Tool::Entry ( DETGN->GetFather(ii)->Label(), ref );
781 di << type<< " ==> (" << ref.ToCString();
782 for (ii = 2; ii <= DETGN->NbFathers(); ii++) {
783 TDF_Tool::Entry ( DETGN->GetFather(ii)->Label(), ref );
784 di << ", " << ref.ToCString();
785 }
786 di << ") ";
787 }
788 ii = 1;
789 if (DETGN->NbChildren()!=0) {
790 TDF_Tool::Entry ( DETGN->GetChild(ii)->Label(), ref );
791 di << type<< " <== (" << ref.ToCString();
792 for (ii = 2; ii <= DETGN->NbChildren(); ii++) {
793 TDF_Tool::Entry ( DETGN->GetChild(ii)->Label(), ref );
794 di << ", " << ref.ToCString();
795 }
796 di << ")";
797 }
798 }
799 return 0;
800}
801
802
803//=======================================================================
804//function : setviewName
805//purpose :
806//=======================================================================
807static Standard_Integer setviewName (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
808{
809 if (argc <2) {
810 di<<"Use: "<<argv[0]<<" (1/0)"<<"\n";
811 return 1;
812 }
813 Standard_Boolean mode = Standard_False;
91322f44 814 if (Draw::Atoi(argv[1]) == 1) mode = Standard_True;
7fd59977 815 XCAFPrs::SetViewNameMode(mode);
816 return 0;
817}
818
819
820//=======================================================================
821//function : getviewName
822//purpose : auxilary
823//=======================================================================
824
825static Standard_Integer getviewName (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
826{
827 if ( XCAFPrs::GetViewNameMode() ) di << "Display names ON"<< "\n";
828 else di << "Display names OFF"<< "\n";
829 return 0;
830}
831
832
5cbef0fe
S
833//=======================================================================
834//function : XSetTransparency
835//purpose :
836//=======================================================================
837static Standard_Integer XSetTransparency (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
838{
839 if (argc < 3) {
840 di<<"Use: "<<argv[0]<<" Doc Transparency [label1 label2 ...] "<<"\n";
841 return 1;
842 }
843
844 Handle(TDocStd_Document) Doc;
845 DDocStd::GetDocument(argv[1], Doc);
846 if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; }
847
91322f44 848 const Standard_Real aTransparency = Draw::Atof(argv[2]);
5cbef0fe
S
849
850 // collect sequence of labels
851 Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
852 TDF_LabelSequence seq;
853 if ( argc > 3 ) {
854 for ( Standard_Integer i=3; i < argc; i++ ) {
855 TDF_Label aLabel;
856 TDF_Tool::Label(Doc->GetData(), argv[i], aLabel);
857 if ( aLabel.IsNull() || ! shapes->IsShape ( aLabel ) ) {
858 di << argv[i] << " is not a valid shape label!";
859 continue;
860 }
861 seq.Append ( aLabel );
862 }
863 }
864 else {
865 shapes->GetFreeShapes ( seq );
866 }
867
868 // find presentations and set transparency
869 for ( Standard_Integer i=1; i <= seq.Length(); i++ ) {
870 Handle(TPrsStd_AISPresentation) prs;
871 if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) ) {
872 prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
873 prs->SetMaterial ( Graphic3d_NOM_PLASTIC );
874 }
875 prs->SetTransparency( aTransparency );
876 }
877 TPrsStd_AISViewer::Update(Doc->GetData()->Root());
878 return 0;
879}
880
a2d5ab2e 881//=======================================================================
882//function : XShowFaceBoundary
883//purpose : Set face boundaries on/off
884//=======================================================================
885static Standard_Integer XShowFaceBoundary (Draw_Interpretor& di,
886 Standard_Integer argc,
887 const char ** argv)
888{
889 if (( argc != 4 && argc < 7 ) || argc > 9)
890 {
891 di << "Usage :\n " << argv[0]
892 << " Doc Label IsOn [R G B [LineWidth [LineStyle]]]\n"
893 << " Doc - is the document name. \n"
894 << " Label - is the shape label. \n"
895 << " IsOn - flag indicating whether the boundaries\n"
896 << " should be turned on or off (can be set\n"
897 << " to 0 (off) or 1 (on)).\n"
898 << " R, G, B - red, green and blue components of boundary\n"
899 << " color in range (0 - 255).\n"
900 << " (default is (0, 0, 0)\n"
901 << " LineWidth - line width\n"
902 << " (default is 1)\n"
903 << " LineStyle - line fill style :\n"
904 << " 0 - solid \n"
905 << " 1 - dashed \n"
906 << " 2 - dot \n"
907 << " 3 - dashdot\n"
908 << " (default is solid)";
909
910 return 1;
911 }
912
913 // get specified document
914 Handle(TDocStd_Document) aDoc;
915 DDocStd::GetDocument (argv[1], aDoc);
916 if (aDoc.IsNull())
917 {
918 di << argv[1] << " is not a document" << "\n";
919 return 1;
920 }
921
922 Handle(AIS_InteractiveContext) aContext;
923 if (!TPrsStd_AISViewer::Find (aDoc->GetData()->Root(), aContext))
924 {
925 di << "Cannot find viewer for document " << argv[1] << "\n";
926 return 1;
927 }
928
929 // get shape tool for shape verification
930 Handle(XCAFDoc_ShapeTool) aShapes =
931 XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
932
933 // get label and validate that it is a shape label
934 TDF_Label aLabel;
935 TDF_Tool::Label (aDoc->GetData(), argv[2], aLabel);
936 if (aLabel.IsNull() || !aShapes->IsShape (aLabel))
937 {
938 di << argv[2] << " is not a valid shape label!";
939 return 1;
940 }
941
942 // get presentation from label
943 Handle(TPrsStd_AISPresentation) aPrs;
944 if (!aLabel.FindAttribute (TPrsStd_AISPresentation::GetID (), aPrs))
945 {
946 aPrs = TPrsStd_AISPresentation::Set (aLabel,XCAFPrs_Driver::GetID ());
947 }
948
949 Handle(AIS_InteractiveObject) anInteractive = aPrs->GetAIS ();
950 if (anInteractive.IsNull ())
951 {
952 di << "Can't set drawer attributes.\n"
953 "Interactive object for shape label doesn't exists.";
954 return 1;
955 }
956
957 // get drawer
958 const Handle(AIS_Drawer)& aDrawer = anInteractive->Attributes ();
959
960 // default attributes
961 Quantity_Parameter aRed = 0.0;
962 Quantity_Parameter aGreen = 0.0;
963 Quantity_Parameter aBlue = 0.0;
964 Standard_Real aWidth = 1.0;
965 Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID;
966
967 // turn boundaries on/off
91322f44 968 Standard_Boolean isBoundaryDraw = (Draw::Atoi (argv[3]) == 1);
a2d5ab2e 969 aDrawer->SetFaceBoundaryDraw (isBoundaryDraw);
970
971 // set boundary color
972 if (argc >= 7)
973 {
974 // Text color
91322f44 975 aRed = Draw::Atof (argv[4])/255.;
976 aGreen = Draw::Atof (argv[5])/255.;
977 aBlue = Draw::Atof (argv[6])/255.;
a2d5ab2e 978 }
979
980 // set line width
981 if (argc >= 8)
982 {
91322f44 983 aWidth = (Standard_Real)Draw::Atof (argv[7]);
a2d5ab2e 984 }
985
986 // select appropriate line type
987 if (argc == 9)
988 {
91322f44 989 switch (Draw::Atoi (argv[8]))
a2d5ab2e 990 {
991 case 1: aLineType = Aspect_TOL_DASH; break;
992 case 2: aLineType = Aspect_TOL_DOT; break;
993 case 3: aLineType = Aspect_TOL_DOTDASH; break;
994 default:
995 aLineType = Aspect_TOL_SOLID;
996 }
997 }
998
999 Quantity_Color aColor (aRed, aGreen, aBlue, Quantity_TOC_RGB);
1000
1001 Handle(Prs3d_LineAspect) aBoundaryAspect =
1002 new Prs3d_LineAspect (aColor, aLineType, aWidth);
1003
1004 aDrawer->SetFaceBoundaryAspect (aBoundaryAspect);
1005
1006 aContext->Redisplay (anInteractive);
1007
1008 return 0;
1009}
5cbef0fe 1010
7fd59977 1011//=======================================================================
1012//function : Init
1013//purpose :
1014//=======================================================================
1015
1016void XDEDRAW::Init(Draw_Interpretor& di)
1017{
1018
1019 static Standard_Boolean initactor = Standard_False;
1020 if (initactor) return; initactor = Standard_True;
1021
02a0b964 1022 // Load static variables for STEPCAF (ssv; 16.08.2012)
1023 STEPCAFControl_Controller::Init();
1024
7fd59977 1025 // OCAF *** szy: use <pload> command
1026
1027// DDF::AllCommands(di);
1028// DNaming::AllCommands(di);
1029// DDataStd::AllCommands(di);
1030// DPrsStd::AllCommands(di);
1031 //DFunction::AllCommands(di);
1032// DDocStd::AllCommands(di);
1033
1034// ViewerTest::Commands (di); *** szy: use <pload> command
1035
1036 // init XCAF application (if not yet done)
1037 XCAFApp_Application::GetApplication();
1038
1039 //=====================================
1040 // General commands
1041 //=====================================
1042
1043 Standard_CString g = "XDE general commands";
1044
1045 di.Add ("XNewDoc","DocName \t: Create new DECAF document",
1046 __FILE__, newDoc, g);
1047
1048 di.Add ("XSave","[Doc Path] \t: Save Doc or first document in session",
1049 __FILE__, saveDoc, g);
1050
02a0b964 1051 di.Add ("XOpen","Path Doc \t: Open XDE Document with name Doc from Path",
1052 __FILE__, openDoc, g);
1053
7fd59977 1054 di.Add ("Xdump","Doc [int deep (0/1)] \t: Print information about tree's structure",
1055 __FILE__, dump, g);
1056
1057 di.Add ("XStat","Doc \t: Print statistics of document",
1058 __FILE__, statdoc, g);
1059
1060 di.Add ("XSetPrs","Doc [label1 lavbel2 ...] \t: Set presentation for given label(s) or whole doc",
1061 __FILE__, setPrs, g);
1062
1063 di.Add ("XShow","Doc [label1 lavbel2 ...] \t: Display document (or some labels) in a graphical window",
1064 __FILE__, show, g);
1065
1066 di.Add ("XWdump","Doc filename.{gif|xwd|bmp} \t: Dump contents of viewer window to XWD, GIF or BMP file",
1067 __FILE__, xwd, g);
1068
1069 di.Add ("XAttributeValue", "Doc label #attribute: internal command for browser",
1070 __FILE__, XAttributeValue, g);
1071
1072 di.Add ("XSetViewNameMode", "(1/0) \t: Set/Unset mode of displaying names.",
1073 __FILE__, setviewName, g);
1074
1075 di.Add ("XGetViewNameMode", "\t: Print if mode of displaying names is turn on.",
1076 __FILE__, getviewName, g);
1077
5cbef0fe
S
1078 di.Add ("XSetTransparency", "Doc Transparency [label1 label2 ...]\t: Set transparency for given label(s) or whole doc",
1079 __FILE__, XSetTransparency, g);
1080
a2d5ab2e 1081 di.Add ("XShowFaceBoundary",
1082 "Doc Label IsOn [R G B [LineWidth [LineStyle]]]:"
1083 "- turns on/off drawing of face boundaries and defines boundary line style",
1084 __FILE__, XShowFaceBoundary, g);
1085
7fd59977 1086 // Specialized commands
1087 XDEDRAW_Shapes::InitCommands ( di );
1088 XDEDRAW_Colors::InitCommands ( di );
1089 XDEDRAW_Layers::InitCommands ( di );
1090 XDEDRAW_Props::InitCommands ( di );
1091 XDEDRAW_Common::InitCommands ( di );//moved from EXE
1092
1093}
1094
1095
1096//==============================================================================
1097// XDEDRAW::Factory
1098//==============================================================================
1099void XDEDRAW::Factory(Draw_Interpretor& theDI)
1100{
1101 XSDRAWIGES::InitSelect();
1102 XSDRAWIGES::InitToBRep(theDI);
1103 XSDRAWIGES::InitFromBRep(theDI);
1104
1105 XSDRAWSTEP::InitCommands(theDI);
1106
1107 SWDRAW::Init(theDI);
1108 XSDRAW::LoadDraw(theDI);
1109
1110 XDEDRAW::Init(theDI);
1111
1112#ifdef DEB
1113 theDI << "Draw Plugin : All TKXDEDRAW commands are loaded" << "\n";
1114#endif
1115}
1116
1117// Declare entry point PLUGINFACTORY
1118DPLUGIN(XDEDRAW)