Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 2000-05-30 |
2 | // Created by: Sergey MOZOKHIN | |
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 | ||
22 | #include <XSDRAWSTLVRML.ixx> | |
23 | #include <Draw_Interpretor.hxx> | |
24 | #include <TopoDS_Shape.hxx> | |
25 | #include <VrmlAPI.hxx> | |
26 | #include <OSD_Path.hxx> | |
27 | #include <StlAPI.hxx> | |
28 | #include <XSDRAW.hxx> | |
29 | #include <DBRep.hxx> | |
30 | #include <VrmlAPI_Writer.hxx> | |
31 | #include <Quantity_Color.hxx> | |
32 | #include <Quantity_HArray1OfColor.hxx> | |
33 | #include <StlAPI_Writer.hxx> | |
34 | #include <Draw_PluginMacro.hxx> | |
35 | #include <SWDRAW.hxx> | |
36 | #include <XSDRAW.hxx> | |
37 | #include <XSDRAWSTEP.hxx> | |
38 | #include <XSDRAWIGES.hxx> | |
39 | #include <AIS_InteractiveContext.hxx> | |
40 | #include <ViewerTest.hxx> | |
41 | #include <Draw.hxx> | |
9c6afe19 | 42 | #include <Draw_ProgressIndicator.hxx> |
7fd59977 | 43 | #include <RWStl.hxx> |
44 | #include <Quantity_Color.hxx> | |
45 | #include <V3d_View.hxx> | |
46 | #include <TCollection_AsciiString.hxx> | |
47 | ||
48 | #include <SelectMgr_SelectionManager.hxx> | |
49 | #include <StdSelect_ViewerSelector3d.hxx> | |
50 | ||
51 | #include <Aspect_TypeOfMarker.hxx> | |
52 | #include <Graphic3d_MaterialAspect.hxx> | |
53 | ||
54 | #include <StlMesh_Mesh.hxx> | |
55 | #include <StlMesh_SequenceOfMeshTriangle.hxx> | |
56 | ||
57 | #include <MeshVS_Mesh.hxx> | |
58 | #include <MeshVS_MeshPrsBuilder.hxx> | |
59 | #include <MeshVS_TextPrsBuilder.hxx> | |
60 | #include <MeshVS_Drawer.hxx> | |
61 | #include <MeshVS_DrawerAttribute.hxx> | |
62 | #include <MeshVS_MeshEntityOwner.hxx> | |
63 | #include <MeshVS_DataMapOfIntegerAsciiString.hxx> | |
64 | ||
65 | #include <XSDRAWSTLVRML_DataSource.hxx> | |
66 | #include <XSDRAWSTLVRML_DrawableMesh.hxx> | |
67 | #include <MeshVS_NodalColorPrsBuilder.hxx> | |
68 | #include <MeshVS_ElementalColorPrsBuilder.hxx> | |
69 | #include <Quantity_NameOfColor.hxx> | |
70 | #include <TColgp_SequenceOfXYZ.hxx> | |
71 | #include <TColStd_HPackedMapOfInteger.hxx> | |
72 | #include <TColStd_MapIteratorOfPackedMapOfInteger.hxx> | |
73 | #include <Standard_ErrorHandler.hxx> | |
74 | #include <VrmlData_Scene.hxx> | |
75 | #include <VrmlData_ShapeConvert.hxx> | |
76 | #include <VrmlData_DataMapOfShapeAppearance.hxx> | |
3ba3388b A |
77 | #include <TColStd_Array1OfReal.hxx> |
78 | #include <Bnd_Box.hxx> | |
7fd59977 | 79 | |
80 | // avoid warnings on 'extern "C"' functions returning C++ classes | |
81 | #ifdef WNT | |
82 | #pragma warning(4:4190) | |
83 | #endif | |
84 | ||
85 | #ifndef _STDIO_H | |
86 | #include <stdio.h> | |
87 | #endif | |
88 | ||
89 | static Standard_Integer writestl | |
90 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv) | |
91 | { | |
416d4426 | 92 | if (argc < 3 || argc > 5) { |
93 | di << "Use: " << argv[0] | |
94 | << " shape file [ascii/binary (0/1) : 1 by default] [InParallel (0/1) : 0 by default]" << "\n"; | |
95 | } else { | |
96 | TopoDS_Shape aShape = DBRep::Get(argv[1]); | |
48a06a30 | 97 | Standard_Boolean isASCIIMode = Standard_False; |
416d4426 | 98 | Standard_Boolean isInParallel = Standard_False; |
48a06a30 | 99 | if (argc > 3) { |
91322f44 | 100 | isASCIIMode = (Draw::Atoi(argv[3]) == 0); |
bd0c22ce | 101 | if (argc > 4) |
91322f44 | 102 | isInParallel = (Draw::Atoi(argv[4]) == 1); |
68bc5ed7 | 103 | } |
48a06a30 | 104 | StlAPI_Writer aWriter; |
105 | aWriter.ASCIIMode() = isASCIIMode; | |
416d4426 | 106 | aWriter.Write (aShape, argv[2], isInParallel); |
7fd59977 | 107 | } |
108 | return 0; | |
109 | } | |
110 | ||
111 | static Standard_Integer readstl | |
112 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv) | |
113 | { | |
114 | if (argc<3) di << "wrong number of parameters" << "\n"; | |
115 | else { | |
116 | TopoDS_Shape shape ; | |
117 | StlAPI::Read(shape,argv[2]); | |
118 | DBRep::Set(argv[1],shape); | |
119 | } | |
120 | return 0; | |
121 | } | |
122 | ||
123 | static Standard_Integer writevrml | |
124 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv) | |
125 | { | |
126 | if (argc<3) di << "wrong number of parameters" << "\n"; | |
127 | else { | |
128 | TopoDS_Shape shape = DBRep::Get(argv[1]); | |
129 | // VrmlAPI_Writer writer; | |
130 | // writer.SetTransparencyToMaterial(writer.GetFrontMaterial(),0.0); | |
131 | // Quantity_Color color; | |
132 | // color.SetValues(Quantity_NOC_GOLD); | |
133 | // Handle(Quantity_HArray1OfColor) Col = new Quantity_HArray1OfColor(1,1); | |
134 | // Col->SetValue(1,color); | |
135 | // writer.SetDiffuseColorToMaterial(writer.GetFrontMaterial(),Col); | |
136 | // writer.SetRepresentation(VrmlAPI_ShadedRepresentation); | |
137 | // writer.SetDeflection(0.01); | |
138 | // writer.Write(shape, argv[2]); | |
139 | VrmlAPI::Write(shape, argv[2]); | |
140 | } | |
141 | return 0; | |
142 | } | |
143 | ||
144 | //======================================================================= | |
145 | //function : loadvrml | |
9c6afe19 | 146 | //purpose : |
7fd59977 | 147 | //======================================================================= |
148 | ||
149 | static Standard_Integer loadvrml | |
150 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv) | |
151 | { | |
152 | if (argc<3) di << "wrong number of parameters" << "\n"; | |
153 | else { | |
154 | TopoDS_Shape shape ; | |
155 | VrmlData_DataMapOfShapeAppearance ShapeAppMap; | |
156 | ||
157 | //----------------------------------------------------------- | |
158 | filebuf fic; | |
159 | istream aStream (&fic); | |
160 | ||
161 | if (fic.open(argv[2], ios::in)) { | |
162 | ||
b569f2a3 | 163 | // Get path of the VRML file. |
164 | OSD_Path path(argv[2]); | |
165 | TCollection_AsciiString vrmlDir("."); | |
166 | TCollection_AsciiString disk = path.Disk(); | |
167 | TCollection_AsciiString trek = path.Trek(); | |
168 | if (!trek.IsEmpty()) | |
169 | { | |
170 | if (!disk.IsEmpty()) | |
171 | vrmlDir = disk; | |
172 | else | |
173 | vrmlDir.Clear(); | |
174 | trek.ChangeAll('|', '/'); | |
175 | vrmlDir += trek; | |
176 | } | |
177 | ||
7fd59977 | 178 | VrmlData_Scene aScene; |
179 | ||
b569f2a3 | 180 | aScene.SetVrmlDir (vrmlDir); |
7fd59977 | 181 | aScene << aStream; |
182 | const char * aStr = 0L; | |
183 | switch (aScene.Status()) { | |
184 | ||
185 | case VrmlData_StatusOK: | |
186 | { | |
187 | shape = aScene.GetShape(ShapeAppMap); | |
188 | break; | |
189 | } | |
190 | case VrmlData_EmptyData: aStr = "EmptyData"; break; | |
191 | case VrmlData_UnrecoverableError: aStr = "UnrecoverableError"; break; | |
192 | case VrmlData_GeneralError: aStr = "GeneralError"; break; | |
193 | case VrmlData_EndOfFile: aStr = "EndOfFile"; break; | |
194 | case VrmlData_NotVrmlFile: aStr = "NotVrmlFile"; break; | |
195 | case VrmlData_CannotOpenFile: aStr = "CannotOpenFile"; break; | |
196 | case VrmlData_VrmlFormatError: aStr = "VrmlFormatError"; break; | |
197 | case VrmlData_NumericInputError: aStr = "NumericInputError"; break; | |
198 | case VrmlData_IrrelevantNumber: aStr = "IrrelevantNumber"; break; | |
199 | case VrmlData_BooleanInputError: aStr = "BooleanInputError"; break; | |
200 | case VrmlData_StringInputError: aStr = "StringInputError"; break; | |
201 | case VrmlData_NodeNameUnknown: aStr = "NodeNameUnknown"; break; | |
202 | case VrmlData_NonPositiveSize: aStr = "NonPositiveSize"; break; | |
203 | case VrmlData_ReadUnknownNode: aStr = "ReadUnknownNode"; break; | |
204 | case VrmlData_NonSupportedFeature:aStr = "NonSupportedFeature"; break; | |
205 | } | |
206 | if (aStr) { | |
207 | di << " ++ VRML Error: " << aStr << " in line " | |
208 | << aScene.GetLineError() << "\n"; | |
209 | } | |
210 | else { | |
211 | DBRep::Set(argv[1],shape); | |
212 | } | |
213 | } | |
214 | else { | |
215 | di << "cannot open file" << "\n"; | |
216 | } | |
217 | ||
218 | ||
219 | //----------------------------------------------------------- | |
220 | } | |
221 | return 0; | |
222 | } | |
223 | ||
224 | //======================================================================= | |
225 | //function : storevrml | |
9c6afe19 | 226 | //purpose : |
7fd59977 | 227 | //======================================================================= |
228 | ||
229 | static Standard_Integer storevrml | |
230 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv) | |
231 | { | |
232 | if (argc < 4) { | |
233 | di << "wrong number of parameters" << "\n"; | |
234 | di << "use: storevrml shape file defl type_of_conversion (0, 1, 2)" << "\n"; | |
235 | } | |
236 | else { | |
7fd59977 | 237 | TopoDS_Shape shape = DBRep::Get(argv[1]); |
91322f44 | 238 | Standard_Real defl = Draw::Atof(argv[3]); |
7fd59977 | 239 | Standard_Integer type = 1; |
91322f44 | 240 | if(argc > 4) type = Draw::Atoi(argv[4]); |
7fd59977 | 241 | type = Max(0, type); |
242 | type = Min(2, type); | |
243 | ||
244 | Standard_Boolean ExtFace = Standard_False; | |
245 | if(type == 0 || type == 2) ExtFace = Standard_True; | |
246 | Standard_Boolean ExtEdge = Standard_False; | |
247 | if(type == 1 || type == 2) ExtEdge = Standard_True; | |
248 | ||
249 | VrmlData_Scene aScene; | |
250 | VrmlData_ShapeConvert Conv(aScene); | |
251 | Conv.AddShape(shape); | |
252 | Conv.Convert(ExtFace, ExtEdge, defl); | |
253 | ||
254 | filebuf foc; | |
255 | ostream outStream (&foc); | |
256 | if (foc.open (argv[2], ios::out)) | |
9c6afe19 | 257 | outStream << aScene; |
7fd59977 | 258 | } |
259 | return 0; | |
260 | } | |
261 | ||
262 | ||
263 | //----------------------------------------------------------------------------- | |
264 | static Standard_Integer createmesh | |
265 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv ) | |
266 | { | |
267 | ||
268 | if (argc<3) | |
269 | { | |
270 | di << "Use: " << argv[0] << " <mesh name> <stl file>" << "\n"; | |
271 | return 1; | |
272 | } | |
273 | ||
9c6afe19 | 274 | // Progress indicator |
7fd59977 | 275 | OSD_Path aFile( argv[2] ); |
9c6afe19 RK |
276 | Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di, 1); |
277 | Handle(StlMesh_Mesh) aSTLMesh = RWStl::ReadFile (aFile, aProgress); | |
7fd59977 | 278 | |
279 | di << "Reading OK..." << "\n"; | |
280 | Handle( XSDRAWSTLVRML_DataSource ) aDS = new XSDRAWSTLVRML_DataSource( aSTLMesh ); | |
281 | di << "Data source is created successful" << "\n"; | |
282 | Handle( MeshVS_Mesh ) aMesh = new MeshVS_Mesh(); | |
283 | di << "MeshVS_Mesh is created successful" << "\n"; | |
284 | ||
285 | aMesh->SetDataSource( aDS ); | |
286 | aMesh->AddBuilder( new MeshVS_MeshPrsBuilder( aMesh.operator->() ), Standard_True ); | |
287 | // Prepare triangle labels | |
288 | MeshVS_DataMapOfIntegerAsciiString aLabels; | |
289 | Standard_Integer anIndex = 1, aLen = aSTLMesh->Triangles().Length(); | |
290 | for ( ; anIndex <= aLen; anIndex++ ){ | |
291 | aLabels.Bind( anIndex, TCollection_AsciiString( anIndex ) ); | |
292 | } | |
293 | ||
294 | Handle(MeshVS_TextPrsBuilder) aTextBuilder = new MeshVS_TextPrsBuilder( aMesh.operator->(), 20., Quantity_NOC_YELLOW ); | |
295 | aTextBuilder->SetTexts( Standard_True, aLabels ); | |
296 | aMesh->AddBuilder( aTextBuilder ); | |
297 | ||
298 | // Hide all nodes by default | |
299 | Handle(TColStd_HPackedMapOfInteger) aNodes = new TColStd_HPackedMapOfInteger(); | |
300 | aLen = aSTLMesh->Vertices().Length(); | |
301 | for ( anIndex = 1; anIndex <= aLen; anIndex++ ) | |
302 | aNodes->ChangeMap().Add( anIndex ); | |
303 | aMesh->SetHiddenNodes( aNodes ); | |
304 | ||
305 | Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); | |
306 | ||
307 | if ( aContext.IsNull() ) | |
308 | { | |
9c6afe19 | 309 | ViewerTest::ViewerInit(); |
7fd59977 | 310 | //To create a 3D view if it doesn't exist |
311 | aContext = ViewerTest::GetAISContext(); | |
312 | if( aContext.IsNull() ) | |
313 | { | |
314 | di << "Cannot create 3D view" << "\n"; | |
315 | return 0; | |
316 | } | |
317 | } | |
318 | ||
319 | aContext->Display( aMesh ); | |
320 | aContext->Deactivate( aMesh ); | |
321 | ||
322 | Draw::Set( argv[1], new XSDRAWSTLVRML_DrawableMesh( aMesh ) ); | |
323 | Handle( V3d_View ) V = ViewerTest::CurrentView(); | |
324 | if ( !V.IsNull() ) | |
325 | V->FitAll(); | |
326 | ||
327 | return 0; | |
328 | } | |
329 | //----------------------------------------------------------------------------- | |
330 | Handle( MeshVS_Mesh ) getMesh( const char* name, Draw_Interpretor& di) | |
331 | { | |
332 | Handle( XSDRAWSTLVRML_DrawableMesh ) aDrawMesh = | |
333 | Handle( XSDRAWSTLVRML_DrawableMesh )::DownCast( Draw::Get( name ) ); | |
334 | ||
335 | if( aDrawMesh.IsNull() ) | |
336 | { | |
337 | di << "There is no such object" << "\n"; | |
338 | return NULL; | |
339 | } | |
340 | else | |
341 | { | |
342 | Handle( MeshVS_Mesh ) aMesh = aDrawMesh->GetMesh(); | |
343 | if( aMesh.IsNull() ) | |
344 | { | |
345 | di << "There is invalid mesh" << "\n"; | |
346 | return NULL; | |
347 | } | |
348 | else | |
349 | return aMesh; | |
350 | } | |
351 | } | |
352 | //----------------------------------------------------------------------------- | |
353 | static Standard_Integer meshdm | |
354 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv ) | |
355 | { | |
356 | if (argc<3) | |
357 | di << "wrong number of parameters" << "\n"; | |
358 | else | |
359 | { | |
360 | Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); | |
361 | if( !aMesh.IsNull() ) | |
362 | { | |
91322f44 | 363 | Standard_Integer DisplayMode = Draw::Atoi (argv[2]); |
7fd59977 | 364 | |
365 | Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); | |
366 | ||
367 | if( aContext.IsNull() ) | |
368 | di << "The context is null" << "\n"; | |
369 | else | |
370 | { | |
371 | Standard_Boolean HasLocal = aContext->HasOpenedContext(); | |
372 | if( HasLocal ) | |
373 | aContext->CloseLocalContext(); | |
374 | ||
375 | aContext->SetDisplayMode( aMesh, DisplayMode ); | |
376 | di << "Setting display mode: " << DisplayMode << "\n"; | |
377 | ||
378 | if( HasLocal ) | |
379 | aContext->OpenLocalContext(); | |
380 | } | |
381 | } | |
382 | } | |
383 | return 0; | |
384 | } | |
385 | //----------------------------------------------------------------------------- | |
386 | static Standard_Integer meshsm | |
387 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv ) | |
388 | { | |
389 | if (argc<3) | |
390 | di << "wrong number of parameters" << "\n"; | |
391 | else | |
392 | { | |
393 | Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); | |
394 | if( !aMesh.IsNull() ) | |
395 | { | |
91322f44 | 396 | Standard_Integer SelMode = Draw::Atoi (argv[2]); |
7fd59977 | 397 | |
398 | Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); | |
399 | ||
400 | if( aContext.IsNull() ) | |
401 | di << "The context is null" << "\n"; | |
402 | else | |
403 | { | |
404 | if( !aContext->HasOpenedContext() ) | |
405 | aContext->OpenLocalContext(); | |
406 | ||
407 | aContext->Load( aMesh, -1 ); | |
408 | ||
409 | if( SelMode==-1 ) | |
410 | aContext->CloseAllContexts(); | |
411 | ||
412 | else if( SelMode==0 ) | |
413 | aContext->Activate( aMesh, 0 ); | |
414 | ||
415 | else if( SelMode>0 ) | |
416 | { | |
417 | aContext->Deactivate( aMesh, 0 ); | |
418 | ||
419 | if( SelMode & 1 ) | |
420 | aContext->Activate( aMesh, 1 ); | |
421 | else | |
422 | aContext->Deactivate( aMesh, 1 ); | |
423 | ||
424 | if( SelMode & 4 ) | |
425 | aContext->Activate( aMesh, 4 ); | |
426 | else | |
427 | aContext->Deactivate( aMesh, 4 ); | |
428 | ||
429 | if( SelMode & 8 ) | |
430 | aContext->Activate( aMesh, 8 ); | |
431 | else | |
432 | aContext->Deactivate( aMesh, 8 ); | |
433 | } | |
434 | ||
435 | di << "Setting selection mode: " << SelMode << "\n"; | |
436 | } | |
437 | } | |
438 | } | |
439 | return 0; | |
440 | } | |
441 | //----------------------------------------------------------------------------- | |
442 | static Standard_Integer setcolor | |
443 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv, Standard_Integer Param ) | |
444 | { | |
445 | if (argc<5) | |
446 | di << "wrong number of parameters" << "\n"; | |
447 | else | |
448 | { | |
449 | Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); | |
450 | if( !aMesh.IsNull() ) | |
451 | { | |
91322f44 | 452 | Standard_Real r = Draw::Atof (argv[2]); |
453 | Standard_Real g = Draw::Atof (argv[3]); | |
454 | Standard_Real b = Draw::Atof (argv[4]); | |
7fd59977 | 455 | aMesh->GetDrawer()->SetColor( (MeshVS_DrawerAttribute)Param, Quantity_Color( r, g, b, Quantity_TOC_RGB ) ); |
456 | ||
457 | Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); | |
458 | ||
459 | if( aContext.IsNull() ) | |
460 | di << "The context is null" << "\n"; | |
461 | else | |
462 | aContext->Redisplay( aMesh ); | |
463 | } | |
464 | } | |
465 | return 0; | |
466 | } | |
467 | //----------------------------------------------------------------------------- | |
468 | static Standard_Integer meshcolor | |
469 | (Draw_Interpretor& interp, Standard_Integer argc, const char** argv ) | |
470 | { | |
471 | return setcolor( interp, argc, argv, MeshVS_DA_InteriorColor ); | |
472 | } | |
473 | //----------------------------------------------------------------------------- | |
474 | static Standard_Integer linecolor | |
475 | (Draw_Interpretor& interp, Standard_Integer argc, const char** argv ) | |
476 | { | |
477 | return setcolor( interp, argc, argv, MeshVS_DA_EdgeColor ); | |
478 | } | |
479 | //----------------------------------------------------------------------------- | |
480 | static Standard_Integer meshmat | |
481 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv ) | |
482 | { | |
483 | if (argc<3) | |
484 | di << "wrong number of parameters" << "\n"; | |
485 | else | |
486 | { | |
487 | Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); | |
488 | if( !aMesh.IsNull() ) | |
489 | { | |
91322f44 | 490 | Standard_Integer mat = Draw::Atoi (argv[2]); |
7fd59977 | 491 | |
492 | Graphic3d_MaterialAspect aMatAsp = | |
493 | (Graphic3d_MaterialAspect)(Graphic3d_NameOfMaterial)mat; | |
494 | ||
495 | aMesh->GetDrawer()->SetMaterial( MeshVS_DA_FrontMaterial, aMatAsp ); | |
496 | aMesh->GetDrawer()->SetMaterial( MeshVS_DA_BackMaterial, aMatAsp ); | |
497 | ||
498 | Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); | |
499 | ||
500 | if( aContext.IsNull() ) | |
501 | di << "The context is null" << "\n"; | |
502 | else | |
503 | aContext->Redisplay( aMesh ); | |
504 | } | |
505 | } | |
506 | return 0; | |
507 | } | |
508 | //----------------------------------------------------------------------------- | |
509 | static Standard_Integer shrink | |
510 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv ) | |
511 | { | |
512 | if (argc<3) | |
513 | di << "wrong number of parameters" << "\n"; | |
514 | else | |
515 | { | |
516 | Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); | |
517 | if( !aMesh.IsNull() ) | |
518 | { | |
91322f44 | 519 | Standard_Real sh = Draw::Atof (argv[2]); |
7fd59977 | 520 | aMesh->GetDrawer()->SetDouble( MeshVS_DA_ShrinkCoeff, sh ); |
521 | ||
522 | Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); | |
523 | ||
524 | if( aContext.IsNull() ) | |
525 | di << "The context is null" << "\n"; | |
526 | else | |
527 | aContext->Redisplay( aMesh ); | |
528 | } | |
529 | } | |
530 | return 0; | |
531 | } | |
532 | //----------------------------------------------------------------------------- | |
533 | ||
534 | static Standard_Integer mdisplay | |
535 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv ) | |
536 | { | |
537 | if (argc<2) | |
538 | di << "wrong number of parameters" << "\n"; | |
539 | else | |
540 | { | |
541 | Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); | |
542 | if( !aMesh.IsNull() ) | |
543 | { | |
544 | Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); | |
545 | ||
546 | if( aContext.IsNull() ) | |
547 | di << "The context is null" << "\n"; | |
548 | else | |
549 | { | |
550 | if( aContext->HasOpenedContext() ) | |
551 | aContext->CloseLocalContext(); | |
552 | ||
553 | aContext->Display( aMesh ); | |
554 | } | |
555 | } | |
556 | } | |
557 | return 0; | |
558 | } | |
559 | //----------------------------------------------------------------------------- | |
560 | static Standard_Integer merase | |
561 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv ) | |
562 | { | |
563 | if (argc<2) | |
564 | di << "wrong number of parameters" << "\n"; | |
565 | else | |
566 | { | |
567 | Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); | |
568 | if( !aMesh.IsNull() ) | |
569 | { | |
570 | Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); | |
571 | ||
572 | if( aContext.IsNull() ) | |
573 | di << "The context is null" << "\n"; | |
574 | else | |
575 | { | |
576 | if( aContext->HasOpenedContext() ) | |
577 | aContext->CloseLocalContext(); | |
578 | ||
579 | aContext->Erase( aMesh ); | |
580 | } | |
581 | } | |
582 | else | |
583 | di << "Mesh is null" << "\n"; | |
584 | } | |
585 | return 0; | |
586 | } | |
587 | //----------------------------------------------------------------------------- | |
588 | static Standard_Integer hidesel | |
589 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv ) | |
590 | { | |
591 | if (argc<1) | |
592 | { | |
593 | di << "wrong number of parameters" << "\n"; | |
594 | return 0; | |
595 | } | |
596 | ||
597 | ||
598 | Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); | |
599 | Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); | |
600 | if( aMesh.IsNull() ) | |
601 | { | |
602 | di << "The mesh is invalid" << "\n"; | |
603 | return 0; | |
604 | } | |
605 | ||
606 | if( aContext.IsNull() ) | |
607 | di << "The context is null" << "\n"; | |
608 | else | |
609 | { | |
610 | Handle(TColStd_HPackedMapOfInteger) aHiddenNodes = aMesh->GetHiddenNodes(); | |
611 | Handle(TColStd_HPackedMapOfInteger) aHiddenElements = aMesh->GetHiddenElems(); | |
612 | for( aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected() ) | |
613 | { | |
614 | Handle( MeshVS_MeshEntityOwner ) anOwner = | |
615 | Handle( MeshVS_MeshEntityOwner )::DownCast( aContext->SelectedOwner() ); | |
616 | if( !anOwner.IsNull() ) | |
eafb234b | 617 | { |
7fd59977 | 618 | if( anOwner->Type()==MeshVS_ET_Node ) |
eafb234b | 619 | { |
7fd59977 | 620 | aHiddenNodes->ChangeMap().Add( anOwner->ID() ); |
eafb234b | 621 | } |
7fd59977 | 622 | else |
eafb234b | 623 | { |
7fd59977 | 624 | aHiddenElements->ChangeMap().Add( anOwner->ID() ); |
eafb234b | 625 | } |
626 | } | |
7fd59977 | 627 | } |
628 | aContext->ClearSelected(); | |
629 | aMesh->SetHiddenNodes( aHiddenNodes ); | |
630 | aMesh->SetHiddenElems( aHiddenElements ); | |
631 | aContext->Redisplay( aMesh ); | |
632 | } | |
633 | ||
634 | return 0; | |
635 | } | |
636 | //----------------------------------------------------------------------------- | |
637 | static Standard_Integer showonly | |
638 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv ) | |
639 | { | |
640 | if (argc<1) | |
641 | { | |
642 | di << "wrong number of parameters" << "\n"; | |
643 | return 0; | |
644 | } | |
645 | ||
646 | ||
647 | Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); | |
648 | Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); | |
649 | if( aMesh.IsNull() ) | |
650 | { | |
651 | di << "The mesh is invalid" << "\n"; | |
652 | return 0; | |
653 | } | |
654 | ||
655 | if( aContext.IsNull() ) | |
656 | di << "The context is null" << "\n"; | |
657 | else | |
658 | { | |
9c6afe19 | 659 | Handle(TColStd_HPackedMapOfInteger) aHiddenNodes = |
7fd59977 | 660 | new TColStd_HPackedMapOfInteger(aMesh->GetDataSource()->GetAllNodes()); |
9c6afe19 | 661 | Handle(TColStd_HPackedMapOfInteger) aHiddenElements = |
7fd59977 | 662 | new TColStd_HPackedMapOfInteger(aMesh->GetDataSource()->GetAllElements()); |
663 | for( aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected() ) | |
664 | { | |
665 | Handle( MeshVS_MeshEntityOwner ) anOwner = | |
666 | Handle( MeshVS_MeshEntityOwner )::DownCast( aContext->SelectedOwner() ); | |
667 | if( !anOwner.IsNull() ) | |
eafb234b | 668 | { |
7fd59977 | 669 | if( anOwner->Type()==MeshVS_ET_Node ) |
eafb234b | 670 | { |
7fd59977 | 671 | aHiddenNodes->ChangeMap().Remove( anOwner->ID() ); |
eafb234b | 672 | } |
7fd59977 | 673 | else |
eafb234b | 674 | { |
7fd59977 | 675 | aHiddenElements->ChangeMap().Remove( anOwner->ID() ); |
eafb234b | 676 | } |
677 | } | |
7fd59977 | 678 | } |
679 | aMesh->SetHiddenNodes( aHiddenNodes ); | |
680 | aMesh->SetHiddenElems( aHiddenElements ); | |
681 | aContext->Redisplay( aMesh ); | |
682 | } | |
683 | ||
684 | return 0; | |
685 | } | |
686 | //----------------------------------------------------------------------------- | |
687 | static Standard_Integer showall | |
688 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv ) | |
689 | { | |
690 | if (argc<1) | |
691 | { | |
692 | di << "wrong number of parameters" << "\n"; | |
693 | return 0; | |
694 | } | |
695 | ||
696 | Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); | |
697 | Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); | |
698 | if( aMesh.IsNull() ) | |
699 | { | |
700 | di << "The mesh is invalid" << "\n"; | |
701 | return 0; | |
702 | } | |
703 | ||
704 | if( aContext.IsNull() ) | |
705 | di << "The context is null" << "\n"; | |
706 | else | |
707 | { | |
708 | aMesh->SetHiddenNodes( 0 ); | |
709 | aMesh->SetHiddenElems( 0 ); | |
710 | aContext->Redisplay( aMesh ); | |
711 | } | |
712 | ||
713 | return 0; | |
714 | } | |
715 | //----------------------------------------------------------------------------- | |
716 | static Standard_Integer delmesh | |
717 | (Draw_Interpretor& di, Standard_Integer argc, const char** argv ) | |
718 | { | |
719 | if (argc<2) | |
720 | { | |
721 | di << "wrong number of parameters" << "\n"; | |
722 | return 0; | |
723 | } | |
724 | ||
725 | Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); | |
726 | ||
727 | if( aMesh.IsNull() ) | |
728 | { | |
729 | di << "The mesh is invalid" << "\n"; | |
730 | return 0; | |
731 | } | |
732 | else | |
733 | { | |
734 | Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); | |
735 | ||
736 | aContext->ClearSelected(); | |
737 | ||
738 | if( aContext->HasOpenedContext() ) | |
739 | aContext->CloseAllContexts(); | |
740 | ||
741 | aContext->Remove( aMesh ); | |
742 | aContext->SelectionManager()->Remove( aMesh ); | |
743 | aMesh->ClearSelections(); | |
744 | aContext->MainSelector()->Clear(); | |
745 | ||
746 | Draw::Set( argv[1], Handle(XSDRAWSTLVRML_DrawableMesh)() ); | |
747 | ||
748 | Standard::Purge(); | |
749 | } | |
750 | return 0; | |
751 | } | |
752 | //----------------------------------------------------------------------------- | |
753 | ||
9c6afe19 RK |
754 | static Standard_Integer meshcolors( Draw_Interpretor& di, |
755 | Standard_Integer argc, | |
7fd59977 | 756 | const char** argv ) |
757 | { | |
758 | try | |
759 | { | |
760 | OCC_CATCH_SIGNALS | |
761 | if ( argc < 2 ) | |
762 | { | |
763 | di << "Use : meshcolors meshname mode isreflect" << "\n"; | |
3ba3388b | 764 | di << "mode : {elem1|elem2|nodal|nodaltex|none}"<< "\n"; |
7fd59977 | 765 | di << " elem1 - different color for each element" << "\n"; |
766 | di << " elem2 - one color for one side"<<"\n"; | |
3ba3388b A |
767 | di << " nodal - different color for each node"<< "\n"; |
768 | di << " nodaltex - different color for each node with texture interpolation"<< "\n"; | |
9c6afe19 | 769 | di << " none - clear"<< "\n"; |
7fd59977 | 770 | di << "isreflect : {0|1} "<< "\n"; |
9c6afe19 | 771 | |
7fd59977 | 772 | return 0; |
773 | } | |
774 | ||
775 | Handle( MeshVS_Mesh ) aMesh = getMesh( argv[ 1 ], di ); | |
776 | ||
777 | if ( aMesh.IsNull() ) | |
778 | { | |
779 | di << "Mesh not found" << "\n"; | |
780 | return 0; | |
781 | } | |
782 | Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext(); | |
783 | if ( anIC.IsNull() ) | |
784 | { | |
785 | di << "The context is null" << "\n"; | |
786 | return 0; | |
787 | } | |
788 | if( !aMesh.IsNull() ) | |
789 | { | |
790 | TCollection_AsciiString aMode = TCollection_AsciiString (argv[2]); | |
791 | Quantity_Color aColor1( (Quantity_NameOfColor)( Quantity_NOC_BLUE1 ) ); | |
792 | Quantity_Color aColor2( (Quantity_NameOfColor)( Quantity_NOC_RED1 ) ); | |
3ba3388b | 793 | if( aMode.IsEqual("elem1") || aMode.IsEqual("elem2") || aMode.IsEqual("nodal") || aMode.IsEqual("nodaltex") || aMode.IsEqual("none") ) |
7fd59977 | 794 | { |
795 | Handle(MeshVS_PrsBuilder) aTempBuilder; | |
91322f44 | 796 | Standard_Integer reflection = Draw::Atoi(argv[3]); |
7fd59977 | 797 | |
798 | for (int count = 0 ; count < aMesh->GetBuildersCount(); count++ ){ | |
799 | aTempBuilder = Handle(MeshVS_PrsBuilder)::DownCast(aMesh->FindBuilder("MeshVS_ElementalColorPrsBuilder")); | |
800 | if( !aTempBuilder.IsNull()) | |
801 | aMesh->RemoveBuilderById(aTempBuilder->GetId()); | |
802 | ||
803 | aTempBuilder = Handle(MeshVS_PrsBuilder)::DownCast(aMesh->FindBuilder("MeshVS_NodalColorPrsBuilder")); | |
804 | if( !aTempBuilder.IsNull()) | |
805 | aMesh->RemoveBuilderById(aTempBuilder->GetId()); | |
806 | } | |
807 | ||
808 | if( aMode.IsEqual("elem1") || aMode.IsEqual("elem2") ) | |
809 | { | |
9c6afe19 | 810 | Handle(MeshVS_ElementalColorPrsBuilder) aBuilder = new MeshVS_ElementalColorPrsBuilder( |
7fd59977 | 811 | aMesh, MeshVS_DMF_ElementalColorDataPrs | MeshVS_DMF_OCCMask ); |
812 | // Color | |
813 | const TColStd_PackedMapOfInteger& anAllElements = aMesh->GetDataSource()->GetAllElements(); | |
814 | TColStd_MapIteratorOfPackedMapOfInteger anIter( anAllElements ); | |
815 | ||
816 | if( aMode.IsEqual("elem1") ) | |
817 | for ( ; anIter.More(); anIter.Next() ) | |
818 | { | |
819 | Quantity_Color aColor( (Quantity_NameOfColor)( anIter.Key() % Quantity_NOC_WHITE ) ); | |
820 | aBuilder->SetColor1( anIter.Key(), aColor ); | |
821 | } | |
822 | else | |
823 | for ( ; anIter.More(); anIter.Next() ) | |
824 | aBuilder->SetColor2( anIter.Key(), aColor1, aColor2 ); | |
825 | ||
826 | aMesh->AddBuilder( aBuilder, Standard_True ); | |
827 | } | |
828 | ||
9c6afe19 | 829 | |
7fd59977 | 830 | if( aMode.IsEqual("nodal") ) |
831 | { | |
9c6afe19 | 832 | Handle(MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder( |
7fd59977 | 833 | aMesh, MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask ); |
834 | aMesh->AddBuilder( aBuilder, Standard_True ); | |
835 | ||
836 | // Color | |
837 | const TColStd_PackedMapOfInteger& anAllNodes = | |
838 | aMesh->GetDataSource()->GetAllNodes(); | |
839 | TColStd_MapIteratorOfPackedMapOfInteger anIter( anAllNodes ); | |
840 | for ( ; anIter.More(); anIter.Next() ) | |
841 | { | |
9c6afe19 | 842 | Quantity_Color aColor( (Quantity_NameOfColor)( |
7fd59977 | 843 | anIter.Key() % Quantity_NOC_WHITE ) ); |
844 | aBuilder->SetColor( anIter.Key(), aColor ); | |
845 | } | |
846 | aMesh->AddBuilder( aBuilder, Standard_True ); | |
847 | } | |
848 | ||
3ba3388b A |
849 | if(aMode.IsEqual("nodaltex")) |
850 | { | |
851 | // assign nodal builder to the mesh | |
9c6afe19 | 852 | Handle(MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder( |
3ba3388b A |
853 | aMesh, MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask); |
854 | aMesh->AddBuilder(aBuilder, Standard_True); | |
855 | aBuilder->UseTexture(Standard_True); | |
856 | ||
857 | // prepare color map for texture | |
858 | Aspect_SequenceOfColor aColorMap; | |
859 | aColorMap.Append((Quantity_NameOfColor) Quantity_NOC_RED); | |
860 | aColorMap.Append((Quantity_NameOfColor) Quantity_NOC_YELLOW); | |
861 | aColorMap.Append((Quantity_NameOfColor) Quantity_NOC_BLUE1); | |
862 | ||
863 | // prepare scale map for mesh - it will be assigned to mesh as texture coordinates | |
864 | // make mesh color interpolated from minimum X coord to maximum X coord | |
865 | Handle(MeshVS_DataSource) aDataSource = aMesh->GetDataSource(); | |
866 | Standard_Real aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ; | |
867 | ||
868 | // get bounding box for calculations | |
869 | aDataSource->GetBoundingBox().Get(aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ); | |
870 | Standard_Real aDelta = aMaxX - aMinX; | |
871 | ||
872 | // assign color scale map values (0..1) to nodes | |
873 | TColStd_DataMapOfIntegerReal aScaleMap; | |
874 | TColStd_Array1OfReal aCoords(1, 3); | |
875 | Standard_Integer aNbNodes; | |
876 | MeshVS_EntityType aType; | |
877 | ||
878 | // iterate nodes | |
879 | const TColStd_PackedMapOfInteger& anAllNodes = | |
880 | aMesh->GetDataSource()->GetAllNodes(); | |
881 | TColStd_MapIteratorOfPackedMapOfInteger anIter(anAllNodes); | |
882 | for (; anIter.More(); anIter.Next()) | |
883 | { | |
884 | //get node coordinates to aCoord variable | |
885 | aDataSource->GetGeom(anIter.Key(), Standard_False, aCoords, aNbNodes, aType); | |
886 | ||
887 | Standard_Real aScaleValue; | |
888 | try { | |
889 | OCC_CATCH_SIGNALS | |
890 | aScaleValue = (aCoords.Value(1) - (Standard_Real) aMinX) / aDelta; | |
891 | } catch(Standard_Failure) { | |
892 | aScaleValue = 0; | |
893 | } | |
894 | ||
9c6afe19 | 895 | aScaleMap.Bind(anIter.Key(), aScaleValue); |
3ba3388b A |
896 | } |
897 | ||
898 | //set color map for builder and a color for invalid scale value | |
899 | aBuilder->SetColorMap(aColorMap); | |
900 | aBuilder->SetInvalidColor(Quantity_NOC_BLACK); | |
901 | aBuilder->SetTextureCoords(aScaleMap); | |
902 | aMesh->AddBuilder(aBuilder, Standard_True); | |
9c6afe19 | 903 | |
3ba3388b A |
904 | //set viewer to display texures |
905 | const Handle(V3d_Viewer)& aViewer = anIC->CurrentViewer(); | |
906 | for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews()) | |
907 | aViewer->ActiveView()->SetSurfaceDetail(V3d_TEX_ALL); | |
908 | } | |
909 | ||
7fd59977 | 910 | aMesh->GetDrawer()->SetBoolean ( MeshVS_DA_ColorReflection, Standard_Boolean(reflection) ); |
911 | ||
912 | anIC->Redisplay( aMesh ); | |
913 | } | |
914 | else | |
9c6afe19 | 915 | { |
7fd59977 | 916 | di << "Wrong mode name" << "\n"; |
917 | return 0; | |
918 | } | |
919 | } | |
920 | } | |
921 | catch ( Standard_Failure ) | |
922 | { | |
923 | di << "Error" << "\n"; | |
924 | } | |
925 | ||
926 | return 0; | |
927 | } | |
928 | //----------------------------------------------------------------------------- | |
929 | ||
9c6afe19 RK |
930 | static Standard_Integer mesh_edge_width( Draw_Interpretor& di, |
931 | Standard_Integer argc, | |
7fd59977 | 932 | const char** argv ) |
933 | { | |
934 | try | |
935 | { | |
936 | OCC_CATCH_SIGNALS | |
937 | if ( argc < 3 ) | |
938 | { | |
939 | di << "Wrong number of parameters. Use : mesh_edge_width mesh width" << "\n"; | |
940 | return 0; | |
941 | } | |
942 | ||
943 | Handle(MeshVS_Mesh) aMesh = getMesh( argv[ 1 ], di ); | |
944 | if ( aMesh.IsNull() ) | |
945 | { | |
946 | di << "Mesh not found" << "\n"; | |
947 | return 0; | |
948 | } | |
949 | ||
950 | const char* aWidthStr = argv[ 2 ]; | |
91322f44 | 951 | if ( aWidthStr == 0 || Draw::Atof( aWidthStr ) <= 0 ) |
7fd59977 | 952 | { |
953 | di << "Width must be real value more than zero" << "\n"; | |
954 | return 0; | |
955 | } | |
956 | ||
91322f44 | 957 | double aWidth = Draw::Atof( aWidthStr ); |
7fd59977 | 958 | |
959 | Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext(); | |
960 | if ( anIC.IsNull() ) | |
961 | { | |
962 | di << "The context is null" << "\n"; | |
963 | return 0; | |
964 | } | |
965 | ||
966 | Handle(MeshVS_Drawer) aDrawer = aMesh->GetDrawer(); | |
967 | if ( aDrawer.IsNull() ) | |
968 | { | |
969 | di << "The drawer is null" << "\n"; | |
970 | return 0; | |
971 | } | |
972 | ||
973 | aDrawer->SetDouble( MeshVS_DA_EdgeWidth, aWidth ); | |
974 | anIC->Redisplay( aMesh ); | |
975 | } | |
976 | catch ( Standard_Failure ) | |
977 | { | |
978 | di << "Error" << "\n"; | |
979 | } | |
980 | ||
981 | return 0; | |
982 | } | |
983 | ||
984 | //----------------------------------------------------------------------------- | |
985 | ||
986 | void XSDRAWSTLVRML::InitCommands (Draw_Interpretor& theCommands) | |
987 | { | |
988 | const char* g = "XSTEP-STL/VRML"; // Step transfer file commands | |
989 | //XSDRAW::LoadDraw(theCommands); | |
990 | ||
991 | theCommands.Add ("writevrml", "shape file",__FILE__,writevrml,g); | |
416d4426 | 992 | theCommands.Add ("writestl", "shape file [ascii/binary (0/1) : 1 by default] [InParallel (0/1) : 0 by default]",__FILE__,writestl,g); |
7fd59977 | 993 | theCommands.Add ("readstl", "shape file",__FILE__,readstl,g); |
994 | theCommands.Add ("loadvrml" , "shape file",__FILE__,loadvrml,g); | |
995 | theCommands.Add ("storevrml" , "shape file defl [type]",__FILE__,storevrml,g); | |
996 | ||
997 | theCommands.Add ("meshfromstl", "creates MeshVS_Mesh from STL file", __FILE__, createmesh, g ); | |
998 | theCommands.Add ("meshdispmode", "changes MeshVS_Mesh display mode", __FILE__, meshdm, g ); | |
999 | theCommands.Add ("meshselmode", "changes MeshVS_Mesh selection mode", __FILE__, meshsm, g ); | |
1000 | theCommands.Add ("meshshadcolor", "change MeshVS_Mesh shading color", __FILE__, meshcolor, g ); | |
1001 | theCommands.Add ("meshlinkcolor", "change MeshVS_Mesh line color", __FILE__, linecolor, g ); | |
1002 | theCommands.Add ("meshmat", "change MeshVS_Mesh material", __FILE__, meshmat, g ); | |
1003 | theCommands.Add ("meshshrcoef", "change MeshVS_Mesh shrink coeff", __FILE__, shrink, g ); | |
1004 | theCommands.Add ("meshshow", "display MeshVS_Mesh object", __FILE__, mdisplay, g ); | |
1005 | theCommands.Add ("meshhide", "erase MeshVS_Mesh object", __FILE__, merase, g ); | |
1006 | theCommands.Add ("meshhidesel", "hide selected entities", __FILE__, hidesel, g ); | |
1007 | theCommands.Add ("meshshowsel", "show only selected entities", __FILE__, showonly, g ); | |
1008 | theCommands.Add ("meshshowall", "show all entities", __FILE__, showall, g ); | |
1009 | theCommands.Add ("meshdelete", "delete MeshVS_Mesh object", __FILE__, delmesh, g ); | |
1010 | theCommands.Add ("meshcolors", "display color presentation", __FILE__, meshcolors, g ); | |
1011 | theCommands.Add ("mesh_edge_width", "set width of edges", __FILE__, mesh_edge_width, g ); | |
1012 | } | |
1013 | ||
1014 | //============================================================================== | |
1015 | // XSDRAWSTLVRML::Factory | |
1016 | //============================================================================== | |
1017 | void XSDRAWSTLVRML::Factory(Draw_Interpretor& theDI) | |
1018 | { | |
1019 | XSDRAWIGES::InitSelect(); | |
1020 | XSDRAWIGES::InitToBRep(theDI); | |
1021 | XSDRAWIGES::InitFromBRep(theDI); | |
1022 | XSDRAWSTEP::InitCommands(theDI); | |
1023 | XSDRAWSTLVRML::InitCommands(theDI); | |
1024 | SWDRAW::Init(theDI); | |
1025 | XSDRAW::LoadDraw(theDI); | |
1026 | #ifdef DEB | |
1027 | theDI << "Draw Plugin : All TKXSDRAW commands are loaded" << "\n"; | |
1028 | #endif | |
1029 | } | |
1030 | ||
1031 | // Declare entry point PLUGINFACTORY | |
1032 | DPLUGIN(XSDRAWSTLVRML) | |
1033 |