]> OCCT Git - occt.git/commitdiff
0033531: Configuration - Rework DataExchange ToolKits organization
authordpasukhi <dpasukhi@opencascade.com>
Sun, 19 Nov 2023 11:09:33 +0000 (11:09 +0000)
committerdpasukhi <dpasukhi@opencascade.com>
Mon, 4 Dec 2023 15:52:47 +0000 (15:52 +0000)
Integrated DE plugin functionality.
Reworked DE components:
 - TKDESTEP: Handling STEP file format.
 - TKDEOBJ: Handling OBJ file format.
 - TKDEIGES: Handling IGES file format.
 - TKDEGLTF: Handling GLTF file format.
 - TKDEVRML: Handling VRML file format.
 - TKDEPLY: Handling PLY file format.
 - TKDESTL: Handling STL file format.
Reworked DE DRAW components:
  TKXSDRAWSTEP: Container for DE command to work with STEP.
  TKXSDRAWOBJ: Container for DE command to work with OBJ.
  TKXSDRAWIGES: Container for DE command to work with IGES.
  TKXSDRAWGLTF: Container for DE command to work with GLTF.
  TKXSDRAWVRML: Container for DE command to work with VRML.
  TKXSDRAWPLY: Container for DE command to work with PLY.
  TKXSDRAWSTL: Container for DE command to work with STL.
TKXSDRAW rework to be base DRAW plugin to keep DE session and utils.
Updated documentation
Updated samples

261 files changed:
adm/MODULES
adm/UDLIST
dox/contribution/tests/tests.md
dox/user_guides/step/step.md
samples/CSharp/OCCTProxy/OCCTProxy.cpp
samples/CSharp/OCCTProxy_D3D/OCCTProxyD3D.cpp
samples/glfw/adm/cmake/FindOpenCASCADE.cmake
samples/ios/UIKitSample/UIKitSample.xcodeproj/project.pbxproj
samples/java/jniviewer/app/src/main/java/com/opencascade/jnisample/OcctJniActivity.java
samples/java/jniviewer/app/src/main/jni/CMakeLists.txt
samples/mfc/standard/01_Geometry/adm/win/vc10/Geometry.vcxproj
samples/mfc/standard/02_Modeling/CMakeLists.txt
samples/mfc/standard/02_Modeling/adm/win/vc10/Modeling.vcxproj
samples/mfc/standard/03_ImportExport/adm/win/vc10/ImportExport.vcxproj
samples/mfc/standard/mfcsample/CMakeLists.txt
samples/mfc/standard/mfcsample/adm/win/vc10/mfcsample.vcxproj
samples/qt/IESample/EXTERNLIB
samples/qt/IESample/IESample.pro
samples/qt/OCCTOverview/EXTERNLIB
samples/qt/OCCTOverview/OCCTOverview.pro
samples/qt/Tutorial/EXTERNLIB
samples/qt/Tutorial/Tutorial.pro
samples/webgl/CMakeLists.txt
samples/xaml/CMakeLists.txt
src/DE/DE_PluginHolder.hxx [new file with mode: 0644]
src/DE/DE_Wrapper.cxx
src/DE/DE_Wrapper.hxx
src/DE/FILES
src/DEBRepCascade/DEBRepCascade_ConfigurationNode.cxx
src/DEXCAFCascade/DEXCAFCascade_ConfigurationNode.cxx
src/DRAWEXE/DRAWEXE.cxx
src/DRAWEXE/EXTERNLIB_STATIC
src/DrawResources/DrawPlugin
src/IGESCAFControl/IGESCAFControl_ConfigurationNode.cxx
src/OS/DataExchange.tcl
src/RWGltf/RWGltf_ConfigurationNode.cxx
src/RWObj/RWObj_ConfigurationNode.cxx
src/RWPly/RWPly_ConfigurationNode.cxx
src/RWStl/RWStl_ConfigurationNode.cxx
src/STEPCAFControl/STEPCAFControl_ConfigurationNode.cxx
src/TKDE/CMakeLists.txt [new file with mode: 0644]
src/TKDE/EXTERNLIB [new file with mode: 0644]
src/TKDE/FILES [new file with mode: 0644]
src/TKDE/PACKAGES [new file with mode: 0644]
src/TKDECascade/CMakeLists.txt [new file with mode: 0644]
src/TKDECascade/EXTERNLIB [new file with mode: 0644]
src/TKDECascade/FILES [new file with mode: 0644]
src/TKDECascade/PACKAGES [new file with mode: 0644]
src/TKDEGLTF/CMakeLists.txt [new file with mode: 0644]
src/TKDEGLTF/EXTERNLIB [new file with mode: 0644]
src/TKDEGLTF/FILES [new file with mode: 0644]
src/TKDEGLTF/PACKAGES [new file with mode: 0644]
src/TKDEIGES/CMakeLists.txt [new file with mode: 0644]
src/TKDEIGES/EXTERNLIB [new file with mode: 0644]
src/TKDEIGES/FILES [new file with mode: 0644]
src/TKDEIGES/PACKAGES [new file with mode: 0644]
src/TKDEOBJ/CMakeLists.txt [new file with mode: 0644]
src/TKDEOBJ/EXTERNLIB [new file with mode: 0644]
src/TKDEOBJ/FILES [new file with mode: 0644]
src/TKDEOBJ/PACKAGES [new file with mode: 0644]
src/TKDEPLY/CMakeLists.txt [new file with mode: 0644]
src/TKDEPLY/EXTERNLIB [new file with mode: 0644]
src/TKDEPLY/FILES [new file with mode: 0644]
src/TKDEPLY/PACKAGES [new file with mode: 0644]
src/TKDESTEP/CMakeLists.txt [new file with mode: 0644]
src/TKDESTEP/EXTERNLIB [new file with mode: 0644]
src/TKDESTEP/FILES [new file with mode: 0644]
src/TKDESTEP/PACKAGES [new file with mode: 0644]
src/TKDESTL/CMakeLists.txt [new file with mode: 0644]
src/TKDESTL/EXTERNLIB [new file with mode: 0644]
src/TKDESTL/FILES [new file with mode: 0644]
src/TKDESTL/PACKAGES [new file with mode: 0644]
src/TKDEVRML/CMakeLists.txt [new file with mode: 0644]
src/TKDEVRML/EXTERNLIB [new file with mode: 0644]
src/TKDEVRML/FILES [new file with mode: 0644]
src/TKDEVRML/PACKAGES [new file with mode: 0644]
src/TKIGES/CMakeLists.txt [deleted file]
src/TKIGES/EXTERNLIB [deleted file]
src/TKIGES/FILES [deleted file]
src/TKIGES/PACKAGES [deleted file]
src/TKQADraw/EXTERNLIB
src/TKRWMesh/EXTERNLIB
src/TKRWMesh/PACKAGES
src/TKSTEP/CMakeLists.txt [deleted file]
src/TKSTEP/EXTERNLIB [deleted file]
src/TKSTEP/FILES [deleted file]
src/TKSTEP/PACKAGES [deleted file]
src/TKSTEP209/CMakeLists.txt [deleted file]
src/TKSTEP209/EXTERNLIB [deleted file]
src/TKSTEP209/FILES [deleted file]
src/TKSTEP209/PACKAGES [deleted file]
src/TKSTEPAttr/CMakeLists.txt [deleted file]
src/TKSTEPAttr/EXTERNLIB [deleted file]
src/TKSTEPAttr/FILES [deleted file]
src/TKSTEPAttr/PACKAGES [deleted file]
src/TKSTEPBase/CMakeLists.txt [deleted file]
src/TKSTEPBase/EXTERNLIB [deleted file]
src/TKSTEPBase/FILES [deleted file]
src/TKSTEPBase/PACKAGES [deleted file]
src/TKSTL/CMakeLists.txt [deleted file]
src/TKSTL/EXTERNLIB [deleted file]
src/TKSTL/FILES [deleted file]
src/TKSTL/PACKAGES [deleted file]
src/TKVRML/CMakeLists.txt [deleted file]
src/TKVRML/EXTERNLIB [deleted file]
src/TKVRML/FILES [deleted file]
src/TKVRML/PACKAGES [deleted file]
src/TKXDE/CMakeLists.txt [deleted file]
src/TKXDE/EXTERNLIB [deleted file]
src/TKXDE/FILES [deleted file]
src/TKXDE/PACKAGES [deleted file]
src/TKXDECascade/CMakeLists.txt [deleted file]
src/TKXDECascade/EXTERNLIB [deleted file]
src/TKXDECascade/FILES [deleted file]
src/TKXDECascade/PACKAGES [deleted file]
src/TKXDEDRAW/EXTERNLIB
src/TKXDEIGES/CMakeLists.txt [deleted file]
src/TKXDEIGES/EXTERNLIB [deleted file]
src/TKXDEIGES/FILES [deleted file]
src/TKXDEIGES/PACKAGES [deleted file]
src/TKXDESTEP/CMakeLists.txt [deleted file]
src/TKXDESTEP/EXTERNLIB [deleted file]
src/TKXDESTEP/FILES [deleted file]
src/TKXDESTEP/PACKAGES [deleted file]
src/TKXSBase/PACKAGES
src/TKXSDRAW/EXTERNLIB
src/TKXSDRAW/PACKAGES
src/TKXSDRAWDE/CMakeLists.txt [new file with mode: 0644]
src/TKXSDRAWDE/EXTERNLIB [new file with mode: 0644]
src/TKXSDRAWDE/FILES [new file with mode: 0644]
src/TKXSDRAWDE/PACKAGES [new file with mode: 0644]
src/TKXSDRAWGLTF/CMakeLists.txt [new file with mode: 0644]
src/TKXSDRAWGLTF/EXTERNLIB [new file with mode: 0644]
src/TKXSDRAWGLTF/FILES [new file with mode: 0644]
src/TKXSDRAWGLTF/PACKAGES [new file with mode: 0644]
src/TKXSDRAWIGES/CMakeLists.txt [new file with mode: 0644]
src/TKXSDRAWIGES/EXTERNLIB [new file with mode: 0644]
src/TKXSDRAWIGES/FILES [new file with mode: 0644]
src/TKXSDRAWIGES/PACKAGES [new file with mode: 0644]
src/TKXSDRAWOBJ/CMakeLists.txt [new file with mode: 0644]
src/TKXSDRAWOBJ/EXTERNLIB [new file with mode: 0644]
src/TKXSDRAWOBJ/FILES [new file with mode: 0644]
src/TKXSDRAWOBJ/PACKAGES [new file with mode: 0644]
src/TKXSDRAWPLY/CMakeLists.txt [new file with mode: 0644]
src/TKXSDRAWPLY/EXTERNLIB [new file with mode: 0644]
src/TKXSDRAWPLY/FILES [new file with mode: 0644]
src/TKXSDRAWPLY/PACKAGES [new file with mode: 0644]
src/TKXSDRAWSTEP/CMakeLists.txt [new file with mode: 0644]
src/TKXSDRAWSTEP/EXTERNLIB [new file with mode: 0644]
src/TKXSDRAWSTEP/FILES [new file with mode: 0644]
src/TKXSDRAWSTEP/PACKAGES [new file with mode: 0644]
src/TKXSDRAWSTL/CMakeLists.txt [new file with mode: 0644]
src/TKXSDRAWSTL/EXTERNLIB [new file with mode: 0644]
src/TKXSDRAWSTL/FILES [new file with mode: 0644]
src/TKXSDRAWSTL/PACKAGES [new file with mode: 0644]
src/TKXSDRAWVRML/CMakeLists.txt [new file with mode: 0644]
src/TKXSDRAWVRML/EXTERNLIB [new file with mode: 0644]
src/TKXSDRAWVRML/FILES [new file with mode: 0644]
src/TKXSDRAWVRML/PACKAGES [new file with mode: 0644]
src/Vrml/Vrml_ConfigurationNode.cxx
src/XDEDRAW/XDEDRAW.cxx
src/XDEDRAW/XDEDRAW.hxx
src/XDEDRAW/XDEDRAW_Common.cxx
src/XDEDRAW/XDEDRAW_Common.hxx
src/XSControl/XSControl_Functions.cxx
src/XSControl/XSControl_WorkSession.hxx
src/XSDRAW/XSDRAW.cxx
src/XSDRAW/XSDRAW.hxx
src/XSDRAWDE/FILES [new file with mode: 0644]
src/XSDRAWDE/XSDRAWDE.cxx [new file with mode: 0644]
src/XSDRAWDE/XSDRAWDE.hxx [new file with mode: 0644]
src/XSDRAWGLTF/FILES [new file with mode: 0644]
src/XSDRAWGLTF/XSDRAWGLTF.cxx [new file with mode: 0644]
src/XSDRAWGLTF/XSDRAWGLTF.hxx [new file with mode: 0644]
src/XSDRAWIGES/XSDRAWIGES.cxx
src/XSDRAWIGES/XSDRAWIGES.hxx
src/XSDRAWOBJ/FILES [new file with mode: 0644]
src/XSDRAWOBJ/XSDRAWOBJ.cxx [new file with mode: 0644]
src/XSDRAWOBJ/XSDRAWOBJ.hxx [new file with mode: 0644]
src/XSDRAWPLY/FILES [new file with mode: 0644]
src/XSDRAWPLY/XSDRAWPLY.cxx [new file with mode: 0644]
src/XSDRAWPLY/XSDRAWPLY.hxx [new file with mode: 0644]
src/XSDRAWSTEP/XSDRAWSTEP.cxx
src/XSDRAWSTEP/XSDRAWSTEP.hxx
src/XSDRAWSTL/FILES [new file with mode: 0644]
src/XSDRAWSTL/XSDRAWSTL.cxx [new file with mode: 0644]
src/XSDRAWSTL/XSDRAWSTL.hxx [new file with mode: 0644]
src/XSDRAWSTL/XSDRAWSTL_DataSource.cxx [new file with mode: 0644]
src/XSDRAWSTL/XSDRAWSTL_DataSource.hxx [new file with mode: 0644]
src/XSDRAWSTL/XSDRAWSTL_DataSource3D.cxx [new file with mode: 0644]
src/XSDRAWSTL/XSDRAWSTL_DataSource3D.hxx [new file with mode: 0644]
src/XSDRAWSTL/XSDRAWSTL_DrawableMesh.cxx [new file with mode: 0644]
src/XSDRAWSTL/XSDRAWSTL_DrawableMesh.hxx [new file with mode: 0644]
src/XSDRAWSTLVRML/FILES [deleted file]
src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx [deleted file]
src/XSDRAWSTLVRML/XSDRAWSTLVRML.hxx [deleted file]
src/XSDRAWSTLVRML/XSDRAWSTLVRML_CoordsMap.hxx [deleted file]
src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfCoordsMap.hxx [deleted file]
src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap.hxx [deleted file]
src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource.cxx [deleted file]
src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource.hxx [deleted file]
src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.cxx [deleted file]
src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.hxx [deleted file]
src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.cxx [deleted file]
src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.hxx [deleted file]
src/XSDRAWSTLVRML/XSDRAWSTLVRML_ElemNodesMap.hxx [deleted file]
src/XSDRAWVRML/FILES [new file with mode: 0644]
src/XSDRAWVRML/XSDRAWVRML.cxx [new file with mode: 0644]
src/XSDRAWVRML/XSDRAWVRML.hxx [new file with mode: 0644]
tests/bugs/demo/bug14673_3
tests/bugs/demo/bug27905
tests/bugs/heal/bug23722
tests/bugs/heal/bug24549
tests/bugs/heal/bug24983
tests/bugs/heal/bug25013_1
tests/bugs/heal/bug25013_2
tests/bugs/heal/bug25823
tests/bugs/heal/bug26280
tests/bugs/heal/bug26671
tests/bugs/heal/bug27078
tests/bugs/heal/bug27894
tests/bugs/heal/bug33028
tests/bugs/heal/bug33398
tests/bugs/mesh/bug28118
tests/bugs/mesh/bug29715
tests/bugs/modalg_4/bug8842_1
tests/bugs/modalg_4/bug8842_10
tests/bugs/modalg_4/bug8842_11
tests/bugs/modalg_4/bug8842_12
tests/bugs/modalg_4/bug8842_13
tests/bugs/modalg_4/bug8842_14
tests/bugs/modalg_4/bug8842_15
tests/bugs/modalg_4/bug8842_16
tests/bugs/modalg_4/bug8842_2
tests/bugs/modalg_4/bug8842_3
tests/bugs/modalg_4/bug8842_4
tests/bugs/modalg_4/bug8842_5
tests/bugs/modalg_4/bug8842_6
tests/bugs/modalg_4/bug8842_7
tests/bugs/modalg_4/bug8842_8
tests/bugs/modalg_4/bug8842_9
tests/bugs/modalg_5/bug25175
tests/bugs/modalg_5/bug25410
tests/bugs/modalg_7/bug30595_2
tests/bugs/modalg_7/bug30829
tests/bugs/modalg_8/bug33165
tests/bugs/moddata_2/bug22572
tests/bugs/stlvrml/begin
tests/perf/fclasses/bug24947
tests/perf/heal/bug24596_1
tests/perf/heal/bug24596_2
tests/perf/moddata/bug25487_1
tests/perf/moddata/bug25487_2
tests/perf/moddata/bug27048_2
tests/v3d/bugs/bug23407_1
tests/v3d/mesh/begin
tests/vselect/bugs/bug26566
tests/vselect/face/G2
tests/vselect/face/G3
tests/vselect/face/G4
tools/TKDFBrowser/EXTERNLIB

index 235c30595dfd2d6ac88e39999f7b5c84742eaa94..480e742983a1731d485855d98b0c7ee965348a2f 100644 (file)
@@ -3,6 +3,6 @@ ModelingData TKG2d TKG3d TKGeomBase TKBRep
 ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
 Visualization TKService TKV3d TKOpenGl TKOpenGles TKMeshVS TKIVtk TKD3DHost
 ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
-DataExchange TKXDE TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh TKXDECascade
-Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
+DataExchange TKDE TKXSBase TKDESTEP TKDEIGES TKDESTL TKDEVRML TKDECascade TKDEOBJ TKDEGLTF TKDEPLY TKXCAF TKXmlXCAF TKBinXCAF TKRWMesh
 DETools TKExpress ExpToCasExe
+Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE TKXSDRAWDE TKXSDRAWGLTF TKXSDRAWIGES TKXSDRAWOBJ TKXSDRAWPLY TKXSDRAWSTEP TKXSDRAWSTL TKXSDRAWVRML
index 0fd9b49e53de2d750b1779f9312cc07ae286678e..14f425239d2e9b7e85f1f69042ce0493bd0abb9b 100644 (file)
@@ -376,18 +376,13 @@ r SHMessage
 r XSMessage
 r XSTEPResource
 t TKBinXCAF
-t TKIGES
-t TKSTEP
-t TKSTEP209
-t TKSTEPAttr
-t TKSTEPBase
-t TKSTL
-t TKVRML
+t TKDESTL
+t TKDEVRML
 t TKXCAF
-t TKXDE
-t TKXDECascade
-t TKXDEIGES
-t TKXDESTEP
+t TKDE
+t TKDECascade
+t TKDEIGES
+t TKDESTEP
 t TKXSBase
 t TKXmlXCAF
 n BOPTest
@@ -419,7 +414,12 @@ n XDEDRAW
 n XSDRAW
 n XSDRAWIGES
 n XSDRAWSTEP
-n XSDRAWSTLVRML
+n XSDRAWSTL
+n XSDRAWVRML
+n XSDRAWDE
+n XSDRAWGLTF
+n XSDRAWOBJ
+n XSDRAWPLY
 r DrawResources
 t TKDCAF
 t TKDraw
@@ -431,6 +431,14 @@ t TKD3DHostTest
 t TKViewerTest
 t TKXDEDRAW
 t TKXSDRAW
+t TKXSDRAWIGES
+t TKXSDRAWSTEP
+t TKXSDRAWSTL
+t TKXSDRAWVRML
+t TKXSDRAWDE
+t TKXSDRAWGLTF
+t TKXSDRAWOBJ
+t TKXSDRAWPLY
 x DRAWEXE
 n QADraw
 n QANCollection
@@ -456,6 +464,9 @@ t TKVCAF
 n XCAFView
 n XCAFNoteObjects
 t TKRWMesh
+t TKDEGLTF
+t TKDEOBJ
+t TKDEPLY
 n RWGltf
 n RWMesh
 n RWObj
index ef8dd4e71141080f7bf48fb795b617b6d5d9d23c..05ef3d56f8e2b475d289e8411402fcbfb5ca67ac 100644 (file)
@@ -1089,10 +1089,10 @@ This group allows  testing extended data exchange packages.
 | Draw  | TKDraw, TKTopTest, TKViewerTest, TKXSDRAW, TKDCAF, TKXDEDRAW, TKTObjDRAW, TKQADraw, DRAWEXE, Problems of testing system | draw | 
 | Shape Healing | TKShHealing | heal |
 | Mesh  | TKMesh, TKXMesh | mesh |
-| Data Exchange | TKIGES  | iges |
-| Data Exchange | TKSTEPBase, TKSTEPAttr, TKSTEP209, TKSTEP | step |
-| Data Exchange | TKSTL, TKVRML   | stlvrml |
-| Data Exchange | TKXSBase, TKXCAF, TKXCAFSchema, TKXDEIGES, TKXDESTEP, TKXmlXCAF, TKBinXCAF | xde |
+| Data Exchange | TKDEIGES  | iges |
+| Data Exchange | TKDESTEP | step |
+| Data Exchange | TKDESTL, TKDEVRML   | stlvrml |
+| Data Exchange | TKXSBase, TKXCAF, TKXCAFSchema, TKXmlXCAF, TKBinXCAF | xde |
 | Foundation Classes |  TKernel, TKMath | fclasses |
 | Modeling_algorithms | TKGeomAlgo, TKTopAlgo, TKPrim, TKBO, TKBool, TKHLR, TKFillet, TKOffset, TKFeat, TKXMesh | modalg |
 | Modeling Data | TKG2d, TKG3d, TKGeomBase, TKBRep  | moddata |
index f8f47da396dc2ea4062adf070e249ecaf7962a3a..3c6b31a56b485209da03edd6edf42ac966a608af 100644 (file)
@@ -1498,7 +1498,7 @@ It is necessary to call command *newmodel* to perform a new translation of the n
 
 @section occt_step_7 Reading from and writing to STEP
 
-The *STEPCAFControl* package (TKXDESTEP toolkit) provides tools to read and write STEP files (see XDE User's Guide). 
+The *STEPCAFControl* package (TKDESTEP toolkit) provides tools to read and write STEP files (see XDE User's Guide). 
 
 In addition to the translation of shapes implemented in basic translator, it provides the following: 
   * STEP assemblies, read as OCCT compounds by basic translator, are translated to XDE assemblies;
index d20a4f6b9b664561332e63b8b1bbcd33e117767d..52bda2ee320cf3b9ae58bb669cf1ed39ac41a25d 100644 (file)
 #pragma comment(lib, "TKService.lib")
 #pragma comment(lib, "TKV3d.lib")
 #pragma comment(lib, "TKOpenGl.lib")
-#pragma comment(lib, "TKIGES.lib")
-#pragma comment(lib, "TKSTEP.lib")
-#pragma comment(lib, "TKStl.lib")
-#pragma comment(lib, "TKVrml.lib")
+#pragma comment(lib, "TKDEIGES.lib")
+#pragma comment(lib, "TKDESTEP.lib")
+#pragma comment(lib, "TKDESTL.lib")
+#pragma comment(lib, "TKDEVRML.lib")
 #pragma comment(lib, "TKLCAF.lib")
 
 //! Auxiliary tool for converting C# string into UTF-8 string.
index 51bf0a56ba81dcf281d6fa9c5590fc5665320785..7f797251479e52aafc8ac607d1889f04daf0c11c 100644 (file)
 #pragma comment(lib, "TKV3d.lib")
 #pragma comment(lib, "TKOpenGl.lib")
 #pragma comment(lib, "TKD3dHost.lib")
-#pragma comment(lib, "TKIGES.lib")
-#pragma comment(lib, "TKSTEP.lib")
-#pragma comment(lib, "TKStl.lib")
-#pragma comment(lib, "TKVrml.lib")
+#pragma comment(lib, "TKDEIGES.lib")
+#pragma comment(lib, "TKDESTEP.lib")
+#pragma comment(lib, "TKDESTL.lib")
+#pragma comment(lib, "TKDEVRML.lib")
 #pragma comment(lib, "TKLCAF.lib")
 
 #pragma comment(lib, "D3D9.lib")
index f079c1542502dce07ab141b6c5d42d291429a841..839cc75192d9daf711091da7c1f4797f767389e6 100644 (file)
@@ -63,7 +63,7 @@ set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKG2d TKG3d TKGeomBase TKBRep) # M
 set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing) # ModelingAlgorithms
 set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKService TKV3d TKOpenGl TKMeshVS TKIVtk TKD3DHost) # Visualization
 set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF) # ApplicationFramework
-set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh) # DataExchange
+set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKXSBase TKXCAF TKDEIGES TKDESTEP TKDESTL TKDEVRML TKXmlXCAF TKBinXCAF TKRWMesh TKDEGLTF TKDEOBJ TKDEPLY) # DataExchange
 set (OpenCASCADE_TKLIST ${OpenCASCADE_TKLIST} TKDraw TKViewerTest) # Draw
 
 # validate location of OCCT libraries and headers
index a83efb466aa5916b7e97e732226325a6809a0546..78a9b1826751dea5519ff9c672bb427cfdc3d763 100644 (file)
                0A7DEDFC1E2D29FF00267B9B /* libTKV3d.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEDF71E2D29F800267B9B /* libTKV3d.a */; };
                0A7DEDFD1E2D29FF00267B9B /* libTKVCAF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEDF81E2D29FB00267B9B /* libTKVCAF.a */; };
                0A7DEE2B1E2D2AE000267B9B /* libTKService.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE0B1E2D2A9D00267B9B /* libTKService.a */; };
-               0A7DEE2E1E2D2AE000267B9B /* libTKSTEP.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE0E1E2D2AA800267B9B /* libTKSTEP.a */; };
-               0A7DEE301E2D2AE000267B9B /* libTKSTEPAttr.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE101E2D2AAE00267B9B /* libTKSTEPAttr.a */; };
-               0A7DEE311E2D2AE000267B9B /* libTKSTEPBase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE111E2D2AB200267B9B /* libTKSTEPBase.a */; };
+               0A7DEE2E1E2D2AE000267B9B /* libTKDESTEP.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE0E1E2D2AA800267B9B /* libTKDESTEP.a */; };
                0A7DEE351E2D2AE000267B9B /* libTKXCAF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE151E2D2AC000267B9B /* libTKXCAF.a */; };
-               0A7DEE371E2D2AE000267B9B /* libTKXDESTEP.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE171E2D2AC700267B9B /* libTKXDESTEP.a */; };
                0A7DEE3E1E2D2B8100267B9B /* libTKBO.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE021E2D2A7F00267B9B /* libTKBO.a */; };
                0A7DEE3F1E2D2BB000267B9B /* libTKOpenGles.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE091E2D2A9700267B9B /* libTKOpenGles.a */; };
-               0A7DEE401E2D2BEA00267B9B /* libTKSTEP209.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE0F1E2D2AAB00267B9B /* libTKSTEP209.a */; };
                0A7DEE411E2D2C1500267B9B /* libTKXSBase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE1D1E2D2ADC00267B9B /* libTKXSBase.a */; };
                0AAE0DE61EAF816E00C1F65B /* screw.step in Resources */ = {isa = PBXBuildFile; fileRef = 0AAE0DE51EAF816D00C1F65B /* screw.step */; };
                0AE286641EB0D29B00A9D719 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AE286631EB0D29A00A9D719 /* libz.tbd */; };
@@ -79,7 +75,7 @@
                0A7DEE031E2D2A8200267B9B /* libTKBool.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKBool.a; path = ../occt/lib/libTKBool.a; sourceTree = "<group>"; };
                0A7DEE041E2D2A8500267B9B /* libTKFeat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKFeat.a; path = ../occt/lib/libTKFeat.a; sourceTree = "<group>"; };
                0A7DEE051E2D2A8900267B9B /* libTKFillet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKFillet.a; path = ../occt/lib/libTKFillet.a; sourceTree = "<group>"; };
-               0A7DEE061E2D2A8C00267B9B /* libTKIGES.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKIGES.a; path = ../occt/lib/libTKIGES.a; sourceTree = "<group>"; };
+               0A7DEE061E2D2A8C00267B9B /* libTKDEIGES.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKDEIGES.a; path = ../occt/lib/libTKDEIGES.a; sourceTree = "<group>"; };
                0A7DEE071E2D2A8F00267B9B /* libTKMeshVS.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKMeshVS.a; path = ../occt/lib/libTKMeshVS.a; sourceTree = "<group>"; };
                0A7DEE081E2D2A9300267B9B /* libTKOffset.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKOffset.a; path = ../occt/lib/libTKOffset.a; sourceTree = "<group>"; };
                0A7DEE091E2D2A9700267B9B /* libTKOpenGles.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKOpenGles.a; path = ../occt/lib/libTKOpenGles.a; sourceTree = "<group>"; };
                0A7DEE0B1E2D2A9D00267B9B /* libTKService.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKService.a; path = ../occt/lib/libTKService.a; sourceTree = "<group>"; };
                0A7DEE0C1E2D2AA100267B9B /* libTKStd.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKStd.a; path = ../occt/lib/libTKStd.a; sourceTree = "<group>"; };
                0A7DEE0D1E2D2AA400267B9B /* libTKStdL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKStdL.a; path = ../occt/lib/libTKStdL.a; sourceTree = "<group>"; };
-               0A7DEE0E1E2D2AA800267B9B /* libTKSTEP.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKSTEP.a; path = ../occt/lib/libTKSTEP.a; sourceTree = "<group>"; };
-               0A7DEE0F1E2D2AAB00267B9B /* libTKSTEP209.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKSTEP209.a; path = ../occt/lib/libTKSTEP209.a; sourceTree = "<group>"; };
-               0A7DEE101E2D2AAE00267B9B /* libTKSTEPAttr.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKSTEPAttr.a; path = ../occt/lib/libTKSTEPAttr.a; sourceTree = "<group>"; };
-               0A7DEE111E2D2AB200267B9B /* libTKSTEPBase.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKSTEPBase.a; path = ../occt/lib/libTKSTEPBase.a; sourceTree = "<group>"; };
-               0A7DEE121E2D2AB500267B9B /* libTKSTL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKSTL.a; path = ../occt/lib/libTKSTL.a; sourceTree = "<group>"; };
+               0A7DEE0E1E2D2AA800267B9B /* libTKDESTEP.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKDESTEP.a; path = ../occt/lib/libTKDESTEP.a; sourceTree = "<group>"; };
+               0A7DEE121E2D2AB500267B9B /* libTKDESTL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKDESTL.a; path = ../occt/lib/libTKDESTL.a; sourceTree = "<group>"; };
                0A7DEE131E2D2AB900267B9B /* libTKTObj.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKTObj.a; path = ../occt/lib/libTKTObj.a; sourceTree = "<group>"; };
-               0A7DEE141E2D2ABC00267B9B /* libTKVRML.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKVRML.a; path = ../occt/lib/libTKVRML.a; sourceTree = "<group>"; };
+               0A7DEE141E2D2ABC00267B9B /* libTKDEVRML.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKDEVRML.a; path = ../occt/lib/libTKDEVRML.a; sourceTree = "<group>"; };
                0A7DEE151E2D2AC000267B9B /* libTKXCAF.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKXCAF.a; path = ../occt/lib/libTKXCAF.a; sourceTree = "<group>"; };
-               0A7DEE161E2D2AC300267B9B /* libTKXDEIGES.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKXDEIGES.a; path = ../occt/lib/libTKXDEIGES.a; sourceTree = "<group>"; };
-               0A7DEE171E2D2AC700267B9B /* libTKXDESTEP.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKXDESTEP.a; path = ../occt/lib/libTKXDESTEP.a; sourceTree = "<group>"; };
                0A7DEE181E2D2ACA00267B9B /* libTKXMesh.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKXMesh.a; path = ../occt/lib/libTKXMesh.a; sourceTree = "<group>"; };
                0A7DEE191E2D2ACE00267B9B /* libTKXml.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKXml.a; path = ../occt/lib/libTKXml.a; sourceTree = "<group>"; };
                0A7DEE1A1E2D2AD100267B9B /* libTKXmlL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKXmlL.a; path = ../occt/lib/libTKXmlL.a; sourceTree = "<group>"; };
                        files = (
                                0AE286641EB0D29B00A9D719 /* libz.tbd in Frameworks */,
                                0A7DEE411E2D2C1500267B9B /* libTKXSBase.a in Frameworks */,
-                               0A7DEE401E2D2BEA00267B9B /* libTKSTEP209.a in Frameworks */,
                                0A7DEE3F1E2D2BB000267B9B /* libTKOpenGles.a in Frameworks */,
                                0A7DEE3E1E2D2B8100267B9B /* libTKBO.a in Frameworks */,
                                0A7DEE2B1E2D2AE000267B9B /* libTKService.a in Frameworks */,
-                               0A7DEE2E1E2D2AE000267B9B /* libTKSTEP.a in Frameworks */,
-                               0A7DEE301E2D2AE000267B9B /* libTKSTEPAttr.a in Frameworks */,
-                               0A7DEE311E2D2AE000267B9B /* libTKSTEPBase.a in Frameworks */,
+                               0A7DEE2E1E2D2AE000267B9B /* libTKDESTEP.a in Frameworks */,
                                0A7DEE351E2D2AE000267B9B /* libTKXCAF.a in Frameworks */,
                                0A7DEE371E2D2AE000267B9B /* libTKXDESTEP.a in Frameworks */,
                                0A7DEDE71E2D28E300267B9B /* libTKBRep.a in Frameworks */,
                                0A7DEE031E2D2A8200267B9B /* libTKBool.a */,
                                0A7DEE041E2D2A8500267B9B /* libTKFeat.a */,
                                0A7DEE051E2D2A8900267B9B /* libTKFillet.a */,
-                               0A7DEE061E2D2A8C00267B9B /* libTKIGES.a */,
+                               0A7DEE061E2D2A8C00267B9B /* libTKDEIGES.a */,
                                0A7DEE071E2D2A8F00267B9B /* libTKMeshVS.a */,
                                0A7DEE081E2D2A9300267B9B /* libTKOffset.a */,
                                0A7DEE091E2D2A9700267B9B /* libTKOpenGles.a */,
                                0A7DEE0B1E2D2A9D00267B9B /* libTKService.a */,
                                0A7DEE0C1E2D2AA100267B9B /* libTKStd.a */,
                                0A7DEE0D1E2D2AA400267B9B /* libTKStdL.a */,
-                               0A7DEE0E1E2D2AA800267B9B /* libTKSTEP.a */,
-                               0A7DEE0F1E2D2AAB00267B9B /* libTKSTEP209.a */,
-                               0A7DEE101E2D2AAE00267B9B /* libTKSTEPAttr.a */,
-                               0A7DEE111E2D2AB200267B9B /* libTKSTEPBase.a */,
-                               0A7DEE121E2D2AB500267B9B /* libTKSTL.a */,
+                               0A7DEE0E1E2D2AA800267B9B /* libTKDESTEP.a */,
+                               0A7DEE121E2D2AB500267B9B /* libTKDESTL.a */,
                                0A7DEE131E2D2AB900267B9B /* libTKTObj.a */,
-                               0A7DEE141E2D2ABC00267B9B /* libTKVRML.a */,
+                               0A7DEE141E2D2ABC00267B9B /* libTKDEVRML.a */,
                                0A7DEE151E2D2AC000267B9B /* libTKXCAF.a */,
-                               0A7DEE161E2D2AC300267B9B /* libTKXDEIGES.a */,
-                               0A7DEE171E2D2AC700267B9B /* libTKXDESTEP.a */,
                                0A7DEE181E2D2ACA00267B9B /* libTKXMesh.a */,
                                0A7DEE191E2D2ACE00267B9B /* libTKXml.a */,
                                0A7DEE1A1E2D2AD100267B9B /* libTKXmlL.a */,
index b92c4ae98d893140112cba03dbd118d179735f85..d75708abfac68700920527e594935f1bf60ced00 100644 (file)
@@ -138,11 +138,8 @@ public class OcctJniActivity extends Activity implements OnClickListener
      || !loadLibVerbose ("TKFillet",     aLoaded, aFailed)
      || !loadLibVerbose ("TKOffset",     aLoaded, aFailed)
      || !loadLibVerbose ("TKXSBase",     aLoaded, aFailed)
-     || !loadLibVerbose ("TKIGES",       aLoaded, aFailed)
-     || !loadLibVerbose ("TKSTEPBase",   aLoaded, aFailed)
-     || !loadLibVerbose ("TKSTEPAttr",   aLoaded, aFailed)
-     || !loadLibVerbose ("TKSTEP209",    aLoaded, aFailed)
-     || !loadLibVerbose ("TKSTEP",       aLoaded, aFailed)
+     || !loadLibVerbose ("TKDEIGES",       aLoaded, aFailed)
+     || !loadLibVerbose ("TKDESTEP",       aLoaded, aFailed)
         // OCCT Visualization
      || !loadLibVerbose ("TKService",    aLoaded, aFailed)
      || !loadLibVerbose ("TKHLR",        aLoaded, aFailed)
index e399de76011b30f9d986db37e458488ffeb8bc44..4c854cfe909ddeb111a318cd24cf5de4a4337bc9 100644 (file)
@@ -8,8 +8,8 @@ set (anOcctLibs
   # exchange
   TKPrim TKBO TKBool TKFillet TKOffset
   TKXSBase
-  TKIGES
-  TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP
+  TKDEIGES
+  TKDESTEP
   # OCCT Visualization
   TKService TKHLR TKV3d TKOpenGles
 )
index 27247f0cff1eace4723c190fd9309c420542172f..57f44ff568def2c0cbc9683299fd04edf719a122 100644 (file)
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKMesh.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBrep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKMesh.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win32\$(VCFMT)\bin/Geometry.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>..\..\..\..\win32\$(VCFMT)\lib;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKMesh.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBrep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKMesh.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win64\$(VCFMT)\bin/Geometry.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>..\..\..\..\win64\$(VCFMT)\lib;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKMesh.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBrep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKMesh.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win32\$(VCFMT)\bind/Geometry.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>..\..\..\..\win32\$(VCFMT)\libd;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKMesh.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBrep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKMesh.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../..\win64\$(VCFMT)\bind/Geometry.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>..\..\..\..\win64\$(VCFMT)\libd;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
index 29b562d013549345e966f40433177c5615e58be8..2cc6bb78bf82983ac46d59bcfb746f276d3c2572 100644 (file)
@@ -61,4 +61,4 @@ include_directories (${CMAKE_BINARY_DIR}/inc
                      ${Modeling_SRC_DIR}
                      ${MFC_STANDARD_SAMPLES_DIR}/Common)
 
-target_link_libraries (Modeling mfcsample TKSTEP209 TKSTEPAttr TKSTEPBase TKBO)
+target_link_libraries (Modeling mfcsample TKDESTEP TKBO)
index 869bea9491e5089e32534158ae03e61e80cf306b..d55e3408007c9d39b298fc75a6d73f0264ce25b1 100644 (file)
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBRep.lib;TKIGES.lib;TKShHealing.lib;TKSTEP.lib;TKSTEP209.lib;TKSTEPAttr.lib;TKSTEPBase.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKBO.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBRep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKBO.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win32\$(VCFMT)\bind/Modeling.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>..\..\..\..\win32\$(VCFMT)\libd;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBRep.lib;TKIGES.lib;TKShHealing.lib;TKSTEP.lib;TKSTEP209.lib;TKSTEPAttr.lib;TKSTEPBase.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKBO.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBRep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKBO.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win64\$(VCFMT)\bind/Modeling.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>..\..\..\..\win64\$(VCFMT)\libd;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBRep.lib;TKIGES.lib;TKShHealing.lib;TKSTEP.lib;TKSTEP209.lib;TKSTEPAttr.lib;TKSTEPBase.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKBO.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBRep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKBO.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win32\$(VCFMT)\bin/Modeling.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>..\..\..\..\win32\$(VCFMT)\lib;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBRep.lib;TKIGES.lib;TKShHealing.lib;TKSTEP.lib;TKSTEP209.lib;TKSTEPAttr.lib;TKSTEPBase.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKBO.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBRep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;mfcsample.lib;TKBO.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win64\$(VCFMT)\bin/Modeling.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>..\..\..\..\win64\$(VCFMT)\lib;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
index 44d11fe0a9a7e7308235e8dd81d22281d20f24f2..66f3d764af5a763c61d0332044f7f369b39326a6 100644 (file)
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBrep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win32\$(VCFMT)\bin/ImportExport.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>..\..\..\..\win32\$(VCFMT)\lib;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBrep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win64\$(VCFMT)\bin/ImportExport.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>..\..\..\..\win64\$(VCFMT)\lib;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBrep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win32\$(VCFMT)\bind/ImportExport.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>..\..\..\..\win32\$(VCFMT)\libd;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBrep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;mfcsample.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win64\$(VCFMT)\bind/ImportExport.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>..\..\..\..\win64\$(VCFMT)\libd;$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
index 55c6e49159d4514a8d9e53646e7ba396a53795d9..c49edb678806b60298e602d1eaa466d0bf6c1a3a 100644 (file)
@@ -158,15 +158,12 @@ include_directories( ${CMAKE_BINARY_DIR}/inc
                      ${COMMON_RESOURCE2D_DIR})
 
 # OCCT libraries for using
-set (mfcsample_USED_LIBS  TKVRML
-                          TKSTL
+set (mfcsample_USED_LIBS  TKDEVRML
+                          TKDESTL
                           TKBRep
-                          TKIGES
+                          TKDEIGES
                           TKShHealing
-                          TKSTEP
-                          TKSTEPBase
-                          TKSTEP209
-                          TKSTEPAttr
+                          TKDESTEP
                           TKXSBase
                           TKBool
                           TKBO
index 4394b3b834ec26cb48e78e0090d0a488eca28536..9b75aed3fd699ecb98e45003b466c1a535d5a4f0 100644 (file)
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBrep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win32\$(VCFMT)\bind/mfcsample.dll</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBrep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win64\$(VCFMT)\bind/mfcsample.dll</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBrep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win32\$(VCFMT)\bin/mfcsample.dll</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ResourceOutputFileName>$(IntDir)%(Filename).res</ResourceOutputFileName>
     </ResourceCompile>
     <Link>
-      <AdditionalDependencies>TKVCAF.lib;TKVrml.lib;TKStl.lib;TKBrep.lib;TKIGES.lib;TKShHealing.lib;TKStep.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>TKVCAF.lib;TKDEVRML.lib;TKDESTL.lib;TKBrep.lib;TKDEIGES.lib;TKShHealing.lib;TKDESTEP.lib;TKXSBase.lib;TKBool.lib;TKCAF.lib;TKCDF.lib;TKernel.lib;TKFeat.lib;TKFillet.lib;TKG2d.lib;TKG3d.lib;TKGeomAlgo.lib;TKGeomBase.lib;TKHLR.lib;TKMath.lib;TKOffset.lib;TKPrim.lib;TKService.lib;TKTopAlgo.lib;TKMesh.lib;TKV3d.lib;TKOpenGl.lib;TKLCAF.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../../win64\$(VCFMT)\bin/mfcsample.dll</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <AdditionalLibraryDirectories>$(CSF_OCCTLibPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
index 71631a4b6feebffd74885113f7959e9151ed1d62..77612e08d98ead1d59480d62cafa0e3f9dad3172 100644 (file)
@@ -8,7 +8,7 @@ TKG3d
 TKGeomAlgo
 TKGeomBase
 TKHLR
-TKIGES
+TKDEIGES
 TKernel
 TKMath
 TKMesh
@@ -17,13 +17,10 @@ TKOpenGl
 TKPrim
 TKShHealing
 TKService
-TKSTEP
-TKSTEP209
-TKSTEPAttr
-TKSTEPBase
-TKSTL
+TKDESTEP
+TKDESTL
 TKTopAlgo
 TKV3d
-TKVRML
+TKDEVRML
 TKXSBase
 
index 12f51c70695166b8ed16b064f2165ccdb85c9656..1a0396d112affe31380097db53dba778b12b8977 100755 (executable)
@@ -72,8 +72,8 @@ win32 {
 }
 
 LIBS += -lTKernel -lTKMath -lTKService -lTKV3d -lTKOpenGl \
-        -lTKBRep -lTKIGES -lTKSTL -lTKVRML -lTKSTEP -lTKSTEPAttr -lTKSTEP209 \
-        -lTKSTEPBase -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d \
+        -lTKBRep -lTKDEIGES -lTKDESTL -lTKDEVRML -lTKDESTEP \
+        -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d \
         -lTKXSBase -lTKShHealing -lTKHLR -lTKTopAlgo -lTKMesh -lTKPrim \
         -lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset -lTKLCAF \
 
index 81f55c1328a96bf5c890dfd2148861eb0a5d86c9..8c5944480ae8d1599ae350ae9db45b7d699d7345 100644 (file)
@@ -10,7 +10,7 @@ TKGeomAlgo
 TKGeomBase
 TKernel
 TKHLR
-TKIGES
+TKDEIGES
 TKMath
 TKMesh
 TKOffset
@@ -18,14 +18,11 @@ TKOpenGl
 TKPrim
 TKService
 TKShHealing
-TKSTEP
-TKSTEP209
-TKSTEPAttr
-TKSTEPBase
-TKSTL
+TKDESTEP
+TKDESTL
 TKTopAlgo
 TKV3d
-TKVRML
+TKDEVRML
 TKXSBase
 TKLCAF
 TKCAF
index eb420457dad9697c5270923982a0cebc8887aa1c..79bf0ee3eda1b41a98224bb104f5f25813dc0807 100644 (file)
@@ -75,8 +75,8 @@ win32 {
 }
 
 LIBS += -lTKernel -lTKMath -lTKService -lTKV3d -lTKOpenGl \
-        -lTKBRep -lTKIGES -lTKSTL -lTKVRML -lTKSTEP -lTKSTEPAttr -lTKSTEP209 \
-        -lTKSTEPBase -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d \
+        -lTKBRep -lTKDEIGES -lTKDESTL -lTKDEVRML -lTKDESTEP \
+        -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d \
         -lTKXSBase -lTKShHealing -lTKHLR -lTKTopAlgo -lTKMesh -lTKPrim \
         -lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset -lTKLCAF -lTKCAF -lTKVCAF \
                -lTKBin -lTKXml
index 8beff5afee8b19351806dd90ddd816b9e5224863..ec996652e0ebd61ef6063be1e45d3323d9fa441d 100644 (file)
@@ -9,7 +9,7 @@ TKGeomAlgo
 TKGeomBase
 TKernel
 TKHLR
-TKIGES
+TKDEIGES
 TKMath
 TKMesh
 TKOffset
@@ -17,13 +17,10 @@ TKOpenGl
 TKPrim
 TKService
 TKShHealing
-TKSTEP
-TKSTEP209
-TKSTEPAttr
-TKSTEPBase
-TKSTL
+TKDESTEP
+TKDESTL
 TKTopAlgo
 TKV3d
-TKVRML
+TKDEVRML
 TKXSBase
 
index 3772f531002a4d772c9dd45e3708ea838ad17333..336a9b352e6938a26f137cfe65c978e5b85da737 100755 (executable)
@@ -73,8 +73,8 @@ win32 {
 }
 
 LIBS += -lTKernel -lTKMath -lTKService -lTKV3d -lTKOpenGl \
-        -lTKBRep -lTKIGES -lTKSTL -lTKVRML -lTKSTEP -lTKSTEPAttr -lTKSTEP209 \
-        -lTKSTEPBase -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d \
+        -lTKBRep -lTKDEIGES -lTKDESTL -lTKDEVRML -lTKDESTEP \
+        -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d \
         -lTKXSBase -lTKShHealing -lTKHLR -lTKTopAlgo -lTKMesh -lTKPrim \
         -lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset -lTKLCAF \
 
index 4991d154e492d5f8c7b99fcd37f3f42bcf42810f..c40372570d149b607a5c406de1dee80ecfbe7b49 100644 (file)
@@ -59,7 +59,7 @@ else()
   set(OCCT_BIN_DIR)
 endif()
 
-set(OpenCASCADE_LIBS TKRWMesh TKBinXCAF TKBin TKBinL TKOpenGles TKXCAF TKVCAF TKCAF TKV3d TKHLR TKMesh TKService TKShHealing TKPrim TKTopAlgo TKGeomAlgo TKBRep TKGeomBase TKG3d TKG2d TKMath TKLCAF TKCDF TKernel)
+set(OpenCASCADE_LIBS TKRWMesh TKDEGLTF TKDEOBJ TKDEPLY TKBinXCAF TKBin TKBinL TKOpenGles TKXCAF TKVCAF TKCAF TKV3d TKHLR TKMesh TKService TKShHealing TKPrim TKTopAlgo TKGeomAlgo TKBRep TKGeomBase TKG3d TKG2d TKMath TKLCAF TKCDF TKernel)
 
 add_executable(${APP_TARGET} ${SOURCES})
 target_link_libraries(
index 4bc143bea01f38717cfde3ddcd10c4022e641a34..8265aea978b5912c313522e2eeb2cbff6d52e766 100644 (file)
@@ -102,11 +102,11 @@ set (uwp_USED_LIBS        TKernel
                           TKHLR
                           TKOffset
                           TKXMesh
-                          TKIGES
-                          TKSTEP
+                          TKDEIGES
+                          TKDESTEP
                           TKXSBase
-                          TKSTL
-                          TKVRML
+                          TKDESTL
+                          TKDEVRML
                           )
 
 target_link_libraries (uwp ${uwp_USED_LIBS})
diff --git a/src/DE/DE_PluginHolder.hxx b/src/DE/DE_PluginHolder.hxx
new file mode 100644 (file)
index 0000000..57ed9f2
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _DE_PluginHolder_HeaderFile
+#define _DE_PluginHolder_HeaderFile
+
+#include <DE_Wrapper.hxx>
+
+//! Base class to work with DE_Wrapper global registration of components.
+//! Control life-time of current configuration node.
+//! In creating stage load into global configuration.
+//! On destroying stage unload from global configuration.
+//! Operation to load/unload are thread safety.
+template <class TheConfType>
+class DE_PluginHolder
+{
+public:
+  DE_PluginHolder()
+  {
+    Standard_Mutex::Sentry aLock(DE_Wrapper::GlobalLoadMutex());
+    myInternalConfiguration = new TheConfType;
+    DE_Wrapper::GlobalWrapper()->Bind(myInternalConfiguration);
+  }
+
+  ~DE_PluginHolder()
+  {
+    Standard_Mutex::Sentry aLock(DE_Wrapper::GlobalLoadMutex());
+    DE_Wrapper::GlobalWrapper()->UnBind(myInternalConfiguration);
+  }
+
+private:
+  Handle(TheConfType) myInternalConfiguration; //!< Wrapped object
+};
+
+#endif // _DE_PluginHolder_HeaderFile
index bd9c6c7cacecd5613f9f7e24be96fe69b61aa84f..7a9531d490c8934df1877560dd37843cbc687f05 100644 (file)
@@ -35,8 +35,11 @@ namespace
     return aScope;
   }
 
-  //! Global configuration of current DE Session
-  static Handle(DE_Wrapper) THE_GLOBAL_CONFIGURATION;
+  static Handle(DE_Wrapper)& THE_GLOBAL_CONFIGURATION()
+  {
+    static Handle(DE_Wrapper) aConf = new DE_Wrapper();
+    return aConf;
+  }
 }
 
 //=======================================================================
@@ -75,13 +78,9 @@ DE_Wrapper::DE_Wrapper(const Handle(DE_Wrapper)& theWrapper)
 // function : GlobalWrapper
 // purpose  :
 //=======================================================================
-Handle(DE_Wrapper) DE_Wrapper::GlobalWrapper()
+const Handle(DE_Wrapper)& DE_Wrapper::GlobalWrapper()
 {
-  if (THE_GLOBAL_CONFIGURATION.IsNull())
-  {
-    THE_GLOBAL_CONFIGURATION = new DE_Wrapper();
-  }
-  return THE_GLOBAL_CONFIGURATION;
+  return THE_GLOBAL_CONFIGURATION();
 }
 
 //=======================================================================
@@ -92,10 +91,20 @@ void DE_Wrapper::SetGlobalWrapper(const Handle(DE_Wrapper)& theWrapper)
 {
   if (!theWrapper.IsNull())
   {
-    THE_GLOBAL_CONFIGURATION = theWrapper;
+    THE_GLOBAL_CONFIGURATION() = theWrapper;
   }
 }
 
+//=======================================================================
+// function : GlobalLoadMutex
+// purpose  :
+//=======================================================================
+Standard_Mutex& DE_Wrapper::GlobalLoadMutex()
+{
+  static Standard_Mutex THE_GLOBAL_LOAD_MUTEX;
+  return THE_GLOBAL_LOAD_MUTEX;
+}
+
 //=======================================================================
 // function : Read
 // purpose  :
@@ -412,6 +421,28 @@ Standard_Boolean DE_Wrapper::Bind(const Handle(DE_ConfigurationNode)& theNode)
   return aVendorMap->Add(aVendorName, theNode) > 0;
 }
 
+//=======================================================================
+// function : UnBind
+// purpose  :
+//=======================================================================
+Standard_Boolean DE_Wrapper::UnBind(const Handle(DE_ConfigurationNode)& theNode)
+{
+  if (theNode.IsNull())
+  {
+    return false;
+  }
+  const TCollection_AsciiString aFileFormat = theNode->GetFormat();
+  const TCollection_AsciiString aVendorName = theNode->GetVendor();
+  DE_ConfigurationVendorMap* aVendorMap = myConfiguration.ChangeSeek(aFileFormat);
+  if (aVendorMap == NULL)
+  {
+    return false;
+  }
+  const auto aPrevSize = aVendorMap->Size();
+  aVendorMap->RemoveKey(aVendorName);
+  return aVendorMap->Size() != aPrevSize;
+}
+
 //=======================================================================
 // function : Find
 // purpose  :
index 02af4150d8a7d3e0dd7b1b34197904f12acfdb1d..e88a1a79a75ac4df68d7542bcf153bba75234a4a 100644 (file)
 #ifndef _DE_Wrapper_HeaderFile
 #define _DE_Wrapper_HeaderFile
 
-#include <Message_ProgressRange.hxx>
 #include <DE_ConfigurationNode.hxx>
-#include <NCollection_IndexedDataMap.hxx>
+#include <Message_ProgressRange.hxx>
 #include <NCollection_DataMap.hxx>
+#include <NCollection_IndexedDataMap.hxx>
+#include <Standard_Mutex.hxx>
 #include <TColStd_ListOfAsciiString.hxx>
 
 class TopoDS_Shape;
@@ -64,12 +65,14 @@ public:
   //! Gets global configuration singleton.
   //! If wrapper is not set, create it by default as base class object.
   //! @return point to global configuration
-  Standard_EXPORT static Handle(DE_Wrapper) GlobalWrapper();
+  Standard_EXPORT static const Handle(DE_Wrapper)& GlobalWrapper();
 
   //! Sets global configuration singleton
   //! @param[in] theWrapper object to set as global configuration
   Standard_EXPORT static void SetGlobalWrapper(const Handle(DE_Wrapper)& theWrapper);
 
+  Standard_EXPORT static Standard_Mutex& GlobalLoadMutex();
+
 public:
 
   //! Reads a CAD file, according internal configuration
@@ -193,6 +196,11 @@ public:
   //! @return Standard_True if binded
   Standard_EXPORT Standard_Boolean Bind(const Handle(DE_ConfigurationNode)& theNode);
 
+  //! Removes node with the same type from the map
+  //! @param[in] theNode input node to remove the same
+  //! @return Standard_True if removed
+  Standard_EXPORT Standard_Boolean UnBind(const Handle(DE_ConfigurationNode)& theNode);
+
   //! Finds a node associated with input format and vendor
   //! @param[in] theFormat input node CAD format
   //! @param[in] theVendor input node vendor name
index 89267b6533b2572866d9abb1c9c570354d3cbb9c..8c79177e58b1657b053e981ad1f4d9c1ad0435b8 100644 (file)
@@ -2,6 +2,7 @@ DE_ConfigurationContext.cxx
 DE_ConfigurationContext.hxx
 DE_ConfigurationNode.cxx
 DE_ConfigurationNode.hxx
+DE_PluginHolder.hxx
 DE_Provider.cxx
 DE_Provider.hxx
 DE_Wrapper.cxx
index ac23714a9e09224dd518eb5c4f9ee4d7a1431333..69f44dcd82a9fa725fb2f8326eacf4f0b37958ac 100644 (file)
@@ -14,6 +14,7 @@
 #include <DEBRepCascade_ConfigurationNode.hxx>
 
 #include <DE_ConfigurationContext.hxx>
+#include <DE_PluginHolder.hxx>
 #include <DEBRepCascade_Provider.hxx>
 #include <NCollection_Buffer.hxx>
 
@@ -26,6 +27,9 @@ namespace
     static const TCollection_AsciiString aScope = "provider";
     return aScope;
   }
+
+  // Wrapper to auto-load DE component
+  DE_PluginHolder<DEBRepCascade_ConfigurationNode> THE_OCCT_BREP_COMPONENT_PLUGIN;
 }
 
 //=======================================================================
index ce56b1151ac2c5ea5eb7328f93a9ac9d6a7a3540..d0e5e2669d3555529c552f2a03370deed1aa5cc4 100644 (file)
@@ -14,6 +14,7 @@
 #include <DEXCAFCascade_ConfigurationNode.hxx>
 
 #include <DE_ConfigurationContext.hxx>
+#include <DE_PluginHolder.hxx>
 #include <DEXCAFCascade_Provider.hxx>
 #include <NCollection_Buffer.hxx>
 
@@ -26,6 +27,9 @@ namespace
     static const TCollection_AsciiString aScope = "provider";
     return aScope;
   }
+
+  // Wrapper to auto-load DE component
+  DE_PluginHolder<DEXCAFCascade_ConfigurationNode> THE_OCCT_XCAF_COMPONENT_PLUGIN;
 }
 
 //=======================================================================
index 12c5dec9435ed13bbed4610369e4d8a8ce8ffa0e..9f3db744c256b8fd39d1aaa831b0d557a351af65 100644 (file)
   #endif
   #include <TObjDRAW.hxx>
   #include <ViewerTest.hxx>
-  #include <XSDRAWSTLVRML.hxx>
+  #include <XSDRAW.hxx>
   #include <XDEDRAW.hxx>
+  #include <XSDRAWSTEP.hxx>
+  #include <XSDRAWIGES.hxx>
+  #include <XSDRAWGLTF.hxx>
+  #include <XSDRAWOBJ.hxx>
+  #include <XSDRAWPLY.hxx>
+  #include <XSDRAWVRML.hxx>
+  #include <XSDRAWSTL.hxx>
 #endif
 
 Standard_IMPORT Standard_Boolean Draw_Interprete (const char* theCommand);
@@ -200,6 +207,13 @@ static Standard_Integer Pload (Draw_Interpretor& theDI,
     else if (anArg == "DATAEXCHANGE")
     {
       aPlugins.Add ("XSDRAW");
+      aPlugins.Add ("XSDRAWSTEP");
+      aPlugins.Add ("XSDRAWIGES");
+      aPlugins.Add ("XSDRAWGLTF");
+      aPlugins.Add ("XSDRAWOBJ");
+      aPlugins.Add ("XSDRAWPLY");
+      aPlugins.Add ("XSDRAWVRML");
+      aPlugins.Add ("XSDRAWSTL");
       aPlugins.Add ("XDEDRAW");
       aPlugins.Add ("AISV");
     }
@@ -215,6 +229,13 @@ static Standard_Integer Pload (Draw_Interpretor& theDI,
       aPlugins.Add ("XSDRAW");
       aPlugins.Add ("XDEDRAW");
       aPlugins.Add ("AISV");
+      aPlugins.Add ("XSDRAWSTEP");
+      aPlugins.Add ("XSDRAWIGES");
+      aPlugins.Add ("XSDRAWGLTF");
+      aPlugins.Add ("XSDRAWOBJ");
+      aPlugins.Add ("XSDRAWPLY");
+      aPlugins.Add ("XSDRAWVRML");
+      aPlugins.Add ("XSDRAWSTL");
     }
     else
     {
@@ -254,14 +275,40 @@ static Standard_Integer Pload (Draw_Interpretor& theDI,
   #endif
     else if (aPlugin == "XSDRAW")
     {
-      XSDRAWSTLVRML::Factory (theDI);
+      XSDRAW::Factory (theDI);
     }
     else if (aPlugin == "XDEDRAW")
     {
       XDEDRAW::Factory (theDI);
     }
-    //else if (aPlugin == "TOBJ")       { TObjDRAW::Factory (theDI); }
-    //else if (aPlugin == "QACOMMANDS") { QADraw::Factory (theDI); }
+    else if (aPlugin == "STEP")
+    {
+      XSDRAWSTEP::Factory (theDI);
+    }
+    else if (aPlugin == "IGES")
+    {
+      XSDRAWIGES::Factory (theDI);
+    }
+    else if (aPlugin == "PLY")
+    {
+      XSDRAWPLY::Factory (theDI);
+    }
+    else if (aPlugin == "GLTF")
+    {
+      XSDRAWGLTF::Factory (theDI);
+    }
+    else if (aPlugin == "VRML")
+    {
+      XSDRAWVRML::Factory (theDI);
+    }
+    else if (aPlugin == "STL")
+    {
+      XSDRAWSTL::Factory (theDI);
+    }
+    else if (aPlugin == "OBJ")
+    {
+      XSDRAWOBJ::Factory (theDI);
+    }
     else
     {
       theDI << "Error: unknown plugin '" << aPlugin << "'";
index ca4c8fa4ee854c9fd3eba6073144e94fc495f672..19aaa0a63891938a881e37a6cf9d5661e1191bef 100644 (file)
@@ -2,27 +2,32 @@ TKTopTest
 TKDCAF
 TKXSDRAW
 TKXDEDRAW
+TKXSDRAWSTEP
+TKXSDRAWIGES
+TKXSDRAWGLTF
+TKXSDRAWOBJ
+TKXSDRAWPLY
+TKXSDRAWVRML
+TKXSDRAWSTL
 TKOpenGlTest
 TKOpenGlesTest
 TKViewerTest
 TKDraw
 TKMeshVS
-TKXDECascade
 TKTObj
 TKBinTObj
 TKXmlTObj
-TKXDESTEP
-TKSTEP
-TKSTEPAttr
-TKSTEP209
-TKSTEPBase
-TKXDEIGES
-TKIGES
 TKXSBase
-TKVRML
-TKSTL
 TKRWMesh
-TKXDE
+TKDE
+TKDESTEP
+TKDEIGES
+TKDEGLTF
+TKDEOBJ
+TKDEPLY
+TKDEVRML
+TKDESTL
+TKDECascade
 TKBinXCAF
 TKXmlXCAF
 TKBin
index b9938be7af8e54d9295313f46e601351c8a8036a..fa7acf1a04af2fd2acf2162a1b96dcfe2a7dad34 100755 (executable)
@@ -33,10 +33,10 @@ DEFAULT            : MODELING
 MODELING           : TOPTEST
 VISUALIZATION      : AISV
 OCAFKERNEL         : DCAF
-DATAEXCHANGEKERNEL : XSDRAW
+DATAEXCHANGEKERNEL : XSDRAW, DE
 OCAF               : VISUALIZATION, OCAFKERNEL
 DATAEXCHANGE       : XDE, VISUALIZATION
-XDE                : DATAEXCHANGEKERNEL, XDEDRAW
+XDE                : DATAEXCHANGEKERNEL, XDEDRAW, STEP, IGES, GLTF, OBJ, PLY, STL, VRML
 ALL                : MODELING, OCAFKERNEL, DATAEXCHANGE
 
 TOPTEST            : TKTopTest
@@ -54,3 +54,11 @@ DFBROWSER          : TKDFBrowser
 QAcommands         : TKQADraw
 VIS                : TKIVtkDraw
 INSPECTOR          : TKToolsDraw
+DE                 : TKXSDRAWDE
+STEP               : TKXSDRAWSTEP
+IGES               : TKXSDRAWIGES
+GLTF               : TKXSDRAWGLTF
+OBJ                : TKXSDRAWOBJ
+PLY                : TKXSDRAWPLY
+STL                : TKXSDRAWSTL
+VRML               : TKXSDRAWVRML
index 68f5312c4323a7bc9b12ec1d1ba2367a2f3446b6..dff11a3de1496a346159c049e2503629c0370b2e 100644 (file)
@@ -14,6 +14,7 @@
 #include <IGESCAFControl_ConfigurationNode.hxx>
 
 #include <DE_ConfigurationContext.hxx>
+#include <DE_PluginHolder.hxx>
 #include <IGESCAFControl_Provider.hxx>
 #include <NCollection_Buffer.hxx>
 
@@ -26,6 +27,9 @@ namespace
     static const TCollection_AsciiString aScope = "provider";
     return aScope;
   }
+
+  // Wrapper to auto-load DE component
+  DE_PluginHolder<IGESCAFControl_ConfigurationNode> THE_OCCT_IGES_COMPONENT_PLUGIN;
 }
 
 //=======================================================================
index 3f3b5badc71e90910d2ee4bd84fdd2bb1c068982..e11aa5496a5a8c070719a52a7bae5af032a59a3d 100644 (file)
 ;# Liste des toolkits WOK sous forme de full path
 ;# 
 proc DataExchange:toolkits { } {
-  return [list TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES \
-               TKXCAF TKXDEIGES TKXDESTEP \
-               TKXDE TKXDECascade \
-               TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh]
+  return [list TKXSBase TKXCAF TKDEIGES TKDESTEP \
+               TKDE TKDECascade TKDESTL TKDEVRML \
+               TKXmlXCAF TKBinXCAF TKRWMesh \
+               TKDEGLTF TKDEOBJ TKDEPLY]
 }
 
 ;#
index 28ce153cbcdb3e67ba75c393263cee56a51dc3bb..afdd542b775de41a4418b4da014e0cb66e7d9940 100644 (file)
@@ -14,6 +14,7 @@
 #include <RWGltf_ConfigurationNode.hxx>
 
 #include <DE_ConfigurationContext.hxx>
+#include <DE_PluginHolder.hxx>
 #include <RWGltf_Provider.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(RWGltf_ConfigurationNode, DE_ConfigurationNode)
@@ -25,6 +26,9 @@ namespace
     static const TCollection_AsciiString aScope = "provider";
     return aScope;
   }
+
+  // Wrapper to auto-load DE component
+  DE_PluginHolder<RWGltf_ConfigurationNode> THE_OCCT_GLTF_COMPONENT_PLUGIN;
 }
 
 //=======================================================================
index 94b6b1d4d823798978b90e42ddf75c96bffc9946..0dd7d8f7e6e2616d95f261297e02742bfa2cef9d 100644 (file)
@@ -14,6 +14,7 @@
 #include <RWObj_ConfigurationNode.hxx>
 
 #include <DE_ConfigurationContext.hxx>
+#include <DE_PluginHolder.hxx>
 #include <RWObj_Provider.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(RWObj_ConfigurationNode, DE_ConfigurationNode)
@@ -25,6 +26,9 @@ namespace
     static const TCollection_AsciiString aScope = "provider";
     return aScope;
   }
+
+  // Wrapper to auto-load DE component
+  DE_PluginHolder<RWObj_ConfigurationNode> THE_OCCT_OBJ_COMPONENT_PLUGIN;
 }
 
 //=======================================================================
index fb978975f6215b5fce7e79e834bb5f9be485ec1b..d9983072a447f825b181324dfd6cc9acae1d5dd4 100644 (file)
 #include <RWPly_ConfigurationNode.hxx>
 
 #include <DE_ConfigurationContext.hxx>
+#include <DE_PluginHolder.hxx>
 #include <NCollection_Buffer.hxx>
 #include <RWPly_Provider.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(RWPly_ConfigurationNode, DE_ConfigurationNode)
 
-static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "provider";
+namespace
+{
+  static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
+  {
+    static const TCollection_AsciiString aScope = "provider";
+    return aScope;
+  }
+
+  // Wrapper to auto-load DE component
+  DE_PluginHolder<RWPly_ConfigurationNode> THE_OCCT_PLY_COMPONENT_PLUGIN;
+}
 
 //=======================================================================
 // function : RWPly_ConfigurationNode
@@ -45,7 +56,7 @@ RWPly_ConfigurationNode::RWPly_ConfigurationNode(const Handle(RWPly_Configuratio
 //=======================================================================
 bool RWPly_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
 {
-  TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor();
+  TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
   InternalParameters.FileLengthUnit = 
     theResource->RealVal("file.length.unit", InternalParameters.FileLengthUnit, aScope);
   InternalParameters.SystemCS = 
@@ -79,7 +90,7 @@ TCollection_AsciiString RWPly_ConfigurationNode::Save() const
   TCollection_AsciiString aResult;
   aResult += "!*****************************************************************************\n";
   aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
-  TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor() + ".";
+  TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".";
 
   aResult += "!\n";
   aResult += "!Common parameters:\n";
index 990f24c73734533f5fd2c9b5618abe7dadfd714a..09f4173d5e96aa5056d7fe72455a125909ac233f 100644 (file)
@@ -14,6 +14,7 @@
 #include <RWStl_ConfigurationNode.hxx>
 
 #include <DE_ConfigurationContext.hxx>
+#include <DE_PluginHolder.hxx>
 #include <NCollection_Buffer.hxx>
 #include <RWStl_Provider.hxx>
 
@@ -26,6 +27,9 @@ namespace
     static const TCollection_AsciiString aScope = "provider";
     return aScope;
   }
+
+  // Wrapper to auto-load DE component
+  DE_PluginHolder<RWStl_ConfigurationNode> THE_OCCT_STL_COMPONENT_PLUGIN;
 }
 
 //=======================================================================
index 588c18deba9ce63143d5b29968a32cfc762d8aed..000077cb1e32e2b6ad708bb0ccab71326e170a92 100644 (file)
@@ -14,6 +14,7 @@
 #include <STEPCAFControl_ConfigurationNode.hxx>
 
 #include <DE_ConfigurationContext.hxx>
+#include <DE_PluginHolder.hxx>
 #include <NCollection_Buffer.hxx>
 #include <STEPCAFControl_Provider.hxx>
 
@@ -26,6 +27,9 @@ namespace
     static const TCollection_AsciiString aScope = "provider";
     return aScope;
   }
+
+  // Wrapper to auto-load DE component
+  DE_PluginHolder<STEPCAFControl_ConfigurationNode> THE_OCCT_STEP_COMPONENT_PLUGIN;
 }
 
 //=======================================================================
diff --git a/src/TKDE/CMakeLists.txt b/src/TKDE/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d558e9f
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKDE)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKDE/EXTERNLIB b/src/TKDE/EXTERNLIB
new file mode 100644 (file)
index 0000000..58c24f0
--- /dev/null
@@ -0,0 +1 @@
+TKernel
diff --git a/src/TKDE/FILES b/src/TKDE/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKDE/PACKAGES b/src/TKDE/PACKAGES
new file mode 100644 (file)
index 0000000..e5d15dd
--- /dev/null
@@ -0,0 +1 @@
+DE
diff --git a/src/TKDECascade/CMakeLists.txt b/src/TKDECascade/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2398b1b
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKDECascade)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKDECascade/EXTERNLIB b/src/TKDECascade/EXTERNLIB
new file mode 100644 (file)
index 0000000..6abe782
--- /dev/null
@@ -0,0 +1,17 @@
+TKBin
+TKBinL
+TKBinTObj
+TKBinXCAF
+TKBRep
+TKStd
+TKXml
+TKXmlL
+TKXmlTObj
+TKXmlXCAF
+TKDE
+TKernel
+TKMath
+TKLCAF
+TKXCAF
+TKStdL
+TKCDF
diff --git a/src/TKDECascade/FILES b/src/TKDECascade/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKDECascade/PACKAGES b/src/TKDECascade/PACKAGES
new file mode 100644 (file)
index 0000000..128e6b2
--- /dev/null
@@ -0,0 +1,2 @@
+DEBRepCascade
+DEXCAFCascade
diff --git a/src/TKDEGLTF/CMakeLists.txt b/src/TKDEGLTF/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8b9c446
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKDEGLTF)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKDEGLTF/EXTERNLIB b/src/TKDEGLTF/EXTERNLIB
new file mode 100644 (file)
index 0000000..0f9a0d8
--- /dev/null
@@ -0,0 +1,13 @@
+TKernel
+TKMath
+TKMesh
+TKXCAF
+TKLCAF
+TKV3d
+TKBRep
+TKG3d
+TKDE
+TKService
+TKRWMesh
+CSF_RapidJSON
+CSF_Draco
diff --git a/src/TKDEGLTF/FILES b/src/TKDEGLTF/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKDEGLTF/PACKAGES b/src/TKDEGLTF/PACKAGES
new file mode 100644 (file)
index 0000000..7758e9e
--- /dev/null
@@ -0,0 +1 @@
+RWGltf
diff --git a/src/TKDEIGES/CMakeLists.txt b/src/TKDEIGES/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a7e09e5
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKDEIGES)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKDEIGES/EXTERNLIB b/src/TKDEIGES/EXTERNLIB
new file mode 100644 (file)
index 0000000..1a7b0cc
--- /dev/null
@@ -0,0 +1,16 @@
+TKBRep
+TKDE
+TKernel
+TKMath
+TKTopAlgo
+TKShHealing
+TKXSBase
+TKGeomBase
+TKGeomAlgo
+TKBool
+TKPrim
+TKCDF
+TKLCAF
+TKG2d
+TKG3d
+TKXCAF
diff --git a/src/TKDEIGES/FILES b/src/TKDEIGES/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKDEIGES/PACKAGES b/src/TKDEIGES/PACKAGES
new file mode 100644 (file)
index 0000000..d697b0b
--- /dev/null
@@ -0,0 +1,19 @@
+IGESCAFControl
+IGESData
+IGESFile
+IGESBasic
+IGESGraph
+IGESGeom
+IGESDimen
+IGESDraw
+IGESSolid
+IGESDefs
+IGESAppli
+IGESConvGeom
+IGESSelect
+IGESToBRep
+GeomToIGES
+Geom2dToIGES
+BRepToIGES
+BRepToIGESBRep
+IGESControl
diff --git a/src/TKDEOBJ/CMakeLists.txt b/src/TKDEOBJ/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d4cf39f
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKDEOBJ)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKDEOBJ/EXTERNLIB b/src/TKDEOBJ/EXTERNLIB
new file mode 100644 (file)
index 0000000..4145bc8
--- /dev/null
@@ -0,0 +1,12 @@
+TKernel
+TKMath
+TKMesh
+TKXCAF
+TKLCAF
+TKV3d
+TKBRep
+TKG3d
+TKDE
+TKService
+TKRWMesh
+CSF_RapidJSON
diff --git a/src/TKDEOBJ/FILES b/src/TKDEOBJ/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKDEOBJ/PACKAGES b/src/TKDEOBJ/PACKAGES
new file mode 100644 (file)
index 0000000..d7824f2
--- /dev/null
@@ -0,0 +1 @@
+RWObj
diff --git a/src/TKDEPLY/CMakeLists.txt b/src/TKDEPLY/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6065cfa
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKDEPLY)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKDEPLY/EXTERNLIB b/src/TKDEPLY/EXTERNLIB
new file mode 100644 (file)
index 0000000..4145bc8
--- /dev/null
@@ -0,0 +1,12 @@
+TKernel
+TKMath
+TKMesh
+TKXCAF
+TKLCAF
+TKV3d
+TKBRep
+TKG3d
+TKDE
+TKService
+TKRWMesh
+CSF_RapidJSON
diff --git a/src/TKDEPLY/FILES b/src/TKDEPLY/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKDEPLY/PACKAGES b/src/TKDEPLY/PACKAGES
new file mode 100644 (file)
index 0000000..228128a
--- /dev/null
@@ -0,0 +1 @@
+RWPly
diff --git a/src/TKDESTEP/CMakeLists.txt b/src/TKDESTEP/CMakeLists.txt
new file mode 100644 (file)
index 0000000..fe235a7
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKDESTEP)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKDESTEP/EXTERNLIB b/src/TKDESTEP/EXTERNLIB
new file mode 100644 (file)
index 0000000..9b86ab5
--- /dev/null
@@ -0,0 +1,23 @@
+TKDE
+TKBRep
+TKernel
+TKMath
+TKXSBase
+TKTopAlgo
+TKG2d
+TKCAF
+TKCDF
+TKLCAF
+TKG3d
+TKXCAF
+TKShHealing
+TKernel
+TKBRep
+TKMath
+TKG2d
+TKShHealing
+TKTopAlgo
+TKG3d
+TKGeomBase
+TKGeomAlgo
+TKXSBase
diff --git a/src/TKDESTEP/FILES b/src/TKDESTEP/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKDESTEP/PACKAGES b/src/TKDESTEP/PACKAGES
new file mode 100644 (file)
index 0000000..58b4ee8
--- /dev/null
@@ -0,0 +1,40 @@
+STEPCAFControl
+StepAP214
+RWStepAP214
+StepAP203
+RWStepAP203
+STEPConstruct
+STEPEdit
+GeomToStep
+StepToGeom
+StepToTopoDS
+TopoDSToStep
+STEPControl
+STEPSelections
+StepAP209
+RWStepAP242
+StepAP242
+StepElement
+StepFEA
+RWStepElement
+RWStepFEA
+StepVisual
+RWStepVisual
+StepDimTol
+RWStepDimTol
+StepKinematics
+RWStepKinematics
+StepBasic
+RWStepBasic
+StepRepr
+RWStepRepr
+StepGeom
+RWStepGeom
+StepShape
+RWStepShape
+StepSelect
+StepData
+StepFile
+RWHeaderSection
+APIHeaderSection
+HeaderSection
\ No newline at end of file
diff --git a/src/TKDESTL/CMakeLists.txt b/src/TKDESTL/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e4a6c15
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKDESTL)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKDESTL/EXTERNLIB b/src/TKDESTL/EXTERNLIB
new file mode 100644 (file)
index 0000000..74fdab3
--- /dev/null
@@ -0,0 +1,9 @@
+TKDE
+TKernel
+TKMath
+TKBRep
+TKG2d
+TKG3d
+TKTopAlgo
+TKLCAF
+TKXCAF
diff --git a/src/TKDESTL/FILES b/src/TKDESTL/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKDESTL/PACKAGES b/src/TKDESTL/PACKAGES
new file mode 100644 (file)
index 0000000..ba06cc7
--- /dev/null
@@ -0,0 +1,2 @@
+StlAPI
+RWStl
diff --git a/src/TKDEVRML/CMakeLists.txt b/src/TKDEVRML/CMakeLists.txt
new file mode 100644 (file)
index 0000000..82e33cb
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKDEVRML)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKDEVRML/EXTERNLIB b/src/TKDEVRML/EXTERNLIB
new file mode 100644 (file)
index 0000000..22fb272
--- /dev/null
@@ -0,0 +1,18 @@
+TKBRep
+TKDE
+TKTopAlgo
+TKMath
+TKGeomBase
+TKernel
+TKPrim
+TKG2d
+TKG3d
+TKMesh
+TKHLR
+TKRWMesh
+TKService
+TKGeomAlgo
+TKV3d
+TKLCAF
+TKXCAF
+TKXSBase
diff --git a/src/TKDEVRML/FILES b/src/TKDEVRML/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKDEVRML/PACKAGES b/src/TKDEVRML/PACKAGES
new file mode 100644 (file)
index 0000000..05ba201
--- /dev/null
@@ -0,0 +1,4 @@
+VrmlConverter
+VrmlAPI
+Vrml
+VrmlData
diff --git a/src/TKIGES/CMakeLists.txt b/src/TKIGES/CMakeLists.txt
deleted file mode 100644 (file)
index 383e62f..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TKIGES)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKIGES/EXTERNLIB b/src/TKIGES/EXTERNLIB
deleted file mode 100755 (executable)
index 56ddcca..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-TKBRep
-TKernel
-TKMath
-TKTopAlgo
-TKShHealing
-TKG2d
-TKG3d
-TKGeomBase
-TKGeomAlgo
-TKPrim
-TKBool
-TKXSBase
diff --git a/src/TKIGES/FILES b/src/TKIGES/FILES
deleted file mode 100755 (executable)
index ca4f0e5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTERNLIB
-PACKAGES
diff --git a/src/TKIGES/PACKAGES b/src/TKIGES/PACKAGES
deleted file mode 100755 (executable)
index b121c19..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-IGESData
-IGESFile
-IGESBasic
-IGESGraph
-IGESGeom
-IGESDimen
-IGESDraw
-IGESSolid
-IGESDefs
-IGESAppli
-IGESConvGeom
-IGESSelect
-IGESToBRep
-GeomToIGES
-Geom2dToIGES
-BRepToIGES
-BRepToIGESBRep
-IGESControl
index 32d736b68b067f5c05293b0ed9ce0bd217739850..0ee59238cb18e15b7136262a7690d6f46db57e2a 100755 (executable)
@@ -23,16 +23,14 @@ TKOffset
 TKFeat
 TKCAF
 TKVCAF
-TKIGES
+TKDEIGES
 TKXSBase
 TKMesh
 TKXCAF
 TKBinXCAF
-TKSTEP
-TKSTEPBase
-TKXDESTEP
+TKDESTEP
 TKXSDRAW
-TKSTL
+TKDESTL
 TKXml
 TKTObj
 TKXmlL
index 80c75df27fa8dcdf5822b6c9678bcbda373f1446..25c3c638004f4176f3c5994e8efd92ef1fbd23e1 100644 (file)
@@ -6,7 +6,7 @@ TKLCAF
 TKV3d
 TKBRep
 TKG3d
-TKXDE
+TKDE
 TKService
 CSF_RapidJSON
 CSF_Draco
index 3b7d93462327e592e20211e15468d555dd29598d..9330e3e37bf9954111581a1664ca24908ef9daf2 100644 (file)
@@ -1,4 +1 @@
-RWGltf
 RWMesh
-RWObj
-RWPly
diff --git a/src/TKSTEP/CMakeLists.txt b/src/TKSTEP/CMakeLists.txt
deleted file mode 100644 (file)
index 2885f9b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TKSTEP)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKSTEP/EXTERNLIB b/src/TKSTEP/EXTERNLIB
deleted file mode 100755 (executable)
index 9423bb5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-TKernel
-TKSTEPAttr
-TKSTEP209
-TKSTEPBase
-TKBRep
-TKMath
-TKG2d
-TKShHealing
-TKTopAlgo
-TKG3d
-TKGeomBase
-TKGeomAlgo
-TKXSBase
diff --git a/src/TKSTEP/FILES b/src/TKSTEP/FILES
deleted file mode 100755 (executable)
index ca4f0e5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTERNLIB
-PACKAGES
diff --git a/src/TKSTEP/PACKAGES b/src/TKSTEP/PACKAGES
deleted file mode 100755 (executable)
index 7087915..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-StepAP214
-RWStepAP214
-StepAP203
-RWStepAP203
-STEPConstruct
-STEPEdit
-GeomToStep
-StepToGeom
-StepToTopoDS
-TopoDSToStep
-STEPControl
-STEPSelections
-StepAP209
-RWStepAP242
-StepAP242
diff --git a/src/TKSTEP209/CMakeLists.txt b/src/TKSTEP209/CMakeLists.txt
deleted file mode 100644 (file)
index 78e09c5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TKSTEP209)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKSTEP209/EXTERNLIB b/src/TKSTEP209/EXTERNLIB
deleted file mode 100644 (file)
index 28cfbb0..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TKernel
-TKXSBase
-TKSTEPBase
diff --git a/src/TKSTEP209/FILES b/src/TKSTEP209/FILES
deleted file mode 100755 (executable)
index ca4f0e5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTERNLIB
-PACKAGES
diff --git a/src/TKSTEP209/PACKAGES b/src/TKSTEP209/PACKAGES
deleted file mode 100755 (executable)
index 0b68453..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-StepElement
-StepFEA
-RWStepElement
-RWStepFEA
diff --git a/src/TKSTEPAttr/CMakeLists.txt b/src/TKSTEPAttr/CMakeLists.txt
deleted file mode 100644 (file)
index 59e2527..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TKSTEPAttr)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKSTEPAttr/EXTERNLIB b/src/TKSTEPAttr/EXTERNLIB
deleted file mode 100644 (file)
index 28cfbb0..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TKernel
-TKXSBase
-TKSTEPBase
diff --git a/src/TKSTEPAttr/FILES b/src/TKSTEPAttr/FILES
deleted file mode 100755 (executable)
index ca4f0e5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTERNLIB
-PACKAGES
diff --git a/src/TKSTEPAttr/PACKAGES b/src/TKSTEPAttr/PACKAGES
deleted file mode 100755 (executable)
index b6bf50c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-StepVisual
-RWStepVisual
-StepDimTol
-RWStepDimTol
-StepKinematics
-RWStepKinematics
diff --git a/src/TKSTEPBase/CMakeLists.txt b/src/TKSTEPBase/CMakeLists.txt
deleted file mode 100644 (file)
index fda0c46..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TKSTEPBase)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKSTEPBase/EXTERNLIB b/src/TKSTEPBase/EXTERNLIB
deleted file mode 100644 (file)
index fb75d58..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TKernel
-TKXSBase
-TKMath
diff --git a/src/TKSTEPBase/FILES b/src/TKSTEPBase/FILES
deleted file mode 100755 (executable)
index ca4f0e5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTERNLIB
-PACKAGES
diff --git a/src/TKSTEPBase/PACKAGES b/src/TKSTEPBase/PACKAGES
deleted file mode 100755 (executable)
index 87033cf..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-StepBasic
-RWStepBasic
-StepRepr
-RWStepRepr
-StepGeom
-RWStepGeom
-StepShape
-RWStepShape
diff --git a/src/TKSTL/CMakeLists.txt b/src/TKSTL/CMakeLists.txt
deleted file mode 100644 (file)
index 2fe1c17..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TKSTL)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKSTL/EXTERNLIB b/src/TKSTL/EXTERNLIB
deleted file mode 100755 (executable)
index 8a5b1c2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-TKXDE
-TKernel
-TKMath
-TKBRep
-TKG2d
-TKG3d
-TKTopAlgo
-TKLCAF
-TKXCAF
diff --git a/src/TKSTL/FILES b/src/TKSTL/FILES
deleted file mode 100755 (executable)
index ca4f0e5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTERNLIB
-PACKAGES
diff --git a/src/TKSTL/PACKAGES b/src/TKSTL/PACKAGES
deleted file mode 100755 (executable)
index ba06cc7..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-StlAPI
-RWStl
diff --git a/src/TKVRML/CMakeLists.txt b/src/TKVRML/CMakeLists.txt
deleted file mode 100644 (file)
index 959447f..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TKVRML)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKVRML/EXTERNLIB b/src/TKVRML/EXTERNLIB
deleted file mode 100755 (executable)
index a996dc4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-TKBRep
-TKXDE
-TKTopAlgo
-TKMath
-TKGeomBase
-TKernel
-TKPrim
-TKG2d
-TKG3d
-TKMesh
-TKHLR
-TKRWMesh
-TKService
-TKGeomAlgo
-TKV3d
-TKLCAF
-TKXCAF
-TKXSBase
diff --git a/src/TKVRML/FILES b/src/TKVRML/FILES
deleted file mode 100755 (executable)
index ca4f0e5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTERNLIB
-PACKAGES
diff --git a/src/TKVRML/PACKAGES b/src/TKVRML/PACKAGES
deleted file mode 100755 (executable)
index 05ba201..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-VrmlConverter
-VrmlAPI
-Vrml
-VrmlData
diff --git a/src/TKXDE/CMakeLists.txt b/src/TKXDE/CMakeLists.txt
deleted file mode 100644 (file)
index 40ac508..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TKXDE)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKXDE/EXTERNLIB b/src/TKXDE/EXTERNLIB
deleted file mode 100644 (file)
index 58c24f0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-TKernel
diff --git a/src/TKXDE/FILES b/src/TKXDE/FILES
deleted file mode 100644 (file)
index ca4f0e5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTERNLIB
-PACKAGES
diff --git a/src/TKXDE/PACKAGES b/src/TKXDE/PACKAGES
deleted file mode 100644 (file)
index e5d15dd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-DE
diff --git a/src/TKXDECascade/CMakeLists.txt b/src/TKXDECascade/CMakeLists.txt
deleted file mode 100644 (file)
index f6bed69..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TKXDECascade)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKXDECascade/EXTERNLIB b/src/TKXDECascade/EXTERNLIB
deleted file mode 100644 (file)
index f0c0f03..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-TKBin
-TKBinL
-TKBinTObj
-TKBinXCAF
-TKBRep
-TKStd
-TKXml
-TKXmlL
-TKXmlTObj
-TKXmlXCAF
-TKXDE
-TKernel
-TKMath
-TKLCAF
-TKXCAF
-TKStdL
-TKCDF
diff --git a/src/TKXDECascade/FILES b/src/TKXDECascade/FILES
deleted file mode 100644 (file)
index ca4f0e5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTERNLIB
-PACKAGES
diff --git a/src/TKXDECascade/PACKAGES b/src/TKXDECascade/PACKAGES
deleted file mode 100644 (file)
index 128e6b2..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-DEBRepCascade
-DEXCAFCascade
index 8ee679cab23440ccf9754803180bd485f82ec8d6..40fafb07a6e9ec4f51dcadf6df79124ca378fb1c 100755 (executable)
@@ -1,9 +1,8 @@
-TKXDE
+TKDE
 TKCDF
 TKBRep
 TKXCAF
 TKernel
-TKIGES
 TKV3d
 TKMath
 TKService
@@ -16,17 +15,18 @@ TKTopAlgo
 TKLCAF
 TKG3d
 TKRWMesh
-TKSTEPBase
-TKSTEP
-TKSTL
+TKDEOBJ
+TKDEGLTF
+TKDEPLY
+TKDESTL
 TKMesh
 TKXSDRAW
-TKXDECascade
-TKXDEIGES
-TKXDESTEP
+TKDECascade
+TKDEIGES
+TKDESTEP
 TKDCAF
 TKViewerTest
 TKBinXCAF
 TKXmlXCAF
-TKVRML
+TKDEVRML
 
diff --git a/src/TKXDEIGES/CMakeLists.txt b/src/TKXDEIGES/CMakeLists.txt
deleted file mode 100644 (file)
index 1b18c66..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TKXDEIGES)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKXDEIGES/EXTERNLIB b/src/TKXDEIGES/EXTERNLIB
deleted file mode 100755 (executable)
index d40184c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-TKBRep
-TKXDE
-TKernel
-TKMath
-TKXSBase
-TKCDF
-TKLCAF
-TKG2d
-TKG3d
-TKXCAF
-TKIGES
diff --git a/src/TKXDEIGES/FILES b/src/TKXDEIGES/FILES
deleted file mode 100755 (executable)
index ca4f0e5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTERNLIB
-PACKAGES
diff --git a/src/TKXDEIGES/PACKAGES b/src/TKXDEIGES/PACKAGES
deleted file mode 100755 (executable)
index 1c6cd95..0000000
+++ /dev/null
@@ -1 +0,0 @@
-IGESCAFControl
diff --git a/src/TKXDESTEP/CMakeLists.txt b/src/TKXDESTEP/CMakeLists.txt
deleted file mode 100644 (file)
index 29d0ca8..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TKXDESTEP)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKXDESTEP/EXTERNLIB b/src/TKXDESTEP/EXTERNLIB
deleted file mode 100755 (executable)
index 547cb01..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-TKXDE
-TKBRep
-TKSTEPAttr
-TKernel
-TKMath
-TKXSBase
-TKTopAlgo
-TKG2d
-TKCAF
-TKSTEPBase
-TKCDF
-TKLCAF
-TKG3d
-TKXCAF
-TKSTEP
-TKShHealing
diff --git a/src/TKXDESTEP/FILES b/src/TKXDESTEP/FILES
deleted file mode 100755 (executable)
index ca4f0e5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTERNLIB
-PACKAGES
diff --git a/src/TKXDESTEP/PACKAGES b/src/TKXDESTEP/PACKAGES
deleted file mode 100755 (executable)
index 508b92a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-STEPCAFControl
index f384afd8f1d3446343e01731a01329c67a6ea895..5e726225c176e96991f35059335ccaa7121bc871 100755 (executable)
@@ -4,12 +4,6 @@ IFGraph
 IFSelect
 TransferBRep
 XSControl
-StepData
-StepFile
-HeaderSection
-RWHeaderSection
-APIHeaderSection
-StepSelect
 XSAlgo
 LibCtl
 MoniTool
index 1947db4b4f00ebfea9003fc7461c6df988113710..8b32e63548e61dbfd660a8e83b3a3d31bfc6e3e4 100755 (executable)
@@ -8,17 +8,11 @@ TKMeshVS
 TKG3d
 TKViewerTest
 TKG2d
-TKSTEPBase
 TKTopAlgo
 TKGeomBase
 TKGeomAlgo
 TKMesh
 TKDraw
-TKSTEP
-TKIGES
-TKSTL
-TKVRML
 TKLCAF
 TKDCAF
 TKXCAF
-TKRWMesh
index da48d7c48ca7f6c4c734487af0f288a1bb9926a2..c06294d5981fb091afed94e66afd9d911fc2dd63 100755 (executable)
@@ -1,4 +1 @@
 XSDRAW
-XSDRAWIGES
-XSDRAWSTEP
-XSDRAWSTLVRML
diff --git a/src/TKXSDRAWDE/CMakeLists.txt b/src/TKXSDRAWDE/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f357436
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKXSDRAWDE)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKXSDRAWDE/EXTERNLIB b/src/TKXSDRAWDE/EXTERNLIB
new file mode 100644 (file)
index 0000000..41bc487
--- /dev/null
@@ -0,0 +1,23 @@
+TKBRep
+TKV3d
+TKMath
+TKernel
+TKService
+TKXSBase
+TKMeshVS
+TKG3d
+TKViewerTest
+TKG2d
+TKTopAlgo
+TKGeomBase
+TKGeomAlgo
+TKMesh
+TKDraw
+TKLCAF
+TKDCAF
+TKXCAF
+TKRWMesh
+TKXSBase
+TKDECascade
+TKDE
+TKXSDRAW
diff --git a/src/TKXSDRAWDE/FILES b/src/TKXSDRAWDE/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKXSDRAWDE/PACKAGES b/src/TKXSDRAWDE/PACKAGES
new file mode 100644 (file)
index 0000000..e7bb61b
--- /dev/null
@@ -0,0 +1 @@
+XSDRAWDE
diff --git a/src/TKXSDRAWGLTF/CMakeLists.txt b/src/TKXSDRAWGLTF/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e372ec3
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKXSDRAWGLTF)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKXSDRAWGLTF/EXTERNLIB b/src/TKXSDRAWGLTF/EXTERNLIB
new file mode 100644 (file)
index 0000000..35dfecf
--- /dev/null
@@ -0,0 +1,21 @@
+TKBRep
+TKV3d
+TKMath
+TKernel
+TKService
+TKXSBase
+TKMeshVS
+TKG3d
+TKViewerTest
+TKG2d
+TKTopAlgo
+TKGeomBase
+TKGeomAlgo
+TKMesh
+TKDraw
+TKLCAF
+TKDCAF
+TKXCAF
+TKRWMesh
+TKDEGLTF
+TKXSDRAW
diff --git a/src/TKXSDRAWGLTF/FILES b/src/TKXSDRAWGLTF/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKXSDRAWGLTF/PACKAGES b/src/TKXSDRAWGLTF/PACKAGES
new file mode 100644 (file)
index 0000000..2d0b09a
--- /dev/null
@@ -0,0 +1 @@
+XSDRAWGLTF
diff --git a/src/TKXSDRAWIGES/CMakeLists.txt b/src/TKXSDRAWIGES/CMakeLists.txt
new file mode 100644 (file)
index 0000000..25283fb
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKXSDRAWIGES)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKXSDRAWIGES/EXTERNLIB b/src/TKXSDRAWIGES/EXTERNLIB
new file mode 100644 (file)
index 0000000..2051a8f
--- /dev/null
@@ -0,0 +1,21 @@
+TKBRep
+TKV3d
+TKMath
+TKernel
+TKService
+TKXSBase
+TKMeshVS
+TKG3d
+TKViewerTest
+TKG2d
+TKTopAlgo
+TKGeomBase
+TKGeomAlgo
+TKMesh
+TKDraw
+TKLCAF
+TKDCAF
+TKXCAF
+TKXSBase
+TKDEIGES
+TKXSDRAW
diff --git a/src/TKXSDRAWIGES/FILES b/src/TKXSDRAWIGES/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKXSDRAWIGES/PACKAGES b/src/TKXSDRAWIGES/PACKAGES
new file mode 100644 (file)
index 0000000..bf6073a
--- /dev/null
@@ -0,0 +1 @@
+XSDRAWIGES
diff --git a/src/TKXSDRAWOBJ/CMakeLists.txt b/src/TKXSDRAWOBJ/CMakeLists.txt
new file mode 100644 (file)
index 0000000..39d98fd
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKXSDRAWOBJ)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKXSDRAWOBJ/EXTERNLIB b/src/TKXSDRAWOBJ/EXTERNLIB
new file mode 100644 (file)
index 0000000..af99e48
--- /dev/null
@@ -0,0 +1,21 @@
+TKBRep
+TKV3d
+TKMath
+TKernel
+TKService
+TKXSBase
+TKMeshVS
+TKG3d
+TKViewerTest
+TKG2d
+TKTopAlgo
+TKGeomBase
+TKGeomAlgo
+TKMesh
+TKDraw
+TKLCAF
+TKDCAF
+TKXCAF
+TKRWMesh
+TKDEOBJ
+TKXSDRAW
diff --git a/src/TKXSDRAWOBJ/FILES b/src/TKXSDRAWOBJ/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKXSDRAWOBJ/PACKAGES b/src/TKXSDRAWOBJ/PACKAGES
new file mode 100644 (file)
index 0000000..2f48af3
--- /dev/null
@@ -0,0 +1 @@
+XSDRAWOBJ
diff --git a/src/TKXSDRAWPLY/CMakeLists.txt b/src/TKXSDRAWPLY/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9b20129
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKXSDRAWPLY)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKXSDRAWPLY/EXTERNLIB b/src/TKXSDRAWPLY/EXTERNLIB
new file mode 100644 (file)
index 0000000..7f5611c
--- /dev/null
@@ -0,0 +1,21 @@
+TKBRep
+TKV3d
+TKMath
+TKernel
+TKService
+TKXSBase
+TKMeshVS
+TKG3d
+TKViewerTest
+TKG2d
+TKTopAlgo
+TKGeomBase
+TKGeomAlgo
+TKMesh
+TKDraw
+TKLCAF
+TKDCAF
+TKXCAF
+TKRWMesh
+TKDEPLY
+TKXSDRAW
diff --git a/src/TKXSDRAWPLY/FILES b/src/TKXSDRAWPLY/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKXSDRAWPLY/PACKAGES b/src/TKXSDRAWPLY/PACKAGES
new file mode 100644 (file)
index 0000000..e62ce60
--- /dev/null
@@ -0,0 +1 @@
+XSDRAWPLY
diff --git a/src/TKXSDRAWSTEP/CMakeLists.txt b/src/TKXSDRAWSTEP/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5ecb56e
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKXSDRAWSTEP)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKXSDRAWSTEP/EXTERNLIB b/src/TKXSDRAWSTEP/EXTERNLIB
new file mode 100644 (file)
index 0000000..5cc664f
--- /dev/null
@@ -0,0 +1,22 @@
+TKBRep
+TKV3d
+TKMath
+TKernel
+TKService
+TKXSBase
+TKMeshVS
+TKG3d
+TKViewerTest
+TKG2d
+TKTopAlgo
+TKGeomBase
+TKGeomAlgo
+TKMesh
+TKDraw
+TKLCAF
+TKDCAF
+TKXCAF
+TKRWMesh
+TKXSBase
+TKDESTEP
+TKXSDRAW
diff --git a/src/TKXSDRAWSTEP/FILES b/src/TKXSDRAWSTEP/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKXSDRAWSTEP/PACKAGES b/src/TKXSDRAWSTEP/PACKAGES
new file mode 100644 (file)
index 0000000..33b9929
--- /dev/null
@@ -0,0 +1 @@
+XSDRAWSTEP
diff --git a/src/TKXSDRAWSTL/CMakeLists.txt b/src/TKXSDRAWSTL/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1a8b908
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKXSDRAWSTL)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKXSDRAWSTL/EXTERNLIB b/src/TKXSDRAWSTL/EXTERNLIB
new file mode 100644 (file)
index 0000000..45138ed
--- /dev/null
@@ -0,0 +1,21 @@
+TKBRep
+TKV3d
+TKMath
+TKernel
+TKService
+TKXSBase
+TKMeshVS
+TKG3d
+TKViewerTest
+TKG2d
+TKTopAlgo
+TKGeomBase
+TKGeomAlgo
+TKMesh
+TKDraw
+TKLCAF
+TKDCAF
+TKXCAF
+TKRWMesh
+TKDESTL
+TKXSDRAW
diff --git a/src/TKXSDRAWSTL/FILES b/src/TKXSDRAWSTL/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKXSDRAWSTL/PACKAGES b/src/TKXSDRAWSTL/PACKAGES
new file mode 100644 (file)
index 0000000..c6c1f75
--- /dev/null
@@ -0,0 +1 @@
+XSDRAWSTL
diff --git a/src/TKXSDRAWVRML/CMakeLists.txt b/src/TKXSDRAWVRML/CMakeLists.txt
new file mode 100644 (file)
index 0000000..75fe4d8
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKXSDRAWVRML)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKXSDRAWVRML/EXTERNLIB b/src/TKXSDRAWVRML/EXTERNLIB
new file mode 100644 (file)
index 0000000..81bcd9f
--- /dev/null
@@ -0,0 +1,21 @@
+TKBRep
+TKV3d
+TKMath
+TKernel
+TKService
+TKXSBase
+TKMeshVS
+TKG3d
+TKViewerTest
+TKG2d
+TKTopAlgo
+TKGeomBase
+TKGeomAlgo
+TKMesh
+TKDraw
+TKLCAF
+TKDCAF
+TKXCAF
+TKRWMesh
+TKDEVRML
+TKXSDRAW
diff --git a/src/TKXSDRAWVRML/FILES b/src/TKXSDRAWVRML/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKXSDRAWVRML/PACKAGES b/src/TKXSDRAWVRML/PACKAGES
new file mode 100644 (file)
index 0000000..d0fc037
--- /dev/null
@@ -0,0 +1 @@
+XSDRAWVRML
index 6cb9de24b2ecbccd67fc54f7335d88ddf9316e90..0e50f82368ebd12ba97cae4918cea6d0b5cd2356 100644 (file)
@@ -14,6 +14,7 @@
 #include <Vrml_ConfigurationNode.hxx>
 
 #include <DE_ConfigurationContext.hxx>
+#include <DE_PluginHolder.hxx>
 #include <Vrml_Provider.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(Vrml_ConfigurationNode, DE_ConfigurationNode)
@@ -25,6 +26,9 @@ namespace
     static const TCollection_AsciiString aScope = "provider";
     return aScope;
   }
+
+  // Wrapper to auto-load DE component
+  DE_PluginHolder<Vrml_ConfigurationNode> THE_OCCT_VRML_COMPONENT_PLUGIN;
 }
 
 //=======================================================================
index df4c0a2da99a5fba659ed6bd7b7a5ee3b355bcda..49d6c2685b3db12c14ff33e8606efd7c57d48994 100644 (file)
@@ -1848,32 +1848,13 @@ void XDEDRAW::Init(Draw_Interpretor& di)
   XDEDRAW_Views::InitCommands(di);
   XDEDRAW_Notes::InitCommands(di);
   XDEDRAW_Common::InitCommands ( di );//moved from EXE
-
-  DE_Wrapper::GlobalWrapper()->Bind(new RWObj_ConfigurationNode());
-  DE_Wrapper::GlobalWrapper()->Bind(new RWPly_ConfigurationNode());
-  DE_Wrapper::GlobalWrapper()->Bind(new RWGltf_ConfigurationNode());
-  DE_Wrapper::GlobalWrapper()->Bind(new IGESCAFControl_ConfigurationNode());
-  DE_Wrapper::GlobalWrapper()->Bind(new STEPCAFControl_ConfigurationNode());
-  DE_Wrapper::GlobalWrapper()->Bind(new Vrml_ConfigurationNode());
-  DE_Wrapper::GlobalWrapper()->Bind(new DEXCAFCascade_ConfigurationNode());
-  DE_Wrapper::GlobalWrapper()->Bind(new RWStl_ConfigurationNode());
-  DE_Wrapper::GlobalWrapper()->Bind(new DEBRepCascade_ConfigurationNode());
 }
 
-
 //==============================================================================
 // XDEDRAW::Factory
 //==============================================================================
 void XDEDRAW::Factory(Draw_Interpretor& theDI)
 {
-  XSDRAWIGES::InitSelect();
-  XSDRAWIGES::InitToBRep(theDI);
-  XSDRAWIGES::InitFromBRep(theDI);
-
-  XSDRAWSTEP::InitCommands(theDI);
-
-  XSDRAW::LoadDraw(theDI);
-
   XDEDRAW::Init(theDI);
 
 #ifdef OCCT_DEBUG
index e40d1de911f22f5ca6c9f4610655a9466c4f25d5..33584a23747862ded4fd96fa63ff5c81e62f3804 100644 (file)
 
 #include <Draw_Interpretor.hxx>
 
-
 //! Provides DRAW commands for work with DECAF data structures
 class XDEDRAW 
 {
-public:
-
   DEFINE_STANDARD_ALLOC
+public:
 
-  
   //! Provides common commands for work XDE
   //! Initializes all the functions
   Standard_EXPORT static void Init (Draw_Interpretor& di);
   
   //! Loads all Draw commands of  TKXDEDRAW. Used for plugin.
   Standard_EXPORT static void Factory (Draw_Interpretor& theDI);
-
 };
 
 #endif // _XDEDRAW_HeaderFile
index 751cb5ca928bba5ef91f9411b032c259a5e4f6e2..d4f9e82d99dcd3321175db0201df4e62cc3c65ec 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <XDEDRAW_Common.hxx>
+
+#include <DBRep.hxx>
 #include <DDocStd.hxx>
 #include <DDocStd_DrawDocument.hxx>
-#include <DE_ConfigurationContext.hxx>
-#include <DE_Wrapper.hxx>
 #include <Draw.hxx>
 #include <Draw_Interpretor.hxx>
 #include <Draw_ProgressIndicator.hxx>
 #include <Message.hxx>
-#include <IFSelect_SessionPilot.hxx>
-#include <IGESCAFControl_Reader.hxx>
-#include <IGESCAFControl_Writer.hxx>
-#include <IGESControl_Controller.hxx>
-#include <Interface_Macros.hxx>
 #include <OSD_OpenFile.hxx>
 #include <OSD_Path.hxx>
-#include <STEPCAFControl_ExternFile.hxx>
-#include <STEPCAFControl_Reader.hxx>
-#include <STEPCAFControl_Writer.hxx>
-#include <STEPControl_Controller.hxx>
-#include <TDF_Data.hxx>
+#include <TDF_Tool.hxx>
 #include <TDocStd_Application.hxx>
 #include <TDocStd_Document.hxx>
-#include <XDEDRAW_Common.hxx>
-#include <XSAlgo.hxx>
-#include <XSAlgo_AlgoContainer.hxx>
-#include <XSControl_WorkSession.hxx>
-#include <XSDRAW.hxx>
-#include <XSDRAW_Vars.hxx>
-#include <VrmlAPI_CafReader.hxx>
-#include <VrmlAPI_Writer.hxx>
-#include <DDF.hxx>
-
-#include <DBRep.hxx>
+#include <TopoDS_Shape.hxx>
 #include <XCAFDoc_DocumentTool.hxx>
-#include <XCAFDoc_ShapeTool.hxx>
 #include <XCAFDoc_Editor.hxx>
-#include <TDF_Tool.hxx>
-#include <TopoDS_Shape.hxx>
-#include <Interface_Static.hxx>
-#include <UnitsAPI.hxx>
-#include <UnitsMethods.hxx>
-
-#include <stdio.h>
-
-//============================================================
-// Support for several models in DRAW
-//============================================================
-static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thedictws;
-
-//=======================================================================
-//function : parseCoordinateSystem
-//purpose  : Parse RWMesh_CoordinateSystem enumeration.
-//=======================================================================
-static bool parseCoordinateSystem(const char* theArg,
-                                  RWMesh_CoordinateSystem& theSystem)
-{
-  TCollection_AsciiString aCSStr(theArg);
-  aCSStr.LowerCase();
-  if (aCSStr == "zup")
-  {
-    theSystem = RWMesh_CoordinateSystem_Zup;
-  }
-  else if (aCSStr == "yup")
-  {
-    theSystem = RWMesh_CoordinateSystem_Yup;
-  }
-  else
-  {
-    return Standard_False;
-  }
-  return Standard_True;
-}
-
-static Standard_Boolean ClearDicWS()
-{
-  thedictws.Clear();
-  return Standard_True;
-}
-
-static void AddWS(const TCollection_AsciiString& filename,
-                  const Handle(XSControl_WorkSession)& WS)
-{
-  WS->SetVars(new XSDRAW_Vars); // support of DRAW variables
-  thedictws.Bind(filename, WS);
-}
-
-
-static Standard_Boolean FillDicWS(NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>& dicFile)
-{
-  ClearDicWS();
-  if (dicFile.IsEmpty())
-  {
-    return Standard_False;
-  }
-  Handle(STEPCAFControl_ExternFile) EF;
-  NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>::Iterator DicEFIt(dicFile);
-  for (; DicEFIt.More(); DicEFIt.Next())
-  {
-    const TCollection_AsciiString& filename = DicEFIt.Key();
-    EF = DicEFIt.Value();
-    AddWS(filename, EF->GetWS());
-  }
-  return Standard_True;
-}
-
-static Standard_Boolean SetCurrentWS(const TCollection_AsciiString& filename)
-{
-  if (!thedictws.IsBound(filename)) return Standard_False;
-  Handle(XSControl_WorkSession) CurrentWS =
-    Handle(XSControl_WorkSession)::DownCast(thedictws.ChangeFind(filename));
-  XSDRAW::Pilot()->SetSession(CurrentWS);
-
-  return Standard_True;
-}
-
+#include <XCAFDoc_ShapeTool.hxx>
+#include <XSDRAW.hxx>
 
 //=======================================================================
 //function : SetCurWS
 //purpose  : Set current file if many files are read
 //=======================================================================
-
-static Standard_Integer SetCurWS(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+static Standard_Integer SetCurWS(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
 {
-  if (argc < 2)
+  if (theNbArgs < 2)
+  {
+    theDI << "Use: " << theArgVec[0] << " filename \n";
+    return 1;
+  }
+  const TCollection_AsciiString aSessionName(theArgVec[1]);
+  Handle(XSControl_WorkSession) aSession;
+  const XSControl_WorkSessionMap& aWSList = XSDRAW::WorkSessionList();
+  if (!aWSList.Find(aSessionName, aSession))
   {
-    di << "Use: " << argv[0] << " filename \n";
+    TCollection_AsciiString aWSs;
+    for (XSControl_WorkSessionMap::Iterator anIter(aWSList);
+         anIter.More(); anIter.Next())
+    {
+      aWSs += "\"";
+      aWSs += anIter.Key();
+      aWSs += "\"\n";
+    }
+    theDI << "Error: Can't find active session. Active sessions list:\n" << aWSs;
     return 1;
   }
-  TCollection_AsciiString filename(argv[1]);
-  SetCurrentWS(filename);
+  XSDRAW::SetSession(aSession);
   return 0;
 }
 
-
 //=======================================================================
 //function : GetDicWSList
 //purpose  : List all files recorded after translation
 //=======================================================================
-
-static Standard_Integer GetDicWSList(Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
+static Standard_Integer GetDicWSList(Draw_Interpretor& theDI,
+                                     Standard_Integer theNbArgs,
+                                     const char** theArgVec)
 {
-  NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> DictWS = thedictws;
-  if (DictWS.IsEmpty()) return 1;
-  NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator DicIt(DictWS);
-  di << " The list of last translated files:\n";
-  Standard_Integer num = 0;
-  for (; DicIt.More(); DicIt.Next(), num++)
+  (void)theNbArgs;
+  (void)theArgVec;
+  Message::SendInfo() << "Active sessions list:";
+  TCollection_AsciiString aWSs;
+  for (XSControl_WorkSessionMap::Iterator anIter(XSDRAW::WorkSessionList());
+       anIter.More(); anIter.Next())
   {
-    const TCollection_AsciiString& strng(DicIt.Key());
-    if (num) di << "\n";
-    di << "\"" << strng.ToCString() << "\"";
+    theDI << "\"" << anIter.Key() << "\"\n";
   }
   return 0;
 }
@@ -172,11 +90,14 @@ static Standard_Integer GetDicWSList(Draw_Interpretor& di, Standard_Integer /*ar
 //function : GetCurWS
 //purpose  : Return name of file which is current
 //=======================================================================
-
-static Standard_Integer GetCurWS(Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
+static Standard_Integer GetCurWS(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
 {
+  (void)theNbArgs;
+  (void)theArgVec;
   Handle(XSControl_WorkSession) WS = XSDRAW::Session();
-  di << "\"" << WS->LoadedFile() << "\"";
+  theDI << "\"" << WS->LoadedFile() << "\"";
   return 0;
 }
 
@@ -184,512 +105,34 @@ static Standard_Integer GetCurWS(Draw_Interpretor& di, Standard_Integer /*argc*/
 //function : FromShape
 //purpose  : Apply fromshape command to all the loaded WSs
 //=======================================================================
-
-static Standard_Integer FromShape(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+static Standard_Integer FromShape(Draw_Interpretor& theDI,
+                                  Standard_Integer theNbArgs,
+                                  const char** theArgVec)
 {
-  if (argc < 2)
+  if (theNbArgs < 2)
   {
-    di << argv[0] << " shape: search for shape origin among all last tranalated files\n";
+    theDI << theArgVec[0] << " shape: search for shape origin among all last tranalated files\n";
     return 0;
   }
 
   char command[256];
-  Sprintf(command, "fromshape %.200s -1", argv[1]);
-  NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> DictWS = thedictws;
-  if (DictWS.IsEmpty()) return di.Eval(command);
-
-  Handle(XSControl_WorkSession) WS = XSDRAW::Session();
-
-  NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator DicIt(DictWS);
-  //  di << "Searching for shape among all the loaded files:\n";
-  Standard_Integer num = 0;
-  for (; DicIt.More(); DicIt.Next(), num++)
-  {
-    Handle(XSControl_WorkSession) CurrentWS =
-      Handle(XSControl_WorkSession)::DownCast(DicIt.Value());
-    XSDRAW::Pilot()->SetSession(CurrentWS);
-    di.Eval(command);
-  }
-
-  XSDRAW::Pilot()->SetSession(WS);
-  return 0;
-}
-
-//=======================================================================
-//function : ReadIges
-//purpose  : Read IGES to DECAF document
-//=======================================================================
-
-static Standard_Integer ReadIges(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-  if (argc < 3)
-  {
-    di << "Use: " << argv[0] << " Doc filename [mode]: read IGES file to a document\n";
-    return 0;
-  }
-
-  DeclareAndCast(IGESControl_Controller, ctl, XSDRAW::Controller());
-  if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
-
-  TCollection_AsciiString fnom, rnom;
-  Standard_Boolean modfic = XSDRAW::FileAndVar(argv[2], argv[1], "IGES", fnom, rnom);
-  if (modfic) di << " File IGES to read : " << fnom.ToCString() << "\n";
-  else        di << " Model taken from the session : " << fnom.ToCString() << "\n";
-  //  di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom<<"\n";
-
-  IGESCAFControl_Reader reader(XSDRAW::Session(), modfic);
-  Standard_Integer onlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
-  reader.SetReadVisible(onlyvisible == 1);
-
-  if (argc == 4)
-  {
-    Standard_Boolean mode = Standard_True;
-    for (Standard_Integer i = 0; argv[3][i]; i++)
-      switch (argv[3][i])
-      {
-        case '-': mode = Standard_False; break;
-        case '+': mode = Standard_True; break;
-        case 'c': reader.SetColorMode(mode); break;
-        case 'n': reader.SetNameMode(mode); break;
-        case 'l': reader.SetLayerMode(mode); break;
-      }
-  }
-
-  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di);
-  Message_ProgressScope aRootScope(aProgress->Start(), "IGES import", modfic ? 2 : 1);
-
-  IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
-  if (modfic)
-  {
-    Message_ProgressScope aReadScope(aRootScope.Next(), "File reading", 1);
-    aReadScope.Show();
-    readstat = reader.ReadFile(fnom.ToCString());
-  }
-  else if (XSDRAW::Session()->NbStartingEntities() > 0)
-  {
-    readstat = IFSelect_RetDone;
-  }
-  if (readstat != IFSelect_RetDone)
-  {
-    if (modfic)
-    {
-      di << "Could not read file " << fnom.ToCString() << " , abandon\n";
-    }
-    else
-    {
-      di << "No model loaded\n";
-    }
-    return 1;
-  }
-
-  Handle(TDocStd_Document) doc;
-  if (!DDocStd::GetDocument(argv[1], doc, Standard_False))
-  {
-    Handle(TDocStd_Application) A = DDocStd::GetApplication();
-    A->NewDocument("BinXCAF", doc);
-    TDataStd_Name::Set(doc->GetData()->Root(), argv[1]);
-    Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(doc);
-    Draw::Set(argv[1], DD);
-    //     di << "Document saved with name " << argv[1];
-  }
-  if (!reader.Transfer(doc, aRootScope.Next()))
-  {
-    di << "Cannot read any relevant data from the IGES file\n";
-    return 1;
-  }
-
-  //  Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(doc);  
-  //  Draw::Set(argv[1],DD);       
-  di << "Document saved with name " << argv[1];
-
-  return 0;
-}
-
-//=======================================================================
-//function : WriteIges
-//purpose  : Write DECAF document to IGES
-//=======================================================================
-
-static Standard_Integer WriteIges(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-  if (argc < 3)
-  {
-    di << "Use: " << argv[0] << " Doc filename [mode]: write document to IGES file\n";
-    return 0;
-  }
-
-  Handle(TDocStd_Document) Doc;
-  DDocStd::GetDocument(argv[1], Doc);
-  if (Doc.IsNull())
-  {
-    di << argv[1] << " is not a document\n";
-    return 1;
-  }
-
-  XSDRAW::SetNorm("IGES");
-
-  TCollection_AsciiString fnom, rnom;
-  const Standard_Boolean modfic = XSDRAW::FileAndVar(argv[2], argv[1], "IGES", fnom, rnom);
-
-  //  IGESControl_Writer ICW (Interface_Static::CVal("write.iges.unit"),
-  //                     Interface_Static::IVal("write.iges.brep.mode"));
-
-  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di);
-  Message_ProgressScope aRootScope(aProgress->Start(), "IGES export", modfic ? 2 : 1);
-
-  IGESCAFControl_Writer writer(XSDRAW::Session(), Standard_True);
-  if (argc == 4)
-  {
-    Standard_Boolean mode = Standard_True;
-    for (Standard_Integer i = 0; argv[3][i]; i++)
-      switch (argv[3][i])
-      {
-        case '-': mode = Standard_False; break;
-        case '+': mode = Standard_True; break;
-        case 'c': writer.SetColorMode(mode); break;
-        case 'n': writer.SetNameMode(mode); break;
-        case 'l': writer.SetLayerMode(mode); break;
-      }
-  }
-  writer.Transfer(Doc, aRootScope.Next());
-
-  if (modfic)
-  {
-    Message_ProgressScope aWriteScope(aRootScope.Next(), "File writing", 1);
-    aWriteScope.Show();
-    di << "Writing IGES model to file " << argv[2] << "\n";
-    if (writer.Write(argv[2]))
-    {
-      di << " Write OK\n";
-    }
-    else
-    {
-      di << " Write failed\n";
-    }
-  }
-  else
-  {
-    di << "Document has been translated into the session";
-  }
-  return 0;
-}
-
-//=======================================================================
-//function : ReadStep
-//purpose  : Read STEP file to DECAF document 
-//=======================================================================
-static Standard_Integer ReadStep(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-  DeclareAndCast(STEPControl_Controller, ctl, XSDRAW::Controller());
-  if (ctl.IsNull())
-  {
-    XSDRAW::SetNorm ("STEP");
-  }
-
-  Standard_CString aDocName = NULL;
-  TCollection_AsciiString aFilePath, aModeStr;
-  bool toTestStream = false;
-  for (Standard_Integer anArgIter = 1; anArgIter < argc; ++anArgIter)
-  {
-    TCollection_AsciiString anArgCase(argv[anArgIter]);
-    anArgCase.LowerCase();
-    if (anArgCase == "-stream")
-    {
-      toTestStream = true;
-    }
-    else if (aDocName == NULL)
-    {
-      aDocName = argv[anArgIter];
-    }
-    else if (aFilePath.IsEmpty())
-    {
-      aFilePath = argv[anArgIter];
-    }
-    else if (aModeStr.IsEmpty())
-    {
-      aModeStr = argv[anArgIter];
-    }
-    else
-    {
-      Message::SendFail() << "Syntax error at '" << argv[anArgIter] << "'";
-      return 1;
-    }
-  }
-
-  TCollection_AsciiString aFileName, anOldVarName;
-  Standard_Boolean isFileMode = XSDRAW::FileAndVar (aFilePath.ToCString(), aDocName, "STEP", aFileName, anOldVarName);
-  if (isFileMode) di << " File STEP to read : " << aFileName << "\n";
-  else            di << " Model taken from the session : " << aFileName << "\n";
-  //  di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom<<"\n";
-
-  STEPCAFControl_Reader aReader (XSDRAW::Session(), isFileMode);
-  if (!aModeStr.IsEmpty())
-  {
-    Standard_Boolean aMode = Standard_True;
-    for (Standard_Integer i = 1; aModeStr.Value (i); ++i)
-    {
-      switch (aModeStr.Value (i))
-      {
-        case '-' : aMode = Standard_False; break;
-        case '+' : aMode = Standard_True;  break;
-        case 'c' : aReader.SetColorMode (aMode); break;
-        case 'n' : aReader.SetNameMode  (aMode); break;
-        case 'l' : aReader.SetLayerMode (aMode); break;
-        case 'v' : aReader.SetPropsMode (aMode); break;
-        default:
-        {
-          Message::SendFail() << "Syntax error at '" << aModeStr << "'\n";
-          return 1;
-        }
-      }
-    }
-  }
-  
-  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
-  Message_ProgressScope aRootScope (aProgress->Start(), "STEP import", isFileMode ? 2 : 1);
-
-  IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
-  if (isFileMode)
-  {
-    Message_ProgressScope aReadScope (aRootScope.Next(), "File reading", 1);
-    aReadScope.Show();
-    if (toTestStream)
-    {
-      std::ifstream aStream;
-      OSD_OpenStream (aStream, aFileName.ToCString(), std::ios::in | std::ios::binary);
-      TCollection_AsciiString aFolder, aFileNameShort;
-      OSD_Path::FolderAndFileFromPath (aFileName, aFolder, aFileNameShort);
-      aReadStat = aReader.ReadStream (aFileNameShort.ToCString(), aStream);
-    }
-    else
-    {
-      aReadStat = aReader.ReadFile (aFileName.ToCString());
-    }
-  }
-  else if (XSDRAW::Session()->NbStartingEntities() > 0)
-  {
-    aReadStat = IFSelect_RetDone;
-  }
-  if (aReadStat != IFSelect_RetDone)
-  {
-    if (isFileMode)
-    {
-      di << "Could not read file " << aFileName << " , abandon\n";
-    }
-    else
-    {
-      di << "No model loaded\n";
-    }
-    return 1;
-  }
-
-  Handle(TDocStd_Document) aDoc;
-  if (!DDocStd::GetDocument (aDocName, aDoc, Standard_False))
-  {
-    Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
-    anApp->NewDocument("BinXCAF", aDoc);
-    TDataStd_Name::Set (aDoc->GetData()->Root(), aDocName);
-    Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument (aDoc);
-    Draw::Set (aDocName, aDrawDoc);
-    //     di << "Document saved with name " << aDocName;
-  }
-  if (!aReader.Transfer (aDoc, aRootScope.Next()))
-  {
-    di << "Cannot read any relevant data from the STEP file\n";
-    return 1;
-  }
-
-  Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument (aDoc);
-  Draw::Set (aDocName, aDrawDoc);
-  di << "Document saved with name " << aDocName;
-
-  NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> aDicFile = aReader.ExternFiles();
-  FillDicWS (aDicFile);
-  AddWS (aFileName, XSDRAW::Session());
-  return 0;
-}
-
-//=======================================================================
-//function : WriteStep
-//purpose  : Write DECAF document to STEP
-//=======================================================================
-static Standard_Integer WriteStep(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-  DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller());
-  if (ctl.IsNull())
-  {
-    XSDRAW::SetNorm ("STEP");
-  }
-  STEPCAFControl_Writer aWriter (XSDRAW::Session(), Standard_True);
-
-  Handle(TDocStd_Document) aDoc;
-  TCollection_AsciiString aDocName, aFilePath;
-  STEPControl_StepModelType aMode = STEPControl_AsIs;
-  bool hasModeArg = false, toTestStream = false;
-  TCollection_AsciiString aMultiFilePrefix, aLabelName;
-  TDF_Label aLabel;
-  for (Standard_Integer anArgIter = 1; anArgIter < argc; ++anArgIter)
-  {
-    TCollection_AsciiString anArgCase (argv[anArgIter]);
-    anArgCase.LowerCase();
-    if (anArgCase == "-stream")
-    {
-      toTestStream = true;
-    }
-    else if (aDocName.IsEmpty())
-    {
-      Standard_CString aDocNameStr = argv[anArgIter];
-      DDocStd::GetDocument (aDocNameStr, aDoc);
-      if (aDoc.IsNull())
-      {
-        di << "Syntax error: '" << argv[anArgIter] << "' is not a document";
-        return 1;
-      }
-      aDocName = aDocNameStr;
-    }
-    else if (aFilePath.IsEmpty())
-    {
-      aFilePath = argv[anArgIter];
-    }
-    else if (!hasModeArg)
-    {
-      hasModeArg = true;
-      switch (anArgCase.Value (1))
-      {
-        case 'a':
-        case '0': aMode = STEPControl_AsIs;                    break;
-        case 'f':
-        case '1': aMode = STEPControl_FacetedBrep;             break;
-        case 's':
-        case '2': aMode = STEPControl_ShellBasedSurfaceModel;  break;
-        case 'm':
-        case '3': aMode = STEPControl_ManifoldSolidBrep;       break;
-        case 'w':
-        case '4': aMode = STEPControl_GeometricCurveSet;       break;
-        default:
-        {
-          di << "Syntax error: mode '" << argv[anArgIter] << "' is incorrect [give fsmw]";
-          return 1;
-        }
-      }
-      Standard_Boolean wrmode = Standard_True;
-      for (Standard_Integer i = 1; i <= anArgCase.Length(); ++i)
-      {
-        switch (anArgCase.Value (i))
-        {
-          case '-' : wrmode = Standard_False; break;
-          case '+' : wrmode = Standard_True;  break;
-          case 'c' : aWriter.SetColorMode (wrmode); break;
-          case 'n' : aWriter.SetNameMode  (wrmode); break;
-          case 'l' : aWriter.SetLayerMode (wrmode); break;
-          case 'v' : aWriter.SetPropsMode (wrmode); break;
-        }
-      }
-    }
-    else if (aMultiFilePrefix.IsEmpty()
-          && anArgCase.Search (":") == -1)
-    {
-      aMultiFilePrefix = argv[anArgIter];
-    }
-    else if (aLabel.IsNull())
-    {
-      if (!DDF::FindLabel (aDoc->Main().Data(), argv[anArgIter], aLabel)
-       || aLabel.IsNull())
-      {
-        di << "Syntax error: No label for entry '" << argv[anArgIter] << "'";
-        return 1;
-      }
-      aLabelName = argv[anArgIter];
-    }
-    else
-    {
-      di << "Syntax error: unknown argument '" << argv[anArgIter] << "'";
-      return 1;
-    }
-  }
-  if (aFilePath.IsEmpty())
-  {
-    di << "Syntax error: wrong number of arguments";
-    return 1;
-  }
-
-  TCollection_AsciiString aFileName, anOldVarName;
-  const Standard_Boolean isFileMode = XSDRAW::FileAndVar (aFilePath.ToCString(), aDocName.ToCString(), "STEP", aFileName, anOldVarName);
-
-  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
-  Message_ProgressScope aRootScope (aProgress->Start(), "STEP export", isFileMode ? 2 : 1);
-  if (!aLabel.IsNull())
-  {  
-    di << "Translating label " << aLabelName << " of document " << aDocName << " to STEP\n";
-    if (!aWriter.Transfer (aLabel, aMode,
-                           !aMultiFilePrefix.IsEmpty() ? aMultiFilePrefix.ToCString() : NULL,
-                           aRootScope.Next()))
-    {
-      di << "Error: the label of document cannot be translated or gives no result";
-      return 1;
-    }
-  }
-  else
-  {
-    di << "Translating document " << aDocName << " to STEP\n";
-    if (!aWriter.Transfer (aDoc, aMode,
-                           !aMultiFilePrefix.IsEmpty() ? aMultiFilePrefix.ToCString() : NULL,
-                           aRootScope.Next()))
-    {
-      di << "Error: The document cannot be translated or gives no result\n";
-    }
-  }
-
-  if (!isFileMode)
-  {
-    di << "Document has been translated into the session";
-    return 0;
-  }
-
-  Message_ProgressScope aWriteScope (aRootScope.Next(), "File writing", 1);
-  aWriteScope.Show();
-  di << "Writing STEP file " << aFilePath << "\n";
-
-  IFSelect_ReturnStatus aStat = IFSelect_RetVoid;
-  if (toTestStream)
-  {
-    std::ofstream aStream;
-    OSD_OpenStream (aStream, aFilePath, std::ios::out | std::ios::binary);
-    aStat = aWriter.WriteStream (aStream);
-    aStream.close();
-    if (!aStream.good()
-      && aStat == IFSelect_RetDone)
-    {
-      aStat = IFSelect_RetFail;
-    }
-  }
-  else
-  {
-    aStat = aWriter.Write (aFilePath.ToCString());
-  }
+  Sprintf(command, "fromshape %.200s -1", theArgVec[1]);
+  const XSControl_WorkSessionMap& DictWS = XSDRAW::WorkSessionList();
+  if (DictWS.IsEmpty())
+    return theDI.Eval(command);
 
-  switch (aStat)
+  Handle(XSControl_WorkSession) aWS = XSDRAW::Session();
+  for (XSControl_WorkSessionMap::Iterator DicIt(DictWS);
+       DicIt.More(); DicIt.Next())
   {
-    case IFSelect_RetVoid:
-    {
-      di << "Error: no file written";
-      break;
-    }
-    case IFSelect_RetDone:
-    {
-      di << "File " << aFilePath << " written\n";
-
-      NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> aDicFile = aWriter.ExternFiles();
-      FillDicWS (aDicFile);
-      AddWS (aFilePath, XSDRAW::Session());
-      break;
-    }
-    default:
+    Handle(XSControl_WorkSession) CurrentWS = Handle(XSControl_WorkSession)::DownCast(DicIt.Value());
+    if (!CurrentWS.IsNull())
     {
-      di << "Error on writing file";
-      break;
+      XSDRAW::SetSession(CurrentWS);
+      theDI.Eval(command);
     }
   }
+  XSDRAW::SetSession(aWS);
   return 0;
 }
 
@@ -697,43 +140,46 @@ static Standard_Integer WriteStep(Draw_Interpretor& di, Standard_Integer argc, c
 //function : Expand
 //purpose  :
 //=======================================================================
-static Standard_Integer Expand(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+static Standard_Integer Expand(Draw_Interpretor& theDI,
+                               Standard_Integer theNbArgs,
+                               const char** theArgVec)
 {
-  if (argc < 3)
+  if (theNbArgs < 3)
   {
-    di << "Use: " << argv[0] << " Doc recurs(0/1) or Doc recurs(0/1) label1 label2 ... or Doc recurs(0/1 shape1 shape2 ...\n";
+    theDI << "Use: " << theArgVec[0]
+      << " Doc recurs(0/1) or Doc recurs(0/1) label1 label2 ... or Doc recurs(0/1 shape1 shape2 ...\n";
     return 1;
   }
   Handle(TDocStd_Document) Doc;
-  DDocStd::GetDocument(argv[1], Doc);
+  DDocStd::GetDocument(theArgVec[1], Doc);
   if (Doc.IsNull())
   {
-    di << argv[1] << " is not a document\n"; return 1;
+    theDI << theArgVec[1] << " is not a document\n"; return 1;
   }
 
   Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
   Standard_Boolean recurs = Standard_False;
-  if (atoi(argv[2]) != 0)
+  if (atoi(theArgVec[2]) != 0)
     recurs = Standard_True;
 
-  if (argc == 3)
+  if (theNbArgs == 3)
   {
     if (!XCAFDoc_Editor::Expand(Doc->Main(), recurs))
     {
-      di << "No suitable labels to expand\n";
+      theDI << "No suitable labels to expand\n";
       return 1;
     }
   }
   else
   {
-    for (Standard_Integer i = 3; i < argc; i++)
+    for (Standard_Integer i = 3; i < theNbArgs; i++)
     {
       TDF_Label aLabel;
-      TDF_Tool::Label(Doc->GetData(), argv[i], aLabel);
+      TDF_Tool::Label(Doc->GetData(), theArgVec[i], aLabel);
       if (aLabel.IsNull())
       {
         TopoDS_Shape aShape;
-        aShape = DBRep::Get(argv[i]);
+        aShape = DBRep::Get(theArgVec[i]);
         aLabel = aShapeTool->FindShape(aShape);
       }
 
@@ -741,13 +187,13 @@ static Standard_Integer Expand(Draw_Interpretor& di, Standard_Integer argc, cons
       {
         if (!XCAFDoc_Editor::Expand(Doc->Main(), aLabel, recurs))
         {
-          di << "The shape is assembly or not compound\n";
+          theDI << "The shape is assembly or not compound\n";
           return 1;
         }
       }
       else
       {
-        di << argv[i] << " is not a shape\n"; return 1;
+        theDI << theArgVec[i] << " is not a shape\n"; return 1;
       }
     }
   }
@@ -758,666 +204,91 @@ static Standard_Integer Expand(Draw_Interpretor& di, Standard_Integer argc, cons
 //function : Extract
 //purpose  :
 //=======================================================================
-static Standard_Integer Extract(Draw_Interpretor& di,
-                                Standard_Integer argc,
-                                const char** argv)
+static Standard_Integer Extract(Draw_Interpretor& theDI,
+                                Standard_Integer theNbArgs,
+                                const char** theArgVec)
 {
-  if (argc < 4)
+  if (theNbArgs < 4)
   {
-    di << "Use: " << argv[0] << "dstDoc [dstAssmblSh] srcDoc srcLabel1 srcLabel2 ...\n";
+    theDI << "Use: " << theArgVec[0] << "dstDoc [dstAssmblSh] srcDoc srcLabel1 srcLabel2 ...\n";
     return 1;
   }
 
   Handle(TDocStd_Document) aSrcDoc, aDstDoc;
-  DDocStd::GetDocument(argv[1], aDstDoc);
+  DDocStd::GetDocument(theArgVec[1], aDstDoc);
   if (aDstDoc.IsNull())
   {
-    di << "Error " << argv[1] << " is not a document\n";
+    theDI << "Error " << theArgVec[1] << " is not a document\n";
     return 1;
   }
   TDF_Label aDstLabel;
   Standard_Integer anArgInd = 3;
-  TDF_Tool::Label(aDstDoc->GetData(), argv[2], aDstLabel);
+  TDF_Tool::Label(aDstDoc->GetData(), theArgVec[2], aDstLabel);
   Handle(XCAFDoc_ShapeTool) aDstShapeTool = XCAFDoc_DocumentTool::ShapeTool(aDstDoc->Main());
   if (aDstLabel.IsNull())
   {
     aDstLabel = aDstShapeTool->Label();
     anArgInd = 2; // to get Src Doc
   }
-  DDocStd::GetDocument(argv[anArgInd++], aSrcDoc);
+  DDocStd::GetDocument(theArgVec[anArgInd++], aSrcDoc);
   if (aSrcDoc.IsNull())
   {
-    di << "Error " << argv[anArgInd] << " is not a document\n";
+    theDI << "Error " << theArgVec[anArgInd] << " is not a document\n";
     return 1;
   }
 
   TDF_LabelSequence aSrcShapes;
-  for (; anArgInd < argc; anArgInd++)
+  for (; anArgInd < theNbArgs; anArgInd++)
   {
     TDF_Label aSrcLabel;
-    TDF_Tool::Label(aSrcDoc->GetData(), argv[anArgInd], aSrcLabel);
+    TDF_Tool::Label(aSrcDoc->GetData(), theArgVec[anArgInd], aSrcLabel);
     if (aSrcLabel.IsNull())
     {
-      di << "[" << argv[anArgInd] << "] is not valid Src label\n";
+      theDI << "[" << theArgVec[anArgInd] << "] is not valid Src label\n";
       return 1;
     }
     aSrcShapes.Append(aSrcLabel);
   }
   if (aSrcShapes.IsEmpty())
   {
-    di << "Error: No Shapes to extract\n";
+    theDI << "Error: No Shapes to extract\n";
     return 1;
   }
 
   if (!XCAFDoc_Editor::Extract(aSrcShapes, aDstLabel))
   {
-    di << "Error: Cannot extract labels\n";
+    theDI << "Error: Cannot extract labels\n";
     return 1;
   }
   return 0;
 }
 
 //=======================================================================
-//function : ReadVrml
+//function : InitCommands
 //purpose  :
 //=======================================================================
-static Standard_Integer ReadVrml(Draw_Interpretor& theDI,
-                                 Standard_Integer  theArgc,
-                                 const char**      theArgv)
-{
-  if(theArgc < 3)
-  {
-    theDI.PrintHelp(theArgv[0]);
-    return 1;
-  }
-
-  Handle(TDocStd_Document) aDoc;
-  Standard_Real aFileUnitFactor = 1.0;
-  RWMesh_CoordinateSystem aFileCoordSys = RWMesh_CoordinateSystem_Yup, aSystemCoordSys = RWMesh_CoordinateSystem_Zup;
-  Standard_Boolean toUseExistingDoc = Standard_False;
-  Standard_Boolean toFillIncomplete = Standard_True;
-  Standard_CString aDocName = NULL;
-  TCollection_AsciiString aFilePath;
-
-  for(Standard_Integer anArgIt = 1; anArgIt < theArgc; anArgIt++)
-  {
-    TCollection_AsciiString anArg(theArgv[anArgIt]);
-    anArg.LowerCase();
-    if(anArgIt + 1 < theArgc && anArg == "-fileunit")
-    {
-      const TCollection_AsciiString aUnitStr(theArgv[++anArgIt]);
-      aFileUnitFactor = UnitsAPI::AnyToSI(1.0, aUnitStr.ToCString());
-      if (aFileUnitFactor <= 0.0)
-      {
-        Message::SendFail() << "Error: wrong length unit '" << aUnitStr << "'";
-        return 1;
-      }
-    }
-    else if (anArgIt + 1 < theArgc && anArg == "-filecoordsys")
-    {
-      if (!parseCoordinateSystem(theArgv[++anArgIt], aFileCoordSys))
-      {
-        Message::SendFail() << "Error: unknown coordinate system '" << theArgv[anArgIt] << "'";
-        return 1;
-      }
-    }
-    else if (anArgIt + 1 < theArgc && anArg == "-systemcoordsys")
-    {
-      if (!parseCoordinateSystem(theArgv[++anArgIt], aSystemCoordSys))
-      {
-        Message::SendFail() << "Error: unknown coordinate system '" << theArgv[anArgIt] << "'";
-        return 1;
-      }
-    }
-    else if (anArg == "-fillincomplete")
-    {
-      toFillIncomplete = true;
-      if (anArgIt + 1 < theArgc && Draw::ParseOnOff(theArgv[anArgIt + 1], toFillIncomplete))
-      {
-        ++anArgIt;
-      }
-    }
-    else if (anArg == "-nocreatedoc")
-    {
-      toUseExistingDoc = true;
-    }
-    else if (aDocName == nullptr)
-    {
-      aDocName = theArgv[anArgIt];
-      DDocStd::GetDocument(aDocName, aDoc, Standard_False);
-    }
-    else if(aFilePath.IsEmpty())
-    {
-      aFilePath = theArgv[anArgIt];
-    }
-    else
-    {
-      Message::SendFail() << "Syntax error at '" << theArgv[anArgIt] << "'";
-      return 1;
-    }
-  }
-
-  if (aFilePath.IsEmpty() || aDocName == nullptr)
-  {
-    Message::SendFail() << "Syntax error: wrong number of arguments";
-    return 1;
-  }
-  
-  if (aDoc.IsNull())
-  {
-    if(toUseExistingDoc)
-    {
-      Message::SendFail() << "Error: document with name " << aDocName << " does not exist";
-      return 1;
-    }
-    Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
-    anApp->NewDocument("BinXCAF", aDoc);
-  }
-  else if (!toUseExistingDoc)
-  {
-    Message::SendFail() << "Error: document with name " << aDocName << " already exists\n";
-    return 1;
-  }
-
-  Standard_Real aScaleFactor = 1.;
-  if (!XCAFDoc_DocumentTool::GetLengthUnit(aDoc, aScaleFactor))
-  {
-    XSAlgo::AlgoContainer()->PrepareForTransfer();
-    aScaleFactor = UnitsMethods::GetCasCadeLengthUnit();
-  }
-
-  VrmlAPI_CafReader aVrmlReader;
-  aVrmlReader.SetDocument(aDoc);
-  aVrmlReader.SetFileLengthUnit(aFileUnitFactor);
-  aVrmlReader.SetSystemLengthUnit(aScaleFactor);
-  aVrmlReader.SetFileCoordinateSystem(aFileCoordSys);
-  aVrmlReader.SetSystemCoordinateSystem(aSystemCoordSys);
-  aVrmlReader.SetFillIncompleteDocument(toFillIncomplete);
-
-  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI, 1);
-  if (!aVrmlReader.Perform(aFilePath, aProgress->Start()))
-  {
-    if (aVrmlReader.ExtraStatus() != RWMesh_CafReaderStatusEx_Partial)
-    {
-      Message::SendFail() << "Error: file reading failed '" << aFilePath << "'";
-      return 1;
-    }
-    Message::SendWarning() <<
-      "Warning: file has been read paratially (due to unexpected EOF, syntax error, memory limit) " << aFilePath;
-  }
-
-  TDataStd_Name::Set(aDoc->GetData()->Root(), aDocName);
-  Handle(DDocStd_DrawDocument) aDD = new DDocStd_DrawDocument(aDoc);
-  Draw::Set(aDocName, aDD);
-
-  return 0;
-}
-
-//=======================================================================
-//function : WriteVrml
-//purpose  : Write DECAF document to Vrml
-//=======================================================================
-
-static Standard_Integer WriteVrml(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-  if (argc < 3)
-  {
-    di << "Use: " << argv[0] << " Doc filename: write document to Vrml file\n";
-    return 0;
-  }
-
-  Handle(TDocStd_Document) aDoc;
-  DDocStd::GetDocument(argv[1], aDoc);
-  if (aDoc.IsNull())
-  {
-    di << argv[1] << " is not a document\n";
-    return 1;
-  }
-
-  if (argc < 3 || argc > 5)
-  {
-    di << "wrong number of parameters\n";
-    return 0;
-  }
-
-  VrmlAPI_Writer writer;
-  writer.SetRepresentation(VrmlAPI_ShadedRepresentation);
-  Standard_Real aScaleFactorM = 1.;
-  if (!XCAFDoc_DocumentTool::GetLengthUnit(aDoc, aScaleFactorM))
-  {
-    XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
-    aScaleFactorM = UnitsMethods::GetCasCadeLengthUnit(UnitsMethods_LengthUnit_Meter);
-  }
-  if (!writer.WriteDoc(aDoc, argv[2], aScaleFactorM))
-  {
-    di << "Error: File " << argv[2] << " was not written\n";
-  }
-
-  return 0;
-}
-
-//=======================================================================
-//function : DumpConfiguration
-//purpose  : 
-//=======================================================================
-static Standard_Integer DumpConfiguration(Draw_Interpretor& theDI,
-                                          Standard_Integer theNbArgs,
-                                          const char** theArgVec)
+void XDEDRAW_Common::InitCommands(Draw_Interpretor& theDI)
 {
-  Handle(DE_Wrapper) aConf = DE_Wrapper::GlobalWrapper();
-  TCollection_AsciiString aPath;
-  Standard_Boolean aIsRecursive = Standard_True;
-  Standard_Boolean isHandleFormat = Standard_False;
-  Standard_Boolean isHandleVendors = Standard_False;
-  TColStd_ListOfAsciiString aFormats;
-  TColStd_ListOfAsciiString aVendors;
-  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
-  {
-    TCollection_AsciiString anArg(theArgVec[anArgIter]);
-    anArg.LowerCase();
-    if ((anArg == "-path") &&
-        (anArgIter + 1 < theNbArgs))
-    {
-      ++anArgIter;
-      aPath = theArgVec[anArgIter];
-    }
-    else if ((anArg == "-recursive") &&
-             (anArgIter + 1 < theNbArgs) &&
-             Draw::ParseOnOff(theArgVec[anArgIter + 1], aIsRecursive))
-    {
-      ++anArgIter;
-    }
-    else if (anArg == "-format")
-    {
-      isHandleFormat = Standard_True;
-      isHandleVendors = Standard_False;
-    }
-    else if (anArg == "-vendor")
-    {
-      isHandleFormat = Standard_False;
-      isHandleVendors = Standard_True;
-    }
-    else if (isHandleFormat)
-    {
-      aFormats.Append(theArgVec[anArgIter]);
-    }
-    else if (isHandleVendors)
-    {
-      aVendors.Append(theArgVec[anArgIter]);
-    }
-    else if (!isHandleFormat && !isHandleVendors)
-    {
-      Message::SendFail() << "Syntax error at argument '" << theArgVec[anArgIter] << "'\n";
-      return 1;
-    }
-  }
-  Standard_Boolean aStat = Standard_True;
-  if (!aPath.IsEmpty())
-  {
-    aStat = aConf->Save(aPath, aIsRecursive, aFormats ,aVendors);
-  }
-  else
-  {
-    theDI << aConf->Save(aIsRecursive, aFormats, aVendors) << "\n";
-  }
-  if (!aStat)
-  {
-    return 1;
-  }
-  return 0;
-}
-
-//=======================================================================
-//function : CompareConfiguration
-//purpose  : 
-//=======================================================================
-static Standard_Integer CompareConfiguration(Draw_Interpretor& theDI,
-                                             Standard_Integer theNbArgs,
-                                             const char** theArgVec)
-{
-  if (theNbArgs > 5)
-  {
-    theDI.PrintHelp(theArgVec[0]);
-    return 1;
-  }
-  Handle(DE_ConfigurationContext) aResourceFirst = new DE_ConfigurationContext();
-  if (!aResourceFirst->Load(theArgVec[1]))
-  {
-    Message::SendFail() << "Error: Can't load first configuration";
-    return 1;
-  }
-  Handle(DE_ConfigurationContext) aResourceSecond = new DE_ConfigurationContext();
-  if (!aResourceSecond->Load(theArgVec[2]))
-  {
-    Message::SendFail() << "Error: Can't load second configuration";
-    return 1;
-  }
-  const DE_ResourceMap& aResourceMapFirst = aResourceFirst->GetInternalMap();
-  const DE_ResourceMap& aResourceMapSecond = aResourceSecond->GetInternalMap();
-  Standard_Integer anDiffers = 0;
-  for (DE_ResourceMap::Iterator anOrigIt(aResourceMapFirst);
-       anOrigIt.More(); anOrigIt.Next())
-  {
-    const TCollection_AsciiString& anOrigValue = anOrigIt.Value();
-    const TCollection_AsciiString& anOrigKey = anOrigIt.Key();
-    TCollection_AsciiString aCompValue;
-    if (!aResourceMapSecond.Find(anOrigKey, aCompValue))
-    {
-      Message::SendWarning() << "Second configuration don't have the next scope : " << anOrigKey;
-      anDiffers++;
-    }
-    if (!aCompValue.IsEqual(anOrigValue))
-    {
-      Message::SendWarning() << "Configurations have differs value with the next scope :" << anOrigKey
-        << " First value : " << anOrigValue << " Second value : " << aCompValue;
-      anDiffers++;
-    }
-  }
-  TCollection_AsciiString aMessage;
-  if (aResourceMapFirst.Extent() != aResourceMapSecond.Extent() || anDiffers > 0)
-  {
-    Message::SendFail() << "Error: Configurations are not same : " << " Differs count : " << anDiffers << " Count of first's scopes : " << aResourceMapFirst.Extent()
-      << " Count of second's scopes : " << aResourceMapSecond.Extent();
-    return 1;
-  }
-  return 0;
-}
-
-//=======================================================================
-//function : LoadConfiguration
-//purpose  : 
-//=======================================================================
-static Standard_Integer LoadConfiguration(Draw_Interpretor& theDI,
-                                          Standard_Integer theNbArgs,
-                                          const char** theArgVec)
-{
-  if (theNbArgs > 4)
-  {
-    theDI.PrintHelp(theArgVec[0]);
-    return 1;
-  }
-  Handle(DE_Wrapper) aConf = DE_Wrapper::GlobalWrapper();
-  TCollection_AsciiString aString = theArgVec[1];
-  Standard_Boolean aIsRecursive = Standard_True;
-  if (theNbArgs == 4)
-  {
-    TCollection_AsciiString anArg = theArgVec[2];
-    anArg.LowerCase();
-    if (!(anArg == "-recursive") ||
-        !Draw::ParseOnOff(theArgVec[3], aIsRecursive))
-    {
-      Message::SendFail() << "Syntax error at argument '" << theArgVec[3] << "'";
-      return 1;
-    }
-  }
-  if (!aConf->Load(aString, aIsRecursive))
-  {
-    Message::SendFail() << "Error: configuration is incorrect";
-    return 1;
-  }
-  return 0;
-}
-
-//=======================================================================
-//function : ReadFile
-//purpose  : 
-//=======================================================================
-static Standard_Integer ReadFile(Draw_Interpretor& theDI,
-                                 Standard_Integer theNbArgs,
-                                 const char** theArgVec)
-{
-  if (theNbArgs > 6)
-  {
-    theDI.PrintHelp(theArgVec[0]);
-    return 1;
-  }
-  TCollection_AsciiString aDocShapeName;
-  TCollection_AsciiString aFilePath;
-  Handle(TDocStd_Document) aDoc;
-  Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
-  TCollection_AsciiString aConfString;
-  Standard_Boolean isNoDoc = (TCollection_AsciiString(theArgVec[0]) == "readfile");
-  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
-  {
-    TCollection_AsciiString anArg(theArgVec[anArgIter]);
-    anArg.LowerCase();
-    if ((anArg == "-conf") &&
-        (anArgIter + 1 < theNbArgs))
-    {
-      ++anArgIter;
-      aConfString = theArgVec[anArgIter];
-    }
-    else if (aDocShapeName.IsEmpty())
-    {
-      aDocShapeName = theArgVec[anArgIter];
-      Standard_CString aNameVar = aDocShapeName.ToCString();
-      if(!isNoDoc)
-      {
-        DDocStd::GetDocument(aNameVar, aDoc, Standard_False);
-      }
-    }
-    else if (aFilePath.IsEmpty())
-    {
-      aFilePath = theArgVec[anArgIter];
-    }
-    else
-    {
-      Message::SendFail() << "Syntax error at argument '" << theArgVec[anArgIter] << "'";
-      return 1;
-    }
-  }
-  if (aDocShapeName.IsEmpty() || aFilePath.IsEmpty())
-  {
-    Message::SendFail() << "Syntax error: wrong number of arguments";
-    return 1;
-  }
-  if (aDoc.IsNull() && !isNoDoc)
-  {
-    anApp->NewDocument(TCollection_ExtendedString("BinXCAF"), aDoc);
-    Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument(aDoc);
-    TDataStd_Name::Set(aDoc->GetData()->Root(), theArgVec[1]);
-    Draw::Set(theArgVec[1], aDrawDoc);
-  }
-
-  Handle(DE_Wrapper) aConf = DE_Wrapper::GlobalWrapper()->Copy();
-  Standard_Boolean aStat = Standard_True;
-  if (!aConfString.IsEmpty())
-  {
-    aStat = aConf->Load(aConfString);
-  }
-  if (aStat)
-  {
-    TopoDS_Shape aShape;
-    aStat = isNoDoc ? aConf->Read(aFilePath, aShape) : aConf->Read(aFilePath, aDoc);
-    if(isNoDoc && aStat)
-    {
-      DBRep::Set(aDocShapeName.ToCString(), aShape);
-    }
-  }
-  if (!aStat)
-  {
-    return 1;
-  }
-  return 0;
-}
-
-//=======================================================================
-//function : WriteFile
-//purpose  : 
-//=======================================================================
-static Standard_Integer WriteFile(Draw_Interpretor& theDI,
-                                  Standard_Integer theNbArgs,
-                                  const char** theArgVec)
-{
-  if (theNbArgs > 6)
-  {
-    theDI.PrintHelp(theArgVec[0]);
-    return 1;
-  }
-  TCollection_AsciiString aDocShapeName;
-  TCollection_AsciiString aFilePath;
-  Handle(TDocStd_Document) aDoc;
-  Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
-  TCollection_AsciiString aConfString;
-  Standard_Boolean isNoDoc = (TCollection_AsciiString(theArgVec[0]) == "writefile");
-  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
-  {
-    TCollection_AsciiString anArg(theArgVec[anArgIter]);
-    anArg.LowerCase();
-    if ((anArg == "-conf") &&
-        (anArgIter + 1 < theNbArgs))
-    {
-      ++anArgIter;
-      aConfString = theArgVec[anArgIter];
-    }
-    else if (aDocShapeName.IsEmpty())
-    {
-      aDocShapeName = theArgVec[anArgIter];
-      Standard_CString aNameVar = aDocShapeName.ToCString();
-      if (!isNoDoc)
-      {
-        DDocStd::GetDocument(aNameVar, aDoc, Standard_False);
-      }
-    }
-    else if (aFilePath.IsEmpty())
-    {
-      aFilePath = theArgVec[anArgIter];
-    }
-    else
-    {
-      Message::SendFail() << "Syntax error at argument '" << theArgVec[anArgIter] << "'";
-      return 1;
-    }
-  }
-  if (aDocShapeName.IsEmpty() || aFilePath.IsEmpty())
-  {
-    Message::SendFail() << "Syntax error: wrong number of arguments";
-    return 1;
-  }
-  if (aDoc.IsNull() && !isNoDoc)
-  {
-    Message::SendFail() << "Error: incorrect document";
-  }
-  Handle(DE_Wrapper) aConf = DE_Wrapper::GlobalWrapper()->Copy();
-  Standard_Boolean aStat = Standard_True;
-  if (!aConfString.IsEmpty())
-  {
-    aStat = aConf->Load(aConfString);
-  }
-  if (aStat)
-  {
-    if(isNoDoc)
-    {
-      TopoDS_Shape aShape = DBRep::Get(aDocShapeName);
-      if(aShape.IsNull())
-      {
-        Message::SendFail() << "Error: incorrect shape";
-        return 1;
-      }
-      aStat = aConf->Write(aFilePath, aShape);
-    }
-    else
-    {
-      aStat = aConf->Write(aFilePath, aDoc);
-    }
-  }
-  if (!aStat)
-  {
-    return 1;
-  }
-  return 0;
-}
-
-void XDEDRAW_Common::InitCommands(Draw_Interpretor& di)
-{
-  static Standard_Boolean initactor = Standard_False;
-  if (initactor)
+  static Standard_Boolean aIsActivated = Standard_False;
+  if (aIsActivated)
   {
     return;
   }
-  initactor = Standard_True;
-
-  Standard_CString g = "XDE translation commands";
-
-  di.Add("ReadIges", "Doc filename: Read IGES file to DECAF document", __FILE__, ReadIges, g);
-  di.Add("WriteIges", "Doc filename: Write DECAF document to IGES file", __FILE__, WriteIges, g);
-  di.Add("ReadStep",
-         "Doc filename [mode] [-stream]"
-         "\n\t\t: Read STEP file to a document."
-         "\n\t\t:  -stream read using istream reading interface (testing)",
-         __FILE__, ReadStep, g);
-  di.Add("WriteStep" ,
-         "Doc filename [mode=a [multifile_prefix] [label]] [-stream]"
-         "\n\t\t: Write DECAF document to STEP file"
-         "\n\t\t:   mode can be: a or 0 : AsIs (default)"
-         "\n\t\t:                f or 1 : FacettedBRep        s or 2 : ShellBasedSurfaceModel"
-         "\n\t\t:                m or 3 : ManifoldSolidBrep   w or 4 : GeometricCurveSet/WireFrame"
-         "\n\t\t:   multifile_prefix: triggers writing assembly components as separate files,"
-         "\n\t\t:                     and defines common prefix for their names"
-         "\n\t\t:   label  tag of the sub-assembly label to save only that sub-assembly"
-         "\n\t\t:  -stream read using ostream writing interface (testing)",
-         __FILE__, WriteStep, g);
+  aIsActivated = Standard_True;
 
-  di.Add("XFileList", "Print list of files that was transferred by the last transfer", __FILE__, GetDicWSList, g);
-  di.Add("XFileCur", ": returns name of file which is set as current", __FILE__, GetCurWS, g);
-  di.Add("XFileSet", "filename: Set the specified file to be the current one", __FILE__, SetCurWS, g);
-  di.Add("XFromShape", "shape: do fromshape command for all the files", __FILE__, FromShape, g);
+  Standard_CString aGroup = "XDE translation commands";
 
-  di.Add("XExpand", "XExpand Doc recursively(0/1) or XExpand Doc recursively(0/1) label1 label2 ..."
-         "or XExpand Doc recursively(0/1) shape1 shape2 ...", __FILE__, Expand, g);
-  di.Add("XExtract", "XExtract dstDoc [dstAssmblSh] srcDoc srcLabel1 srcLabel2 ...\t"
-         "Extracts given srcLabel1 srcLabel2 ... from srcDoc into given Doc or assembly shape",
-         __FILE__, Extract, g);
+  theDI.Add("XFileList", "Print list of files that was transferred by the last transfer", __FILE__, GetDicWSList, aGroup);
+  theDI.Add("XFileCur", ": returns name of file which is set as current", __FILE__, GetCurWS, aGroup);
+  theDI.Add("XFileSet", "filename: Set the specified file to be the current one", __FILE__, SetCurWS, aGroup);
+  theDI.Add("XFromShape", "shape: do fromshape command for all the files", __FILE__, FromShape, aGroup);
 
-  di.Add("ReadVrml",
-         "ReadVrml docName filePath [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]"
-         "\n\t\t:                   [-systemCoordSys {Zup|Yup}] [-noCreateDoc] [-fillIncomplete {ON|OFF}]"
-         "\n\t\t: Read Vrml file into XDE document."
-         "\n\t\t:   -fileCoordSys   coordinate system defined by Vrml file; Yup when not specified."
-         "\n\t\t:   -fileUnit       length unit of Vrml file content."
-         "\n\t\t:   -systemCoordSys result coordinate system; Zup when not specified."
-         "\n\t\t:   -noCreateDoc    read into existing XDE document."
-         "\n\t\t:   -fillIncomplete fill the document with partially retrieved data even if reader has failed with "
-         "error; true when not specified", 
-         __FILE__, ReadVrml, g);
-  di.Add("WriteVrml",
-         "WriteVrml Doc filename [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 0 by default]",
-         __FILE__, WriteVrml, g);
+  theDI.Add("XExpand", "XExpand Doc recursively(0/1) or XExpand Doc recursively(0/1) label1 label2 ..."
+            "or XExpand Doc recursively(0/1) shape1 shape2 ...", __FILE__, Expand, aGroup);
+  theDI.Add("XExtract", "XExtract dstDoc [dstAssmblSh] srcDoc srcLabel1 srcLabel2 ...\t"
+            "Extracts given srcLabel1 srcLabel2 ... from srcDoc into given Doc or assembly shape",
+            __FILE__, Extract, aGroup);
 
-  di.Add("DumpConfiguration",
-         "DumpConfiguration [-path <path>] [-recursive {on|off}] [-format fmt1 fmt2 ...] [-vendor vend1 vend2 ...]\n"
-         "\n\t\t: Dump special resource generated from global configuration."
-         "\n\t\t:   '-path' - save resource configuration to the file"
-         "\n\t\t:   '-recursive' - flag to generate a resource from providers. Default is On. Off disables other options"
-         "\n\t\t:   '-format' - flag to generate a resource for choosen formats. If list is empty, generate it for all"
-         "\n\t\t:   '-vendor' - flag to generate a resource for choosen vendors. If list is empty, generate it for all",
-         __FILE__, DumpConfiguration, g);
-  di.Add("LoadConfiguration",
-         "LoadConfiguration conf [-recursive {on|off}]\n"
-         "\n\t\t:   'conf' - path to the resouce file or string value in the special format"
-         "\n\t\t:   '-recursive' - flag to generate a resource for all providers. Default is true"
-         "\n\t\t: Configure global configuration according special resource",
-         __FILE__, LoadConfiguration, g);
-  di.Add("CompareConfiguration",
-         "CompareConfiguration conf1 conf2\n"
-         "\n\t\t:   'conf1' - path to the first resouce file or string value in the special format"
-         "\n\t\t:   'conf2' - path to the second resouce file or string value in the special format"
-         "\n\t\t: Compare two configurations",
-         __FILE__, CompareConfiguration, g);
-  di.Add("ReadFile",
-         "ReadFile docName filePath [-conf <value|path>]\n"
-         "\n\t\t: Read CAD file to document with registered format's providers. Use global configuration by default.",
-         __FILE__, ReadFile, g);
-  di.Add("readfile",
-         "readfile shapeName filePath [-conf <value|path>]\n"
-         "\n\t\t: Read CAD file to shape with registered format's providers. Use global configuration by default.",
-         __FILE__, ReadFile, g);
-  di.Add("WriteFile",
-         "WriteFile docName filePath [-conf <value|path>]\n"
-         "\n\t\t: Write CAD file to document with registered format's providers. Use global configuration by default.",
-         __FILE__, WriteFile, g);
-  di.Add("writefile",
-         "writefile shapeName filePath [-conf <value|path>]\n"
-         "\n\t\t: Write CAD file to shape with registered format's providers. Use global configuration by default.",
-         __FILE__, WriteFile, g);
+  // Load XSDRAW session for pilot activation
+  XSDRAW::LoadDraw(theDI);
 }
index d945f419ee90f074c3e19afc493e67f3a3fa988c..5193f683a8eac564ef17f8821a72f42769b4c72c 100644 (file)
 
 #include <Draw_Interpretor.hxx>
 
-
-
 class XDEDRAW_Common 
 {
-public:
-
   DEFINE_STANDARD_ALLOC
-
-  
+public:
   Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands);
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
 };
 
-
-
-
-
-
-
 #endif // _XDEDRAW_Common_HeaderFile
index efe8bb8e3fc82265f6fda79c39d0daaeef291d8d..970529952c453ef77b1b534139d669d0bc6fa770 100644 (file)
@@ -93,7 +93,7 @@ static IFSelect_ReturnStatus XSControl_newmodel(const Handle(IFSelect_SessionPil
   if (!XSControl::Session(pilot)->NewModel().IsNull()) return IFSelect_RetDone;
   Message_Messenger::StreamBuffer sout = Message::SendInfo();
   sout<<"No new Model produced"<<std::endl;
-  return IFSelect_RetFail;
+  return IFSelect_RetDone;
 }
 
 
index c94fe0bdf8ea0da1540354ccaa4147a15032a2fb..21ec67fbb8c7e4fec21e2c138e1d543b41b26386 100644 (file)
@@ -36,6 +36,8 @@ class Interface_CheckIterator;
 class XSControl_WorkSession;
 DEFINE_STANDARD_HANDLE(XSControl_WorkSession, IFSelect_WorkSession)
 
+using XSControl_WorkSessionMap = NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>;
+
 //! This WorkSession completes the basic one, by adding :
 //! - use of Controller, with norm selection...
 //! - management of transfers (both ways) with auxiliary classes
@@ -82,12 +84,12 @@ class XSControl_WorkSession : public IFSelect_WorkSession
   
   //! Returns the current Context List, Null if not defined
   //! The Context is given to the TransientProcess for TransferRead
-  const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> & Context() const
+  const XSControl_WorkSessionMap& Context() const
   { return myContext; }
   
   //! Sets the current Context List, as a whole
   //! Sets it to the TransferReader
-  Standard_EXPORT void SetAllContext (const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& theContext);
+  Standard_EXPORT void SetAllContext (const XSControl_WorkSessionMap& theContext);
   
   //! Clears the whole current Context (nullifies it)
   Standard_EXPORT void ClearContext();
@@ -199,7 +201,7 @@ class XSControl_WorkSession : public IFSelect_WorkSession
   Handle(XSControl_Controller) myController;
   Handle(XSControl_TransferReader) myTransferReader;
   Handle(XSControl_TransferWriter) myTransferWriter;
-  NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> myContext;
+  XSControl_WorkSessionMap myContext;
   Handle(XSControl_Vars) myVars;
 };
 
index c4638e2427e94ee3d579e7229c512f7bfb7de483..79fe1e8d1174cdb980c209905ab995ad2f7325a2 100644 (file)
@@ -15,6 +15,7 @@
 #include <DBRep.hxx>
 #include <Draw_Appli.hxx>
 #include <Draw_Printer.hxx>
+#include <Draw_PluginMacro.hxx>
 #include <IFSelect_Functions.hxx>
 #include <IFSelect_SessionPilot.hxx>
 #include <Interface_InterfaceModel.hxx>
@@ -30,6 +31,7 @@
 #include <Transfer_FinderProcess.hxx>
 #include <Transfer_TransientProcess.hxx>
 #include <TransferBRep.hxx>
+#include <XSAlgo.hxx>
 #include <XSControl.hxx>
 #include <XSControl_Controller.hxx>
 #include <XSControl_FuncShape.hxx>
 #include <XSControl_WorkSession.hxx>
 #include <XSDRAW.hxx>
 #include <XSDRAW_Vars.hxx>
+#include <UnitsMethods.hxx>
+#include <Interface_Static.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
 
 #include <iostream>
 #include <string>
-//#include <XSDRAW_Shape.hxx>
-static int deja = 0, dejald = 0;
-//unused variable 
-//static int okxset = 0;
+namespace
+{
+  static int deja = 0, dejald = 0;
 
-static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> theolds;
-static Handle(TColStd_HSequenceOfAsciiString) thenews;
+  static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> theolds;
+  static Handle(TColStd_HSequenceOfAsciiString) thenews;
 
-static Handle(IFSelect_SessionPilot)    thepilot;  // detient Session, Model
+  static Handle(IFSelect_SessionPilot)    thepilot;  // detient Session, Model
+
+  //=======================================================================
+  //function : collectActiveWorkSessions
+  //purpose  :
+  //=======================================================================
+  static void collectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS,
+                                        const TCollection_AsciiString& theName,
+                                        XSControl_WorkSessionMap& theMap,
+                                        const Standard_Boolean theIsFirst)
+  {
+    if (theIsFirst)
+    {
+      theMap.Clear();
+    }
+    if (theWS.IsNull())
+    {
+      return;
+    }
+    if (theMap.IsBound(theName))
+    {
+      return;
+    }
+    theMap.Bind(theName, theWS);
+    for (XSControl_WorkSessionMap::Iterator anIter(theWS->Context());
+         anIter.More(); anIter.Next())
+    {
+      Handle(XSControl_WorkSession) aWS = Handle(XSControl_WorkSession)::DownCast(anIter.Value());
+      collectActiveWorkSessions(aWS, anIter.Key(), theMap, Standard_False);
+    }
+  }
+}
 
 static Standard_Integer XSTEPDRAWRUN (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
 {
@@ -104,6 +139,7 @@ static Standard_Integer XSTEPDRAWRUN (Draw_Interpretor& di, Standard_Integer arg
   IFSelect_Functions::Init();
   XSControl_Functions::Init();
   XSControl_FuncShape::Init();
+  XSAlgo::Init();
 //  XSDRAW_Shape::Init();   passe a present par theCommands
   return Standard_True;
 }
@@ -167,7 +203,10 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
     Handle(IFSelect_SessionPilot)  XSDRAW::Pilot ()
       {  return thepilot;  }
 
-    Handle(XSControl_WorkSession)  XSDRAW::Session ()
+    void XSDRAW::SetSession(const Handle(XSControl_WorkSession)& theSession)
+      {  Pilot()->SetSession(theSession);  }
+
+    const Handle(XSControl_WorkSession)  XSDRAW::Session ()
       {  return XSControl::Session(thepilot);  }
 
     void  XSDRAW::SetController (const Handle(XSControl_Controller)& control)
@@ -289,16 +328,71 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
   (Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name)
 {  return XSControl_FuncShape::MoreShapes  (XSDRAW::Session(),list,name);  }
 
+//=======================================================================
+//function : GetLengthUnit
+//purpose  :
+//=======================================================================
+Standard_Real XSDRAW::GetLengthUnit(const Handle(TDocStd_Document)& theDoc)
+{
+  if (!theDoc.IsNull())
+  {
+    Standard_Real aUnit = 1.;
+    if (XCAFDoc_DocumentTool::GetLengthUnit(theDoc, aUnit,
+      UnitsMethods_LengthUnit_Millimeter))
+    {
+      return aUnit;
+    }
+  }
+  if (Interface_Static::IsPresent("xstep.cascade.unit"))
+  {
+    UnitsMethods::SetCasCadeLengthUnit(Interface_Static::IVal("xstep.cascade.unit"));
+  }
+  return UnitsMethods::GetCasCadeLengthUnit();
+}
+
+//=======================================================================
+//function : WorkSessionList
+//purpose  :
+//=======================================================================
+XSControl_WorkSessionMap& XSDRAW::WorkSessionList()
+{
+  static std::shared_ptr<XSControl_WorkSessionMap> THE_PREVIOUS_WORK_SESSIONS;
+  if (THE_PREVIOUS_WORK_SESSIONS == nullptr)
+  {
+    THE_PREVIOUS_WORK_SESSIONS =
+      std::make_shared<XSControl_WorkSessionMap>();
+  }
+  return *THE_PREVIOUS_WORK_SESSIONS;
+}
+
+//=======================================================================
+//function : CollectActiveWorkSessions
+//purpose  :
+//=======================================================================
+void XSDRAW::CollectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS,
+  const TCollection_AsciiString& theName,
+  XSControl_WorkSessionMap& theMap)
+{
+  collectActiveWorkSessions(theWS, theName, theMap, Standard_True);
+}
 
-//  FONCTION POUR LE DEBUG
+//=======================================================================
+//function : CollectActiveWorkSessions
+//purpose  :
+//=======================================================================
+void XSDRAW::CollectActiveWorkSessions(const TCollection_AsciiString& theName)
+{
+  collectActiveWorkSessions(Session(), theName, WorkSessionList(), Standard_True);
+}
 
-Standard_Integer XSDRAW_WHAT (const Handle(Standard_Transient)& ent)
+//=======================================================================
+//function : Factory
+//purpose  :
+//=======================================================================
+void XSDRAW::Factory(Draw_Interpretor& theDI)
 {
-  if (ent.IsNull()) { std::cout<<"(Null Handle)"<<std::endl; return 0; }
-  Handle(Interface_InterfaceModel) model = XSDRAW::Model();
-  if (model.IsNull()) { std::cout<<"(No model)  Type:"<<ent->DynamicType()->Name()<<std::endl; return 0; }
-  std::cout<<" Num/Id :";  
-  model->Print (ent, std::cout, 0);
-  std::cout<<"  --  Recorded Type:"<<model->TypeName (ent)<<std::endl;
-  return model->Number(ent);
+  XSDRAW::LoadDraw(theDI);
 }
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAW)
index 70da6cbb7b7b77b8fdf627416dab78327b85a585..2a9a6da5a33327274b2b5ce7e84225ca0ee42d05 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <Draw_Interpretor.hxx>
 #include <TColStd_HSequenceOfTransient.hxx>
+#include <XSControl_WorkSession.hxx>
 #include <TopTools_HSequenceOfShape.hxx>
 class IFSelect_SessionPilot;
 class XSControl_WorkSession;
@@ -33,6 +34,7 @@ class Transfer_TransientProcess;
 class Transfer_FinderProcess;
 class XSControl_TransferReader;
 class TCollection_AsciiString;
+class TDocStd_Document;
 
 
 //! Basic package to work functions of X-STEP (IFSelect & Co)
@@ -96,10 +98,14 @@ class XSDRAW
   
   //! Returns the SessionPilot (can be used for direct call)
   Standard_EXPORT static Handle(IFSelect_SessionPilot) Pilot();
+
+  //! Updates the WorkSession defined in AddDraw (through Pilot)
+  //! It is from XSControl, it brings functionalities for Transfers
+  Standard_EXPORT static void SetSession(const Handle(XSControl_WorkSession)& theSession);
   
   //! Returns the WorkSession defined in AddDraw (through Pilot)
   //! It is from XSControl, it brings functionalities for Transfers
-  Standard_EXPORT static Handle(XSControl_WorkSession) Session();
+  Standard_EXPORT static const Handle(XSControl_WorkSession) Session();
   
   //! Defines a Controller for the command "xinit" and applies it
   //! (i.e. calls its method Customise)
@@ -202,6 +208,30 @@ class XSDRAW
   //! completed (Append without Clear) by the Shapes found
   //! Returns 0 if no Shape could be found
   Standard_EXPORT static Standard_Integer MoreShapes (Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name);
+
+  //! Extracts length unit from the static interface or document.
+  //! Document unit has the highest priority.
+  //! @return length unit in MM. 1.0 by default
+  Standard_EXPORT static Standard_Real GetLengthUnit(const Handle(TDocStd_Document)& theDoc = nullptr);
+
+  //! Returns avaliable work sessions with their associated files.
+  Standard_EXPORT static XSControl_WorkSessionMap& WorkSessionList();
+
+  //! Binds session and name into map recursively.
+  //! Recursively means extract sub-sessions from main session.
+  //! @param[in] theWS the session object
+  //! @param[in] theName the session file name
+  //! @param[out] theMap collection to keep session info
+  Standard_EXPORT static void CollectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS,
+                                                        const TCollection_AsciiString& theName,
+                                                        XSControl_WorkSessionMap& theMap);
+
+  //! Binds current session with input name.
+  //! @param[in] theName the session file name
+  Standard_EXPORT static void CollectActiveWorkSessions(const TCollection_AsciiString& theName);
+
+  //! Loads all Draw commands of XSDRAW. Used for plugin.
+  Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
 };
 
 #endif // _XSDRAW_HeaderFile
diff --git a/src/XSDRAWDE/FILES b/src/XSDRAWDE/FILES
new file mode 100644 (file)
index 0000000..9025c37
--- /dev/null
@@ -0,0 +1,2 @@
+XSDRAWDE.cxx
+XSDRAWDE.hxx
diff --git a/src/XSDRAWDE/XSDRAWDE.cxx b/src/XSDRAWDE/XSDRAWDE.cxx
new file mode 100644 (file)
index 0000000..b88b47f
--- /dev/null
@@ -0,0 +1,427 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XSDRAWDE.hxx>
+
+#include <DBRep.hxx>
+#include <DDocStd.hxx>
+#include <DDocStd_DrawDocument.hxx>
+#include <DE_ConfigurationContext.hxx>
+#include <DE_Provider.hxx>
+#include <DE_Wrapper.hxx>
+#include <DEBRepCascade_ConfigurationNode.hxx>
+#include <Draw.hxx>
+#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
+#include <Draw_ProgressIndicator.hxx>
+#include <Message.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDocStd_Application.hxx>
+#include <TopoDS_Shape.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <XSDRAW.hxx>
+
+//=======================================================================
+//function : DumpConfiguration
+//purpose  :
+//=======================================================================
+static Standard_Integer DumpConfiguration(Draw_Interpretor& theDI,
+                                          Standard_Integer theNbArgs,
+                                          const char** theArgVec)
+{
+  Handle(DE_Wrapper) aConf = DE_Wrapper::GlobalWrapper();
+  TCollection_AsciiString aPath;
+  Standard_Boolean aIsRecursive = Standard_True;
+  Standard_Boolean isHandleFormat = Standard_False;
+  Standard_Boolean isHandleVendors = Standard_False;
+  TColStd_ListOfAsciiString aFormats;
+  TColStd_ListOfAsciiString aVendors;
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArg(theArgVec[anArgIter]);
+    anArg.LowerCase();
+    if ((anArg == "-path") &&
+        (anArgIter + 1 < theNbArgs))
+    {
+      ++anArgIter;
+      aPath = theArgVec[anArgIter];
+    }
+    else if ((anArg == "-recursive") &&
+             (anArgIter + 1 < theNbArgs) &&
+             Draw::ParseOnOff(theArgVec[anArgIter + 1], aIsRecursive))
+    {
+      ++anArgIter;
+    }
+    else if (anArg == "-format")
+    {
+      isHandleFormat = Standard_True;
+      isHandleVendors = Standard_False;
+    }
+    else if (anArg == "-vendor")
+    {
+      isHandleFormat = Standard_False;
+      isHandleVendors = Standard_True;
+    }
+    else if (isHandleFormat)
+    {
+      aFormats.Append(theArgVec[anArgIter]);
+    }
+    else if (isHandleVendors)
+    {
+      aVendors.Append(theArgVec[anArgIter]);
+    }
+    else if (!isHandleFormat && !isHandleVendors)
+    {
+      theDI << "Syntax error at argument '" << theArgVec[anArgIter] << "'\n";
+      return 1;
+    }
+  }
+  Standard_Boolean aStat = Standard_True;
+  if (!aPath.IsEmpty())
+  {
+    aStat = aConf->Save(aPath, aIsRecursive, aFormats, aVendors);
+  }
+  else
+  {
+    theDI << aConf->Save(aIsRecursive, aFormats, aVendors) << "\n";
+  }
+  if (!aStat)
+  {
+    return 1;
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : CompareConfiguration
+//purpose  :
+//=======================================================================
+static Standard_Integer CompareConfiguration(Draw_Interpretor& theDI,
+                                             Standard_Integer theNbArgs,
+                                             const char** theArgVec)
+{
+  if (theNbArgs > 5)
+  {
+    theDI.PrintHelp(theArgVec[0]);
+    return 1;
+  }
+  Handle(DE_ConfigurationContext) aResourceFirst = new DE_ConfigurationContext();
+  if (!aResourceFirst->Load(theArgVec[1]))
+  {
+    theDI << "Error: Can't load first configuration\n";
+    return 1;
+  }
+  Handle(DE_ConfigurationContext) aResourceSecond = new DE_ConfigurationContext();
+  if (!aResourceSecond->Load(theArgVec[2]))
+  {
+    theDI << "Error: Can't load second configuration\n";
+    return 1;
+  }
+  const DE_ResourceMap& aResourceMapFirst = aResourceFirst->GetInternalMap();
+  const DE_ResourceMap& aResourceMapSecond = aResourceSecond->GetInternalMap();
+  Standard_Integer anDiffers = 0;
+  for (DE_ResourceMap::Iterator anOrigIt(aResourceMapFirst);
+       anOrigIt.More(); anOrigIt.Next())
+  {
+    const TCollection_AsciiString& anOrigValue = anOrigIt.Value();
+    const TCollection_AsciiString& anOrigKey = anOrigIt.Key();
+    TCollection_AsciiString aCompValue;
+    if (!aResourceMapSecond.Find(anOrigKey, aCompValue))
+    {
+      Message::SendWarning() << "Second configuration don't have the next scope : " << anOrigKey;
+      anDiffers++;
+    }
+    if (!aCompValue.IsEqual(anOrigValue))
+    {
+      Message::SendWarning() << "Configurations have differs value with the next scope :" << anOrigKey
+        << " First value : " << anOrigValue << " Second value : " << aCompValue;
+      anDiffers++;
+    }
+  }
+  TCollection_AsciiString aMessage;
+  if (aResourceMapFirst.Extent() != aResourceMapSecond.Extent() || anDiffers > 0)
+  {
+    theDI << "Error: Configurations are not same : " << " Differs count : "
+      << anDiffers << " Count of first's scopes : " << aResourceMapFirst.Extent()
+      << " Count of second's scopes : " << aResourceMapSecond.Extent() << "\n";
+    return 1;
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : LoadConfiguration
+//purpose  :
+//=======================================================================
+static Standard_Integer LoadConfiguration(Draw_Interpretor& theDI,
+                                          Standard_Integer theNbArgs,
+                                          const char** theArgVec)
+{
+  if (theNbArgs > 4)
+  {
+    theDI.PrintHelp(theArgVec[0]);
+    return 1;
+  }
+  Handle(DE_Wrapper) aConf = DE_Wrapper::GlobalWrapper();
+  TCollection_AsciiString aString = theArgVec[1];
+  Standard_Boolean aIsRecursive = Standard_True;
+  if (theNbArgs == 4)
+  {
+    TCollection_AsciiString anArg = theArgVec[2];
+    anArg.LowerCase();
+    if (!(anArg == "-recursive") ||
+        !Draw::ParseOnOff(theArgVec[3], aIsRecursive))
+    {
+      theDI << "Syntax error at argument '" << theArgVec[3] << "'\n";
+      return 1;
+    }
+  }
+  if (!aConf->Load(aString, aIsRecursive))
+  {
+    theDI << "Error: configuration is incorrect\n";
+    return 1;
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : ReadFile
+//purpose  :
+//=======================================================================
+static Standard_Integer ReadFile(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
+{
+  if (theNbArgs > 6)
+  {
+    theDI.PrintHelp(theArgVec[0]);
+    return 1;
+  }
+  TCollection_AsciiString aDocShapeName;
+  TCollection_AsciiString aFilePath;
+  Handle(TDocStd_Document) aDoc;
+  Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
+  TCollection_AsciiString aConfString;
+  Standard_Boolean isNoDoc = (TCollection_AsciiString(theArgVec[0]) == "readfile");
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArg(theArgVec[anArgIter]);
+    anArg.LowerCase();
+    if ((anArg == "-conf") &&
+        (anArgIter + 1 < theNbArgs))
+    {
+      ++anArgIter;
+      aConfString = theArgVec[anArgIter];
+    }
+    else if (aDocShapeName.IsEmpty())
+    {
+      aDocShapeName = theArgVec[anArgIter];
+      Standard_CString aNameVar = aDocShapeName.ToCString();
+      if (!isNoDoc)
+      {
+        DDocStd::GetDocument(aNameVar, aDoc, Standard_False);
+      }
+    }
+    else if (aFilePath.IsEmpty())
+    {
+      aFilePath = theArgVec[anArgIter];
+    }
+    else
+    {
+      theDI << "Syntax error at argument '" << theArgVec[anArgIter] << "'\n";
+      return 1;
+    }
+  }
+  if (aDocShapeName.IsEmpty() || aFilePath.IsEmpty())
+  {
+    theDI << "Syntax error: wrong number of arguments\n";
+    return 1;
+  }
+  if (aDoc.IsNull() && !isNoDoc)
+  {
+    anApp->NewDocument(TCollection_ExtendedString("BinXCAF"), aDoc);
+    Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument(aDoc);
+    TDataStd_Name::Set(aDoc->GetData()->Root(), theArgVec[1]);
+    Draw::Set(theArgVec[1], aDrawDoc);
+  }
+
+  Handle(DE_Wrapper) aConf = DE_Wrapper::GlobalWrapper()->Copy();
+  Standard_Boolean aStat = Standard_True;
+  if (!aConfString.IsEmpty())
+  {
+    aStat = aConf->Load(aConfString);
+  }
+  if (aStat)
+  {
+    TopoDS_Shape aShape;
+    aStat = isNoDoc ? aConf->Read(aFilePath, aShape) : aConf->Read(aFilePath, aDoc);
+    if (isNoDoc && aStat)
+    {
+      DBRep::Set(aDocShapeName.ToCString(), aShape);
+    }
+  }
+  if (!aStat)
+  {
+    return 1;
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : WriteFile
+//purpose  :
+//=======================================================================
+static Standard_Integer WriteFile(Draw_Interpretor& theDI,
+                                  Standard_Integer theNbArgs,
+                                  const char** theArgVec)
+{
+  if (theNbArgs > 6)
+  {
+    theDI.PrintHelp(theArgVec[0]);
+    return 1;
+  }
+  TCollection_AsciiString aDocShapeName;
+  TCollection_AsciiString aFilePath;
+  Handle(TDocStd_Document) aDoc;
+  TCollection_AsciiString aConfString;
+  Standard_Boolean isNoDoc = (TCollection_AsciiString(theArgVec[0]) == "writefile");
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArg(theArgVec[anArgIter]);
+    anArg.LowerCase();
+    if ((anArg == "-conf") &&
+        (anArgIter + 1 < theNbArgs))
+    {
+      ++anArgIter;
+      aConfString = theArgVec[anArgIter];
+    }
+    else if (aDocShapeName.IsEmpty())
+    {
+      aDocShapeName = theArgVec[anArgIter];
+      Standard_CString aNameVar = aDocShapeName.ToCString();
+      if (!isNoDoc)
+      {
+        DDocStd::GetDocument(aNameVar, aDoc, Standard_False);
+      }
+    }
+    else if (aFilePath.IsEmpty())
+    {
+      aFilePath = theArgVec[anArgIter];
+    }
+    else
+    {
+      theDI << "Syntax error at argument '" << theArgVec[anArgIter] << "'\n";
+      return 1;
+    }
+  }
+  if (aDocShapeName.IsEmpty() || aFilePath.IsEmpty())
+  {
+    theDI << "Syntax error: wrong number of arguments\n";
+    return 1;
+  }
+  if (aDoc.IsNull() && !isNoDoc)
+  {
+    theDI << "Error: incorrect document\n";
+    return 1;
+  }
+  Handle(DE_Wrapper) aConf = DE_Wrapper::GlobalWrapper()->Copy();
+  Standard_Boolean aStat = Standard_True;
+  if (!aConfString.IsEmpty())
+  {
+    aStat = aConf->Load(aConfString);
+  }
+  if (aStat)
+  {
+    if (isNoDoc)
+    {
+      TopoDS_Shape aShape = DBRep::Get(aDocShapeName);
+      if (aShape.IsNull())
+      {
+        theDI << "Error: incorrect shape " << aDocShapeName << "\n";
+        return 1;
+      }
+      aStat = aConf->Write(aFilePath, aShape);
+    }
+    else
+    {
+      aStat = aConf->Write(aFilePath, aDoc);
+    }
+  }
+  if (!aStat)
+  {
+    return 1;
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : Factory
+//purpose  :
+//=======================================================================
+void XSDRAWDE::Factory(Draw_Interpretor& theDI)
+{
+  static Standard_Boolean aIsActivated = Standard_False;
+  if (aIsActivated)
+  {
+    return;
+  }
+  aIsActivated = Standard_True;
+
+  Standard_CString aGroup = "XDE translation commands";
+  theDI.Add("DumpConfiguration",
+            "DumpConfiguration [-path <path>] [-recursive {on|off}] [-format fmt1 fmt2 ...] [-vendor vend1 vend2 ...]\n"
+            "\n\t\t: Dump special resource generated from global configuration."
+            "\n\t\t:   '-path' - save resource configuration to the file"
+            "\n\t\t:   '-recursive' - flag to generate a resource from providers. Default is On. Off disables other options"
+            "\n\t\t:   '-format' - flag to generate a resource for choosen formats. If list is empty, generate it for all"
+            "\n\t\t:   '-vendor' - flag to generate a resource for choosen vendors. If list is empty, generate it for all",
+            __FILE__, DumpConfiguration, aGroup);
+  theDI.Add("LoadConfiguration",
+            "LoadConfiguration conf [-recursive {on|off}]\n"
+            "\n\t\t:   'conf' - path to the resouce file or string value in the special format"
+            "\n\t\t:   '-recursive' - flag to generate a resource for all providers. Default is true"
+            "\n\t\t: Configure global configuration according special resource",
+            __FILE__, LoadConfiguration, aGroup);
+  theDI.Add("CompareConfiguration",
+            "CompareConfiguration conf1 conf2\n"
+            "\n\t\t:   'conf1' - path to the first resouce file or string value in the special format"
+            "\n\t\t:   'conf2' - path to the second resouce file or string value in the special format"
+            "\n\t\t: Compare two configurations",
+            __FILE__, CompareConfiguration, aGroup);
+  theDI.Add("ReadFile",
+            "ReadFile docName filePath [-conf <value|path>]\n"
+            "\n\t\t: Read CAD file to document with registered format's providers. Use global configuration by default.",
+            __FILE__, ReadFile, aGroup);
+  theDI.Add("readfile",
+            "readfile shapeName filePath [-conf <value|path>]\n"
+            "\n\t\t: Read CAD file to shape with registered format's providers. Use global configuration by default.",
+            __FILE__, ReadFile, aGroup);
+  theDI.Add("WriteFile",
+            "WriteFile docName filePath [-conf <value|path>]\n"
+            "\n\t\t: Write CAD file to document with registered format's providers. Use global configuration by default.",
+            __FILE__, WriteFile, aGroup);
+  theDI.Add("writefile",
+            "writefile shapeName filePath [-conf <value|path>]\n"
+            "\n\t\t: Write CAD file to shape with registered format's providers. Use global configuration by default.",
+            __FILE__, WriteFile, aGroup);
+
+  // Load XSDRAW session for pilot activation
+  XSDRAW::LoadDraw(theDI);
+
+  // Workaround to force load TKDECascade lib
+  DEBRepCascade_ConfigurationNode aTmpObj;
+  (void)aTmpObj;
+}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWDE)
diff --git a/src/XSDRAWDE/XSDRAWDE.hxx b/src/XSDRAWDE/XSDRAWDE.hxx
new file mode 100644 (file)
index 0000000..d3c393f
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XSDRAWDE_HeaderFile
+#define _XSDRAWDE_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+
+#include <Draw_Interpretor.hxx>
+
+class XSDRAWDE
+{
+  DEFINE_STANDARD_ALLOC
+public:
+
+  //! Loads all Draw commands of XSDRAWDE. Used for plugin.
+  Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
+};
+
+#endif // _XSDRAWDE_HeaderFile
diff --git a/src/XSDRAWGLTF/FILES b/src/XSDRAWGLTF/FILES
new file mode 100644 (file)
index 0000000..28bb8b0
--- /dev/null
@@ -0,0 +1,2 @@
+XSDRAWGLTF.cxx
+XSDRAWGLTF.hxx
diff --git a/src/XSDRAWGLTF/XSDRAWGLTF.cxx b/src/XSDRAWGLTF/XSDRAWGLTF.cxx
new file mode 100644 (file)
index 0000000..6c7f9cc
--- /dev/null
@@ -0,0 +1,602 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XSDRAWGLTF.hxx>
+
+#include <DBRep.hxx>
+#include <DDocStd.hxx>
+#include <DDocStd_DrawDocument.hxx>
+#include <Draw.hxx>
+#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
+#include <Draw_ProgressIndicator.hxx>
+#include <RWGltf_CafReader.hxx>
+#include <RWGltf_CafWriter.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDocStd_Application.hxx>
+#include <TopoDS_Shape.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
+#include <XCAFDoc_ShapeTool.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <XSDRAW.hxx>
+
+//=============================================================================
+//function : parseNameFormat
+//purpose  : Parse RWMesh_NameFormat enumeration
+//=============================================================================
+static bool parseNameFormat(const char* theArg,
+                            RWMesh_NameFormat& theFormat)
+{
+  TCollection_AsciiString aName(theArg);
+  aName.LowerCase();
+  if (aName == "empty")
+  {
+    theFormat = RWMesh_NameFormat_Empty;
+  }
+  else if (aName == "product"
+           || aName == "prod")
+  {
+    theFormat = RWMesh_NameFormat_Product;
+  }
+  else if (aName == "instance"
+           || aName == "inst")
+  {
+    theFormat = RWMesh_NameFormat_Instance;
+  }
+  else if (aName == "instanceorproduct"
+           || aName == "instance||product"
+           || aName == "instance|product"
+           || aName == "instorprod"
+           || aName == "inst||prod"
+           || aName == "inst|prod")
+  {
+    theFormat = RWMesh_NameFormat_InstanceOrProduct;
+  }
+  else if (aName == "productorinstance"
+           || aName == "product||instance"
+           || aName == "product|instance"
+           || aName == "prodorinst"
+           || aName == "prod||inst"
+           || aName == "prod|inst")
+  {
+    theFormat = RWMesh_NameFormat_ProductOrInstance;
+  }
+  else if (aName == "productandinstance"
+           || aName == "prodandinst"
+           || aName == "product&instance"
+           || aName == "prod&inst")
+  {
+    theFormat = RWMesh_NameFormat_ProductAndInstance;
+  }
+  else if (aName == "productandinstanceandocaf"
+           || aName == "verbose"
+           || aName == "debug")
+  {
+    theFormat = RWMesh_NameFormat_ProductAndInstanceAndOcaf;
+  }
+  else
+  {
+    return false;
+  }
+  return true;
+}
+
+//=============================================================================
+//function : parseCoordinateSystem
+//purpose  : Parse RWMesh_CoordinateSystem enumeration
+//=============================================================================
+static bool parseCoordinateSystem(const char* theArg,
+                                  RWMesh_CoordinateSystem& theSystem)
+{
+  TCollection_AsciiString aCSStr(theArg);
+  aCSStr.LowerCase();
+  if (aCSStr == "zup")
+  {
+    theSystem = RWMesh_CoordinateSystem_Zup;
+  }
+  else if (aCSStr == "yup")
+  {
+    theSystem = RWMesh_CoordinateSystem_Yup;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+
+//=============================================================================
+//function : ReadGltf
+//purpose  : Reads glTF file
+//=============================================================================
+static Standard_Integer ReadGltf(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
+{
+  TCollection_AsciiString aDestName, aFilePath;
+  Standard_Boolean toUseExistingDoc = Standard_False;
+  Standard_Boolean toListExternalFiles = Standard_False;
+  Standard_Boolean isParallel = Standard_False;
+  Standard_Boolean isDoublePrec = Standard_False;
+  Standard_Boolean toSkipLateDataLoading = Standard_False;
+  Standard_Boolean toKeepLateData = Standard_True;
+  Standard_Boolean toPrintDebugInfo = Standard_False;
+  Standard_Boolean toLoadAllScenes = Standard_False;
+  Standard_Boolean toPrintAssetInfo = Standard_False;
+  Standard_Boolean isNoDoc = (TCollection_AsciiString(theArgVec[0]) == "readgltf");
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArgCase(theArgVec[anArgIter]);
+    anArgCase.LowerCase();
+    if (!isNoDoc
+      && (anArgCase == "-nocreate"
+        || anArgCase == "-nocreatedoc"))
+    {
+      toUseExistingDoc = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArgCase == "-parallel")
+    {
+      isParallel = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArgCase == "-doubleprec"
+      || anArgCase == "-doubleprecision"
+      || anArgCase == "-singleprec"
+      || anArgCase == "-singleprecision")
+    {
+      isDoublePrec = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
+      if (anArgCase.StartsWith("-single"))
+      {
+        isDoublePrec = !isDoublePrec;
+      }
+    }
+    else if (anArgCase == "-skiplateloading")
+    {
+      toSkipLateDataLoading = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArgCase == "-keeplate")
+    {
+      toKeepLateData = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArgCase == "-allscenes")
+    {
+      toLoadAllScenes = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArgCase == "-toprintinfo"
+      || anArgCase == "-toprintdebuginfo")
+    {
+      toPrintDebugInfo = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArgCase == "-listexternalfiles"
+      || anArgCase == "-listexternals"
+      || anArgCase == "-listexternal"
+      || anArgCase == "-external"
+      || anArgCase == "-externalfiles")
+    {
+      toListExternalFiles = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArgCase == "-assetinfo"
+      || anArgCase == "-metadata")
+    {
+      toPrintAssetInfo = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
+    }
+    else if (aDestName.IsEmpty())
+    {
+      aDestName = theArgVec[anArgIter];
+    }
+    else if (aFilePath.IsEmpty())
+    {
+      aFilePath = theArgVec[anArgIter];
+    }
+    else
+    {
+      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
+      return 1;
+    }
+  }
+  if (aFilePath.IsEmpty() && !aDestName.IsEmpty())
+  {
+    if (toListExternalFiles || toPrintAssetInfo)
+    {
+      std::swap(aFilePath, aDestName);
+    }
+  }
+  if (aFilePath.IsEmpty())
+  {
+    Message::SendFail() << "Syntax error: wrong number of arguments";
+    return 1;
+  }
+
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI, 1);
+  Handle(TDocStd_Document) aDoc;
+  if (!aDestName.IsEmpty()
+    && !isNoDoc)
+  {
+    Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
+    Standard_CString aNameVar = aDestName.ToCString();
+    DDocStd::GetDocument(aNameVar, aDoc, Standard_False);
+    if (aDoc.IsNull())
+    {
+      if (toUseExistingDoc)
+      {
+        Message::SendFail() << "Error: document with name " << aDestName << " does not exist";
+        return 1;
+      }
+      anApp->NewDocument(TCollection_ExtendedString("BinXCAF"), aDoc);
+    }
+    else if (!toUseExistingDoc)
+    {
+      Message::SendFail() << "Error: document with name " << aDestName << " already exists";
+      return 1;
+    }
+  }
+
+  const Standard_Real aScaleFactorM = XSDRAW::GetLengthUnit(aDoc) / 1000;
+
+  RWGltf_CafReader aReader;
+  aReader.SetSystemLengthUnit(aScaleFactorM);
+  aReader.SetSystemCoordinateSystem(RWMesh_CoordinateSystem_Zup);
+  aReader.SetDocument(aDoc);
+  aReader.SetParallel(isParallel);
+  aReader.SetDoublePrecision(isDoublePrec);
+  aReader.SetToSkipLateDataLoading(toSkipLateDataLoading);
+  aReader.SetToKeepLateData(toKeepLateData);
+  aReader.SetToPrintDebugMessages(toPrintDebugInfo);
+  aReader.SetLoadAllScenes(toLoadAllScenes);
+  if (aDestName.IsEmpty())
+  {
+    aReader.ProbeHeader(aFilePath);
+  }
+  else
+  {
+    aReader.Perform(aFilePath, aProgress->Start());
+    if (isNoDoc)
+    {
+      DBRep::Set(aDestName.ToCString(), aReader.SingleShape());
+    }
+    else
+    {
+      Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument(aDoc);
+      TDataStd_Name::Set(aDoc->GetData()->Root(), aDestName);
+      Draw::Set(aDestName.ToCString(), aDrawDoc);
+    }
+  }
+
+  bool isFirstLine = true;
+  if (toPrintAssetInfo)
+  {
+    for (TColStd_IndexedDataMapOfStringString::Iterator aKeyIter(aReader.Metadata()); aKeyIter.More(); aKeyIter.Next())
+    {
+      if (!isFirstLine)
+      {
+        theDI << "\n";
+      }
+      isFirstLine = false;
+      theDI << aKeyIter.Key() << ": " << aKeyIter.Value();
+    }
+  }
+  if (toListExternalFiles)
+  {
+    if (!isFirstLine)
+    {
+      theDI << "\n";
+    }
+    for (NCollection_IndexedMap<TCollection_AsciiString>::Iterator aFileIter(aReader.ExternalFiles()); aFileIter.More(); aFileIter.Next())
+    {
+      theDI << "\"" << aFileIter.Value() << "\" ";
+    }
+  }
+  return 0;
+}
+
+//=============================================================================
+//function : WriteGltf
+//purpose  : Writes glTF file
+//=============================================================================
+static Standard_Integer WriteGltf(Draw_Interpretor& theDI,
+                                  Standard_Integer theNbArgs,
+                                  const char** theArgVec)
+{
+  TCollection_AsciiString aGltfFilePath;
+  Handle(TDocStd_Document) aDoc;
+  Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
+  TColStd_IndexedDataMapOfStringString aFileInfo;
+  RWGltf_WriterTrsfFormat aTrsfFormat = RWGltf_WriterTrsfFormat_Compact;
+  RWMesh_CoordinateSystem aSystemCoordSys = RWMesh_CoordinateSystem_Zup;
+  bool toForceUVExport = false, toEmbedTexturesInGlb = true;
+  bool toMergeFaces = false, toSplitIndices16 = false;
+  bool isParallel = false;
+  RWMesh_NameFormat aNodeNameFormat = RWMesh_NameFormat_InstanceOrProduct;
+  RWMesh_NameFormat aMeshNameFormat = RWMesh_NameFormat_Product;
+  RWGltf_DracoParameters aDracoParameters;
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArgCase(theArgVec[anArgIter]);
+    anArgCase.LowerCase();
+    if (anArgCase == "-comments"
+      && anArgIter + 1 < theNbArgs)
+    {
+      aFileInfo.Add("Comments", theArgVec[++anArgIter]);
+    }
+    else if (anArgCase == "-author"
+      && anArgIter + 1 < theNbArgs)
+    {
+      aFileInfo.Add("Author", theArgVec[++anArgIter]);
+    }
+    else if (anArgCase == "-forceuvexport"
+      || anArgCase == "-forceuv")
+    {
+      toForceUVExport = true;
+      if (anArgIter + 1 < theNbArgs
+        && Draw::ParseOnOff(theArgVec[anArgIter + 1], toForceUVExport))
+      {
+        ++anArgIter;
+      }
+    }
+    else if (anArgCase == "-mergefaces")
+    {
+      toMergeFaces = true;
+      if (anArgIter + 1 < theNbArgs
+        && Draw::ParseOnOff(theArgVec[anArgIter + 1], toMergeFaces))
+      {
+        ++anArgIter;
+      }
+    }
+    else if (anArgCase == "-splitindices16"
+      || anArgCase == "-splitindexes16"
+      || anArgCase == "-splitindices"
+      || anArgCase == "-splitindexes"
+      || anArgCase == "-splitind")
+    {
+      toSplitIndices16 = true;
+      if (anArgIter + 1 < theNbArgs
+        && Draw::ParseOnOff(theArgVec[anArgIter + 1], toSplitIndices16))
+      {
+        ++anArgIter;
+      }
+    }
+    else if (anArgIter + 1 < theNbArgs
+      && (anArgCase == "-systemcoordinatesystem"
+        || anArgCase == "-systemcoordsystem"
+        || anArgCase == "-systemcoordsys"
+        || anArgCase == "-syscoordsys"))
+    {
+      if (!parseCoordinateSystem(theArgVec[++anArgIter], aSystemCoordSys))
+      {
+        Message::SendFail() << "Syntax error: unknown coordinate system '" << theArgVec[anArgIter] << "'";
+        return 1;
+      }
+    }
+    else if (anArgCase == "-trsfformat"
+      && anArgIter + 1 < theNbArgs)
+    {
+      TCollection_AsciiString aTrsfStr(theArgVec[++anArgIter]);
+      aTrsfStr.LowerCase();
+      if (aTrsfStr == "compact")
+      {
+        aTrsfFormat = RWGltf_WriterTrsfFormat_Compact;
+      }
+      else if (aTrsfStr == "mat4")
+      {
+        aTrsfFormat = RWGltf_WriterTrsfFormat_Mat4;
+      }
+      else if (aTrsfStr == "trs")
+      {
+        aTrsfFormat = RWGltf_WriterTrsfFormat_TRS;
+      }
+      else
+      {
+        Message::SendFail() << "Syntax error at '" << anArgCase << "'";
+        return 1;
+      }
+    }
+    else if (anArgCase == "-nodenameformat"
+      || anArgCase == "-nodename")
+    {
+      ++anArgIter;
+      if (anArgIter >= theNbArgs
+        || !parseNameFormat(theArgVec[anArgIter], aNodeNameFormat))
+      {
+        Message::SendFail() << "Syntax error at '" << anArgCase << "'";
+        return 1;
+      }
+    }
+    else if (anArgCase == "-meshnameformat"
+      || anArgCase == "-meshname")
+    {
+      ++anArgIter;
+      if (anArgIter >= theNbArgs
+        || !parseNameFormat(theArgVec[anArgIter], aMeshNameFormat))
+      {
+        Message::SendFail() << "Syntax error at '" << anArgCase << "'";
+        return 1;
+      }
+    }
+    else if (aDoc.IsNull())
+    {
+      Standard_CString aNameVar = theArgVec[anArgIter];
+      DDocStd::GetDocument(aNameVar, aDoc, false);
+      if (aDoc.IsNull())
+      {
+        TopoDS_Shape aShape = DBRep::Get(aNameVar);
+        if (aShape.IsNull())
+        {
+          Message::SendFail() << "Syntax error: '" << aNameVar << "' is not a shape nor document";
+          return 1;
+        }
+
+        anApp->NewDocument(TCollection_ExtendedString("BinXCAF"), aDoc);
+        Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
+        // auto-naming doesn't generate meaningful instance names
+        //aShapeTool->SetAutoNaming (false);
+        aNodeNameFormat = RWMesh_NameFormat_Product;
+        aShapeTool->AddShape(aShape);
+      }
+    }
+    else if (aGltfFilePath.IsEmpty())
+    {
+      aGltfFilePath = theArgVec[anArgIter];
+    }
+    else if (anArgCase == "-texturesSeparate")
+    {
+      toEmbedTexturesInGlb = false;
+    }
+    else if (anArgCase == "-draco")
+    {
+      aDracoParameters.DracoCompression = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArgCase == "-compressionlevel" && (anArgIter + 1) < theNbArgs
+      && Draw::ParseInteger(theArgVec[anArgIter + 1], aDracoParameters.CompressionLevel))
+    {
+      ++anArgIter;
+    }
+    else if (anArgCase == "-quantizepositionbits" && (anArgIter + 1) < theNbArgs
+      && Draw::ParseInteger(theArgVec[anArgIter + 1], aDracoParameters.QuantizePositionBits))
+    {
+      ++anArgIter;
+    }
+    else if (anArgCase == "-quantizenormalbits" && (anArgIter + 1) < theNbArgs
+      && Draw::ParseInteger(theArgVec[anArgIter + 1], aDracoParameters.QuantizeNormalBits))
+    {
+      ++anArgIter;
+    }
+    else if (anArgCase == "-quantizetexcoordbits" && (anArgIter + 1) < theNbArgs
+      && Draw::ParseInteger(theArgVec[anArgIter + 1], aDracoParameters.QuantizeTexcoordBits))
+    {
+      ++anArgIter;
+    }
+    else if (anArgCase == "-quantizecolorbits" && (anArgIter + 1) < theNbArgs
+      && Draw::ParseInteger(theArgVec[anArgIter + 1], aDracoParameters.QuantizeColorBits))
+    {
+      ++anArgIter;
+    }
+    else if (anArgCase == "-quantizegenericbits" && (anArgIter + 1) < theNbArgs
+      && Draw::ParseInteger(theArgVec[anArgIter + 1], aDracoParameters.QuantizeGenericBits))
+    {
+      ++anArgIter;
+    }
+    else if (anArgCase == "-unifiedquantization")
+    {
+      aDracoParameters.UnifiedQuantization = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArgCase == "-parallel")
+    {
+      isParallel = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
+    }
+    else
+    {
+      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
+      return 1;
+    }
+  }
+  if (aGltfFilePath.IsEmpty())
+  {
+    Message::SendFail() << "Syntax error: wrong number of arguments";
+    return 1;
+  }
+
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI, 1);
+
+  TCollection_AsciiString anExt = aGltfFilePath;
+  anExt.LowerCase();
+
+  const Standard_Real aScaleFactorM = XSDRAW::GetLengthUnit(aDoc) / 1000;
+
+  RWGltf_CafWriter aWriter(aGltfFilePath, anExt.EndsWith(".glb"));
+  aWriter.SetTransformationFormat(aTrsfFormat);
+  aWriter.SetNodeNameFormat(aNodeNameFormat);
+  aWriter.SetMeshNameFormat(aMeshNameFormat);
+  aWriter.SetForcedUVExport(toForceUVExport);
+  aWriter.SetToEmbedTexturesInGlb(toEmbedTexturesInGlb);
+  aWriter.SetMergeFaces(toMergeFaces);
+  aWriter.SetSplitIndices16(toSplitIndices16);
+  aWriter.SetParallel(isParallel);
+  aWriter.SetCompressionParameters(aDracoParameters);
+  aWriter.ChangeCoordinateSystemConverter().SetInputLengthUnit(aScaleFactorM);
+  aWriter.ChangeCoordinateSystemConverter().SetInputCoordinateSystem(aSystemCoordSys);
+  aWriter.Perform(aDoc, aFileInfo, aProgress->Start());
+  return 0;
+}
+
+//=======================================================================
+//function : Factory
+//purpose  :
+//=======================================================================
+void XSDRAWGLTF::Factory(Draw_Interpretor& theDI)
+{
+  static Standard_Boolean aIsActivated = Standard_False;
+  if (aIsActivated)
+  {
+    return;
+  }
+  aIsActivated = Standard_True;
+
+  const char* aGroup = "XSTEP-STL/VRML";  // Step transfer file commands
+  theDI.Add("ReadGltf",
+            "ReadGltf Doc file [-parallel {on|off}] [-listExternalFiles] [-noCreateDoc] [-doublePrecision {on|off}] [-assetInfo]"
+            "\n\t\t: Read glTF file into XDE document."
+            "\n\t\t:   -listExternalFiles do not read mesh and only list external files"
+            "\n\t\t:   -noCreateDoc read into existing XDE document"
+            "\n\t\t:   -doublePrecision store triangulation with double or single floating point"
+            "\n\t\t:                    precision (single by default)"
+            "\n\t\t:   -skipLateLoading data loading is skipped and can be performed later"
+            "\n\t\t:                    (false by default)"
+            "\n\t\t:   -keepLate data is loaded into itself with preservation of information"
+            "\n\t\t:             about deferred storage to load/unload this data later."
+            "\n\t\t:   -allScenes load all scenes defined in the document instead of default one (false by default)"
+            "\n\t\t:   -toPrintDebugInfo print additional debug information during data reading"
+            "\n\t\t:   -assetInfo print asset information",
+            __FILE__, ReadGltf, aGroup);
+  theDI.Add("readgltf",
+            "readgltf shape file"
+            "\n\t\t: Same as ReadGltf but reads glTF file into a shape instead of a document.",
+            __FILE__, ReadGltf, aGroup);
+  theDI.Add("WriteGltf",
+            "WriteGltf Doc file [-trsfFormat {compact|TRS|mat4}]=compact"
+            "\n\t\t:            [-systemCoordSys {Zup|Yup}]=Zup"
+            "\n\t\t:            [-comments Text] [-author Name]"
+            "\n\t\t:            [-forceUVExport]=0 [-texturesSeparate]=0 [-mergeFaces]=0 [-splitIndices16]=0"
+            "\n\t\t:            [-nodeNameFormat {empty|product|instance|instOrProd|prodOrInst|prodAndInst|verbose}]=instOrProd"
+            "\n\t\t:            [-meshNameFormat {empty|product|instance|instOrProd|prodOrInst|prodAndInst|verbose}]=product"
+            "\n\t\t:            [-draco]=0 [-compressionLevel {0-10}]=7 [-quantizePositionBits Value]=14 [-quantizeNormalBits Value]=10"
+            "\n\t\t:            [-quantizeTexcoordBits Value]=12 [-quantizeColorBits Value]=8 [-quantizeGenericBits Value]=12"
+            "\n\t\t:            [-unifiedQuantization]=0 [-parallel]=0"
+            "\n\t\t: Write XDE document into glTF file."
+            "\n\t\t:   -trsfFormat       preferred transformation format"
+            "\n\t\t:   -systemCoordSys   system coordinate system; Zup when not specified"
+            "\n\t\t:   -mergeFaces       merge Faces within the same Mesh"
+            "\n\t\t:   -splitIndices16   split Faces to keep 16-bit indices when -mergeFaces is enabled"
+            "\n\t\t:   -forceUVExport    always export UV coordinates"
+            "\n\t\t:   -texturesSeparate write textures to separate files"
+            "\n\t\t:   -nodeNameFormat   name format for Nodes"
+            "\n\t\t:   -meshNameFormat   name format for Meshes"
+            "\n\t\t:   -draco            use Draco compression 3D geometric meshes"
+            "\n\t\t:   -compressionLevel draco compression level [0-10] (by default 7), a value of 0 will apply sequential encoding and preserve face order"
+            "\n\t\t:   -quantizePositionBits quantization bits for position attribute when using Draco compression (by default 14)"
+            "\n\t\t:   -quantizeNormalBits   quantization bits for normal attribute when using Draco compression (by default 10)"
+            "\n\t\t:   -quantizeTexcoordBits quantization bits for texture coordinate attribute when using Draco compression (by default 12)"
+            "\n\t\t:   -quantizeColorBits    quantization bits for color attribute when using Draco compression (by default 8)"
+            "\n\t\t:   -quantizeGenericBits  quantization bits for skinning attribute (joint indices and joint weights)"
+            "\n                        and custom attributes when using Draco compression (by default 12)"
+            "\n\t\t:   -unifiedQuantization  quantization is applied on each primitive separately if this option is false"
+            "\n\t\t:   -parallel             use multithreading for Draco compression",
+            __FILE__, WriteGltf, aGroup);
+  theDI.Add("writegltf",
+            "writegltf shape file",
+            __FILE__, WriteGltf, aGroup);
+
+  // Load XSDRAW session for pilot activation
+  XSDRAW::LoadDraw(theDI);
+}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWGLTF)
diff --git a/src/XSDRAWGLTF/XSDRAWGLTF.hxx b/src/XSDRAWGLTF/XSDRAWGLTF.hxx
new file mode 100644 (file)
index 0000000..092c3ad
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XSDRAWGLTF_HeaderFile
+#define _XSDRAWGLTF_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+
+#include <Draw_Interpretor.hxx>
+
+class XSDRAWGLTF
+{
+  DEFINE_STANDARD_ALLOC
+public:
+
+  //! Loads all Draw commands of XSDRAWGLTF. Used for plugin.
+  Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
+};
+
+#endif // _XSDRAWGLTF_HeaderFile
index 195159619f9ff0134269f49fc4de9459d3446a21..4b8263c4ba91b09d5ca6139e03f0eaa506c40ced 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
+// Copyright (c) 2023 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
 //
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-//gka 06.01.99 S3767 new function TPSTAT (first version)
-//pdn 11.01.99 putting "return" statement for compilation on NT
+#include <XSDRAWIGES.hxx>
 
 #include <BRepTools.hxx>
 #include <DBRep.hxx>
-#include <Draw_Appli.hxx>
+#include <DDocStd.hxx>
+#include <DDocStd_DrawDocument.hxx>
+#include <Draw.hxx>
+#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
 #include <Draw_ProgressIndicator.hxx>
 #include <DrawTrSurf.hxx>
-#include <IFSelect_Functions.hxx>
-#include <IFSelect_SessionPilot.hxx>
+#include <IGESCAFControl_Reader.hxx>
+#include <IGESCAFControl_Writer.hxx>
 #include <IGESControl_Controller.hxx>
 #include <IGESControl_Reader.hxx>
 #include <IGESControl_Writer.hxx>
 #include <IGESSelect_Activator.hxx>
 #include <Interface_Macros.hxx>
 #include <Interface_Static.hxx>
-#include <Message_ProgressScope.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TColStd_MapOfTransient.hxx>
+#include <Message.hxx>
+#include <OSD_OpenFile.hxx>
+#include <OSD_Path.hxx>
+#include <TColStd_Array1OfAsciiString.hxx>
+#include <TColStd_MapIteratorOfMapOfTransient.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDocStd_Application.hxx>
 #include <TopoDS_Shape.hxx>
 #include <Transfer_IteratorOfProcessForTransient.hxx>
 #include <Transfer_TransientProcess.hxx>
-#include <XSControl.hxx>
-#include <XSControl_WorkSession.hxx>
+#include <XSAlgo.hxx>
+#include <XSAlgo_AlgoContainer.hxx>
 #include <XSControl_TransferReader.hxx>
+#include <XSControl_WorkSession.hxx>
 #include <XSDRAW.hxx>
-#include <XSDRAWIGES.hxx>
 
-#include <stdio.h>
-
-namespace {
-
-  //=======================================================================
+//=======================================================================
 //function : WriteShape
 //purpose  : Creates a file Shape_'number'
 //=======================================================================
-void WriteShape(const TopoDS_Shape& shape, const Standard_Integer number)
+void WriteShape(const TopoDS_Shape& shape,
+                const Standard_Integer number)
 {
   char fname[110];
-  sprintf(fname, "Shape_%d",number);
-  std::ofstream f(fname,std::ios::out | std::ios::binary);
+  sprintf(fname, "Shape_%d", number);
+  std::ofstream f(fname, std::ios::out | std::ios::binary);
   std::cout << "Output file name : " << fname << std::endl;
   f << "DBRep_DrawableShape\n";
-  
+
   BRepTools::Write(shape, f);
   f.close();
 }
 
-TCollection_AsciiString XSDRAW_CommandPart
-  (Standard_Integer argc, const char** argv, const Standard_Integer argf)
+//=======================================================================
+//function : XSDRAW_CommandPart
+//purpose  :
+//=======================================================================
+TCollection_AsciiString XSDRAW_CommandPart(Standard_Integer argc,
+                                           const char** argv,
+                                           const Standard_Integer argf)
 {
   TCollection_AsciiString res;
-  for (Standard_Integer i = argf; i < argc; i ++) {
+  for (Standard_Integer i = argf; i < argc; i++)
+  {
     if (i > argf) res.AssignCat(" ");
-    res.AssignCat (argv[i]);
+    res.AssignCat(argv[i]);
   }
   return res;
 }
+
+//=======================================================================
+//function : GiveEntityNumber
+//purpose  :
+//=======================================================================
+static Standard_Integer GiveEntityNumber(const Handle(XSControl_WorkSession)& WS,
+                                         const Standard_CString name)
+{
+  Standard_Integer num = 0;
+  if (!name || name[0] == '\0')
+  {
+    char ligne[80];  ligne[0] = '\0';
+    std::cin >> ligne;
+    //    std::cin.clear();  std::cin.getline (ligne,79);
+    if (ligne[0] == '\0') return 0;
+    num = WS->NumberFromLabel(ligne);
+  }
+  else num = WS->NumberFromLabel(name);
+  return num;
 }
 
-//--------------------------------------------------------------
-// Function : igesbrep
-//--------------------------------------------------------------
-static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
+//=======================================================================
+//function : FileAndVar
+//purpose  : 
+//=======================================================================
+Standard_Boolean FileAndVar(const Handle(XSControl_WorkSession)& session,
+                            const Standard_CString file,
+                            const Standard_CString var,
+                            const Standard_CString def,
+                            TCollection_AsciiString& resfile,
+                            TCollection_AsciiString& resvar)
 {
-  DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
-  if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
+  Standard_Boolean iafic = Standard_True;
+  resfile.Clear();  resvar.Clear();
+  if (file)
+    if (file[0] == '\0' ||
+        (file[0] == '.' && file[1] == '\0')) iafic = Standard_False;
+  if (!iafic) resfile.AssignCat(session->LoadedFile());
+  else        resfile.AssignCat(file);
+
+  if (var && var[0] != '\0' && (var[0] != '.' || var[1] != '\0'))
+    resvar.AssignCat(var);
+  else if (resfile.Length() == 0) resvar.AssignCat(def);
+  else
+  {
+    Standard_Integer nomdeb, nomfin;
+    nomdeb = resfile.SearchFromEnd("/");
+    if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\");  // pour NT
+    if (nomdeb < 0) nomdeb = 0;
+    nomfin = resfile.SearchFromEnd(".");
+    if (nomfin < nomdeb) nomfin = resfile.Length() + 1;
+    resvar = resfile.SubString(nomdeb + 1, nomfin - 1);
+  }
+  return iafic;
+}
+
+//=======================================================================
+//function : igesbrep
+//purpose  :
+//=======================================================================
+static Standard_Integer igesbrep(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
+{
+  Handle(XSControl_WorkSession) aWS = XSDRAW::Session();
+  Handle(IGESControl_Controller) aCtl =
+    Handle(IGESControl_Controller)::DownCast(aWS->NormAdaptor());
+  if (aCtl.IsNull())
+  {
+    aWS->SelectNorm("IGES");
+  }
 
   // Progress indicator
-  Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
-  Message_ProgressScope aPSRoot (progress->Start(), "Reading", 100);
-  IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
+  Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator(theDI, 1);
+  Message_ProgressScope aPSRoot(progress->Start(), "Reading", 100);
+
+  IGESControl_Reader Reader(XSDRAW::Session(), Standard_False);
   Standard_Boolean aFullMode = Standard_True;
   Reader.WS()->SetModeStat(aFullMode);
-  if (ctl.IsNull())
-    ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
 
-  TCollection_AsciiString fnom,rnom;
+  TCollection_AsciiString fnom, rnom;
 
-  Standard_Boolean modfic = XSDRAW::FileAndVar
-    (argv[1],argv[2],"IGESBREP",fnom,rnom);
-  if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
-  else        di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
-  di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
+  Standard_Boolean modfic = FileAndVar
+  (aWS, theArgVec[1], theArgVec[2], "IGESBREP", fnom, rnom);
+  if (modfic) theDI << " File IGES to read : " << fnom.ToCString() << "\n";
+  else        theDI << " Model taken from the session : " << fnom.ToCString() << "\n";
+  theDI << " -- Names of variables BREP-DRAW prefixed by : " << rnom.ToCString() << "\n";
   IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
 
 #ifdef CHRONOMESURE
@@ -108,163 +175,177 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
   IDT_SetLevel(3);
 #endif
 
-
-// Reading the file
+  // Reading the file
   aPSRoot.SetName("Loading");
   progress->Show(aPSRoot);
 
-  if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
+  if (modfic) readstat = Reader.ReadFile(fnom.ToCString());
   else  if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
 
   aPSRoot.Next(20); // On average loading takes 20% 
   if (aPSRoot.UserBreak())
     return 1;
 
-  if (readstat != IFSelect_RetDone) {
-    if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
-    else di<<"No model loaded\n";
+  if (readstat != IFSelect_RetDone)
+  {
+    if (modfic) theDI << "Could not read file " << fnom.ToCString() << " , abandon\n";
+    else theDI << "No model loaded\n";
     return 1;
   }
-// Choice of treatment
-  Standard_Boolean fromtcl = (argc > 3);
+  // Choice of treatment
+  Standard_Boolean fromtcl = (theNbArgs > 3);
   Standard_Integer modepri = 1, nent, nbs;
   if (fromtcl) modepri = 4;
 
-  while (modepri) {
+  while (modepri)
+  {
     //Roots for transfer are defined before setting mode ALL or OnlyVisible - gka 
     //mode OnlyVisible does not work.
     // nent = Reader.NbRootsForTransfer();
-    if (!fromtcl) {
-      std::cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<std::flush;
+    if (!fromtcl)
+    {
+      std::cout << "Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :" << std::flush;
       modepri = -1;
-      
-// amv 26.09.2003 : this is used to avoid error of enter's simbol        
-      char str[80];                                                             
-      std::cin>>str;                                                                 
-      modepri = Draw::Atoi(str);   
+
+      // amv 26.09.2003 : this is used to avoid error of enter's simbol        
+      char str[80];
+      std::cin >> str;
+      modepri = Draw::Atoi(str);
     }
 
-    if (modepri == 0) {  //fin
-      di << "Bye and good luck! \n";
+    if (modepri == 0)
+    {  //fin
+      theDI << "Bye and good luck! \n";
       break;
-    } 
+    }
 
-    else if (modepri <= 2) {  // 1 : Visible Roots, 2 : All Roots
-      di << "All Geometry Transfer\n";
-      di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
-      di<<"  To modify : command  param read.iges.bspline.continuity\n";
-      Handle(XSControl_WorkSession) thesession = Reader.WS();
-      thesession->ClearContext();
-      XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
+    else if (modepri <= 2)
+    {  // 1 : Visible Roots, 2 : All Roots
+      theDI << "All Geometry Transfer\n";
+      theDI << "spline_continuity (read) : " << Interface_Static::IVal("read.iges.bspline.continuity") << " (0 : no modif, 1 : C1, 2 : C2)\n";
+      theDI << "  To modify : command  param read.iges.bspline.continuity\n";
+      const Handle(XSControl_WorkSession)& thesession = Reader.WS();
+      thesession->TransferReader()->Context().Clear();
 
       aPSRoot.SetName("Translation");
       progress->Show(aPSRoot);
-      
-      if (modepri == 1) Reader.SetReadVisible (Standard_True);
+
+      if (modepri == 1) Reader.SetReadVisible(Standard_True);
       Reader.TransferRoots(aPSRoot.Next(80));
-      
+
       if (aPSRoot.UserBreak())
         return 1;
 
       // result in only one shape for all the roots
       //        or in one shape for one root.
-      di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
+      theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n";
       Standard_Integer answer = 1;
-      if (Reader.NbShapes() > 1) {
-       std::cout << " pass(0)  one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << std::flush;
+      if (Reader.NbShapes() > 1)
+      {
+        std::cout << " pass(0)  one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << std::flush;
         answer = -1;
         //amv 26.09.2003                                                        
-        char str_a[80];                                                         
-        std::cin >> str_a;                                                           
-        answer = Draw::Atoi(str_a);    
+        char str_a[80];
+        std::cin >> str_a;
+        answer = Draw::Atoi(str_a);
       }
-      if ( answer == 0) continue;
-      if ( answer == 1 || answer == 3) {
-       TopoDS_Shape shape = Reader.OneShape();
-       // save the shape
-       if (shape.IsNull()) { di<<"No Shape produced\n"; continue; }
-       char fname[110];
-       Sprintf(fname, "%s", rnom.ToCString());
-       di << "Saving shape in variable Draw : " << fname << "\n";
-       if (answer == 3) WriteShape (shape,1);
-       try {
-         OCC_CATCH_SIGNALS
-         DBRep::Set(fname,shape);
-       }
-       catch(Standard_Failure const& anException) {
-         di << "** Exception : ";
-         di << anException.GetMessageString();
-         di<<" ** Skip\n";
-         di << "Saving shape in variable Draw : " << fname << "\n";
-         WriteShape (shape,1);
-       }
+      if (answer == 0) continue;
+      if (answer == 1 || answer == 3)
+      {
+        TopoDS_Shape shape = Reader.OneShape();
+        // save the shape
+        if (shape.IsNull()) { theDI << "No Shape produced\n"; continue; }
+        char fname[110];
+        Sprintf(fname, "%s", rnom.ToCString());
+        theDI << "Saving shape in variable Draw : " << fname << "\n";
+        if (answer == 3) WriteShape(shape, 1);
+        try
+        {
+          OCC_CATCH_SIGNALS
+            DBRep::Set(fname, shape);
+        }
+        catch (Standard_Failure const& anException)
+        {
+          theDI << "** Exception : ";
+          theDI << anException.GetMessageString();
+          theDI << " ** Skip\n";
+          theDI << "Saving shape in variable Draw : " << fname << "\n";
+          WriteShape(shape, 1);
+        }
       }
-       
-      else if (answer == 2 || answer == 4) {
-       Standard_Integer numshape = Reader.NbShapes();
-       for (Standard_Integer inum = 1; inum <= numshape; inum++) {
-         // save all the shapes
-         TopoDS_Shape shape = Reader.Shape(inum);
-         if (shape.IsNull()) { di<<"No Shape produced\n"; continue; }
-         char fname[110];
-         Sprintf(fname, "%s_%d", rnom.ToCString(),inum);
-         di << "Saving shape in variable Draw : " << fname << "\n";
-         if (answer == 4) WriteShape (shape,inum);
-         try {
-           OCC_CATCH_SIGNALS
-           DBRep::Set(fname,shape);
-         }
-         catch(Standard_Failure const& anException) {
-           di << "** Exception : ";
-           di << anException.GetMessageString();
-           di<<" ** Skip\n";
-         }
-       }
+
+      else if (answer == 2 || answer == 4)
+      {
+        Standard_Integer numshape = Reader.NbShapes();
+        for (Standard_Integer inum = 1; inum <= numshape; inum++)
+        {
+          // save all the shapes
+          TopoDS_Shape shape = Reader.Shape(inum);
+          if (shape.IsNull()) { theDI << "No Shape produced\n"; continue; }
+          char fname[110];
+          Sprintf(fname, "%s_%d", rnom.ToCString(), inum);
+          theDI << "Saving shape in variable Draw : " << fname << "\n";
+          if (answer == 4) WriteShape(shape, inum);
+          try
+          {
+            OCC_CATCH_SIGNALS
+              DBRep::Set(fname, shape);
+          }
+          catch (Standard_Failure const& anException)
+          {
+            theDI << "** Exception : ";
+            theDI << anException.GetMessageString();
+            theDI << " ** Skip\n";
+          }
+        }
       }
       else return 0;
     }
 
-    else if (modepri == 3) {  // One Entity
-      std::cout << "Only One Entity"<<std::endl;
-      std::cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<std::endl;
-      std::cout<<"  To modify : command  param read.iges.bspline.continuity"<<std::endl;
+    else if (modepri == 3)
+    {  // One Entity
+      std::cout << "Only One Entity" << std::endl;
+      std::cout << "spline_continuity (read) : " << Interface_Static::IVal("read.iges.bspline.continuity") << " (0 : no modif, 1 : C1, 2 : C2)" << std::endl;
+      std::cout << "  To modify : command  param read.iges.bspline.continuity" << std::endl;
       std::cout << " give the number of the Entity : " << std::flush;
-      nent = XSDRAW::GetEntityNumber();
-
-      if (!Reader.TransferOne (nent))
-        di<<"Transfer entity n0 "<<nent<<" : no result\n";
-      else {
-       nbs = Reader.NbShapes();
-       char shname[30];  Sprintf (shname,"%s_%d",rnom.ToCString(),nent);
-       di<<"Transfer entity n0 "<<nent<<" OK  -> DRAW Shape: "<<shname<<"\n";
-       di<<"Now, "<<nbs<<" Shapes produced\n";
-       TopoDS_Shape sh = Reader.Shape(nbs);
-       DBRep::Set (shname,sh);
+      nent = GiveEntityNumber(aWS, "");
+
+      if (!Reader.TransferOne(nent))
+        theDI << "Transfer entity n0 " << nent << " : no result\n";
+      else
+      {
+        nbs = Reader.NbShapes();
+        char shname[30];  Sprintf(shname, "%s_%d", rnom.ToCString(), nent);
+        theDI << "Transfer entity n0 " << nent << " OK  -> DRAW Shape: " << shname << "\n";
+        theDI << "Now, " << nbs << " Shapes produced\n";
+        TopoDS_Shape sh = Reader.Shape(nbs);
+        DBRep::Set(shname, sh);
       }
     }
 
-    else if (modepri == 4) {   // Selection
+    else if (modepri == 4)
+    {   // Selection
       Standard_Integer answer = 1;
       Handle(TColStd_HSequenceOfTransient)  list;
 
-//  Selection, nommee ou via tcl. tcl : raccourcis admis
-//   * donne iges-visible + xst-transferrable-roots
-//   *r donne xst-model-roots (TOUTES racines)
+      //  Selection, nommee ou via tcl. tcl : raccourcis admis
+      //   * donne iges-visible + xst-transferrable-roots
+      //   *r donne xst-model-roots (TOUTES racines)
 
-      if( fromtcl && argv[3][0]=='*' && argv[3][1]=='\0' ) {         
-        di << "All Geometry Transfer\n";
-        di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
-        di<<"  To modify : command  param read.iges.bspline.continuity\n";
-        Handle(XSControl_WorkSession) thesession = Reader.WS();
-        thesession->ClearContext();
-        XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
+      if (fromtcl && theArgVec[3][0] == '*' && theArgVec[3][1] == '\0')
+      {
+        theDI << "All Geometry Transfer\n";
+        theDI << "spline_continuity (read) : " << Interface_Static::IVal("read.iges.bspline.continuity") << " (0 : no modif, 1 : C1, 2 : C2)\n";
+        theDI << "  To modify : command  param read.iges.bspline.continuity\n";
+        const Handle(XSControl_WorkSession)& thesession = Reader.WS();
+        thesession->TransferReader()->Context().Clear();
 
         aPSRoot.SetName("Translation");
         progress->Show(aPSRoot);
-      
-        Reader.SetReadVisible (Standard_True);
+
+        Reader.SetReadVisible(Standard_True);
         Reader.TransferRoots(aPSRoot.Next(80));
-      
+
         if (aPSRoot.UserBreak())
           return 1;
 
@@ -273,435 +354,645 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
         // save the shape
         char fname[110];
         Sprintf(fname, "%s", rnom.ToCString());
-        di << "Saving shape in variable Draw : " << fname << "\n";
-        try {
+        theDI << "Saving shape in variable Draw : " << fname << "\n";
+        try
+        {
           OCC_CATCH_SIGNALS
-          DBRep::Set(fname,shape);
+            DBRep::Set(fname, shape);
+        }
+        catch (Standard_Failure const& anException)
+        {
+          theDI << "** Exception : ";
+          theDI << anException.GetMessageString();
+          theDI << " ** Skip\n";
+          theDI << "Saving shape in variable Draw : " << fname << "\n";
+          WriteShape(shape, 1);
         }
-        catch(Standard_Failure const& anException) {
-          di << "** Exception : ";
-         di << anException.GetMessageString();
-         di<<" ** Skip\n";
-          di << "Saving shape in variable Draw : " << fname << "\n";
-          WriteShape (shape,1);
-        }                                                                             
         return 0;
       }
-   
-      if(fromtcl) {
-       modepri = 0;    // d office, une seule passe
-       if (argv[3][0] == '*' && argv[3][1] == 'r' && argv[3][2] == '\0') {
-         di<<"All Roots : ";
-         list = XSDRAW::GetList ("xst-model-roots");
-       }
-        else {
-         TCollection_AsciiString compart = XSDRAW_CommandPart (argc,argv,3);
-         di<<"List given by "<<compart.ToCString()<<" : ";
-         list = XSDRAW::GetList (compart.ToCString());
-       }
-       if (list.IsNull()) {
-          di<<"No list defined. Give a selection name or * for all visible transferrable roots\n";
+
+      if (fromtcl)
+      {
+        modepri = 0;    // d office, une seule passe
+        if (theArgVec[3][0] == '*' && theArgVec[3][1] == 'r' && theArgVec[3][2] == '\0')
+        {
+          theDI << "All Roots : ";
+          list = XSDRAW::Session()->GiveList("xst-model-roots");
+        }
+        else
+        {
+          TCollection_AsciiString compart = XSDRAW_CommandPart(theNbArgs, theArgVec, 3);
+          theDI << "List given by " << compart.ToCString() << " : ";
+          list = XSDRAW::Session()->GiveList(compart.ToCString());
+        }
+        if (list.IsNull())
+        {
+          theDI << "No list defined. Give a selection name or * for all visible transferrable roots\n";
           continue;
         }
       }
-      else {
-       std::cout<<"Name of Selection :"<<std::flush;
-       list = XSDRAW::GetList();
-       if (list.IsNull()) { std::cout<<"No list defined"<<std::endl; continue; }
+      else
+      {
+        std::cout << "Name of Selection :" << std::flush;
+        list = XSDRAW::Session()->GiveList("");
+        if (list.IsNull()) { std::cout << "No list defined" << std::endl; continue; }
       }
 
       Standard_Integer nbl = list->Length();
-      di<<"Nb entities selected : "<<nbl<<"\n";
+      theDI << "Nb entities selected : " << nbl << "\n";
       if (nbl == 0) continue;
-      while (answer) {
-       if (!fromtcl) {
-         std::cout<<"Choice: 0 abandon  1 transfer all  2 with confirmation  3 list n0s ents :"<<std::flush;
+      while (answer)
+      {
+        if (!fromtcl)
+        {
+          std::cout << "Choice: 0 abandon  1 transfer all  2 with confirmation  3 list n0s ents :" << std::flush;
           answer = -1;
           // anv 26.09.2003                                                     
-          char str_answer[80];                                                  
-          std::cin>>str_answer;                                                      
-          answer = Draw::Atoi(str_answer);    
-       }
-       if (answer <= 0 || answer > 3) continue;
-       if (answer == 3) {
-         for (Standard_Integer ill = 1; ill <= nbl; ill ++) {
-           Handle(Standard_Transient) ent = list->Value(ill);
-           di<<"  ";// model->Print(ent,di);
-         }
-         di<<"\n";
-       }
-       if (answer == 1 || answer == 2) {
-         Standard_Integer nbt = 0;
-         Handle(XSControl_WorkSession) thesession = Reader.WS();
-       
-         XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
+          char str_answer[80];
+          std::cin >> str_answer;
+          answer = Draw::Atoi(str_answer);
+        }
+        if (answer <= 0 || answer > 3) continue;
+        if (answer == 3)
+        {
+          for (Standard_Integer ill = 1; ill <= nbl; ill++)
+          {
+            Handle(Standard_Transient) ent = list->Value(ill);
+            theDI << "  ";// model->Print(ent,theDI);
+          }
+          theDI << "\n";
+        }
+        if (answer == 1 || answer == 2)
+        {
+          Standard_Integer nbt = 0;
+          Handle(XSControl_WorkSession) thesession = Reader.WS();
+
           aPSRoot.SetName("Translation");
           progress->Show(aPSRoot);
 
           Message_ProgressScope aPS(aPSRoot.Next(80), "Root", nbl);
           for (Standard_Integer ill = 1; ill <= nbl && aPS.More(); ill++)
           {
-           nent = Reader.Model()->Number(list->Value(ill));
-           if (nent == 0) continue;
-           if (!Reader.TransferOne(nent, aPS.Next()))
-              di<<"Transfer entity n0 "<<nent<<" : no result\n";
-           else {
-             nbs = Reader.NbShapes();
-             char shname[30];  Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
-             di<<"Transfer entity n0 "<<nent<<" OK  -> DRAW Shape: "<<shname<<"\n";
-             di<<"Now, "<<nbs<<" Shapes produced\n";
-             TopoDS_Shape sh = Reader.Shape(nbs);
-             DBRep::Set (shname,sh);
+            nent = Reader.Model()->Number(list->Value(ill));
+            if (nent == 0) continue;
+            if (!Reader.TransferOne(nent, aPS.Next()))
+              theDI << "Transfer entity n0 " << nent << " : no result\n";
+            else
+            {
+              nbs = Reader.NbShapes();
+              char shname[30];  Sprintf(shname, "%s_%d", rnom.ToCString(), nbs);
+              theDI << "Transfer entity n0 " << nent << " OK  -> DRAW Shape: " << shname << "\n";
+              theDI << "Now, " << nbs << " Shapes produced\n";
+              TopoDS_Shape sh = Reader.Shape(nbs);
+              DBRep::Set(shname, sh);
               nbt++;
-           }
-         }
+            }
+          }
           if (aPSRoot.UserBreak())
             return 1;
-          di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
-         answer = 0;  // on ne reboucle pas
-       }
+          theDI << "Nb Shapes successfully produced : " << nbt << "\n";
+          answer = 0;  // on ne reboucle pas
+        }
       }
     }
-    else di<<"Unknown mode n0 "<<modepri<<"\n";
+    else theDI << "Unknown mode n0 " << modepri << "\n";
   }
   return 0;
 }
 
-//--------------------------------------------------------------
-// Function : testreadiges
-//
-//--------------------------------------------------------------
-static Standard_Integer testread (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
+//=======================================================================
+//function : testread
+//purpose  :
+//=======================================================================
+static Standard_Integer testread(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
 {
-  if (argc != 3)                                                                                      
-    {                                                                                             
-      di << "ERROR in " << argv[0] << "Wrong Number of Arguments.\n";                     
-      di << " Usage : " << argv[0] <<" file_name shape_name\n";                          
-      return 1;                                                                                 
-    }  
+  if (theNbArgs != 3)
+  {
+    theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
+    theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n";
+    return 1;
+  }
   IGESControl_Reader Reader;
-  Standard_CString filename = argv[1];
-  IFSelect_ReturnStatus readstat =  Reader.ReadFile(filename);
-  di<<"Status from reading IGES file "<<filename<<" : ";  
-  switch(readstat) {                                                              
-    case IFSelect_RetVoid  : { di<<"empty file\n"; return 1; }            
-    case IFSelect_RetDone  : { di<<"file read\n";    break; }             
-    case IFSelect_RetError : { di<<"file not found\n";   return 1; }      
-    case IFSelect_RetFail  : { di<<"error during read\n";  return 1; }    
-    default  :  { di<<"failure\n";   return 1; }                          
-  }       
+  Standard_CString filename = theArgVec[1];
+  IFSelect_ReturnStatus readstat = Reader.ReadFile(filename);
+  theDI << "Status from reading IGES file " << filename << " : ";
+  switch (readstat)
+  {
+    case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; }
+    case IFSelect_RetDone: { theDI << "file read\n";    break; }
+    case IFSelect_RetError: { theDI << "file not found\n";   return 1; }
+    case IFSelect_RetFail: { theDI << "error during read\n";  return 1; }
+    default: { theDI << "failure\n";   return 1; }
+  }
   Reader.TransferRoots();
   TopoDS_Shape shape = Reader.OneShape();
-  DBRep::Set(argv[2],shape); 
-  di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
-  return 0;  
+  DBRep::Set(theArgVec[2], shape);
+  theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n";
+  return 0;
 }
-//--------------------------------------------------------------
-// Function : brepiges
-//
-//--------------------------------------------------------------
 
-static Standard_Integer brepiges (Draw_Interpretor& di, Standard_Integer n, const char** a) 
+//=======================================================================
+//function : brepiges
+//purpose  :
+//=======================================================================
+static Standard_Integer brepiges(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
 {
-  XSDRAW::SetNorm ("IGES");
-  // ecriture dans le model d'une entite :
-  //    -  model_AddEntity(ent)             : ecriture de l`entite seule
-  //    -  model->AddWithRefs(ent, protocol): ecriture de l`entite et eventuellement 
-  //                                          . de sa matrice de transformation 
-  //                                          . de ses sous-elements
-
-  IGESControl_Writer ICW (Interface_Static::CVal("write.iges.unit"),
-                         Interface_Static::IVal("write.iges.brep.mode"));
-  di<<"unit (write) : "<<Interface_Static::CVal("write.iges.unit")<<"\n";
-  di<<"mode  write  : "<<Interface_Static::CVal("write.iges.brep.mode")<<"\n";
-  di<<"  To modify : command  param\n";
-
-//  Mode d emploi (K4B ->) : brepiges shape [+shape][ +shape] nomfic
-//   c a d tant qu il y a des + on ajoute ce qui suit
-  const char* nomfic = NULL;
-  Standard_Integer npris = 0;
-
-  Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
-  Message_ProgressScope aPSRoot (progress->Start(), "Translating", 100);
-  progress->Show(aPSRoot);
+  Handle(XSControl_WorkSession) aWorkSession = XSDRAW::Session();
+  aWorkSession->SelectNorm("IGES");
 
-  Message_ProgressScope aPS(aPSRoot.Next(90), NULL, n);
-  for ( Standard_Integer i = 1; i < n && aPS.More(); i++) {
-    const char* nomvar = a[i];
-    if (a[i][0] == '+') nomvar = &(a[i])[1];
-    else if (i > 1)  {  nomfic = a[i];  break;  }
-    TopoDS_Shape Shape = DBRep::Get(nomvar);
-    if      (ICW.AddShape (Shape, aPS.Next())) npris ++;
-    else if (ICW.AddGeom (DrawTrSurf::GetCurve   (nomvar)) ) npris ++;
-    else if (ICW.AddGeom (DrawTrSurf::GetSurface (nomvar)) ) npris ++;
-  }
-  ICW.ComputeModel();
-  XSDRAW::SetModel(ICW.Model());
-  XSDRAW::SetTransferProcess (ICW.TransferProcess());
-    
-  if (aPSRoot.UserBreak())
+  IGESControl_Writer anIgesWriter(Interface_Static::CVal("write.iges.unit"),
+    Interface_Static::IVal("write.iges.brep.mode"));
+  theDI << "unit (write) : " << Interface_Static::CVal("write.iges.unit") << "\n";
+  theDI << "mode  write  : " << Interface_Static::CVal("write.iges.brep.mode") << "\n";
+  theDI << "  To modify : command  param\n";
+
+  const char* aFileName = nullptr;
+  Standard_Integer aNumShapesProcessed = 0;
+
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI, 1);
+  Message_ProgressScope aRootProgress(aProgress->Start(), "Translating", 100);
+  aProgress->Show(aRootProgress);
+
+  Message_ProgressScope aStepProgress(aRootProgress.Next(90), NULL, theNbArgs);
+  for (Standard_Integer i = 1; i < theNbArgs && aStepProgress.More(); i++)
+  {
+    const char* aVariableName = theArgVec[i];
+    if (theArgVec[i][0] == '+') aVariableName = &(theArgVec[i])[1];
+    else if (i > 1) {
+      aFileName = theArgVec[i];  break;
+    }
+
+    TopoDS_Shape aShape = DBRep::Get(aVariableName);
+    if (anIgesWriter.AddShape(aShape, aStepProgress.Next())) aNumShapesProcessed++;
+    else if (anIgesWriter.AddGeom(DrawTrSurf::GetCurve(aVariableName))) aNumShapesProcessed++;
+    else if (anIgesWriter.AddGeom(DrawTrSurf::GetSurface(aVariableName))) aNumShapesProcessed++;
+  }
+  anIgesWriter.ComputeModel();
+
+  if (aRootProgress.UserBreak())
     return 1;
-  aPSRoot.SetName("Writing");
-  progress->Show(aPSRoot);
 
-  di<<npris<<" Shapes written, giving "<<XSDRAW::Model()->NbEntities()<<" Entities\n";
+  aRootProgress.SetName("Writing");
+  aProgress->Show(aRootProgress);
+
+  theDI << aNumShapesProcessed << " Shapes written, giving " << anIgesWriter.Model()->NbEntities() << " Entities\n";
 
-  if ( ! nomfic ) // delayed write
+  if (!aFileName) // delayed write
   {
-    di<<" Now, to write a file, command : writeall filename\n";
+    theDI << " Now, to write a file, command : writeall filename\n";
     return 0;
   }
 
   // write file
-  if (! ICW.Write(nomfic)) di<<" Error: could not write file " << nomfic;
-  else                     di<<" File " << nomfic << " written";
+  if (!anIgesWriter.Write(aFileName))
+  {
+    theDI << " Error: could not write file " << aFileName << "\n";
+    return 1;
+  }
+  theDI << " File " << aFileName << " written\n";
+  aWorkSession->SetModel(anIgesWriter.Model());
 
   return 0;
 }
 
-//--------------------------------------------------------------
-// Function : testwriteiges
-//
-//--------------------------------------------------------------
-
-static Standard_Integer testwrite (Draw_Interpretor& di, Standard_Integer n, const char** a) 
+//=======================================================================
+//function : testwrite
+//purpose  :
+//=======================================================================
+static Standard_Integer testwrite(Draw_Interpretor& theDI,
+                                  Standard_Integer theNbArgs,
+                                  const char** theArgVec)
 {
-  if (n != 3)                                                                                      
-    {                                                                                             
-      di << "ERROR in " << a[0] << "Wrong Number of Arguments.\n";                     
-      di << " Usage : " << a[0] <<" file_name shape_name\n";                          
-      return 1;                                                                                 
-    }
+  if (theNbArgs != 3)
+  {
+    theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
+    theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n";
+    return 1;
+  }
   IGESControl_Writer Writer;
-  Standard_CString filename = a[1];
-  TopoDS_Shape shape = DBRep::Get(a[2]); 
+  Standard_CString filename = theArgVec[1];
+  TopoDS_Shape shape = DBRep::Get(theArgVec[2]);
   Standard_Boolean ok = Writer.AddShape(shape);
-  if(!ok){
-    di<<"Shape not add\n";
+  if (!ok)
+  {
+    theDI << "Shape not add\n";
     return 1;
   }
-  
-  if(!(Writer.Write(filename))){
-    di<<"Error on writing file\n";
+
+  if (!(Writer.Write(filename)))
+  {
+    theDI << "Error on writing file\n";
     return 1;
   }
-  di<<"File Is Written\n"; 
+  theDI << "File Is Written\n";
   return 0;
 }
-//--------------------------------------------------------------
-// Function : igesparam
-//
-//--------------------------------------------------------------
-
 
-static Standard_Integer igesparam (Draw_Interpretor& di, Standard_Integer , const char** ) 
+//=======================================================================
+//function : igesparam
+//purpose  :
+//=======================================================================
+static Standard_Integer igesparam(Draw_Interpretor& theDI,
+                                  Standard_Integer,
+                                  const char**)
 {
-//  liste des parametres
-  di<<"List of parameters which control IGES :\n";
-  di<<"  unit : write.iges.unit\n  mode write : write.iges.brep.mode\n  spline_continuity (read) : read.iges.bspline.continuity\nSee definition by  defparam, read/edit value by  param\n";
-  di<<"unit (write) : "<<Interface_Static::CVal("write.iges.unit")<<"\n";
-  di<<"mode  write  : "<<Interface_Static::CVal("write.iges.brep.mode")<<"\n";
-  di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
-  di<<"\n To modifier, param nom_param new_val\n";
+  //  liste des parametres
+  theDI << "List of parameters which control IGES :\n";
+  theDI << "  unit : write.iges.unit\n  mode write : write.iges.brep.mode\n  spline_continuity (read) : read.iges.bspline.continuity\nSee definition by  defparam, read/edit value by  param\n";
+  theDI << "unit (write) : " << Interface_Static::CVal("write.iges.unit") << "\n";
+  theDI << "mode  write  : " << Interface_Static::CVal("write.iges.brep.mode") << "\n";
+  theDI << "spline_continuity (read) : " << Interface_Static::IVal("read.iges.bspline.continuity") << " (0 : no modif, 1 : C1, 2 : C2)\n";
+  theDI << "\n To modifier, param nom_param new_val\n";
   return 0;
 }
 
+//=======================================================================
+//function : XSDRAWIGES_tplosttrim
+//purpose  :
+//=======================================================================
+static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI,
+                                              Standard_Integer theNbArgs,
+                                              const char** theArgVec)
+{
+  Handle(XSControl_WorkSession) aWorkSession = XSDRAW::Session();
+  const Handle(Transfer_TransientProcess)& anTransientProcess = aWorkSession->TransferReader()->TransientProcess();
+  TColStd_Array1OfAsciiString aTypeStrings(1, 3);
+  TColStd_Array1OfAsciiString aKindStrings(1, 3);
+  aTypeStrings.SetValue(1, "xst-type(CurveOnSurface)");
+  aTypeStrings.SetValue(2, "xst-type(Boundary)");
+  aTypeStrings.SetValue(3, "xst-type(Loop)");
+  aKindStrings.SetValue(1, "IGESGeom_TrimmedSurface");
+  aKindStrings.SetValue(2, "IGESGeom_BoundedSurface");
+  aKindStrings.SetValue(3, "IGESSolid_Face");
+  if (anTransientProcess.IsNull())
+  {
+    theDI << "No Transfer Read\n";
+    return 1;
+  }
+  Standard_Integer anNumFaces = 0, aTotalFaces = 0;
+  Transfer_IteratorOfProcessForTransient anIterator = anTransientProcess->AbnormalResult();
+  Standard_Integer anIndex = 0;
+  if (theNbArgs > 1)
+  {
+    TCollection_AsciiString anArg(theArgVec[1]);
+    for (anIndex = 1; anIndex <= 3; anIndex++)
+    {
+      if (aKindStrings.Value(anIndex).Location(anArg, 1, aKindStrings.Value(anIndex).Length()) != 0)
+      {
+        break;
+      }
+    }
+  }
 
-//--------------------------------------------------------------
-// Function : tplosttrim
-//
-//--------------------------------------------------------------
+  if (anIndex == 4)
+  {
+    theDI << "Invalid argument\n";
+    return 0;
+  }
 
-static Standard_Integer XSDRAWIGES_tplosttrim (Draw_Interpretor& di, Standard_Integer n, const char** a) 
-{
-  Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
-
-//  Standard_Integer narg = pilot->NbWords();
-  Standard_Integer narg = n;
-
-  const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
-  TColStd_Array1OfAsciiString strarg(1, 3);
-  TColStd_Array1OfAsciiString typarg(1, 3);
-  strarg.SetValue(1,"xst-type(CurveOnSurface)");
-  strarg.SetValue(2,"xst-type(Boundary)");
-  strarg.SetValue(3,"xst-type(Loop)");
-  typarg.SetValue(1,"IGESGeom_TrimmedSurface");
-  typarg.SetValue(2,"IGESGeom_BoundedSurface");
-  typarg.SetValue(3,"IGESSolid_Face");
-  if (TP.IsNull()) { di<<"No Transfer Read\n"; return 1; }
-  Standard_Integer nbFaces = 0, totFaces = 0 ;
-  Handle(IFSelect_WorkSession) WS = pilot->Session(); 
-  Transfer_IteratorOfProcessForTransient itrp = TP->AbnormalResult(); 
-  Standard_Integer k=0;
-  if(narg > 1) {
-//    TCollection_AsciiString Arg = pilot->Word(1);
-    TCollection_AsciiString Arg(a[1]);
-    for(k=1 ; k<=3;k++ ) {
-      if(typarg.Value(k).Location(Arg,1,typarg.Value(k).Length()) != 0) break;
+  for (Standard_Integer j = 1; j <= 3; j++)
+  {
+    TColStd_MapOfTransient aFaceMap;
+
+    if (theNbArgs == 1)
+    {
+      anIndex = j;
     }
-  }   
-  if( k == 4) {di<< "Invalid argument\n"; return 0; }
-  for(Standard_Integer j = 1 ; j <= 3; j++) {
-    TColStd_MapOfTransient aMap;
-    if(narg == 1) k=j;
-    Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList(pilot->Session(),strarg.Value(k).ToCString());
-    if (!list.IsNull()) itrp.Filter (list);
-    else {
-      di << "No untrimmed faces\n";
+    Handle(TColStd_HSequenceOfTransient) aFaceList = aWorkSession->GiveList(aTypeStrings.Value(anIndex).ToCString());
+    if (!aFaceList.IsNull())
+    {
+      anIterator.Filter(aFaceList);
+    }
+    else
+    {
+      theDI << "No untrimmed faces\n";
       return 0;
     }
-    for (itrp.Start(); itrp.More(); itrp.Next()) {
-      const Handle(Standard_Transient)& ent = itrp.Starting();
-      Handle(TColStd_HSequenceOfTransient) super = WS->Sharings (ent);
-      if (!super.IsNull()) {
-       Standard_Integer nb = super->Length();
-       if (nb > 0) {
-           for (Standard_Integer i = 1; i <= nb; i++)
-             if (super->Value(i)->IsKind (typarg.Value(k).ToCString())) {
-               if(aMap.Add(super->Value(i))) nbFaces++;
-             }
-       }
+    for (anIterator.Start(); anIterator.More(); anIterator.Next())
+    {
+      Handle(Standard_Transient) anEntity = anIterator.Starting();
+      Handle(TColStd_HSequenceOfTransient) aSharingEntities = aWorkSession->Sharings(anEntity);
+      if (!aSharingEntities.IsNull())
+      {
+        Standard_Integer aNumSharingEntities = aSharingEntities->Length();
+        if (aNumSharingEntities > 0)
+        {
+          for (Standard_Integer i = 1; i <= aNumSharingEntities; i++)
+          {
+            if (aSharingEntities->Value(i)->IsKind(aKindStrings.Value(anIndex).ToCString()))
+            {
+              if (aFaceMap.Add(aSharingEntities->Value(i)))
+              {
+                anNumFaces++;
+              }
+            }
+          }
+        }
       }
     }
-    if(nbFaces != 0) {
-      if( j == 1 ) di << "Number of untrimmed faces: \n";
-      switch(k){
-      case 1:  
-       di << "Trimmed Surface: \n"; break;
+    if (anNumFaces != 0)
+    {
+      if (j == 1)
+      {
+        theDI << "Number of untrimmed faces: \n";
+      }
+      switch (anIndex)
+      {
+      case 1:
+        theDI << "Trimmed Surface: \n";
+        break;
       case 2:
-       di << "Bounded Surface: \n"; break;
+        theDI << "Bounded Surface: \n";
+        break;
       case 3:
-       di << "Face: \n"; break;
+        theDI << "Face: \n";
+        break;
       }
-
-      TColStd_MapIteratorOfMapOfTransient itmap;
+      TColStd_MapIteratorOfMapOfTransient anMapIterator;
       Standard_SStream aTmpStream;
-      for(itmap.Initialize(aMap); itmap.More(); itmap.Next()) {
-        XSDRAW::Model()->Print (itmap.Key(), aTmpStream);
+      for (anMapIterator.Initialize(aFaceMap); anMapIterator.More(); anMapIterator.Next())
+      {
+        aWorkSession->Model()->Print(anMapIterator.Key(), aTmpStream);
         aTmpStream << "  ";
       }
-      di << aTmpStream.str().c_str();
-      di << "\n";
-      di << "\nNumber:"<< nbFaces << "\n";
-      totFaces += nbFaces;
+      theDI << aTmpStream.str().c_str();
+      theDI << "\n";
+      theDI << "\nNumber:" << anNumFaces << "\n";
+      aTotalFaces += anNumFaces;
+    }
+    if (theNbArgs > 1)
+    {
+      break;
     }
-    if(narg > 1) break;
-    nbFaces = 0;
+    anNumFaces = 0;
+  }
+  if (aTotalFaces == 0)
+  {
+    theDI << "No untrimmed faces\n";
+  }
+  else
+  {
+    theDI << "Total number :" << aTotalFaces << "\n";
   }
-  
-  if(totFaces == 0) di << "No untrimmed faces\n";
-  else              di << "Total number :" << totFaces << "\n";
   return 0;
 }
-//-------------------------------------------------------------------
-//--------------------------------------------------------------
-// Function : TPSTAT
-//
-//--------------------------------------------------------------
-static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& di,Standard_Integer n, const char** a)
+
+
+//=======================================================================
+//function : XSDRAWIGES_TPSTAT
+//purpose  :
+//=======================================================================
+static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& theDI,
+                                          Standard_Integer theNbArgs,
+                                          const char** theArgVec)
 {
-  Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
-  Standard_Integer argc = n;//= pilot->NbWords();
-  const Standard_CString arg1 = a[1];//pilot->Arg(1);
-  const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
-  IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
-//        ****    tpent        ****
-  Handle(Interface_InterfaceModel) model = TP->Model();
-  if (model.IsNull()) {di<<"No Transfer Read\n"; return -1;}
-  Handle(XSControl_WorkSession) thesession = read.WS();
-  thesession->SetMapReader(TP);
-  Standard_Integer mod1 = 0;
-  if (argc > 1) {
-    char a2 = arg1[1]; if (a2 == '\0') a2 = '!';
-    switch (arg1[0]) {
-    case 'g' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_GeneralInfo);break;
-    case 'c' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_CountByItem); break;
-    case 'C' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_ListByItem); break;
-    case 'r' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_ResultCount);break;
-    case 's' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_Mapping);break;
-    case '?' : mod1 = -1; break;
-    default  : mod1 = -2; break;
+  Handle(XSControl_WorkSession) aWorkSession = XSDRAW::Session();
+  const Standard_CString anArg1 = theArgVec[1];
+  const Handle(Transfer_TransientProcess)& aTransientProcess = aWorkSession->TransferReader()->TransientProcess();
+  IGESControl_Reader aReader;
+  Handle(Interface_InterfaceModel) aModel = aTransientProcess->Model();
+  if (aModel.IsNull()) { theDI << "No Transfer Read\n"; return -1; }
+  Handle(XSControl_WorkSession) aSession = aReader.WS();
+  aSession->SetMapReader(aTransientProcess);
+  Standard_Integer aMode = 0;
+  if (theNbArgs > 1)
+  {
+    char a2 = anArg1[1]; if (a2 == '\0') a2 = '!';
+    switch (anArg1[0])
+    {
+      case 'g': aReader.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_GeneralInfo); break;
+      case 'c': aReader.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_CountByItem); break;
+      case 'C': aReader.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ListByItem); break;
+      case 'r': aReader.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ResultCount); break;
+      case 's': aReader.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_Mapping); break;
+      case '?': aMode = -1; break;
+      default: aMode = -2; break;
     }
   }
-  if (mod1 < -1) di<<"Unknown Mode\n";
-  if (mod1 < 0) {
-    di<<"Modes available :\n"
-      <<"g : general    c : checks (count)  C (list)\n"
-      <<"r : number of CasCade resulting shapes\n"
-      <<"s : mapping between IGES entities and CasCade shapes\n";
-    if (mod1 < -1) return -1;
+  if (aMode < -1) theDI << "Unknown Mode\n";
+  if (aMode < 0)
+  {
+    theDI << "Modes available :\n"
+      << "g : general    c : checks (count)  C (list)\n"
+      << "r : number of CasCade resulting shapes\n"
+      << "s : mapping between IGES entities and CasCade shapes\n";
+    if (aMode < -1) return -1;
     return 0;
   }
   return 0;
 }
 
-static Standard_Integer etest(Draw_Interpretor& di, Standard_Integer argc, const char** a)
+
+//=======================================================================
+//function : etest
+//purpose  :
+//=======================================================================
+static Standard_Integer etest(Draw_Interpretor& theDI,
+                              Standard_Integer theNbArgs,
+                              const char** theArgVec)
 {
-  if(argc < 3) {
-    di<<"etest igesfile shape\n";
+  if (theNbArgs < 3)
+  {
+    theDI << "etest igesfile shape\n";
     return 0;
   }
   IGESControl_Reader aReader;
-  aReader.ReadFile(a[1]);
+  aReader.ReadFile(theArgVec[1]);
   aReader.SetReadVisible(Standard_True);
   aReader.TransferRoots();
   TopoDS_Shape shape = aReader.OneShape();
-  DBRep::Set(a[2],shape);
+  DBRep::Set(theArgVec[2], shape);
   return 0;
 }
 
-extern "C" {
-static void cleanpilot ()
+//=======================================================================
+//function : ReadIges
+//purpose  : Read IGES to DECAF document
+//=======================================================================
+static Standard_Integer ReadIges(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
 {
-  XSDRAW::Session()->ClearData(1);
-}
-}
+  if (theNbArgs < 3)
+  {
+    theDI << "Use: " << theArgVec[0] << " Doc filename [mode]: read IGES file to a document\n";
+    return 0;
+  }
 
+  DeclareAndCast(IGESControl_Controller, aController, XSDRAW::Controller());
+  if (aController.IsNull()) XSDRAW::SetNorm("IGES");
 
-//--------------------------------------------------------------
-// Function : Init(s)
-//
-//--------------------------------------------------------------
+  TCollection_AsciiString aFileName, aModelName;
+  Standard_Boolean isModified = XSDRAW::FileAndVar(theArgVec[2], theArgVec[1], "IGES", aFileName, aModelName);
+  if (isModified) theDI << " File IGES to read : " << aFileName.ToCString() << "\n";
+  else theDI << " Model taken from the session : " << aModelName.ToCString() << "\n";
 
-void  XSDRAWIGES::InitSelect ()
-{
-  Handle(IGESSelect_Activator)    igesact = new IGESSelect_Activator;
-  IGESControl_Controller::Init();
-//  XSDRAW::SetNorm ("IGES");  trop tot
-  XSDRAW::SetController (XSControl_Controller::Recorded("iges"));
-  
-  atexit (cleanpilot);
-}
+  IGESCAFControl_Reader aReader(XSDRAW::Session(), isModified);
+  Standard_Integer onlyVisible = Interface_Static::IVal("read.iges.onlyvisible");
+  aReader.SetReadVisible(onlyVisible == 1);
+
+  if (theNbArgs == 4)
+  {
+    Standard_Boolean mode = Standard_True;
+    for (Standard_Integer i = 0; theArgVec[3][i]; i++)
+      switch (theArgVec[3][i])
+      {
+      case '-': mode = Standard_False; break;
+      case '+': mode = Standard_True; break;
+      case 'c': aReader.SetColorMode(mode); break;
+      case 'n': aReader.SetNameMode(mode); break;
+      case 'l': aReader.SetLayerMode(mode); break;
+      }
+  }
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI);
+  Message_ProgressScope aRootScope(aProgress->Start(), "IGES import", isModified ? 2 : 1);
+
+  IFSelect_ReturnStatus aReadStatus = IFSelect_RetVoid;
+  if (isModified)
+  {
+    Message_ProgressScope aReadScope(aRootScope.Next(), "File reading", 1);
+    aReadScope.Show();
+    aReadStatus = aReader.ReadFile(aFileName.ToCString());
+  }
+  else if (XSDRAW::Session()->NbStartingEntities() > 0)
+  {
+    aReadStatus = IFSelect_RetDone;
+  }
+  if (aReadStatus != IFSelect_RetDone)
+  {
+    if (isModified)
+    {
+      theDI << "Could not read file " << aFileName.ToCString() << " , abandon\n";
+    }
+    else
+    {
+      theDI << "No model loaded\n";
+    }
+    return 1;
+  }
+
+  Handle(TDocStd_Document) aDocument;
+  if (!DDocStd::GetDocument(theArgVec[1], aDocument, Standard_False))
+  {
+    Handle(TDocStd_Application) anApplication = DDocStd::GetApplication();
+    anApplication->NewDocument("BinXCAF", aDocument);
+    TDataStd_Name::Set(aDocument->GetData()->Root(), theArgVec[1]);
+    Handle(DDocStd_DrawDocument) aDrawDocument = new DDocStd_DrawDocument(aDocument);
+    Draw::Set(theArgVec[1], aDrawDocument);
+  }
+  if (!aReader.Transfer(aDocument, aRootScope.Next()))
+  {
+    theDI << "Cannot read any relevant data from the IGES file\n";
+    return 1;
+  }
+  theDI << "Document saved with name " << theArgVec[1];
 
+  return 0;
+}
 
 //=======================================================================
-//function : InitToBRep
-//purpose  : 
+//function : WriteIges
+//purpose  : Write DECAF document to IGES
 //=======================================================================
-
-void  XSDRAWIGES::InitToBRep (Draw_Interpretor& theCommands)
+static Standard_Integer WriteIges(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec)
 {
-  const char* g = "DE: IGES";
-  theCommands.Add("igesbrep",     "igesbrep [file else already loaded model] [name DRAW]",     __FILE__, igesbrep,              g);
-  theCommands.Add("testreadiges", "testreadiges [file else already loaded model] [name DRAW]", __FILE__, testread,              g);
-  theCommands.Add("igesread",     "igesread [file else already loaded model] [name DRAW]",     __FILE__, igesbrep,              g);
-  theCommands.Add("igesparam",    "igesparam ->list, + name ->one param, + name val->change",  __FILE__, igesparam,             g);
-  theCommands.Add("TPSTAT",       " ",                                                         __FILE__, XSDRAWIGES_TPSTAT,     g);
-  theCommands.Add("tplosttrim",   "number of untrimmed faces during last transfer",            __FILE__, XSDRAWIGES_tplosttrim, g);
-  theCommands.Add("etest",        "test of eviewer",                                           __FILE__, etest,                 g);
+  if (theNbArgs < 3)
+  {
+    theDI << "Use: " << theArgVec[0] << " Doc filename [mode]: write document to IGES file\n";
+    return 0;
+  }
 
-}
+  Handle(TDocStd_Document) aDocument;
+  DDocStd::GetDocument(theArgVec[1], aDocument);
+  if (aDocument.IsNull())
+  {
+    theDI << theArgVec[1] << " is not a document\n";
+    return 1;
+  }
 
+  XSDRAW::SetNorm("IGES");
+
+  TCollection_AsciiString aFileName, aModelName;
+  const Standard_Boolean isModified = XSDRAW::FileAndVar(theArgVec[2], theArgVec[1], "IGES", aFileName, aModelName);
+
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI);
+  Message_ProgressScope aRootScope(aProgress->Start(), "IGES export", isModified ? 2 : 1);
+
+  IGESCAFControl_Writer aWriter(XSDRAW::Session(), Standard_True);
+  if (theNbArgs == 4)
+  {
+    Standard_Boolean mode = Standard_True;
+    for (Standard_Integer i = 0; theArgVec[3][i]; i++)
+      switch (theArgVec[3][i])
+      {
+      case '-': mode = Standard_False; break;
+      case '+': mode = Standard_True; break;
+      case 'c': aWriter.SetColorMode(mode); break;
+      case 'n': aWriter.SetNameMode(mode); break;
+      case 'l': aWriter.SetLayerMode(mode); break;
+      }
+  }
+  aWriter.Transfer(aDocument, aRootScope.Next());
+
+  if (isModified)
+  {
+    Message_ProgressScope aWriteScope(aRootScope.Next(), "File writing", 1);
+    aWriteScope.Show();
+    theDI << "Writing IGES model to file " << theArgVec[2] << "\n";
+    if (aWriter.Write(aFileName.ToCString()))
+    {
+      theDI << " Write OK\n";
+    }
+    else
+    {
+      theDI << " Write failed\n";
+    }
+  }
+  else
+  {
+    theDI << "Document has been translated into the session";
+  }
+  return 0;
+}
 
 //=======================================================================
-//function : InitFromBRep
-//purpose  : 
+//function : Factory
+//purpose  :
 //=======================================================================
-
-void  XSDRAWIGES::InitFromBRep (Draw_Interpretor& theCommands)
+void XSDRAWIGES::Factory(Draw_Interpretor& theDI)
 {
-  const char* g = "DE: IGES";
-  theCommands.Add("brepiges",      "brepiges sh1 [+sh2 [+sh3 ..]] filename.igs", __FILE__, brepiges,  g);
-  theCommands.Add("testwriteiges", "testwriteiges filename.igs shape",           __FILE__, testwrite, g);
+  static Standard_Boolean aIsActivated = Standard_False;
+  if (aIsActivated)
+  {
+    return;
+  }
+  aIsActivated = Standard_True;
+
+  IGESControl_Controller::Init();
+
+  const char* aGroup = "DE: IGES";
+
+  theDI.Add("tplosttrim", "number of untrimmed faces during last transfer", __FILE__, XSDRAWIGES_tplosttrim, aGroup);
+  theDI.Add("igesbrep", "igesbrep [file else already loaded model] [name DRAW]", __FILE__, igesbrep, aGroup);
+  theDI.Add("testreadiges", "testreadiges [file else already loaded model] [name DRAW]", __FILE__, testread, aGroup);
+  theDI.Add("igesparam", "igesparam ->list, + name ->one param, + name val->change", __FILE__, igesparam, aGroup);
+  theDI.Add("TPSTAT", " ", __FILE__, XSDRAWIGES_TPSTAT, aGroup);
+  theDI.Add("etest", "test of eviewer", __FILE__, etest, aGroup);
+
+  theDI.Add("ReadIges", "Doc filename: Read IGES file to DECAF document", __FILE__, ReadIges, aGroup);
+  theDI.Add("WriteIges", "Doc filename: Write DECAF document to IGES file", __FILE__, WriteIges, aGroup);
+  theDI.Add("igesread", "igesread [file else already loaded model] [name DRAW]", __FILE__, igesbrep, aGroup);
+  theDI.Add("igeswrite", "igesread [file else already loaded model] [name DRAW]", __FILE__, brepiges, aGroup);
+  theDI.Add("brepiges", "brepiges sh1 [+sh2 [+sh3 ..]] filename.igs", __FILE__, brepiges, aGroup);
+  theDI.Add("testwriteiges", "testwriteiges filename.igs shape", __FILE__, testwrite, aGroup);
+
+  // Load XSDRAW session for pilot activation
+  XSDRAW::LoadDraw(theDI);
 }
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWIGES)
index e78351cdd1e3b31d581dfa2a57e0395bb58811fb..19a0a447e2f67327fb8143697c5abbe60ec7704c 100644 (file)
@@ -1,7 +1,4 @@
-// Created on: 1995-03-15
-// Created by: Christian CAILLET
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
+// Copyright (c) 2023 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
 //
 
 #include <Draw_Interpretor.hxx>
 
-
-//! XSDRAW for IGES : commands IGESSelect, Controller, transfer
-class XSDRAWIGES 
+class XSDRAWIGES
 {
-public:
-
   DEFINE_STANDARD_ALLOC
+public:
 
-  
-  //! Inits IGESSelect commands, for DRAW
-  Standard_EXPORT static void InitSelect();
-  
-  //! Inits IGESToBRep for DRAW
-  Standard_EXPORT static void InitToBRep (Draw_Interpretor& theCommands);
-  
-  //! Inits BRepToIGES for DRAW
-  Standard_EXPORT static void InitFromBRep (Draw_Interpretor& theCommands);
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
+  //! Loads all Draw commands of XSDRAWIGES. Used for plugin.
+  Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
 };
 
-
-
-
-
-
-
 #endif // _XSDRAWIGES_HeaderFile
diff --git a/src/XSDRAWOBJ/FILES b/src/XSDRAWOBJ/FILES
new file mode 100644 (file)
index 0000000..9659ffd
--- /dev/null
@@ -0,0 +1,2 @@
+XSDRAWOBJ.cxx
+XSDRAWOBJ.hxx
diff --git a/src/XSDRAWOBJ/XSDRAWOBJ.cxx b/src/XSDRAWOBJ/XSDRAWOBJ.cxx
new file mode 100644 (file)
index 0000000..87d1795
--- /dev/null
@@ -0,0 +1,405 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XSDRAWOBJ.hxx>
+
+#include <BRep_Builder.hxx>
+#include <DBRep.hxx>
+#include <DDocStd.hxx>
+#include <DDocStd_DrawDocument.hxx>
+#include <Draw.hxx>
+#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
+#include <Draw_ProgressIndicator.hxx>
+#include <RWObj_CafReader.hxx>
+#include <RWObj_CafWriter.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDocStd_Application.hxx>
+#include <TopoDS_Shape.hxx>
+#include <UnitsAPI.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
+#include <XCAFDoc_ShapeTool.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <XSDRAW.hxx>
+
+//=============================================================================
+//function : parseCoordinateSystem
+//purpose  : Parse RWMesh_CoordinateSystem enumeration
+//=============================================================================
+static bool parseCoordinateSystem(const char* theArg,
+                                  RWMesh_CoordinateSystem& theSystem)
+{
+  TCollection_AsciiString aCSStr(theArg);
+  aCSStr.LowerCase();
+  if (aCSStr == "zup")
+  {
+    theSystem = RWMesh_CoordinateSystem_Zup;
+  }
+  else if (aCSStr == "yup")
+  {
+    theSystem = RWMesh_CoordinateSystem_Yup;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+
+//=============================================================================
+//function : ReadObj
+//purpose  : Reads OBJ file
+//=============================================================================
+static Standard_Integer ReadObj (Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
+{
+  TCollection_AsciiString aDestName, aFilePath;
+  Standard_Boolean toUseExistingDoc = Standard_False;
+  Standard_Real aFileUnitFactor = -1.0;
+  RWMesh_CoordinateSystem aResultCoordSys = RWMesh_CoordinateSystem_Zup, aFileCoordSys = RWMesh_CoordinateSystem_Yup;
+  Standard_Boolean toListExternalFiles = Standard_False, isSingleFace = Standard_False, isSinglePrecision = Standard_False;
+  Standard_Boolean isNoDoc = (TCollection_AsciiString(theArgVec[0]) == "readobj");
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArgCase (theArgVec[anArgIter]);
+    anArgCase.LowerCase();
+    if (anArgIter + 1 < theNbArgs
+     && (anArgCase == "-unit"
+      || anArgCase == "-units"
+      || anArgCase == "-fileunit"
+      || anArgCase == "-fileunits"))
+    {
+      const TCollection_AsciiString aUnitStr (theArgVec[++anArgIter]);
+      aFileUnitFactor = UnitsAPI::AnyToSI (1.0, aUnitStr.ToCString());
+      if (aFileUnitFactor <= 0.0)
+      {
+        Message::SendFail() << "Syntax error: wrong length unit '" << aUnitStr << "'";
+        return 1;
+      }
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArgCase == "-filecoordinatesystem"
+           || anArgCase == "-filecoordsystem"
+           || anArgCase == "-filecoordsys"))
+    {
+      if (!parseCoordinateSystem (theArgVec[++anArgIter], aFileCoordSys))
+      {
+        Message::SendFail() << "Syntax error: unknown coordinate system '" << theArgVec[anArgIter] << "'";
+        return 1;
+      }
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArgCase == "-resultcoordinatesystem"
+           || anArgCase == "-resultcoordsystem"
+           || anArgCase == "-resultcoordsys"
+           || anArgCase == "-rescoordsys"))
+    {
+      if (!parseCoordinateSystem (theArgVec[++anArgIter], aResultCoordSys))
+      {
+        Message::SendFail() << "Syntax error: unknown coordinate system '" << theArgVec[anArgIter] << "'";
+        return 1;
+      }
+    }
+    else if (anArgCase == "-singleprecision"
+          || anArgCase == "-singleprec")
+    {
+      isSinglePrecision = Standard_True;
+      if (anArgIter + 1 < theNbArgs
+       && Draw::ParseOnOff (theArgVec[anArgIter + 1], isSinglePrecision))
+      {
+        ++anArgIter;
+      }
+    }
+    else if (isNoDoc
+          && (anArgCase == "-singleface"
+           || anArgCase == "-singletriangulation"))
+    {
+      isSingleFace = Standard_True;
+    }
+    else if (!isNoDoc
+          && (anArgCase == "-nocreate"
+           || anArgCase == "-nocreatedoc"))
+    {
+      toUseExistingDoc = Standard_True;
+      if (anArgIter + 1 < theNbArgs
+       && Draw::ParseOnOff (theArgVec[anArgIter + 1], toUseExistingDoc))
+      {
+        ++anArgIter;
+      }
+    }
+    else if (anArgCase == "-listexternalfiles"
+          || anArgCase == "-listexternals"
+          || anArgCase == "-listexternal"
+          || anArgCase == "-external"
+          || anArgCase == "-externalfiles")
+    {
+      toListExternalFiles = Standard_True;
+    }
+    else if (aDestName.IsEmpty())
+    {
+      aDestName = theArgVec[anArgIter];
+    }
+    else if (aFilePath.IsEmpty())
+    {
+      aFilePath = theArgVec[anArgIter];
+    }
+    else
+    {
+      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
+      return 1;
+    }
+  }
+  if (aFilePath.IsEmpty())
+  {
+    Message::SendFail() << "Syntax error: wrong number of arguments";
+    return 1;
+  }
+
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
+  Handle(TDocStd_Document) aDoc;
+  if (!isNoDoc
+   && !toListExternalFiles)
+  {
+    Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
+    Standard_CString aNameVar = aDestName.ToCString();
+    DDocStd::GetDocument (aNameVar, aDoc, Standard_False);
+    if (aDoc.IsNull())
+    {
+      if (toUseExistingDoc)
+      {
+        Message::SendFail() << "Error: document with name " << aDestName << " does not exist";
+        return 1;
+      }
+      anApp->NewDocument (TCollection_ExtendedString ("BinXCAF"), aDoc);
+    }
+    else if (!toUseExistingDoc)
+    {
+      Message::SendFail() << "Error: document with name " << aDestName << " already exists";
+      return 1;
+    }
+  }
+  const Standard_Real aScaleFactorM = XSDRAW::GetLengthUnit() / 1000;
+
+  RWObj_CafReader aReader;
+  aReader.SetSinglePrecision (isSinglePrecision);
+  aReader.SetSystemLengthUnit (aScaleFactorM);
+  aReader.SetSystemCoordinateSystem (aResultCoordSys);
+  aReader.SetFileLengthUnit (aFileUnitFactor);
+  aReader.SetFileCoordinateSystem (aFileCoordSys);
+  aReader.SetDocument (aDoc);
+  if (isSingleFace)
+  {
+    RWObj_TriangulationReader aSimpleReader;
+    aSimpleReader.SetSinglePrecision (isSinglePrecision);
+    aSimpleReader.SetCreateShapes (Standard_False);
+    aSimpleReader.SetTransformation (aReader.CoordinateSystemConverter());
+    aSimpleReader.Read (aFilePath.ToCString(), aProgress->Start());
+
+    Handle(Poly_Triangulation) aTriangulation = aSimpleReader.GetTriangulation();
+    TopoDS_Face aFace;
+    BRep_Builder aBuiler;
+    aBuiler.MakeFace (aFace);
+    aBuiler.UpdateFace (aFace, aTriangulation);
+    DBRep::Set (aDestName.ToCString(), aFace);
+    return 0;
+  }
+
+  if (toListExternalFiles)
+  {
+    aReader.ProbeHeader (aFilePath);
+    for (NCollection_IndexedMap<TCollection_AsciiString>::Iterator aFileIter (aReader.ExternalFiles()); aFileIter.More(); aFileIter.Next())
+    {
+      theDI << "\"" << aFileIter.Value() << "\" ";
+    }
+  }
+  else
+  {
+    aReader.Perform (aFilePath, aProgress->Start());
+    if (isNoDoc)
+    {
+      DBRep::Set (aDestName.ToCString(), aReader.SingleShape());
+    }
+    else
+    {
+      Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument (aDoc);
+      TDataStd_Name::Set (aDoc->GetData()->Root(), aDestName);
+      Draw::Set (aDestName.ToCString(), aDrawDoc);
+    }
+  }
+  return 0;
+}
+
+///=============================================================================
+//function : WriteObj
+//purpose  : Writes OBJ file
+//=============================================================================
+static Standard_Integer WriteObj (Draw_Interpretor& theDI,
+                                  Standard_Integer theNbArgs,
+                                  const char** theArgVec)
+{
+  TCollection_AsciiString anObjFilePath;
+  Handle(TDocStd_Document) aDoc;
+  Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
+  TColStd_IndexedDataMapOfStringString aFileInfo;
+  Standard_Real aFileUnitFactor = -1.0;
+  RWMesh_CoordinateSystem aSystemCoordSys = RWMesh_CoordinateSystem_Zup, aFileCoordSys = RWMesh_CoordinateSystem_Yup;
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArgCase (theArgVec[anArgIter]);
+    anArgCase.LowerCase();
+        if (anArgIter + 1 < theNbArgs
+     && (anArgCase == "-unit"
+      || anArgCase == "-units"
+      || anArgCase == "-fileunit"
+      || anArgCase == "-fileunits"))
+    {
+      const TCollection_AsciiString aUnitStr (theArgVec[++anArgIter]);
+      aFileUnitFactor = UnitsAPI::AnyToSI (1.0, aUnitStr.ToCString());
+      if (aFileUnitFactor <= 0.0)
+      {
+        Message::SendFail() << "Syntax error: wrong length unit '" << aUnitStr << "'";
+        return 1;
+      }
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArgCase == "-filecoordinatesystem"
+           || anArgCase == "-filecoordsystem"
+           || anArgCase == "-filecoordsys"))
+    {
+      if (!parseCoordinateSystem (theArgVec[++anArgIter], aFileCoordSys))
+      {
+        Message::SendFail() << "Syntax error: unknown coordinate system '" << theArgVec[anArgIter] << "'";
+        return 1;
+      }
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArgCase == "-systemcoordinatesystem"
+           || anArgCase == "-systemcoordsystem"
+           || anArgCase == "-systemcoordsys"
+           || anArgCase == "-syscoordsys"))
+    {
+      if (!parseCoordinateSystem (theArgVec[++anArgIter], aSystemCoordSys))
+      {
+        Message::SendFail() << "Syntax error: unknown coordinate system '" << theArgVec[anArgIter] << "'";
+        return 1;
+      }
+    }
+    else if (anArgCase == "-comments"
+          && anArgIter + 1 < theNbArgs)
+    {
+      aFileInfo.Add ("Comments", theArgVec[++anArgIter]);
+    }
+    else if (anArgCase == "-author"
+          && anArgIter + 1 < theNbArgs)
+    {
+      aFileInfo.Add ("Author", theArgVec[++anArgIter]);
+    }
+    else if (aDoc.IsNull())
+    {
+      Standard_CString aNameVar = theArgVec[anArgIter];
+      DDocStd::GetDocument (aNameVar, aDoc, false);
+      if (aDoc.IsNull())
+      {
+        TopoDS_Shape aShape = DBRep::Get (aNameVar);
+        if (aShape.IsNull())
+        {
+          Message::SendFail() << "Syntax error: '" << aNameVar << "' is not a shape nor document";
+          return 1;
+        }
+
+        anApp->NewDocument (TCollection_ExtendedString ("BinXCAF"), aDoc);
+        Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
+        aShapeTool->AddShape (aShape);
+      }
+    }
+    else if (anObjFilePath.IsEmpty())
+    {
+      anObjFilePath = theArgVec[anArgIter];
+    }
+    else
+    {
+      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
+      return 1;
+    }
+  }
+  if (anObjFilePath.IsEmpty())
+  {
+    Message::SendFail() << "Syntax error: wrong number of arguments";
+    return 1;
+  }
+
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
+
+  const Standard_Real aSystemUnitFactor = XSDRAW::GetLengthUnit() * 0.001;
+  RWObj_CafWriter aWriter (anObjFilePath);
+  aWriter.ChangeCoordinateSystemConverter().SetInputLengthUnit (aSystemUnitFactor);
+  aWriter.ChangeCoordinateSystemConverter().SetInputCoordinateSystem (aSystemCoordSys);
+  aWriter.ChangeCoordinateSystemConverter().SetOutputLengthUnit (aFileUnitFactor);
+  aWriter.ChangeCoordinateSystemConverter().SetOutputCoordinateSystem (aFileCoordSys);
+  aWriter.Perform (aDoc, aFileInfo, aProgress->Start());
+  return 0;
+}
+
+//=======================================================================
+//function : Factory
+//purpose  :
+//=======================================================================
+void XSDRAWOBJ::Factory(Draw_Interpretor& theDI)
+{
+  static Standard_Boolean aIsActivated = Standard_False;
+  if (aIsActivated)
+  {
+    return;
+  }
+  aIsActivated = Standard_True;
+
+  const char* aGroup = "XSTEP-STL/VRML";  // Step transfer file commands
+  theDI.Add("ReadObj",
+            "ReadObj Doc file [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]"
+            "\n\t\t:                  [-resultCoordSys {Zup|Yup}] [-singlePrecision]"
+            "\n\t\t:                  [-listExternalFiles] [-noCreateDoc]"
+            "\n\t\t: Read OBJ file into XDE document."
+            "\n\t\t:   -fileUnit       length unit of OBJ file content;"
+            "\n\t\t:   -fileCoordSys   coordinate system defined by OBJ file; Yup when not specified."
+            "\n\t\t:   -resultCoordSys result coordinate system; Zup when not specified."
+            "\n\t\t:   -singlePrecision truncate vertex data to single precision during read; FALSE by default."
+            "\n\t\t:   -listExternalFiles do not read mesh and only list external files."
+            "\n\t\t:   -noCreateDoc    read into existing XDE document.",
+            __FILE__, ReadObj, aGroup);
+  theDI.Add("readobj",
+            "readobj shape file [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]"
+            "\n\t\t:                    [-resultCoordSys {Zup|Yup}] [-singlePrecision]"
+            "\n\t\t:                    [-singleFace]"
+            "\n\t\t: Same as ReadObj but reads OBJ file into a shape instead of a document."
+            "\n\t\t:   -singleFace merge OBJ content into a single triangulation Face.",
+            __FILE__, ReadObj, aGroup);
+  theDI.Add("WriteObj",
+            "WriteObj Doc file [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]"
+            "\n\t\t:                   [-systemCoordSys {Zup|Yup}]"
+            "\n\t\t:                   [-comments Text] [-author Name]"
+            "\n\t\t: Write XDE document into OBJ file."
+            "\n\t\t:   -fileUnit       length unit of OBJ file content;"
+            "\n\t\t:   -fileCoordSys   coordinate system defined by OBJ file; Yup when not specified."
+            "\n\t\t:   -systemCoordSys system coordinate system; Zup when not specified.",
+            __FILE__, WriteObj, aGroup);
+  theDI.Add("writeobj",
+            "writeobj shape file",
+            __FILE__, WriteObj, aGroup);
+
+  // Load XSDRAW session for pilot activation
+  XSDRAW::LoadDraw(theDI);
+}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWOBJ)
diff --git a/src/XSDRAWOBJ/XSDRAWOBJ.hxx b/src/XSDRAWOBJ/XSDRAWOBJ.hxx
new file mode 100644 (file)
index 0000000..d935601
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XSDRAWOBJ_HeaderFile
+#define _XSDRAWOBJ_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+
+#include <Draw_Interpretor.hxx>
+
+class XSDRAWOBJ
+{
+  DEFINE_STANDARD_ALLOC
+public:
+
+  //! Loads all Draw commands of XSDRAWOBJ. Used for plugin.
+  Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
+};
+
+#endif // _XSDRAWOBJ_HeaderFile
diff --git a/src/XSDRAWPLY/FILES b/src/XSDRAWPLY/FILES
new file mode 100644 (file)
index 0000000..3501638
--- /dev/null
@@ -0,0 +1,2 @@
+XSDRAWPLY.cxx
+XSDRAWPLY.hxx
diff --git a/src/XSDRAWPLY/XSDRAWPLY.cxx b/src/XSDRAWPLY/XSDRAWPLY.cxx
new file mode 100644 (file)
index 0000000..a16d9f1
--- /dev/null
@@ -0,0 +1,348 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XSDRAWPLY.hxx>
+
+#include <BRep_Builder.hxx>
+#include <BRepLib_PointCloudShape.hxx>
+#include <DBRep.hxx>
+#include <DDocStd.hxx>
+#include <DDocStd_DrawDocument.hxx>
+#include <Draw.hxx>
+#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
+#include <Draw_ProgressIndicator.hxx>
+#include <RWMesh_FaceIterator.hxx>
+#include <RWPly_CafWriter.hxx>
+#include <RWPly_PlyWriterContext.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDocStd_Application.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Shape.hxx>
+#include <UnitsAPI.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
+#include <XCAFDoc_ShapeTool.hxx>
+#include <XCAFPrs_DocumentExplorer.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <XSDRAW.hxx>
+
+//=======================================================================
+//function : writeply
+//purpose  : write PLY file
+//=======================================================================
+static Standard_Integer WritePly (Draw_Interpretor& theDI,
+                                  Standard_Integer theNbArgs,
+                                  const char** theArgVec)
+{
+  Handle(TDocStd_Document) aDoc;
+  Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
+  TCollection_AsciiString aShapeName, aFileName;
+
+  Standard_Real aDist = 0.0;
+  Standard_Real aDens = Precision::Infinite();
+  Standard_Real aTol  = Precision::Confusion();
+  bool hasColors = true, hasNormals = true, hasTexCoords = false, hasPartId = true, hasFaceId = false;
+  bool isPntSet = false, isDensityPoints = false;
+  TColStd_IndexedDataMapOfStringString aFileInfo;
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArg (theArgVec[anArgIter]);
+    anArg.LowerCase();
+    if (anArg == "-normal")
+    {
+      hasNormals = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArg == "-nonormal")
+    {
+      hasNormals = !Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArg == "-color"
+          || anArg == "-nocolor"
+          || anArg == "-colors"
+          || anArg == "-nocolors")
+    {
+      hasColors = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArg == "-uv"
+          || anArg == "-nouv")
+    {
+      hasTexCoords = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
+    }
+    else if (anArg == "-partid")
+    {
+      hasPartId = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
+      hasFaceId = hasFaceId && !hasPartId;
+    }
+    else if (anArg == "-surfid"
+          || anArg == "-surfaceid"
+          || anArg == "-faceid")
+    {
+      hasFaceId = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
+      hasPartId = hasPartId && !hasFaceId;
+    }
+    else if (anArg == "-pntset"
+          || anArg == "-pntcloud"
+          || anArg == "-pointset"
+          || anArg == "-pointcloud"
+          || anArg == "-cloud"
+          || anArg == "-points")
+    {
+      isPntSet = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
+    }
+    else if ((anArg == "-dist"
+           || anArg == "-distance")
+          && anArgIter + 1 < theNbArgs
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aDist))
+    {
+      ++anArgIter;
+      isPntSet = true;
+      if (aDist < 0.0)
+      {
+        theDI << "Syntax error: -distance value should be >= 0.0";
+        return 1;
+      }
+      aDist = Max (aDist, Precision::Confusion());
+    }
+    else if ((anArg == "-dens"
+           || anArg == "-density")
+          && anArgIter + 1 < theNbArgs
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aDens))
+    {
+      ++anArgIter;
+      isDensityPoints = Standard_True;
+      isPntSet = true;
+      if (aDens <= 0.0)
+      {
+        theDI << "Syntax error: -density value should be > 0.0";
+        return 1;
+      }
+    }
+    else if ((anArg == "-tol"
+           || anArg == "-tolerance")
+          && anArgIter + 1 < theNbArgs
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aTol))
+    {
+      ++anArgIter;
+      isPntSet = true;
+      if (aTol < Precision::Confusion())
+      {
+        theDI << "Syntax error: -tol value should be >= " << Precision::Confusion();
+        return 1;
+      }
+    }
+    else if (anArg == "-comments"
+          && anArgIter + 1 < theNbArgs)
+    {
+      aFileInfo.Add ("Comments", theArgVec[++anArgIter]);
+    }
+    else if (anArg == "-author"
+          && anArgIter + 1 < theNbArgs)
+    {
+      aFileInfo.Add ("Author", theArgVec[++anArgIter]);
+    }
+    else if (aDoc.IsNull())
+    {
+      if (aShapeName.IsEmpty())
+      {
+        aShapeName = theArgVec[anArgIter];
+      }
+
+      Standard_CString aNameVar = theArgVec[anArgIter];
+      DDocStd::GetDocument (aNameVar, aDoc, false);
+      if (aDoc.IsNull())
+      {
+        TopoDS_Shape aShape = DBRep::Get (aNameVar);
+        if (!aShape.IsNull())
+        {
+          anApp->NewDocument (TCollection_ExtendedString ("BinXCAF"), aDoc);
+          Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
+          aShapeTool->AddShape (aShape);
+        }
+      }
+    }
+    else if (aFileName.IsEmpty())
+    {
+      aFileName = theArgVec[anArgIter];
+    }
+    else
+    {
+      theDI << "Syntax error at '" << theArgVec[anArgIter] << "'";
+      return 1;
+    }
+  }
+  if (aDoc.IsNull()
+  && !aShapeName.IsEmpty())
+  {
+    theDI << "Syntax error: '" << aShapeName << "' is not a shape nor document";
+    return 1;
+  }
+  else if (aDoc.IsNull()
+        || aFileName.IsEmpty())
+  {
+    theDI << "Syntax error: wrong number of arguments";
+    return 1;
+  }
+
+  TDF_LabelSequence aRootLabels;
+  Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
+  aShapeTool->GetFreeShapes (aRootLabels);
+  if (aRootLabels.IsEmpty())
+  {
+    theDI << "Error: empty document";
+    return 1;
+  }
+
+  if (isPntSet)
+  {
+    class PointCloudPlyWriter : public BRepLib_PointCloudShape, public RWPly_PlyWriterContext
+    {
+    public:
+      PointCloudPlyWriter (Standard_Real theTol)
+      : BRepLib_PointCloudShape (TopoDS_Shape(), theTol) {}
+
+      void AddFaceColor (const TopoDS_Shape& theFace, const Graphic3d_Vec4ub& theColor)
+      { myFaceColor.Bind (theFace, theColor); }
+
+    protected:
+      virtual void addPoint (const gp_Pnt& thePoint,
+                             const gp_Vec& theNorm,
+                             const gp_Pnt2d& theUV,
+                             const TopoDS_Shape& theFace)
+      {
+        Graphic3d_Vec4ub aColor;
+        myFaceColor.Find (theFace, aColor);
+        RWPly_PlyWriterContext::WriteVertex (thePoint,
+                                             Graphic3d_Vec3 ((float )theNorm.X(), (float )theNorm.Y(), (float )theNorm.Z()),
+                                             Graphic3d_Vec2 ((float )theUV.X(), (float )theUV.Y()),
+                                             aColor);
+      }
+
+    private:
+      NCollection_DataMap<TopoDS_Shape, Graphic3d_Vec4ub> myFaceColor;
+    };
+
+    PointCloudPlyWriter aPlyCtx (aTol);
+    aPlyCtx.SetNormals (hasNormals);
+    aPlyCtx.SetColors (hasColors);
+    aPlyCtx.SetTexCoords (hasTexCoords);
+
+    TopoDS_Compound aComp;
+    BRep_Builder().MakeCompound (aComp);
+    for (XCAFPrs_DocumentExplorer aDocExplorer (aDoc, aRootLabels, XCAFPrs_DocumentExplorerFlags_OnlyLeafNodes);
+         aDocExplorer.More(); aDocExplorer.Next())
+    {
+      const XCAFPrs_DocumentNode& aDocNode = aDocExplorer.Current();
+      for (RWMesh_FaceIterator aFaceIter (aDocNode.RefLabel, aDocNode.Location, true, aDocNode.Style); aFaceIter.More(); aFaceIter.Next())
+      {
+        BRep_Builder().Add (aComp, aFaceIter.Face());
+        Graphic3d_Vec4ub aColorVec (255);
+        if (aFaceIter.HasFaceColor())
+        {
+          Graphic3d_Vec4 aColorF = aFaceIter.FaceColor();
+          aColorVec.SetValues ((unsigned char )int(aColorF.r() * 255.0f),
+                               (unsigned char )int(aColorF.g() * 255.0f),
+                               (unsigned char )int(aColorF.b() * 255.0f),
+                               (unsigned char )int(aColorF.a() * 255.0f));
+        }
+        aPlyCtx.AddFaceColor (aFaceIter.Face(), aColorVec);
+      }
+    }
+    aPlyCtx.SetShape (aComp);
+
+    Standard_Integer aNbPoints = isDensityPoints
+                               ? aPlyCtx.NbPointsByDensity (aDens)
+                               : aPlyCtx.NbPointsByTriangulation();
+    if (aNbPoints <= 0)
+    {
+      theDI << "Error: unable to generate points";
+      return 0;
+    }
+
+    if (!aPlyCtx.Open (aFileName)
+     || !aPlyCtx.WriteHeader (aNbPoints, 0, TColStd_IndexedDataMapOfStringString()))
+    {
+      theDI << "Error: unable to create file '" << aFileName << "'";
+      return 0;
+    }
+
+    Standard_Boolean isDone = isDensityPoints
+                            ? aPlyCtx.GeneratePointsByDensity (aDens)
+                            : aPlyCtx.GeneratePointsByTriangulation();
+    if (!isDone)
+    {
+      theDI << "Error: Point cloud was not generated in file '" << aFileName << "'";
+    }
+    else if (!aPlyCtx.Close())
+    {
+      theDI << "Error: Point cloud file '" << aFileName << "' was not written";
+    }
+    else
+    {
+      theDI << aNbPoints;
+    }
+  }
+  else
+  {
+    Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
+    RWPly_CafWriter aPlyCtx (aFileName);
+    aPlyCtx.SetNormals (hasNormals);
+    aPlyCtx.SetColors (hasColors);
+    aPlyCtx.SetTexCoords (hasTexCoords);
+    aPlyCtx.SetPartId (hasPartId);
+    aPlyCtx.SetFaceId (hasFaceId);
+    aPlyCtx.Perform (aDoc, aFileInfo, aProgress->Start());
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : Factory
+//purpose  :
+//=======================================================================
+void XSDRAWPLY::Factory(Draw_Interpretor& theDI)
+{
+  static Standard_Boolean aIsActivated = Standard_False;
+  if (aIsActivated)
+  {
+    return;
+  }
+  aIsActivated = Standard_True;
+
+  const char* aGroup = "XSTEP-STL/VRML";  // Step transfer file commands
+  //XSDRAW::LoadDraw(theCommands);
+  theDI.Add("WritePly", R"(
+WritePly Doc file [-normals {0|1}]=1 [-colors {0|1}]=1 [-uv {0|1}]=0 [-partId {0|1}]=1 [-faceId {0|1}]=0
+                  [-pointCloud {0|1}]=0 [-distance Value]=0.0 [-density Value] [-tolerance Value]
+Write document or triangulated shape into PLY file.
+ -normals write per-vertex normals
+ -colors  write per-vertex colors
+ -uv      write per-vertex UV coordinates
+ -partId  write per-element part index (alternative to -faceId)
+ -faceId  write per-element face index (alternative to -partId)
+
+Generate point cloud out of the shape and write it into PLY file.
+ -pointCloud write point cloud instead without triangulation indices
+ -distance   sets distance from shape into the range [0, Value];
+ -density    sets density of points to generate randomly on surface;
+ -tolerance  sets tolerance; default value is Precision::Confusion();
+)", __FILE__, WritePly, aGroup);
+  theDI.Add("writeply",
+            "writeply shape file",
+            __FILE__, WritePly, aGroup);
+
+  // Load XSDRAW session for pilot activation
+  XSDRAW::LoadDraw(theDI);
+}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWPLY)
diff --git a/src/XSDRAWPLY/XSDRAWPLY.hxx b/src/XSDRAWPLY/XSDRAWPLY.hxx
new file mode 100644 (file)
index 0000000..0802003
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XSDRAWPLY_HeaderFile
+#define _XSDRAWPLY_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+
+#include <Draw_Interpretor.hxx>
+
+class XSDRAWPLY
+{
+  DEFINE_STANDARD_ALLOC
+public:
+
+  //! Loads all Draw commands of XSDRAWPLY. Used for plugin.
+  Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
+};
+
+#endif // _XSDRAWPLY_HeaderFile
index d03c76978408c235736d0bbd8940e3dee3c5e673..d15e01ddd93067ad57fd1e7f4cd7036e45f319be 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
+// Copyright (c) 2023 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
 //
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-//:k8 abv 6 Jan 98: using parameter "step.group" for writing assemblies/shapes
+#include <XSDRAWSTEP.hxx>
 
 #include <DBRep.hxx>
-#include <Draw_Appli.hxx>
+#include <DDF.hxx>
+#include <DDocStd.hxx>
+#include <DDocStd_DrawDocument.hxx>
+#include <Draw.hxx>
 #include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
 #include <Draw_ProgressIndicator.hxx>
-#include <IFSelect_SessionPilot.hxx>
 #include <Interface_Macros.hxx>
 #include <Interface_Static.hxx>
 #include <Message.hxx>
-#include <Message_ProgressScope.hxx>
 #include <OSD_OpenFile.hxx>
 #include <OSD_Path.hxx>
+#include <STEPCAFControl_Reader.hxx>
+#include <STEPCAFControl_Writer.hxx>
 #include <STEPControl_ActorWrite.hxx>
 #include <STEPControl_Controller.hxx>
 #include <STEPControl_Reader.hxx>
 #include <STEPControl_StepModelType.hxx>
 #include <STEPControl_Writer.hxx>
 #include <StepData_StepModel.hxx>
-#include <StepData_Factors.hxx>
 #include <StepGeom_Axis2Placement3d.hxx>
 #include <StepSelect_Activator.hxx>
 #include <STEPSelections_AssemblyExplorer.hxx>
 #include <STEPSelections_Counter.hxx>
 #include <StepToTopoDS_MakeTransformed.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TopExp_Explorer.hxx>
-#include <Transfer_TransientProcess.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDocStd_Application.hxx>
+#include <TopoDS_Shape.hxx>
+#include <UnitsMethods.hxx>
 #include <XSAlgo.hxx>
 #include <XSAlgo_AlgoContainer.hxx>
-#include <XSControl_Controller.hxx>
 #include <XSControl_WorkSession.hxx>
 #include <XSDRAW.hxx>
-#include <XSDRAWSTEP.hxx>
-#include <UnitsMethods.hxx>
-
-#include <stdio.h>
-//  Pour le transfert (write)
-//  Pour NewModel et Write : definition de produit (temporaire ...)
-// steptrans
-extern "C" {
-static void cleanpilot ()
-{
-  XSDRAW::Session()->ClearData(1);
-}
-}
-
 
-//=======================================================================
-//function : Init
-//purpose  : 
-//=======================================================================
-
-void XSDRAWSTEP::Init ()
+namespace
 {
-  Handle(StepSelect_Activator)   stepact = new StepSelect_Activator;
-  if (STEPControl_Controller::Init()) // XSDRAW::SetNorm("STEP AP-214"); trop tot
-    XSDRAW::SetController(XSControl_Controller::Recorded("STEP"));
-  
-  atexit (cleanpilot);
+  using ExternalFileMap = NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>;
 }
 
-//  ########  COMMANDE stepread  : teste le Reader  #########
 
 //=======================================================================
 //function : stepread
-//purpose  : 
+//purpose  :
 //=======================================================================
-
-static Standard_Integer stepread (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
+static Standard_Integer stepread(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
 {
-  if (argc < 3) {
-    di << "Use: stepread  [file] [f or r (type of model full or reduced)]\n";
+  if (theNbArgs < 3)
+  {
+    theDI << "Use: stepread  [file] [f or r (type of model full or reduced)]\n";
     return 1;
   }
-  //  On admet le controller AP214 ou une variante
-  DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller());
-  if (ctl.IsNull()) XSDRAW::SetNorm("STEP");
-
 
   // Progress indicator
-  Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
-  Message_ProgressScope aPSRoot (progress->Start(), "Reading", 100);
-
-  STEPControl_Reader sr (XSDRAW::Session(),Standard_False);
-  TCollection_AsciiString fnom,rnom;
-  Standard_Boolean modfic = XSDRAW::FileAndVar
-    (argv[1],argv[2],"STEP",fnom,rnom);
-  if (modfic) di<<" File STEP to read : "<<fnom.ToCString()<<"\n";
-  else        di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
-  di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
+  Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator(theDI, 1);
+  Message_ProgressScope aPSRoot(progress->Start(), "Reading", 100);
+
+  STEPControl_Reader sr(XSDRAW::Session(), Standard_False);
+  TCollection_AsciiString fnom, rnom;
+  Standard_Boolean modfic = XSDRAW::FileAndVar(theArgVec[1], theArgVec[2], "STEP", fnom, rnom);
+  if (modfic) theDI << " File STEP to read : " << fnom.ToCString() << "\n";
+  else        theDI << " Model taken from the session : " << fnom.ToCString() << "\n";
+  theDI << " -- Names of variables BREP-DRAW prefixed by : " << rnom.ToCString() << "\n";
   IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
 
   aPSRoot.SetName("Loading");
@@ -110,344 +86,370 @@ static Standard_Integer stepread (Draw_Interpretor& di, Standard_Integer argc, c
   Standard_Boolean fromtcl = Standard_False;
   Standard_Boolean aFullMode = Standard_False;
   Standard_Integer k = 3;
-  if(argc > k )
+  if (theNbArgs > k)
   {
-    if(argv[k][0] == 'f' || argv[3][0] == 'F')
+    if (theArgVec[k][0] == 'f' || theArgVec[3][0] == 'F')
     {
       aFullMode = Standard_True;
       k++;
     }
-    else if(argv[k][0] == 'r' || argv[3][0] == 'R')
+    else if (theArgVec[k][0] == 'r' || theArgVec[3][0] == 'R')
     {
       aFullMode = Standard_False;
       k++;
     }
     else
       fromtcl = Standard_True;
-   
   }
-  if(!fromtcl)
-    fromtcl = argc > k;
-  if(aFullMode)
-    std::cout<<"Full model for translation with additional info will be used \n"<<std::flush;
+  if (!fromtcl)
+    fromtcl = theNbArgs > k;
+  if (aFullMode)
+    std::cout << "Full model for translation with additional info will be used \n" << std::flush;
   else
-    std::cout<<"Reduced model for translation without additional info will be used \n"<<std::flush;
-  
-  sr.WS()->SetModeStat(aFullMode);
+    std::cout << "Reduced model for translation without additional info will be used \n" << std::flush;
 
+  sr.WS()->SetModeStat(aFullMode);
 
-  if (modfic) readstat = sr.ReadFile (fnom.ToCString());
+  if (modfic) readstat = sr.ReadFile(fnom.ToCString());
   else  if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
 
   aPSRoot.Next(20); // On average loading takes 20% 
   if (aPSRoot.UserBreak())
     return 1;
 
-  if (readstat != IFSelect_RetDone) {
-    if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
-    else di<<"No model loaded\n";
+  if (readstat != IFSelect_RetDone)
+  {
+    if (modfic) theDI << "Could not read file " << fnom.ToCString() << " , abandon\n";
+    else theDI << "No model loaded\n";
     return 1;
   }
 
-  XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
-  sr.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
+  sr.SetSystemLengthUnit(XSDRAW::GetLengthUnit());
 
   //   nom = "." -> fichier deja lu
   Standard_Integer i, num, nbs, modepri = 1;
   if (fromtcl) modepri = 4;
-  while (modepri) {
+  while (modepri)
+  {
     num = sr.NbRootsForTransfer();
-    if (!fromtcl) {
-      di<<"NbRootsForTransfer="<<num<<" :\n";
-      for (i = 1; i <= num; i ++) {
-        di<<"Root."<<i<<", Ent. ";
+    if (!fromtcl)
+    {
+      theDI << "NbRootsForTransfer=" << num << " :\n";
+      for (i = 1; i <= num; i++)
+      {
+        theDI << "Root." << i << ", Ent. ";
         Standard_SStream aTmpStream;
-        sr.Model()->Print (sr.RootForTransfer(i), aTmpStream);
-        di << aTmpStream.str().c_str();
-        di<<" Type:"<<sr.RootForTransfer(i)->DynamicType()->Name()<<"\n";
+        sr.Model()->Print(sr.RootForTransfer(i), aTmpStream);
+        theDI << aTmpStream.str().c_str();
+        theDI << " Type:" << sr.RootForTransfer(i)->DynamicType()->Name() << "\n";
       }
 
-      std::cout<<"Mode (0 End, 1 root n0 1, 2 one root/n0, 3 one entity/n0, 4 Selection) : "<<std::flush;
-      std::cin>>modepri;
+      std::cout << "Mode (0 End, 1 root n0 1, 2 one root/n0, 3 one entity/n0, 4 Selection) : " << std::flush;
+      std::cin >> modepri;
     }
 
-    if (modepri == 0) { di<<"End Reading STEP\n"; return 0; }
-    if (modepri <= 2) {
+    if (modepri == 0) { theDI << "End Reading STEP\n"; return 0; }
+    if (modepri <= 2)
+    {
       num = 1;
-      if (modepri == 2) {
-        std::cout<<"Root N0 : "<<std::flush;  std::cin>>num;
+      if (modepri == 2)
+      {
+        std::cout << "Root N0 : " << std::flush;  std::cin >> num;
       }
       aPSRoot.SetName("Translation");
       progress->Show(aPSRoot);
 
-      if (!sr.TransferRoot (num, aPSRoot.Next(80)))
-        di<<"Transfer root n0 "<<num<<" : no result\n";
-      else {
+      if (!sr.TransferRoot(num, aPSRoot.Next(80)))
+        theDI << "Transfer root n0 " << num << " : no result\n";
+      else
+      {
         nbs = sr.NbShapes();
-        char shname[30];  Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
-        di<<"Transfer root n0 "<<num<<" OK  -> DRAW Shape: "<<shname<<"\n";
-        di<<"Now, "<<nbs<<" Shapes produced\n";
+        char shname[30];  Sprintf(shname, "%s_%d", rnom.ToCString(), nbs);
+        theDI << "Transfer root n0 " << num << " OK  -> DRAW Shape: " << shname << "\n";
+        theDI << "Now, " << nbs << " Shapes produced\n";
         TopoDS_Shape sh = sr.Shape(nbs);
-        DBRep::Set (shname,sh);
+        DBRep::Set(shname, sh);
       }
       if (aPSRoot.UserBreak())
         return 1;
     }
-    else if (modepri == 3) {
-      std::cout<<"Entity : "<<std::flush;  num = XSDRAW::GetEntityNumber();
-      if (!sr.TransferOne (num))
-        di<<"Transfer entity n0 "<<num<<" : no result\n";
-      else {
+    else if (modepri == 3)
+    {
+      std::cout << "Entity : " << std::flush;  num = XSDRAW::GetEntityNumber("");
+      if (!sr.TransferOne(num))
+        theDI << "Transfer entity n0 " << num << " : no result\n";
+      else
+      {
         nbs = sr.NbShapes();
-        char shname[30];  Sprintf (shname,"%s_%d",rnom.ToCString(),num);
-        di<<"Transfer entity n0 "<<num<<" OK  -> DRAW Shape: "<<shname<<"\n";
-        di<<"Now, "<<nbs<<" Shapes produced\n";
+        char shname[30];  Sprintf(shname, "%s_%d", rnom.ToCString(), num);
+        theDI << "Transfer entity n0 " << num << " OK  -> DRAW Shape: " << shname << "\n";
+        theDI << "Now, " << nbs << " Shapes produced\n";
         TopoDS_Shape sh = sr.Shape(nbs);
-        DBRep::Set (shname,sh);
+        DBRep::Set(shname, sh);
       }
     }
-    else if (modepri == 4) {
+    else if (modepri == 4)
+    {
       //      char snm[100];  Standard_Integer answer = 1;
       Handle(TColStd_HSequenceOfTransient)  list;
 
       //  Selection, nommee ou via tcl. tcl : raccourcis admis
       //   * donne xst-transferrable-roots
-      if (fromtcl) {
+      if (fromtcl)
+      {
         modepri = 0;    // d ioffice une seule passe
-        if (argv[k][0] == '*' && argv[k][1] == '\0') {
-          di<<"Transferrable Roots : ";
-          list = XSDRAW::GetList("xst-transferrable-roots");
+        if (theArgVec[k][0] == '*' && theArgVec[k][1] == '\0')
+        {
+          theDI << "Transferrable Roots : ";
+          list = XSDRAW::Session()->GiveList("xst-transferrable-roots");
           //list = new TColStd_HSequenceOfTransient;
           //for(Standard_Integer j=1; j<=num; j++)
           //  list->Append(sr.RootForTransfer(j));
         }
-        else {
-          di<<"List given by "<<argv[k];
-          if (argc > k+1) di<<" "<<argv[k+1];
-          di<<" : ";
-          list = XSDRAW::GetList (argv[k], ( argc > (k+1) ? argv[k+1] : 0 ) );
+        else
+        {
+          theDI << "List given by " << theArgVec[k];
+          if (theNbArgs > k + 1) theDI << " " << theArgVec[k + 1];
+          theDI << " : ";
+          list = XSDRAW::Session()->GiveList(theArgVec[k], (theNbArgs > (k + 1) ? theArgVec[k + 1] : 0));
         }
-        if (list.IsNull()) { di<<"No list defined. Give a selection name or * for all transferrable roots\n"; continue; }
-      } else {
-        std::cout<<"Name of Selection :"<<std::flush;
-        list = XSDRAW::GetList();
-        if (list.IsNull()) { di<<"No list defined\n"; continue; }
+        if (list.IsNull()) { theDI << "No list defined. Give a selection name or * for all transferrable roots\n"; continue; }
+      }
+      else
+      {
+        std::cout << "Name of Selection :" << std::flush;
+        list = XSDRAW::Session()->GiveList("");
+        if (list.IsNull()) { theDI << "No list defined\n"; continue; }
       }
 
       Standard_Integer ill, nbl = list->Length();
-      di<<"Nb entities selected : "<<nbl<<"\n";
+      theDI << "Nb entities selected : " << nbl << "\n";
       if (nbl == 0) continue;
 
       aPSRoot.SetName("Translation");
       progress->Show(aPSRoot);
 
       Message_ProgressScope aPS(aPSRoot.Next(80), "Root", nbl);
-      for (ill = 1; ill <= nbl && aPS.More(); ill++) {
+      for (ill = 1; ill <= nbl && aPS.More(); ill++)
+      {
         num = sr.Model()->Number(list->Value(ill));
         if (num == 0) continue;
         if (!sr.TransferOne(num, aPS.Next()))
-          di<<"Transfer entity n0 "<<num<<" : no result\n";
-        else {
+          theDI << "Transfer entity n0 " << num << " : no result\n";
+        else
+        {
           nbs = sr.NbShapes();
-          char shname[30];  Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
-          di<<"Transfer entity n0 "<<num<<" OK  -> DRAW Shape: "<<shname<<"\n";
-          di<<"Now, "<<nbs<<" Shapes produced\n";
+          char shname[30];  Sprintf(shname, "%s_%d", rnom.ToCString(), nbs);
+          theDI << "Transfer entity n0 " << num << " OK  -> DRAW Shape: " << shname << "\n";
+          theDI << "Now, " << nbs << " Shapes produced\n";
           TopoDS_Shape sh = sr.Shape(nbs);
-          DBRep::Set (shname,sh);
+          DBRep::Set(shname, sh);
         }
       }
       if (aPSRoot.UserBreak())
         return 1;
     }
-    else di<<"Unknown mode n0 "<<modepri<<"\n";
+    else theDI << "Unknown mode n0 " << modepri << "\n";
   }
   return 0;
 }
 
 //=======================================================================
 //function : testreadstep
-//purpose  : 
+//purpose  :
 //=======================================================================
-static Standard_Integer testreadstep (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+static Standard_Integer testreadstep(Draw_Interpretor& theDI,
+                                     Standard_Integer theNbArgs,
+                                     const char** theArgVec)
 {
-  if (argc < 3 || argc > 4)                                                                                      
+  if (theNbArgs < 3 || theNbArgs > 4)
   {
-    di << "ERROR in " << argv[0] << "Wrong Number of Arguments.\n";
-    di << " Usage : " << argv[0] << " file_name shape_name [-stream]\n";
-    di << " Option -stream forces usage of API accepting stream\n";
+    theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
+    theDI << " Usage : " << theArgVec[0] << " file_name shape_name [-stream]\n";
+    theDI << " Option -stream forces usage of API accepting stream\n";
     return 1;
   }
 
-  Standard_Boolean useStream = (argc > 3 && ! strcasecmp (argv[3], "-stream"));
+  Standard_Boolean useStream = (theNbArgs > 3 && !strcasecmp(theArgVec[3], "-stream"));
 
   STEPControl_Reader Reader;
-  Standard_CString filename = argv[1];
+  Standard_CString filename = theArgVec[1];
   IFSelect_ReturnStatus readstat;
   if (useStream)
   {
     std::ifstream aStream;
-    OSD_OpenStream (aStream, filename, std::ios::in | std::ios::binary);
+    OSD_OpenStream(aStream, filename, std::ios::in | std::ios::binary);
     TCollection_AsciiString aFolder, aFileNameShort;
-    OSD_Path::FolderAndFileFromPath (filename, aFolder, aFileNameShort);
-    readstat = Reader.ReadStream (aFileNameShort.ToCString(), aStream);
+    OSD_Path::FolderAndFileFromPath(filename, aFolder, aFileNameShort);
+    readstat = Reader.ReadStream(aFileNameShort.ToCString(), aStream);
   }
   else
   {
     readstat = Reader.ReadFile(filename);
   }
-  di<<"Status from reading STEP file "<<filename<<" : ";  
-  switch(readstat) {                                                              
-    case IFSelect_RetVoid  : { di<<"empty file\n"; return 1; }            
-    case IFSelect_RetDone  : { di<<"file read\n";    break; }             
-    case IFSelect_RetError : { di<<"file not found\n";   return 1; }      
-    case IFSelect_RetFail  : { di<<"error during read\n";  return 1; }    
-    default  :  { di<<"failure\n";   return 1; }                          
+  theDI << "Status from reading STEP file " << filename << " : ";
+  switch (readstat)
+  {
+    case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; }
+    case IFSelect_RetDone: { theDI << "file read\n";    break; }
+    case IFSelect_RetError: { theDI << "file not found\n";   return 1; }
+    case IFSelect_RetFail: { theDI << "error during read\n";  return 1; }
+    default: { theDI << "failure\n";   return 1; }
   }
-  XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
-  Reader.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
+  Reader.SetSystemLengthUnit(XSDRAW::GetLengthUnit());
   Reader.TransferRoots();
   TopoDS_Shape shape = Reader.OneShape();
-  DBRep::Set(argv[2],shape); 
-  di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
+  DBRep::Set(theArgVec[2], shape);
+  theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n";
   return 0;
 }
-//  ########  COMMANDE steptrans  : teste les transformations  #########
+
 //=======================================================================
 //function : steptrans
-//purpose  : 
+//purpose  :
 //=======================================================================
-
-static Standard_Integer steptrans (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
+static Standard_Integer steptrans(Draw_Interpretor& theDI,
+                                  Standard_Integer theNbArgs,
+                                  const char** theArgVec)
 {
-  if (argc < 5) { di<<"give shape-name new-shape + entity-n0 entity-n0: AXIS2\n";
-                 return 1; }
-  TopoDS_Shape shape = DBRep::Get(argv[1]);
-  if (shape.IsNull()) { di<<"Not a shape : "<<argv[1]<<"\n"; return 1; }
-  Handle(StepGeom_Axis2Placement3d) ax1,ax2;
+  if (theNbArgs < 5)
+  {
+    theDI << "give shape-name new-shape + entity-n0 entity-n0: AXIS2\n";
+    return 1;
+  }
+  Handle(XSControl_WorkSession) aWS = XSDRAW::Session();
+  TopoDS_Shape shape = DBRep::Get(theArgVec[1]);
+  if (shape.IsNull())
+  {
+    theDI << "Not a shape : " << theArgVec[1] << "\n";
+    return 1;
+  }
+  Handle(StepGeom_Axis2Placement3d) ax1, ax2;
   Standard_Integer n1 = 0, n2 = 0;
-  n1 = XSDRAW::GetEntityNumber(argv[3]);
-  if (argc > 4) n2 = XSDRAW::GetEntityNumber(argv[4]);
+  n1 = XSDRAW::GetEntityNumber(theArgVec[3]);
+  if (theNbArgs > 4) n2 = XSDRAW::GetEntityNumber(theArgVec[4]);
   if (n1 > 0) ax1 = Handle(StepGeom_Axis2Placement3d)::DownCast
-    (XSDRAW::Entity(n1));
+  (aWS->StartingEntity(n1));
   if (n2 > 0) ax2 = Handle(StepGeom_Axis2Placement3d)::DownCast
-    (XSDRAW::Entity(n2));
+  (aWS->StartingEntity(n2));
+  StepData_Factors aFactors;
   StepToTopoDS_MakeTransformed mktrans;
-  StepData_Factors aLocalFactors;
-  if (mktrans.Compute (ax1,ax2, aLocalFactors)) {
-    TopLoc_Location loc (mktrans.Transformation());
-    shape.Move (loc);
-//    mktrans.Transform (shape);
-    DBRep::Set (argv[2],shape);
-    di<<"Transformed Shape as "<<argv[2]<<"\n";
-  }
-  else di<<"No transformation computed\n";
+  if (mktrans.Compute(ax1, ax2, aFactors))
+  {
+    TopLoc_Location loc(mktrans.Transformation());
+    shape.Move(loc);
+    DBRep::Set(theArgVec[2], shape);
+    theDI << "Transformed Shape as " << theArgVec[2] << "\n";
+  }
+  else
+    theDI << "No transformation computed\n";
   return 0;
 }
 
-//  ########  COMMANDE stepwrite : teste le Writer  #########
-
 //=======================================================================
 //function : stepwrite
 //purpose  : 
 //=======================================================================
-
-static Standard_Integer stepwrite (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
+static Standard_Integer stepwrite(Draw_Interpretor& theDI,
+                                  Standard_Integer theNbArgs,
+                                  const char** theArgVec)
 {
-//  On admet le controller AP214 ou une variante
-  DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller());
-  if (ctl.IsNull()) {
-    XSDRAW::SetNorm("STEP");
-    //sln 14.01.2002 OCC51: assign new value to ctl in order to avoid exception during using one in the function
-    ctl = Handle(STEPControl_Controller)::DownCast(XSDRAW::Controller());
+  Handle(XSControl_WorkSession) aWS = XSDRAW::Session();
+  Handle(STEPControl_Controller) aCtl =
+    Handle(STEPControl_Controller)::DownCast(aWS->NormAdaptor());
+  if (aCtl.IsNull())
+  {
+    aWS->SelectNorm("STEP");
+  }
+  if (theNbArgs < 3)
+  {
+    theDI << "Error: Give mode[1-4] and Shape name + optional file. Mode possible\n";
+    theDI << "f ou 1 : FacettedBRep        s ou 2 : ShellBasedSurfaceModel\n"
+      << "m ou 3 : ManifoldSolidBrep   w ou 4 : GeometricCurveSet/WireFrame\n";
+    return 1;
   }
-
-  if (argc < 3) {
-    di<<"Give mode[1-4] and Shape name + optional file. Mode possible\n";
-    di<<"f ou 1 : FacettedBRep        s ou 2 : ShellBasedSurfaceModel\n"
-        <<"m ou 3 : ManifoldSolidBrep   w ou 4 : GeometricCurveSet/WireFrame\n";
-    return 1; }
-  char modeshape = argv[1][0];
   STEPControl_StepModelType mode;
-  switch (modeshape) {
-    case 'a' :
-    case '0' : mode = STEPControl_AsIs;                    break;
-    case 'f' :
-    case '1' : mode = STEPControl_FacetedBrep;             break;
-    case 's' :
-    case '2' : mode = STEPControl_ShellBasedSurfaceModel;  break;
-    case 'm' :
-    case '3' : mode = STEPControl_ManifoldSolidBrep;       break;
-    case 'w' :
-    case '4' : mode = STEPControl_GeometricCurveSet;       break;
-    default :  di<<"1st arg = mode, incorrect [give fsmw]\n"; return 1;
-  }
-
-  //:k8 abv 6 Jan 98: using parameter for writing mode (assemblies/shapes)
-  Handle(STEPControl_ActorWrite) ActWrite = 
-    Handle(STEPControl_ActorWrite)::DownCast ( ctl->ActorWrite() );
-  if ( ! ActWrite.IsNull() ) 
-    ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
-
-  TopoDS_Shape shape = DBRep::Get(argv[2]);
-  STEPControl_Writer sw (XSDRAW::Session(),Standard_False);
+  switch (theArgVec[1][0])
+  {
+    case 'a':
+    case '0': mode = STEPControl_AsIs;                    break;
+    case 'f':
+    case '1': mode = STEPControl_FacetedBrep;             break;
+    case 's':
+    case '2': mode = STEPControl_ShellBasedSurfaceModel;  break;
+    case 'm':
+    case '3': mode = STEPControl_ManifoldSolidBrep;       break;
+    case 'w':
+    case '4': mode = STEPControl_GeometricCurveSet;       break;
+    default:  theDI << "Error: 1st arg = mode, incorrect [give fsmw]\n"; return 1;
+  }
+  Handle(STEPControl_ActorWrite) ActWrite =
+    Handle(STEPControl_ActorWrite)::DownCast(aWS->NormAdaptor()->ActorWrite());
+  if (!ActWrite.IsNull())
+    ActWrite->SetGroupMode(Interface_Static::IVal("write.step.assembly"));
+
+  TopoDS_Shape shape = DBRep::Get(theArgVec[2]);
+  STEPControl_Writer sw(aWS, Standard_False);
   Handle(Interface_InterfaceModel) stepmodel = sw.Model();
   Standard_Integer nbavant = (stepmodel.IsNull() ? 0 : stepmodel->NbEntities());
 
-  Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
-  Message_ProgressScope aPSRoot (progress->Start(), "Translating", 100);
+  Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator(theDI, 1);
+  Message_ProgressScope aPSRoot(progress->Start(), "Translating", 100);
   progress->Show(aPSRoot);
 
-  Standard_Integer stat = sw.Transfer (shape, mode, Standard_True, aPSRoot.Next(90));
+  Standard_Integer stat = sw.Transfer(shape, mode, Standard_True, aPSRoot.Next(90));
   if (stat == IFSelect_RetDone)
   {
-    di << "Translation: OK\n";
-  } 
-  else 
+    theDI << "Translation: OK\n";
+  }
+  else
   {
-    di << "Error: translation failed, status = " << stat << "\n";
+    theDI << "Error: translation failed, status = " << stat << "\n";
   }
-
   if (aPSRoot.UserBreak())
     return 1;
   aPSRoot.SetName("Writing");
   progress->Show(aPSRoot);
 
-//   Que s est-il passe
+  //   Que s est-il passe
   stepmodel = sw.Model();
   Standard_Integer nbapres = (stepmodel.IsNull() ? 0 : stepmodel->NbEntities());
-  if (nbavant > 0) di<<"Beware : Model not empty before transferring\n";
-  if (nbapres <= nbavant) di<<"Beware : No data produced by this transfer\n";
-  if (nbapres == 0) { di<<"No data to write\n"; return 0; }
+  if (nbavant > 0) theDI << "Beware : Model not empty before transferring\n";
+  if (nbapres <= nbavant) theDI << "Beware : No data produced by this transfer\n";
+  if (nbapres == 0) { theDI << "No data to write\n"; return 0; }
 
-  if (argc <= 3) {
-    di<<" Now, to write a file, command : writeall filename\n";
+  if (theNbArgs <= 3)
+  {
+    theDI << " Now, to write a file, command : writeall filename\n";
     return 0;
   }
-
-  const char *nomfic = argv[3];
+  const char* nomfic = theArgVec[3];
   stat = sw.Write(nomfic);
-  switch (stat) {
-  case IFSelect_RetVoid : di<<"Error: No file written\n"; break;
-    case IFSelect_RetDone : di<<"File "<<nomfic<<" written\n"; break;
-    case IFSelect_RetStop : di<<"Error on writing file: no space on disk or destination is write protected\n"; break;
-    default : di<<"Error: File "<<nomfic<<" written with fail messages\n"; break;
+  switch (stat)
+  {
+    case IFSelect_RetVoid: theDI << "Error: No file written\n"; return 1;
+    case IFSelect_RetDone: theDI << "File " << nomfic << " written\n"; break;
+    case IFSelect_RetStop: theDI << "Error on writing file: no space on disk or destination is write protected\n"; return 1;
+    default: theDI << "Error: File " << nomfic << " written with fail messages\n";  break;
   }
-
+  XSDRAW::CollectActiveWorkSessions(aWS, nomfic, XSDRAW::WorkSessionList());
   return 0;
 }
+
 //=======================================================================
-//function : testwritestep
-//purpose  : 
+//function : testwrite
+//purpose  :
 //=======================================================================
-static Standard_Integer testwrite (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
+static Standard_Integer testwrite(Draw_Interpretor& theDI,
+                                  Standard_Integer theNbArgs,
+                                  const char** theArgVec)
 {
   TCollection_AsciiString aFilePath;
   TopoDS_Shape aShape;
   bool toTestStream = false;
-  for (Standard_Integer anArgIter = 1; anArgIter < argc; ++anArgIter)
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
   {
-    TCollection_AsciiString anArgCase (argv[anArgIter]);
+    TCollection_AsciiString anArgCase(theArgVec[anArgIter]);
     anArgCase.LowerCase();
     if (anArgCase == "-stream")
     {
@@ -455,164 +457,588 @@ static Standard_Integer testwrite (Draw_Interpretor& di, Standard_Integer argc,
     }
     else if (aFilePath.IsEmpty())
     {
-      aFilePath = argv[anArgIter];
+      aFilePath = theArgVec[anArgIter];
     }
     else if (aShape.IsNull())
     {
-      aShape = DBRep::Get (argv[anArgIter]);
+      aShape = DBRep::Get(theArgVec[anArgIter]);
       if (aShape.IsNull())
       {
-        di << "Syntax error: '" << argv[anArgIter] << "' is not a shape";
+        theDI << "Syntax error: '" << theArgVec[anArgIter] << "' is not a shape\n";
         return 1;
       }
     }
     else
     {
-      di << "Syntax error: unknown argument '" << argv[anArgIter] << "'";
+      theDI << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
       return 1;
     }
   }
   if (aShape.IsNull())
   {
-    di << "Syntax error: wrong number of arguments";
+    theDI << "Syntax error: wrong number of arguments\n";
     return 1;
   }
 
   STEPControl_Writer aWriter;
-  IFSelect_ReturnStatus aStat = aWriter.Transfer (aShape, STEPControl_AsIs);
+  IFSelect_ReturnStatus aStat = aWriter.Transfer(aShape, STEPControl_AsIs);
   if (aStat != IFSelect_RetDone)
   {
-    di << "Error on transferring shape";
+    theDI << "Error on transferring shape\n";
     return 1;
   }
 
   if (toTestStream)
   {
     std::ofstream aStream;
-    OSD_OpenStream (aStream, aFilePath, std::ios::out | std::ios::binary);
-    aStat = aWriter.WriteStream (aStream);
+    OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary);
+    aStat = aWriter.WriteStream(aStream);
     aStream.close();
     if (!aStream.good()
-      && aStat == IFSelect_RetDone)
+        && aStat == IFSelect_RetDone)
     {
       aStat = IFSelect_RetFail;
     }
   }
   else
   {
-    aStat = aWriter.Write (aFilePath.ToCString());
+    aStat = aWriter.Write(aFilePath.ToCString());
   }
   if (aStat != IFSelect_RetDone)
   {
-    di << "Error on writing file";
-    return 1; 
+    theDI << "Error on writing file\n";
+    return 1;
   }
-  di << "File Is Written";
+  theDI << "File Is Written\n";
   return 0;
 }
 
 //=======================================================================
 //function : countexpected
-//purpose  : 
+//purpose  :
 //=======================================================================
-
-static Standard_Integer countexpected
-  (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
+static Standard_Integer countexpected(Draw_Interpretor& theDI,
+                                      Standard_Integer /*theNbArgs*/,
+                                      const char** /*theArgVec*/)
 {
-  Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
-  Handle(IFSelect_WorkSession) WS = pilot->Session();
-   const Interface_Graph& graph = WS->Graph();
-  
+  Handle(XSControl_WorkSession) WS = XSDRAW::Session();
+  const Interface_Graph& graph = WS->Graph();
+
   Handle(TColStd_HSequenceOfTransient) roots = WS->GiveList("xst-transferrable-roots", "");
   STEPSelections_Counter cnt;
-  
-  for (Standard_Integer i =1 ; i <= roots->Length(); i++) {
-    cnt.Count(graph,roots->Value(i));
-  }
-  
-  di<< "Instances of Faces \t: "<<cnt.NbInstancesOfFaces()<<"\n";
-  di<< "Instances of Shells\t: "<<cnt.NbInstancesOfShells()<<"\n";
-  di<< "Instances of Solids\t: "<<cnt.NbInstancesOfSolids()<<"\n";
-  di<< "Instances of Wires in GS\t: "<<cnt.NbInstancesOfWires()<<"\n";
-  di<< "Instances of Edges in GS\t: "<<cnt.NbInstancesOfEdges()<<"\n";
-  
-  di<< "Source Faces \t: "<<cnt.NbSourceFaces()<<"\n";
-  di<< "Source Shells\t: "<<cnt.NbSourceShells()<<"\n";
-  di<< "Source Solids\t: "<<cnt.NbSourceSolids()<<"\n";
-  di<< "Source Wires in GS\t: "<<cnt.NbSourceWires()<<"\n";
-  di<< "Source Edges in GS\t: "<<cnt.NbSourceEdges()<<"\n";
-  
+
+  for (Standard_Integer i = 1; i <= roots->Length(); i++)
+  {
+    cnt.Count(graph, roots->Value(i));
+  }
+
+  theDI << "Instances of Faces \t: " << cnt.NbInstancesOfFaces() << "\n";
+  theDI << "Instances of Shells\t: " << cnt.NbInstancesOfShells() << "\n";
+  theDI << "Instances of Solids\t: " << cnt.NbInstancesOfSolids() << "\n";
+  theDI << "Instances of Wires in GS\t: " << cnt.NbInstancesOfWires() << "\n";
+  theDI << "Instances of Edges in GS\t: " << cnt.NbInstancesOfEdges() << "\n";
+
+  theDI << "Source Faces \t: " << cnt.NbSourceFaces() << "\n";
+  theDI << "Source Shells\t: " << cnt.NbSourceShells() << "\n";
+  theDI << "Source Solids\t: " << cnt.NbSourceSolids() << "\n";
+  theDI << "Source Wires in GS\t: " << cnt.NbSourceWires() << "\n";
+  theDI << "Source Edges in GS\t: " << cnt.NbSourceEdges() << "\n";
+
   return 1;
 }
 
-static Standard_Integer dumpassembly
-  (Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char** /*argv*/)
+//=======================================================================
+//function : dumpassembly
+//purpose  :
+//=======================================================================
+static Standard_Integer dumpassembly(Draw_Interpretor& /*theDI*/,
+                                     Standard_Integer /*theNbArgs*/,
+                                     const char** /*theArgVec*/)
 {
-  Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
-  Handle(IFSelect_WorkSession) WS = pilot->Session();
+  Handle(XSControl_WorkSession) WS = XSDRAW::Session();
   const Interface_Graph& graph = WS->Graph();
-  
+
   STEPSelections_AssemblyExplorer exp(graph);
   exp.Dump(std::cout);
   return 0;
 }
 
-static Standard_Integer stepfileunits (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
+//=======================================================================
+//function : stepfileunits
+//purpose  :
+//=======================================================================
+static Standard_Integer stepfileunits(Draw_Interpretor& theDI,
+                                      Standard_Integer theNbArgs,
+                                      const char** theArgVec)
 {
-
-  if(  argc < 2)
+  if (theNbArgs < 2)
   {
-    di << "Error: Invalid number of parameters. Should be: getfileunits name_file\n";
+    theDI << "Error: Invalid number of parameters. Should be: getfileunits name_file\n";
     return 1;
   }
   STEPControl_Reader aStepReader;
-  
   IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
-  readstat = aStepReader.ReadFile (argv[1]);
-  if (readstat != IFSelect_RetDone) {
-    
-    di<<"No model loaded\n";
+  readstat = aStepReader.ReadFile(theArgVec[1]);
+  if (readstat != IFSelect_RetDone)
+  {
+    theDI << "No model loaded\n";
     return 1;
   }
 
   TColStd_SequenceOfAsciiString anUnitLengthNames;
   TColStd_SequenceOfAsciiString anUnitAngleNames;
   TColStd_SequenceOfAsciiString anUnitSolidAngleNames;
-  aStepReader.FileUnits( anUnitLengthNames,anUnitAngleNames,anUnitSolidAngleNames);
-                                   
-  Standard_Integer i =1;
-  di<<"=====================================================\n";
-  di<<"LENGTH Unit\n";
-  for( ; i <= anUnitLengthNames.Length() ; i++)
-    di<<anUnitLengthNames(i).ToCString()<<"\n";
-  
-  di<<"=====================================================\n";
-  di<<"Angle Unit\n";
-  for( i =1 ; i <= anUnitAngleNames.Length() ; i++)
-    di<<anUnitAngleNames(i).ToCString()<<"\n";
-
-  di<<"=====================================================\n";
-  di<<"Solid Angle Unit\n";
-  for( i =1 ; i <= anUnitSolidAngleNames.Length() ; i++)
-    di<<anUnitSolidAngleNames(i).ToCString()<<"\n";
-  
+  aStepReader.FileUnits(anUnitLengthNames, anUnitAngleNames, anUnitSolidAngleNames);
+
+  Standard_Integer i = 1;
+  theDI << "=====================================================\n";
+  theDI << "LENGTH Unit\n";
+  for (; i <= anUnitLengthNames.Length(); i++)
+    theDI << anUnitLengthNames(i).ToCString() << "\n";
+
+  theDI << "=====================================================\n";
+  theDI << "Angle Unit\n";
+  for (i = 1; i <= anUnitAngleNames.Length(); i++)
+    theDI << anUnitAngleNames(i).ToCString() << "\n";
+
+  theDI << "=====================================================\n";
+  theDI << "Solid Angle Unit\n";
+  for (i = 1; i <= anUnitSolidAngleNames.Length(); i++)
+    theDI << anUnitSolidAngleNames(i).ToCString() << "\n";
+
+  return 0;
+}
+
+//=======================================================================
+//function : ReadStep
+//purpose  : Read STEP file to DECAF document
+//=======================================================================
+static Standard_Integer ReadStep(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
+{
+  DeclareAndCast(STEPControl_Controller, aController, XSDRAW::Controller());
+  if (aController.IsNull())
+  {
+    XSDRAW::SetNorm("STEP");
+  }
+
+  Standard_CString aDocumentName = NULL;
+  TCollection_AsciiString aFilePath, aModeStr;
+  bool toTestStream = false;
+
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArgCase(theArgVec[anArgIter]);
+    anArgCase.LowerCase();
+
+    if (anArgCase == "-stream")
+    {
+      toTestStream = true;
+    }
+    else if (aDocumentName == NULL)
+    {
+      aDocumentName = theArgVec[anArgIter];
+    }
+    else if (aFilePath.IsEmpty())
+    {
+      aFilePath = theArgVec[anArgIter];
+    }
+    else if (aModeStr.IsEmpty())
+    {
+      aModeStr = theArgVec[anArgIter];
+    }
+    else
+    {
+      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
+      return 1;
+    }
+  }
+
+  TCollection_AsciiString aFileName, anOldVarName;
+  Standard_Boolean isFileMode = XSDRAW::FileAndVar(aFilePath.ToCString(), aDocumentName, "STEP", aFileName, anOldVarName);
+
+  if (isFileMode)
+  {
+    theDI << " File STEP to read : " << aFileName << "\n";
+  }
+  else
+  {
+    theDI << " Model taken from the session : " << aFileName << "\n";
+  }
+
+  STEPCAFControl_Reader aReader(XSDRAW::Session(), isFileMode);
+
+  if (!aModeStr.IsEmpty())
+  {
+    Standard_Boolean aMode = Standard_True;
+
+    for (Standard_Integer i = 1; aModeStr.Value(i); ++i)
+    {
+      switch (aModeStr.Value(i))
+      {
+      case '-':
+        aMode = Standard_False;
+        break;
+      case '+':
+        aMode = Standard_True;
+        break;
+      case 'c':
+        aReader.SetColorMode(aMode);
+        break;
+      case 'n':
+        aReader.SetNameMode(aMode);
+        break;
+      case 'l':
+        aReader.SetLayerMode(aMode);
+        break;
+      case 'v':
+        aReader.SetPropsMode(aMode);
+        break;
+      default:
+        Message::SendFail() << "Syntax error at '" << aModeStr << "'\n";
+        return 1;
+      }
+    }
+  }
+
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI);
+  Message_ProgressScope aRootScope(aProgress->Start(), "STEP import", isFileMode ? 2 : 1);
+
+  IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
+
+  if (isFileMode)
+  {
+    Message_ProgressScope aReadScope(aRootScope.Next(), "File reading", 1);
+    aReadScope.Show();
+
+    if (toTestStream)
+    {
+      std::ifstream aStream;
+      OSD_OpenStream(aStream, aFileName.ToCString(), std::ios::in | std::ios::binary);
+      TCollection_AsciiString aFolder, aFileNameShort;
+      OSD_Path::FolderAndFileFromPath(aFileName, aFolder, aFileNameShort);
+      aReadStat = aReader.ReadStream(aFileNameShort.ToCString(), aStream);
+    }
+    else
+    {
+      aReadStat = aReader.ReadFile(aFileName.ToCString());
+    }
+  }
+  else if (XSDRAW::Session()->NbStartingEntities() > 0)
+  {
+    aReadStat = IFSelect_RetDone;
+  }
+
+  if (aReadStat != IFSelect_RetDone)
+  {
+    if (isFileMode)
+    {
+      theDI << "Could not read file " << aFileName << " , abandon\n";
+    }
+    else
+    {
+      theDI << "No model loaded\n";
+    }
+    return 1;
+  }
+
+  Handle(TDocStd_Document) aDocument;
+
+  if (!DDocStd::GetDocument(aDocumentName, aDocument, Standard_False))
+  {
+    Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
+    anApp->NewDocument("BinXCAF", aDocument);
+    TDataStd_Name::Set(aDocument->GetData()->Root(), aDocumentName);
+    Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument(aDocument);
+    Draw::Set(aDocumentName, aDrawDoc);
+  }
+
+  if (!aReader.Transfer(aDocument, aRootScope.Next()))
+  {
+    theDI << "Cannot read any relevant data from the STEP file\n";
+    return 1;
+  }
+
+  Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument(aDocument);
+  Draw::Set(aDocumentName, aDrawDoc);
+
+  theDI << "Document saved with name " << aDocumentName;
+
+  XSDRAW::CollectActiveWorkSessions(aFilePath);
+  for (ExternalFileMap::Iterator anIter(aReader.ExternFiles()); anIter.More(); anIter.Next())
+  {
+    XSDRAW::CollectActiveWorkSessions(anIter.Value()->GetWS(), anIter.Key(), XSDRAW::WorkSessionList());
+  }
+
   return 0;
 }
-//  ########  COMMANDE stepwrite : teste le Writer  #########
 
-void XSDRAWSTEP::InitCommands (Draw_Interpretor& theCommands)
+//=======================================================================
+//function : WriteStep
+//purpose  : Write DECAF document to STEP
+//=======================================================================
+static Standard_Integer WriteStep(Draw_Interpretor& theDI,
+                                  Standard_Integer theNbArgs,
+                                  const char** theArgVec)
 {
-  const char* g = "DE: STEP";  // Step transfer file commands
-  XSDRAWSTEP::Init();
-  XSDRAW::LoadDraw(theCommands);
-  theCommands.Add("stepwrite" ,    "stepwrite mode[0-4 afsmw] shape",  __FILE__, stepwrite,     g);
-  theCommands.Add("testwritestep", "testwritestep filename.stp shape [-stream]",
-                   __FILE__, testwrite, g);
-  theCommands.Add("stepread",      "stepread  [file] [f or r (type of model full or reduced)]",__FILE__, stepread,      g);
-  theCommands.Add("testreadstep",  "testreadstep file shape [-stream]",__FILE__, testreadstep,  g);
-  theCommands.Add("steptrans",     "steptrans shape stepax1 stepax2",  __FILE__, steptrans,     g);
-  theCommands.Add("countexpected","TEST",                              __FILE__, countexpected, g);
-  theCommands.Add("dumpassembly", "TEST",                              __FILE__, dumpassembly,  g);
-  theCommands.Add("stepfileunits" , "stepfileunits name_file", __FILE__, stepfileunits,      g);
+  DeclareAndCast(STEPControl_Controller, aController, XSDRAW::Controller());
+  if (aController.IsNull())
+  {
+    XSDRAW::SetNorm("STEP");
+  }
+
+  STEPCAFControl_Writer aWriter(XSDRAW::Session(), Standard_True);
+
+  Handle(TDocStd_Document) aDocument;
+  TCollection_AsciiString aDocumentName, aFilePath;
+  STEPControl_StepModelType aMode = STEPControl_AsIs;
+  bool hasModeArg = false, toTestStream = false;
+  TCollection_AsciiString aMultiFilePrefix, aLabelName;
+  TDF_Label aLabel;
+
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArgCase(theArgVec[anArgIter]);
+    anArgCase.LowerCase();
+
+    if (anArgCase == "-stream")
+    {
+      toTestStream = true;
+    }
+    else if (aDocumentName.IsEmpty())
+    {
+      Standard_CString aDocNameStr = theArgVec[anArgIter];
+      DDocStd::GetDocument(aDocNameStr, aDocument);
+
+      if (aDocument.IsNull())
+      {
+        theDI << "Syntax error: '" << theArgVec[anArgIter] << "' is not a document";
+        return 1;
+      }
+
+      aDocumentName = aDocNameStr;
+    }
+    else if (aFilePath.IsEmpty())
+    {
+      aFilePath = theArgVec[anArgIter];
+    }
+    else if (!hasModeArg)
+    {
+      hasModeArg = true;
+
+      switch (anArgCase.Value(1))
+      {
+      case 'a':
+      case '0':
+        aMode = STEPControl_AsIs;
+        break;
+      case 'f':
+      case '1':
+        aMode = STEPControl_FacetedBrep;
+        break;
+      case 's':
+      case '2':
+        aMode = STEPControl_ShellBasedSurfaceModel;
+        break;
+      case 'm':
+      case '3':
+        aMode = STEPControl_ManifoldSolidBrep;
+        break;
+      case 'w':
+      case '4':
+        aMode = STEPControl_GeometricCurveSet;
+        break;
+      default:
+      {
+        theDI << "Syntax error: mode '" << theArgVec[anArgIter] << "' is incorrect [give fsmw]";
+        return 1;
+      }
+      }
+
+      Standard_Boolean wrmode = Standard_True;
+
+      for (Standard_Integer i = 1; i <= anArgCase.Length(); ++i)
+      {
+        switch (anArgCase.Value(i))
+        {
+        case '-':
+          wrmode = Standard_False;
+          break;
+        case '+':
+          wrmode = Standard_True;
+          break;
+        case 'c':
+          aWriter.SetColorMode(wrmode);
+          break;
+        case 'n':
+          aWriter.SetNameMode(wrmode);
+          break;
+        case 'l':
+          aWriter.SetLayerMode(wrmode);
+          break;
+        case 'v':
+          aWriter.SetPropsMode(wrmode);
+          break;
+        }
+      }
+    }
+    else if (aMultiFilePrefix.IsEmpty() && anArgCase.Search(":") == -1)
+    {
+      aMultiFilePrefix = theArgVec[anArgIter];
+    }
+    else if (aLabel.IsNull())
+    {
+      if (!DDF::FindLabel(aDocument->Main().Data(), theArgVec[anArgIter], aLabel) || aLabel.IsNull())
+      {
+        theDI << "Syntax error: No label for entry '" << theArgVec[anArgIter] << "'";
+        return 1;
+      }
+
+      aLabelName = theArgVec[anArgIter];
+    }
+    else
+    {
+      theDI << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'";
+      return 1;
+    }
+  }
+
+  if (aFilePath.IsEmpty())
+  {
+    theDI << "Syntax error: wrong number of arguments";
+    return 1;
+  }
+
+  TCollection_AsciiString aFileName, anOldVarName;
+  const Standard_Boolean isFileMode = XSDRAW::FileAndVar(aFilePath.ToCString(), aDocumentName.ToCString(), "STEP", aFileName, anOldVarName);
+
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI);
+  Message_ProgressScope aRootScope(aProgress->Start(), "STEP export", isFileMode ? 2 : 1);
+
+  if (!aLabel.IsNull())
+  {
+    theDI << "Translating label " << aLabelName << " of document " << aDocumentName << " to STEP\n";
+
+    if (!aWriter.Transfer(aLabel, aMode,
+      !aMultiFilePrefix.IsEmpty() ? aMultiFilePrefix.ToCString() : NULL,
+      aRootScope.Next()))
+    {
+      theDI << "Error: the label of document cannot be translated or gives no result";
+      return 1;
+    }
+  }
+  else
+  {
+    theDI << "Translating document " << aDocumentName << " to STEP\n";
+
+    if (!aWriter.Transfer(aDocument, aMode,
+      !aMultiFilePrefix.IsEmpty() ? aMultiFilePrefix.ToCString() : NULL,
+      aRootScope.Next()))
+    {
+      theDI << "Error: The document cannot be translated or gives no result\n";
+    }
+  }
+
+  if (!isFileMode)
+  {
+    theDI << "Document has been translated into the session";
+    return 0;
+  }
+
+  Message_ProgressScope aWriteScope(aRootScope.Next(), "File writing", 1);
+  aWriteScope.Show();
+  theDI << "Writing STEP file " << aFilePath << "\n";
+
+  IFSelect_ReturnStatus aStat = IFSelect_RetVoid;
+
+  if (toTestStream)
+  {
+    std::ofstream aStream;
+    OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary);
+    aStat = aWriter.WriteStream(aStream);
+    aStream.close();
+
+    if (!aStream.good() && aStat == IFSelect_RetDone)
+    {
+      aStat = IFSelect_RetFail;
+    }
+  }
+  else
+  {
+    aStat = aWriter.Write(aFilePath.ToCString());
+  }
+
+  switch (aStat)
+  {
+    case IFSelect_RetVoid:
+    {
+      theDI << "Error: no file written";
+      break;
+    }
+    case IFSelect_RetDone:
+    {
+      theDI << "File " << aFilePath << " written\n";
+
+      XSDRAW::CollectActiveWorkSessions(aFilePath);
+      for (ExternalFileMap::Iterator anIter(aWriter.ExternFiles()); anIter.More(); anIter.Next())
+      {
+        XSDRAW::CollectActiveWorkSessions(anIter.Value()->GetWS(), anIter.Key(), XSDRAW::WorkSessionList());
+      }
+      break;
+    }
+    default:
+    {
+      theDI << "Error on writing file";
+      break;
+    }
+  }
+  return 0;
 }
+
+//=======================================================================
+//function : Factory
+//purpose  :
+//=======================================================================
+void XSDRAWSTEP::Factory(Draw_Interpretor& theDI)
+{
+  static Standard_Boolean aIsActivated = Standard_False;
+  if (aIsActivated)
+  {
+    return;
+  }
+  aIsActivated = Standard_True;
+
+  const char* aGroup = "DE: STEP";  // Step transfer file commands
+  theDI.Add("stepwrite", "stepwrite mode[0-4 afsmw] shape", __FILE__, stepwrite, aGroup);
+  theDI.Add("testwritestep", "testwritestep filename.stp shape [-stream]",
+            __FILE__, testwrite, aGroup);
+  theDI.Add("stepread", "stepread  [file] [f or r (type of model full or reduced)]", __FILE__, stepread, aGroup);
+  theDI.Add("testreadstep", "testreadstep file shape [-stream]", __FILE__, testreadstep, aGroup);
+  theDI.Add("steptrans", "steptrans shape stepax1 stepax2", __FILE__, steptrans, aGroup);
+  theDI.Add("countexpected", "TEST", __FILE__, countexpected, aGroup);
+  theDI.Add("dumpassembly", "TEST", __FILE__, dumpassembly, aGroup);
+  theDI.Add("stepfileunits", "stepfileunits name_file", __FILE__, stepfileunits, aGroup);
+  theDI.Add("ReadStep",
+            "Doc filename [mode] [-stream]"
+            "\n\t\t: Read STEP file to a document."
+            "\n\t\t:  -stream read using istream reading interface (testing)",
+            __FILE__, ReadStep, aGroup);
+  theDI.Add("WriteStep",
+            "Doc filename [mode=a [multifile_prefix] [label]] [-stream]"
+            "\n\t\t: Write DECAF document to STEP file"
+            "\n\t\t:   mode can be: a or 0 : AsIs (default)"
+            "\n\t\t:                f or 1 : FacettedBRep        s or 2 : ShellBasedSurfaceModel"
+            "\n\t\t:                m or 3 : ManifoldSolidBrep   w or 4 : GeometricCurveSet/WireFrame"
+            "\n\t\t:   multifile_prefix: triggers writing assembly components as separate files,"
+            "\n\t\t:                     and defines common prefix for their names"
+            "\n\t\t:   label  tag of the sub-assembly label to save only that sub-assembly"
+            "\n\t\t:  -stream read using ostream writing interface (testing)",
+            __FILE__, WriteStep, aGroup);
+
+  // Load XSDRAW session for pilot activation
+  XSDRAW::LoadDraw(theDI);
+}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWSTEP)
index 9c2673ba25e4a6c729e59f7a2c6f4b2d09b6a7ff..0a5b90898a05e9f607b00ed82b0e51e6c9ab3bb8 100644 (file)
@@ -1,7 +1,4 @@
-// Created on: 1996-01-12
-// Created by: Christian CAILLET
-// Copyright (c) 1996-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
+// Copyright (c) 2023 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
 //
 
 #include <Draw_Interpretor.hxx>
 
-
-//! XSDRAW for STEP AP214 and AP203
-class XSDRAWSTEP 
+class XSDRAWSTEP
 {
-public:
-
   DEFINE_STANDARD_ALLOC
+public:
 
-  
-  Standard_EXPORT static void Init();
-  
-  //! Inits commands to access product data and to write shapes
-  Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands);
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
+  //! Loads all Draw commands of XSDRAWSTEP. Used for plugin.
+  Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
 };
 
-
-
-
-
-
-
 #endif // _XSDRAWSTEP_HeaderFile
diff --git a/src/XSDRAWSTL/FILES b/src/XSDRAWSTL/FILES
new file mode 100644 (file)
index 0000000..7a96455
--- /dev/null
@@ -0,0 +1,8 @@
+XSDRAWSTL.cxx
+XSDRAWSTL.hxx
+XSDRAWSTL_DataSource.cxx
+XSDRAWSTL_DataSource.hxx
+XSDRAWSTL_DataSource3D.cxx
+XSDRAWSTL_DataSource3D.hxx
+XSDRAWSTL_DrawableMesh.cxx
+XSDRAWSTL_DrawableMesh.hxx
\ No newline at end of file
diff --git a/src/XSDRAWSTL/XSDRAWSTL.cxx b/src/XSDRAWSTL/XSDRAWSTL.cxx
new file mode 100644 (file)
index 0000000..48fb999
--- /dev/null
@@ -0,0 +1,1322 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XSDRAWSTL.hxx>
+
+#include <AIS_InteractiveContext.hxx>
+#include <BRep_Builder.hxx>
+#include <DBRep.hxx>
+#include <DDocStd.hxx>
+#include <DDocStd_DrawDocument.hxx>
+#include <Draw.hxx>
+#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
+#include <Draw_ProgressIndicator.hxx>
+#include <MeshVS_DeformedDataSource.hxx>
+#include <MeshVS_Drawer.hxx>
+#include <MeshVS_DrawerAttribute.hxx>
+#include <MeshVS_ElementalColorPrsBuilder.hxx>
+#include <MeshVS_Mesh.hxx>
+#include <MeshVS_MeshEntityOwner.hxx>
+#include <MeshVS_MeshPrsBuilder.hxx> 
+#include <MeshVS_NodalColorPrsBuilder.hxx>
+#include <MeshVS_TextPrsBuilder.hxx>
+#include <MeshVS_VectorPrsBuilder.hxx>
+#include <RWStl.hxx>
+#include <StlAPI.hxx>
+#include <StlAPI_Writer.hxx>
+#include <TColStd_HPackedMapOfInteger.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDocStd_Application.hxx>
+#include <TopoDS_Shape.hxx>
+#include <V3d_View.hxx>
+#include <ViewerTest.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <XSDRAW.hxx>
+#include <XSDRAWSTL_DataSource.hxx>
+#include <XSDRAWSTL_DataSource3D.hxx>
+#include <XSDRAWSTL_DrawableMesh.hxx>
+
+extern Standard_Boolean VDisplayAISObject(const TCollection_AsciiString& theName,
+                                          const Handle(AIS_InteractiveObject)& theAISObj,
+                                          Standard_Boolean theReplaceIfExists = Standard_True);
+
+//=============================================================================
+//function : writestl
+//purpose  :
+//=============================================================================
+static Standard_Integer writestl
+(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3 || argc > 4) {
+    di << "Use: " << argv[0]
+    << " shape file [ascii/binary (0/1) : 1 by default]\n";
+  } else {
+    TopoDS_Shape aShape = DBRep::Get(argv[1]);
+    Standard_Boolean isASCIIMode = Standard_False;
+    if (argc == 4) {
+      isASCIIMode = (Draw::Atoi(argv[3]) == 0);
+    }
+    StlAPI_Writer aWriter;
+    aWriter.ASCIIMode() = isASCIIMode;
+    Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
+    Standard_Boolean isOK = aWriter.Write (aShape, argv[2], aProgress->Start());
+    if (!isOK)
+       di << "** Error **: Mesh writing has been failed.\n";
+  }
+  return 0;
+}
+
+//=============================================================================
+//function : readstl
+//purpose  : Reads stl file
+//=============================================================================
+static Standard_Integer readstl(Draw_Interpretor& theDI,
+                                Standard_Integer theArgc,
+                                const char** theArgv)
+{
+  TCollection_AsciiString aShapeName, aFilePath;
+  bool toCreateCompOfTris = false;
+  bool anIsMulti = false;
+  double aMergeAngle = M_PI / 2.0;
+  for (Standard_Integer anArgIter = 1; anArgIter < theArgc; ++anArgIter)
+  {
+    TCollection_AsciiString anArg (theArgv[anArgIter]);
+    anArg.LowerCase();
+    if (aShapeName.IsEmpty())
+    {
+      aShapeName = theArgv[anArgIter];
+    }
+    else if (aFilePath.IsEmpty())
+    {
+      aFilePath = theArgv[anArgIter];
+    }
+    else if (anArg == "-brep")
+    {
+      toCreateCompOfTris = true;
+      if (anArgIter + 1 < theArgc
+       && Draw::ParseOnOff (theArgv[anArgIter + 1], toCreateCompOfTris))
+      {
+        ++anArgIter;
+      }
+    }
+    else if (anArg == "-multi")
+    {
+      anIsMulti = true;
+      if (anArgIter + 1 < theArgc
+       && Draw::ParseOnOff (theArgv[anArgIter + 1], anIsMulti))
+      {
+        ++anArgIter;
+      }
+    }
+    else if (anArg == "-mergeangle"
+          || anArg == "-smoothangle"
+          || anArg == "-nomergeangle"
+          || anArg == "-nosmoothangle")
+    {
+      if (anArg.StartsWith ("-no"))
+      {
+        aMergeAngle = M_PI / 2.0;
+      }
+      else
+      {
+        aMergeAngle = M_PI / 4.0;
+        if (anArgIter + 1 < theArgc
+         && Draw::ParseReal (theArgv[anArgIter + 1], aMergeAngle))
+        {
+          if (aMergeAngle < 0.0 || aMergeAngle > 90.0)
+          {
+            theDI << "Syntax error: angle should be within [0,90] range";
+            return 1;
+          }
+
+          ++anArgIter;
+          aMergeAngle = aMergeAngle * M_PI / 180.0;
+        }
+      }
+    }
+    else
+    {
+      Message::SendFail() << "Syntax error: unknown argument '" << theArgv[anArgIter] << "'";
+      return 1;
+    }
+  }
+  if (aFilePath.IsEmpty())
+  {
+    Message::SendFail() << "Syntax error: not enough arguments";
+    return 1;
+  }
+
+  TopoDS_Shape aShape;
+  if (!toCreateCompOfTris)
+  {
+    Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI,1);
+    if(anIsMulti)
+    {
+      NCollection_Sequence<Handle(Poly_Triangulation)> aTriangList;
+      // Read STL file to the triangulation list.
+      RWStl::ReadFile(aFilePath.ToCString(),aMergeAngle,aTriangList,aProgress->Start());
+      BRep_Builder aB;
+      TopoDS_Face aFace;
+      if (aTriangList.Size() == 1)
+      {
+        aB.MakeFace (aFace);
+        aB.UpdateFace (aFace,aTriangList.First());
+        aShape = aFace;
+      }
+      else
+      {
+        TopoDS_Compound aCmp;
+        aB.MakeCompound (aCmp);
+      
+        NCollection_Sequence<Handle(Poly_Triangulation)>::Iterator anIt (aTriangList);
+        for (; anIt.More(); anIt.Next())
+        { 
+          aB.MakeFace (aFace);
+          aB.UpdateFace (aFace,anIt.Value());
+          aB.Add (aCmp,aFace);
+        }
+        aShape = aCmp;
+      }
+    }
+    else
+    {
+      // Read STL file to the triangulation.
+      Handle(Poly_Triangulation) aTriangulation = RWStl::ReadFile (aFilePath.ToCString(),aMergeAngle,aProgress->Start());
+
+      TopoDS_Face aFace;
+      BRep_Builder aB;
+      aB.MakeFace (aFace);
+      aB.UpdateFace (aFace,aTriangulation);
+      aShape = aFace;
+    }
+  }
+  else
+  {
+    Standard_DISABLE_DEPRECATION_WARNINGS
+    StlAPI::Read(aShape, aFilePath.ToCString());
+    Standard_ENABLE_DEPRECATION_WARNINGS
+  }
+  DBRep::Set (aShapeName.ToCString(), aShape);
+  return 0;
+}
+
+//=======================================================================
+//function : createmesh
+//purpose  :
+//=======================================================================
+static Standard_Integer createmesh(Draw_Interpretor& theDI,
+                                   Standard_Integer theNbArgs,
+                                   const char** theArgVec)
+{
+  if (theNbArgs < 3)
+  {
+    theDI << "Wrong number of parameters\n";
+    theDI << "Use: " << theArgVec[0] << " <mesh name> <stl file>\n";
+    return 0;
+  }
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if (aContext.IsNull())
+  {
+    theDI << "No active view. Please call 'vinit' first\n";
+    return 0;
+  }
+
+  // Progress indicator
+  OSD_Path aFile(theArgVec[2]);
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI, 1);
+  Handle(Poly_Triangulation) aSTLMesh = RWStl::ReadFile(aFile, aProgress->Start());
+
+  theDI << "Reading OK...\n";
+  Handle(XSDRAWSTL_DataSource) aDS = new XSDRAWSTL_DataSource(aSTLMesh);
+  theDI << "Data source is created successful\n";
+  Handle(MeshVS_Mesh) aMesh = new MeshVS_Mesh();
+  theDI << "MeshVS_Mesh is created successful\n";
+
+  aMesh->SetDataSource(aDS);
+  aMesh->AddBuilder(new MeshVS_MeshPrsBuilder(aMesh.operator->()), Standard_True);
+
+  aMesh->GetDrawer()->SetColor(MeshVS_DA_EdgeColor, Quantity_NOC_YELLOW);
+
+  // Hide all nodes by default
+  Handle(TColStd_HPackedMapOfInteger) aNodes = new TColStd_HPackedMapOfInteger();
+  const Standard_Integer aLen = aSTLMesh->NbNodes();
+  for (Standard_Integer anIndex = 1; anIndex <= aLen; anIndex++)
+    aNodes->ChangeMap().Add(anIndex);
+  aMesh->SetHiddenNodes(aNodes);
+  aMesh->SetSelectableNodes(aNodes);
+
+  VDisplayAISObject(theArgVec[1], aMesh);
+  aContext->Deactivate(aMesh);
+
+  Draw::Set(theArgVec[1], new XSDRAWSTL_DrawableMesh(aMesh));
+  Handle(V3d_View) aView = ViewerTest::CurrentView();
+  if (!aView.IsNull())
+    aView->FitAll();
+
+  return 0;
+}
+
+//=======================================================================
+//function : create3d
+//purpose  :
+//=======================================================================
+static Standard_Integer create3d(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
+{
+  if (theNbArgs < 2)
+  {
+    theDI << "Wrong number of parameters\n";
+    theDI << "Use: " << theArgVec[0] << " <mesh name>\n";
+    return 0;
+  }
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if (aContext.IsNull())
+  {
+    theDI << "No active view. Please call 'vinit' first\n";
+    return 0;
+  }
+
+  Handle(XSDRAWSTL_DataSource3D) aDS = new XSDRAWSTL_DataSource3D();
+  theDI << "Data source is created successful\n";
+  Handle(MeshVS_Mesh) aMesh = new MeshVS_Mesh();
+  theDI << "MeshVS_Mesh is created successful\n";
+
+  aMesh->SetDataSource(aDS);
+  aMesh->AddBuilder(new MeshVS_MeshPrsBuilder(aMesh.operator->()), Standard_True);
+
+  aMesh->GetDrawer()->SetColor(MeshVS_DA_EdgeColor, Quantity_NOC_YELLOW);
+
+  // Hide all nodes by default
+  Handle(TColStd_HPackedMapOfInteger) aNodes = new TColStd_HPackedMapOfInteger();
+  Standard_Integer aLen = aDS->GetAllNodes().Extent();
+  for (Standard_Integer anIndex = 1; anIndex <= aLen; anIndex++)
+    aNodes->ChangeMap().Add(anIndex);
+  aMesh->SetHiddenNodes(aNodes);
+  aMesh->SetSelectableNodes(aNodes);
+
+  VDisplayAISObject(theArgVec[1], aMesh);
+  aContext->Deactivate(aMesh);
+
+  Draw::Set(theArgVec[1], new XSDRAWSTL_DrawableMesh(aMesh));
+  Handle(V3d_View) aView = ViewerTest::CurrentView();
+  if (!aView.IsNull())
+    aView->FitAll();
+
+  return 0;
+}
+
+//=======================================================================
+//function : getMesh
+//purpose  :
+//=======================================================================
+Handle(MeshVS_Mesh) getMesh(const char* theName,
+                            Draw_Interpretor& theDI)
+{
+  Handle(XSDRAWSTL_DrawableMesh) aDrawMesh =
+    Handle(XSDRAWSTL_DrawableMesh)::DownCast(Draw::Get(theName));
+
+  if (aDrawMesh.IsNull())
+  {
+    theDI << "There is no such object\n";
+    return NULL;
+  }
+  else
+  {
+    Handle(MeshVS_Mesh) aMesh = aDrawMesh->GetMesh();
+    if (aMesh.IsNull())
+    {
+      theDI << "There is invalid mesh\n";
+      return NULL;
+    }
+    else
+      return aMesh;
+  }
+}
+
+//=======================================================================
+//function : setcolor
+//purpose  :
+//=======================================================================
+static Standard_Integer setcolor(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec,
+                                 Standard_Integer theParam)
+{
+  if (theNbArgs < 5)
+    theDI << "Wrong number of parameters\n";
+  else
+  {
+    Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+    if (!aMesh.IsNull())
+    {
+      Standard_Real aRed = Draw::Atof(theArgVec[2]);
+      Standard_Real aGreen = Draw::Atof(theArgVec[3]);
+      Standard_Real aBlue = Draw::Atof(theArgVec[4]);
+      aMesh->GetDrawer()->SetColor((MeshVS_DrawerAttribute)theParam,
+                                   Quantity_Color(aRed, aGreen, aBlue, Quantity_TOC_RGB));
+
+      Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+
+      if (aContext.IsNull())
+        theDI << "The context is null\n";
+      else
+        aContext->Redisplay(aMesh, Standard_True);
+    }
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : meshcolor
+//purpose  :
+//=======================================================================
+static Standard_Integer meshcolor(Draw_Interpretor& theInterp,
+                                  Standard_Integer theNbArgs,
+                                  const char** theArgVec)
+{
+  return setcolor(theInterp, theNbArgs, theArgVec, MeshVS_DA_InteriorColor);
+}
+
+//=======================================================================
+//function : linecolor
+//purpose  :
+//=======================================================================
+static Standard_Integer linecolor(Draw_Interpretor& theInterp,
+                                  Standard_Integer theNbArgs,
+                                  const char** theArgVec)
+{
+  return setcolor(theInterp, theNbArgs, theArgVec, MeshVS_DA_EdgeColor);
+}
+
+//=======================================================================
+//function : meshmat
+//purpose  :
+//=======================================================================
+static Standard_Integer meshmat(Draw_Interpretor& theDI,
+                                Standard_Integer theNbArgs,
+                                const char** theArgVec)
+{
+  if (theNbArgs < 3)
+    theDI << "Wrong number of parameters\n";
+  else
+  {
+    Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+    if (!aMesh.IsNull())
+    {
+      Standard_Integer aMaterial = Draw::Atoi(theArgVec[2]);
+
+      Graphic3d_MaterialAspect aMatAsp =
+        (Graphic3d_MaterialAspect)(Graphic3d_NameOfMaterial)aMaterial;
+
+      if (theNbArgs == 4)
+      {
+        Standard_Real aTransparency = Draw::Atof(theArgVec[3]);
+        aMatAsp.SetTransparency(Standard_ShortReal(aTransparency));
+      }
+      aMesh->GetDrawer()->SetMaterial(MeshVS_DA_FrontMaterial, aMatAsp);
+      aMesh->GetDrawer()->SetMaterial(MeshVS_DA_BackMaterial, aMatAsp);
+
+      Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+
+      if (aContext.IsNull())
+        theDI << "The context is null\n";
+      else
+        aContext->Redisplay(aMesh, Standard_True);
+    }
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : shrink
+//purpose  :
+//=======================================================================
+static Standard_Integer shrink(Draw_Interpretor& theDI,
+                               Standard_Integer theNbArgs,
+                               const char** theArgVec)
+{
+  if (theNbArgs < 3)
+    theDI << "Wrong number of parameters\n";
+  else
+  {
+    Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+    if (!aMesh.IsNull())
+    {
+      Standard_Real aShrinkCoeff = Draw::Atof(theArgVec[2]);
+      aMesh->GetDrawer()->SetDouble(MeshVS_DA_ShrinkCoeff, aShrinkCoeff);
+
+      Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+
+      if (aContext.IsNull())
+        theDI << "The context is null\n";
+      else
+        aContext->Redisplay(aMesh, Standard_True);
+    }
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : closed
+//purpose  :
+//=======================================================================
+static Standard_Integer closed(Draw_Interpretor& theDI,
+                               Standard_Integer theArgc,
+                               const char** theArgv)
+{
+  if (theArgc < 3)
+  {
+    theDI << "Wrong number of parameters.\n";
+  }
+  else
+  {
+    Handle(MeshVS_Mesh) aMesh = getMesh(theArgv[1], theDI);
+    if (!aMesh.IsNull())
+    {
+      Standard_Boolean aFlag = Draw::Atoi(theArgv[2]) != 0;
+      aMesh->GetDrawer()->SetBoolean(MeshVS_DA_SupressBackFaces, aFlag);
+
+      Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+      if (aContext.IsNull())
+      {
+        theDI << "The context is null\n";
+      }
+      else
+      {
+        aContext->Redisplay(aMesh, Standard_True);
+      }
+    }
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : mdisplay
+//purpose  :
+//=======================================================================
+static Standard_Integer mdisplay(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
+{
+  if (theNbArgs < 2)
+    theDI << "Wrong number of parameters\n";
+  else
+  {
+    Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+    if (!aMesh.IsNull())
+    {
+      Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+
+      if (aContext.IsNull())
+        theDI << "The context is null\n";
+      else
+      {
+        aContext->Display(aMesh, Standard_True);
+      }
+    }
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : merase
+//purpose  :
+//=======================================================================
+static Standard_Integer merase(Draw_Interpretor& theDI,
+                               Standard_Integer theNbArgs,
+                               const char** theArgVec)
+{
+  if (theNbArgs < 2)
+    theDI << "Wrong number of parameters\n";
+  else
+  {
+    Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+    if (!aMesh.IsNull())
+    {
+      Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+
+      if (aContext.IsNull())
+        theDI << "The context is null\n";
+      else
+      {
+        aContext->Erase(aMesh, Standard_True);
+      }
+    }
+    else
+      theDI << "Mesh is null\n";
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : hidesel
+//purpose  :
+//=======================================================================
+static Standard_Integer hidesel(Draw_Interpretor& theDI,
+                                Standard_Integer theNbArgs,
+                                const char** theArgVec)
+{
+  if (theNbArgs < 2)
+  {
+    theDI << "Wrong number of parameters\n";
+    theDI << "Use: " << theArgVec[0] << " <mesh name>\n";
+    return 0;
+  }
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+  if (aMesh.IsNull())
+  {
+    theDI << "The mesh is invalid\n";
+    return 0;
+  }
+
+  if (aContext.IsNull())
+    theDI << "The context is null\n";
+  else
+  {
+    Handle(TColStd_HPackedMapOfInteger) aHiddenNodes = aMesh->GetHiddenNodes();
+    if (aHiddenNodes.IsNull())
+    {
+      aHiddenNodes = new TColStd_HPackedMapOfInteger();
+    }
+    Handle(TColStd_HPackedMapOfInteger) aHiddenElements = aMesh->GetHiddenElems();
+    if (aHiddenElements.IsNull())
+    {
+      aHiddenElements = new TColStd_HPackedMapOfInteger();
+    }
+    for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
+    {
+      Handle(MeshVS_MeshEntityOwner) anOwner =
+        Handle(MeshVS_MeshEntityOwner)::DownCast(aContext->SelectedOwner());
+      if (!anOwner.IsNull())
+      {
+        if (anOwner->Type() == MeshVS_ET_Node)
+        {
+          aHiddenNodes->ChangeMap().Add(anOwner->ID());
+        }
+        else
+        {
+          aHiddenElements->ChangeMap().Add(anOwner->ID());
+        }
+      }
+    }
+    aContext->ClearSelected(Standard_False);
+    aMesh->SetHiddenNodes(aHiddenNodes);
+    aMesh->SetHiddenElems(aHiddenElements);
+    aContext->Redisplay(aMesh, Standard_True);
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : showonly
+//purpose  :
+//=======================================================================
+static Standard_Integer showonly(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
+{
+  if (theNbArgs < 2)
+  {
+    theDI << "Wrong number of parameters\n";
+    theDI << "Use: " << theArgVec[0] << " <mesh name>\n";
+    return 0;
+  }
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+  if (aMesh.IsNull())
+  {
+    theDI << "The mesh is invalid\n";
+    return 0;
+  }
+
+  if (aContext.IsNull())
+    theDI << "The context is null\n";
+  else
+  {
+    Handle(TColStd_HPackedMapOfInteger) aHiddenNodes =
+      new TColStd_HPackedMapOfInteger(aMesh->GetDataSource()->GetAllNodes());
+    Handle(TColStd_HPackedMapOfInteger) aHiddenElements =
+      new TColStd_HPackedMapOfInteger(aMesh->GetDataSource()->GetAllElements());
+    for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
+    {
+      Handle(MeshVS_MeshEntityOwner) anOwner =
+        Handle(MeshVS_MeshEntityOwner)::DownCast(aContext->SelectedOwner());
+      if (!anOwner.IsNull())
+      {
+        if (anOwner->Type() == MeshVS_ET_Node)
+        {
+          aHiddenNodes->ChangeMap().Remove(anOwner->ID());
+        }
+        else
+        {
+          aHiddenElements->ChangeMap().Remove(anOwner->ID());
+        }
+      }
+    }
+    aMesh->SetHiddenNodes(aHiddenNodes);
+    aMesh->SetHiddenElems(aHiddenElements);
+    aContext->Redisplay(aMesh, Standard_True);
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : showonly
+//purpose  :
+//=======================================================================
+static Standard_Integer showall(Draw_Interpretor& theDI,
+                                Standard_Integer theNbArgs,
+                                const char** theArgVec)
+{
+  if (theNbArgs < 2)
+  {
+    theDI << "Wrong number of parameters\n";
+    theDI << "Use: " << theArgVec[0] << " <mesh name>\n";
+    return 0;
+  }
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+  if (aMesh.IsNull())
+  {
+    theDI << "The mesh is invalid\n";
+    return 0;
+  }
+
+  if (aContext.IsNull())
+    theDI << "The context is null\n";
+  else
+  {
+    aMesh->SetHiddenNodes(new TColStd_HPackedMapOfInteger());
+    aMesh->SetHiddenElems(new TColStd_HPackedMapOfInteger());
+    aContext->Redisplay(aMesh, Standard_True);
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : meshcolors
+//purpose  :
+//=======================================================================
+static Standard_Integer meshcolors(Draw_Interpretor& theDI,
+                                   Standard_Integer theNbArgs,
+                                   const char** theArgVec)
+{
+  try
+  {
+    OCC_CATCH_SIGNALS
+      if (theNbArgs < 4)
+      {
+        theDI << "Wrong number of parameters\n";
+        theDI << "Use : meshcolors <mesh name> <mode> <isreflect>\n";
+        theDI << "mode : {elem1|elem2|nodal|nodaltex|none}\n";
+        theDI << "       elem1 - different color for each element\n";
+        theDI << "       elem2 - one color for one side\n";
+        theDI << "       nodal - different color for each node\n";
+        theDI << "       nodaltex - different color for each node with texture interpolation\n";
+        theDI << "       none  - clear\n";
+        theDI << "isreflect : {0|1} \n";
+
+        return 0;
+      }
+
+    Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+
+    if (aMesh.IsNull())
+    {
+      theDI << "Mesh not found\n";
+      return 0;
+    }
+    Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext();
+    if (anIC.IsNull())
+    {
+      theDI << "The context is null\n";
+      return 0;
+    }
+    if (!aMesh.IsNull())
+    {
+      TCollection_AsciiString aMode = TCollection_AsciiString(theArgVec[2]);
+      Quantity_Color aColor1(Quantity_NOC_BLUE1);
+      Quantity_Color aColor2(Quantity_NOC_RED1);
+      if (aMode.IsEqual("elem1") || aMode.IsEqual("elem2") || aMode.IsEqual("nodal") || aMode.IsEqual("nodaltex") || aMode.IsEqual("none"))
+      {
+        Handle(MeshVS_PrsBuilder) aTempBuilder;
+        Standard_Integer aReflection = Draw::Atoi(theArgVec[3]);
+
+        for (Standard_Integer aCount = 0; aCount < aMesh->GetBuildersCount(); aCount++)
+        {
+          aTempBuilder = aMesh->FindBuilder("MeshVS_ElementalColorPrsBuilder");
+          if (!aTempBuilder.IsNull())
+            aMesh->RemoveBuilderById(aTempBuilder->GetId());
+
+          aTempBuilder = aMesh->FindBuilder("MeshVS_NodalColorPrsBuilder");
+          if (!aTempBuilder.IsNull())
+            aMesh->RemoveBuilderById(aTempBuilder->GetId());
+        }
+
+        if (aMode.IsEqual("elem1") || aMode.IsEqual("elem2"))
+        {
+          Handle(MeshVS_ElementalColorPrsBuilder) aBuilder = new MeshVS_ElementalColorPrsBuilder(
+            aMesh, MeshVS_DMF_ElementalColorDataPrs | MeshVS_DMF_OCCMask);
+          // Color
+          const TColStd_PackedMapOfInteger& anAllElements = aMesh->GetDataSource()->GetAllElements();
+
+          if (aMode.IsEqual("elem1"))
+            for (TColStd_PackedMapOfInteger::Iterator anIter(anAllElements);
+                 anIter.More(); anIter.Next())
+          {
+            Quantity_Color aColor((Quantity_NameOfColor)(anIter.Key() % Quantity_NOC_WHITE));
+            aBuilder->SetColor1(anIter.Key(), aColor);
+          }
+          else
+            for (TColStd_PackedMapOfInteger::Iterator anIter(anAllElements);
+                 anIter.More(); anIter.Next())
+          {
+            aBuilder->SetColor2(anIter.Key(), aColor1, aColor2);
+          }
+
+          aMesh->AddBuilder(aBuilder, Standard_True);
+        }
+
+        if (aMode.IsEqual("nodal"))
+        {
+          Handle(MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder(
+            aMesh, MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask);
+          aMesh->AddBuilder(aBuilder, Standard_True);
+
+          // Color
+          const TColStd_PackedMapOfInteger& anAllNodes =
+            aMesh->GetDataSource()->GetAllNodes();
+          for (TColStd_PackedMapOfInteger::Iterator anIter(anAllNodes);
+               anIter.More(); anIter.Next())
+          {
+            Quantity_Color aColor((Quantity_NameOfColor)(
+              anIter.Key() % Quantity_NOC_WHITE));
+            aBuilder->SetColor(anIter.Key(), aColor);
+          }
+          aMesh->AddBuilder(aBuilder, Standard_True);
+        }
+
+        if (aMode.IsEqual("nodaltex"))
+        {
+          // assign nodal builder to the mesh
+          Handle(MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder(
+            aMesh, MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask);
+          aMesh->AddBuilder(aBuilder, Standard_True);
+          aBuilder->UseTexture(Standard_True);
+
+          // prepare color map for texture
+          Aspect_SequenceOfColor aColorMap;
+          aColorMap.Append((Quantity_NameOfColor)Quantity_NOC_RED);
+          aColorMap.Append((Quantity_NameOfColor)Quantity_NOC_YELLOW);
+          aColorMap.Append((Quantity_NameOfColor)Quantity_NOC_BLUE1);
+
+          // prepare scale map for mesh - it will be assigned to mesh as texture coordinates
+          // make mesh color interpolated from minimum X coord to maximum X coord
+          Handle(MeshVS_DataSource) aDataSource = aMesh->GetDataSource();
+          Standard_Real aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ;
+
+          // get bounding box for calculations
+          aDataSource->GetBoundingBox().Get(aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ);
+          Standard_Real aDelta = aMaxX - aMinX;
+
+          // assign color scale map values (0..1) to nodes
+          TColStd_DataMapOfIntegerReal aScaleMap;
+          TColStd_Array1OfReal aCoords(1, 3);
+          Standard_Integer     aNbNodes;
+          MeshVS_EntityType    aType;
+
+          // iterate nodes
+          const TColStd_PackedMapOfInteger& anAllNodes =
+            aMesh->GetDataSource()->GetAllNodes();
+          for (TColStd_PackedMapOfInteger::Iterator anIter(anAllNodes);
+               anIter.More(); anIter.Next())
+          {
+            //get node coordinates to aCoord variable
+            aDataSource->GetGeom(anIter.Key(), Standard_False, aCoords, aNbNodes, aType);
+
+            Standard_Real aScaleValue;
+            try
+            {
+              OCC_CATCH_SIGNALS
+                aScaleValue = (aCoords.Value(1) - (Standard_Real)aMinX) / aDelta;
+            }
+            catch (Standard_Failure const&)
+            {
+              aScaleValue = 0;
+            }
+
+            aScaleMap.Bind(anIter.Key(), aScaleValue);
+          }
+
+          //set color map for builder and a color for invalid scale value
+          aBuilder->SetColorMap(aColorMap);
+          aBuilder->SetInvalidColor(Quantity_NOC_BLACK);
+          aBuilder->SetTextureCoords(aScaleMap);
+          aMesh->AddBuilder(aBuilder, Standard_True);
+        }
+
+        aMesh->GetDrawer()->SetBoolean(MeshVS_DA_ColorReflection, aReflection != 0);
+
+        anIC->Redisplay(aMesh, Standard_True);
+      }
+      else
+      {
+        theDI << "Wrong mode name\n";
+        return 0;
+      }
+    }
+  }
+  catch (Standard_Failure const&)
+  {
+    theDI << "Error\n";
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : meshvectors
+//purpose  :
+//=======================================================================
+static Standard_Integer meshvectors(Draw_Interpretor& theDI,
+                                    Standard_Integer theNbArgs,
+                                    const char** theArgVec)
+{
+  if (theNbArgs < 3)
+  {
+    theDI << "Wrong number of parameters\n";
+    theDI << "Use : meshvectors <mesh name> < -mode {elem|nodal|none} > [-maxlen len] [-color name] [-arrowpart ratio] [-issimple {1|0}]\n";
+    theDI << "Supported mode values:\n";
+    theDI << "       elem  - vector per element\n";
+    theDI << "       nodal - vector per node\n";
+    theDI << "       none  - clear\n";
+
+    return 0;
+  }
+
+  Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+
+  if (aMesh.IsNull())
+  {
+    theDI << "Mesh not found\n";
+    return 0;
+  }
+  Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext();
+  if (anIC.IsNull())
+  {
+    theDI << "The context is null\n";
+    return 0;
+  }
+
+  TCollection_AsciiString aParam;
+  TCollection_AsciiString aMode("none");
+  Standard_Real           aMaxlen(1.0);
+  Quantity_Color          aColor(Quantity_NOC_ORANGE);
+  Standard_Real           anArrowPart(0.1);
+  Standard_Boolean        isSimplePrs(Standard_False);
+
+  for (Standard_Integer anIdx = 2; anIdx < theNbArgs; anIdx++)
+  {
+    if (!aParam.IsEmpty())
+    {
+      if (aParam == "-mode")
+      {
+        aMode = theArgVec[anIdx];
+      }
+      else if (aParam == "-maxlen")
+      {
+        aMaxlen = Draw::Atof(theArgVec[anIdx]);
+      }
+      else if (aParam == "-color")
+      {
+        if (!Quantity_Color::ColorFromName(theArgVec[anIdx], aColor))
+        {
+          theDI << "Syntax error at " << aParam << "\n";
+          return 1;
+        }
+      }
+      else if (aParam == "-arrowpart")
+      {
+        anArrowPart = Draw::Atof(theArgVec[anIdx]);
+      }
+      else if (aParam == "-issimple")
+      {
+        isSimplePrs = Draw::Atoi(theArgVec[anIdx]) != 0;
+      }
+      aParam.Clear();
+    }
+    else if (theArgVec[anIdx][0] == '-')
+    {
+      aParam = theArgVec[anIdx];
+    }
+  }
+
+  if (!aMode.IsEqual("elem") && !aMode.IsEqual("nodal") && !aMode.IsEqual("none"))
+  {
+    theDI << "Wrong mode name\n";
+    return 0;
+  }
+
+  Handle(MeshVS_PrsBuilder) aTempBuilder;
+
+  aTempBuilder = aMesh->FindBuilder("MeshVS_VectorPrsBuilder");
+  if (!aTempBuilder.IsNull())
+    aMesh->RemoveBuilderById(aTempBuilder->GetId());
+
+  if (!aMode.IsEqual("none"))
+  {
+    Handle(MeshVS_VectorPrsBuilder) aBuilder = new MeshVS_VectorPrsBuilder(aMesh.operator->(),
+                                                                           aMaxlen,
+                                                                           aColor,
+                                                                           MeshVS_DMF_VectorDataPrs,
+                                                                           0,
+                                                                           -1,
+                                                                           MeshVS_BP_Vector,
+                                                                           isSimplePrs);
+
+    Standard_Boolean anIsElement = aMode.IsEqual("elem");
+    const TColStd_PackedMapOfInteger& anAllIDs = anIsElement ? aMesh->GetDataSource()->GetAllElements() :
+      aMesh->GetDataSource()->GetAllNodes();
+
+    Standard_Integer aNbNodes;
+    MeshVS_EntityType aEntType;
+
+    TColStd_Array1OfReal aCoords(1, 3);
+    aCoords.Init(0.);
+    for (TColStd_PackedMapOfInteger::Iterator anIter(anAllIDs);
+         anIter.More(); anIter.Next())
+    {
+      Standard_Boolean IsValidData = Standard_False;
+      if (anIsElement)
+      {
+        aMesh->GetDataSource()->GetGeomType(anIter.Key(), anIsElement, aEntType);
+        if (aEntType == MeshVS_ET_Face)
+          IsValidData = aMesh->GetDataSource()->GetNormal(anIter.Key(), 3, aCoords.ChangeValue(1), aCoords.ChangeValue(2), aCoords.ChangeValue(3));
+      }
+      else
+        IsValidData = aMesh->GetDataSource()->GetGeom(anIter.Key(), Standard_False, aCoords, aNbNodes, aEntType);
+
+      gp_Vec aNorm;
+      if (IsValidData)
+      {
+        aNorm = gp_Vec(aCoords.Value(1), aCoords.Value(2), aCoords.Value(3));
+        if (aNorm.Magnitude() < gp::Resolution())
+        {
+          aNorm = gp_Vec(0, 0, 1); //method GetGeom(...) returns coordinates of nodes
+        }
+      }
+      else
+      {
+        aNorm = gp_Vec(0, 0, 1);
+      }
+      aBuilder->SetVector(anIsElement, anIter.Key(), aNorm.Normalized());
+    }
+
+    aMesh->AddBuilder(aBuilder, Standard_False);
+    aMesh->GetDrawer()->SetDouble(MeshVS_DA_VectorArrowPart, anArrowPart);
+  }
+
+  anIC->Redisplay(aMesh, Standard_True);
+
+  return 0;
+}
+
+//=======================================================================
+//function : meshtext
+//purpose  :
+//=======================================================================
+static Standard_Integer meshtext(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
+{
+  if (theNbArgs < 2)
+  {
+    theDI << "Wrong number of parameters\n";
+    theDI << "Use : meshtext <mesh name>\n";
+    return 0;
+  }
+
+  Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+
+  if (aMesh.IsNull())
+  {
+    theDI << "Mesh not found\n";
+    return 0;
+  }
+
+  Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext();
+  if (anIC.IsNull())
+  {
+    theDI << "The context is null\n";
+    return 0;
+  }
+
+  // Prepare triangle labels
+  MeshVS_DataMapOfIntegerAsciiString aLabels;
+  Standard_Integer aLen = aMesh->GetDataSource()->GetAllElements().Extent();
+  for (Standard_Integer anIndex = 1; anIndex <= aLen; anIndex++)
+  {
+    aLabels.Bind(anIndex, TCollection_AsciiString(anIndex));
+  }
+
+  Handle(MeshVS_TextPrsBuilder) aTextBuilder = new MeshVS_TextPrsBuilder(aMesh.operator->(), 20., Quantity_NOC_YELLOW);
+  aTextBuilder->SetTexts(Standard_True, aLabels);
+  aMesh->AddBuilder(aTextBuilder);
+
+  return 0;
+}
+
+//=======================================================================
+//function : meshdeform
+//purpose  :
+//=======================================================================
+static Standard_Integer meshdeform(Draw_Interpretor& theDI,
+                                   Standard_Integer theNbArgs,
+                                   const char** theArgVec)
+{
+  if (theNbArgs < 3)
+  {
+    theDI << "Wrong number of parameters\n";
+    theDI << "Use : meshdeform <mesh name> < -mode {on|off} > [-scale scalefactor]\n";
+    return 0;
+  }
+
+  Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+
+  if (aMesh.IsNull())
+  {
+    theDI << "Mesh not found\n";
+    return 0;
+  }
+  Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext();
+  if (anIC.IsNull())
+  {
+    theDI << "The context is null\n";
+    return 0;
+  }
+
+  TCollection_AsciiString aParam;
+  TCollection_AsciiString aMode("off");
+  Standard_Real           aScale(1.0);
+
+  for (Standard_Integer anIdx = 2; anIdx < theNbArgs; anIdx++)
+  {
+    if (!aParam.IsEmpty())
+    {
+      if (aParam == "-mode")
+      {
+        aMode = theArgVec[anIdx];
+      }
+      else if (aParam == "-scale")
+      {
+        aScale = Draw::Atof(theArgVec[anIdx]);
+      }
+      aParam.Clear();
+    }
+    else if (theArgVec[anIdx][0] == '-')
+    {
+      aParam = theArgVec[anIdx];
+    }
+  }
+
+  if (!aMode.IsEqual("on") && !aMode.IsEqual("off"))
+  {
+    theDI << "Wrong mode name\n";
+    return 0;
+  }
+
+  Handle(MeshVS_DeformedDataSource) aDefDS =
+    new MeshVS_DeformedDataSource(aMesh->GetDataSource(), aScale);
+
+  const TColStd_PackedMapOfInteger& anAllIDs = aMesh->GetDataSource()->GetAllNodes();
+
+  Standard_Integer aNbNodes;
+  MeshVS_EntityType aEntType;
+
+  for (TColStd_PackedMapOfInteger::Iterator anIter(anAllIDs);
+       anIter.More(); anIter.Next())
+  {
+    TColStd_Array1OfReal aCoords(1, 3);
+    aMesh->GetDataSource()->GetGeom(anIter.Key(), Standard_False, aCoords, aNbNodes, aEntType);
+
+    gp_Vec aNorm = gp_Vec(aCoords.Value(1), aCoords.Value(2), aCoords.Value(3));
+    if (!aNorm.Magnitude())
+      aNorm = gp_Vec(0, 0, 1);
+    aDefDS->SetVector(anIter.Key(), aNorm.Normalized());
+  }
+
+  aMesh->SetDataSource(aDefDS);
+
+  anIC->Redisplay(aMesh, Standard_False);
+
+  Handle(V3d_View) aView = ViewerTest::CurrentView();
+  if (!aView.IsNull())
+    aView->FitAll();
+
+  return 0;
+}
+
+//=======================================================================
+//function : mesh_edge_width
+//purpose  :
+//=======================================================================
+static Standard_Integer mesh_edge_width(Draw_Interpretor& theDI,
+                                        Standard_Integer theNbArgs,
+                                        const char** theArgVec)
+{
+  try
+  {
+    OCC_CATCH_SIGNALS
+      if (theNbArgs < 3)
+      {
+        theDI << "Wrong number of parameters\n";
+        theDI << "Use : mesh_edge_width <mesh name> <width>\n";
+        return 0;
+      }
+
+    Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+    if (aMesh.IsNull())
+    {
+      theDI << "Mesh not found\n";
+      return 0;
+    }
+
+    const char* aWidthStr = theArgVec[2];
+    if (aWidthStr == 0 || Draw::Atof(aWidthStr) <= 0)
+    {
+      theDI << "Width must be real value more than zero\n";
+      return 0;
+    }
+
+    double aWidth = Draw::Atof(aWidthStr);
+
+    Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext();
+    if (anIC.IsNull())
+    {
+      theDI << "The context is null\n";
+      return 0;
+    }
+
+    Handle(MeshVS_Drawer) aDrawer = aMesh->GetDrawer();
+    if (aDrawer.IsNull())
+    {
+      theDI << "The drawer is null\n";
+      return 0;
+    }
+
+    aDrawer->SetDouble(MeshVS_DA_EdgeWidth, aWidth);
+    anIC->Redisplay(aMesh, Standard_True);
+  }
+  catch (Standard_Failure const&)
+  {
+    theDI << "Error\n";
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : meshinfo
+//purpose  :
+//=======================================================================
+static Standard_Integer meshinfo(Draw_Interpretor& theDI,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
+{
+  if (theNbArgs != 2)
+  {
+    theDI << "Wrong number of parameters. Use : meshinfo mesh\n";
+    return 0;
+  }
+
+  Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI);
+  if (aMesh.IsNull())
+  {
+    theDI << "Mesh not found\n";
+    return 0;
+  }
+
+  Handle(XSDRAWSTL_DataSource) stlMeshSource = Handle(XSDRAWSTL_DataSource)::DownCast(aMesh->GetDataSource());
+  if (!stlMeshSource.IsNull())
+  {
+    const TColStd_PackedMapOfInteger& nodes = stlMeshSource->GetAllNodes();
+    const TColStd_PackedMapOfInteger& tris = stlMeshSource->GetAllElements();
+
+    theDI << "Nb nodes = " << nodes.Extent() << "\n";
+    theDI << "Nb triangles = " << tris.Extent() << "\n";
+  }
+
+  return 0;
+}
+
+//=============================================================================
+//function : Factory
+//purpose  :
+//=============================================================================
+void XSDRAWSTL::Factory(Draw_Interpretor& theDI)
+{
+  static Standard_Boolean aIsActivated = Standard_False;
+  if (aIsActivated)
+  {
+    return;
+  }
+  aIsActivated = Standard_True;
+
+  const char* aGroup = "XSTEP-STL/VRML";  // Step transfer file commands
+
+  theDI.Add("writestl", "shape file [ascii/binary (0/1) : 1 by default] [InParallel (0/1) : 0 by default]", __FILE__, writestl, aGroup);
+  theDI.Add("readstl",
+            "readstl shape file [-brep] [-mergeAngle Angle] [-multi]"
+            "\n\t\t: Reads STL file and creates a new shape with specified name."
+            "\n\t\t: When -brep is specified, creates a Compound of per-triangle Faces."
+            "\n\t\t: Single triangulation-only Face is created otherwise (default)."
+            "\n\t\t: -mergeAngle specifies maximum angle in degrees between triangles to merge equal nodes; disabled by default."
+            "\n\t\t: -multi creates a face per solid in multi-domain files; ignored when -brep is set.",
+            __FILE__, readstl, aGroup);
+
+  theDI.Add("meshfromstl", "creates MeshVS_Mesh from STL file", __FILE__, createmesh, aGroup);
+  theDI.Add("mesh3delem", "creates 3d element mesh to test", __FILE__, create3d, aGroup);
+  theDI.Add("meshshadcolor", "change MeshVS_Mesh shading color", __FILE__, meshcolor, aGroup);
+  theDI.Add("meshlinkcolor", "change MeshVS_Mesh line color", __FILE__, linecolor, aGroup);
+  theDI.Add("meshmat", "change MeshVS_Mesh material and transparency", __FILE__, meshmat, aGroup);
+  theDI.Add("meshshrcoef", "change MeshVS_Mesh shrink coeff", __FILE__, shrink, aGroup);
+  theDI.Add("meshclosed", "meshclosed meshname (0/1) \nChange MeshVS_Mesh drawing mode. 0 - not closed object, 1 - closed object", __FILE__, closed, aGroup);
+  theDI.Add("meshshow", "display MeshVS_Mesh object", __FILE__, mdisplay, aGroup);
+  theDI.Add("meshhide", "erase MeshVS_Mesh object", __FILE__, merase, aGroup);
+  theDI.Add("meshhidesel", "hide selected entities", __FILE__, hidesel, aGroup);
+  theDI.Add("meshshowsel", "show only selected entities", __FILE__, showonly, aGroup);
+  theDI.Add("meshshowall", "show all entities", __FILE__, showall, aGroup);
+  theDI.Add("meshcolors", "display color presentation", __FILE__, meshcolors, aGroup);
+  theDI.Add("meshvectors", "display sample vectors", __FILE__, meshvectors, aGroup);
+  theDI.Add("meshtext", "display text labels", __FILE__, meshtext, aGroup);
+  theDI.Add("meshdeform", "display deformed mesh", __FILE__, meshdeform, aGroup);
+  theDI.Add("mesh_edge_width", "set width of edges", __FILE__, mesh_edge_width, aGroup);
+  theDI.Add("meshinfo", "displays the number of nodes and triangles", __FILE__, meshinfo, aGroup);
+
+  // Load XSDRAW session for pilot activation
+  XSDRAW::LoadDraw(theDI);
+}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWSTL)
diff --git a/src/XSDRAWSTL/XSDRAWSTL.hxx b/src/XSDRAWSTL/XSDRAWSTL.hxx
new file mode 100644 (file)
index 0000000..32b4ca7
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XSDRAWSTL_HeaderFile
+#define _XSDRAWSTL_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+
+#include <Draw_Interpretor.hxx>
+
+class XSDRAWSTL
+{
+  DEFINE_STANDARD_ALLOC
+public:
+
+  //! Loads all Draw commands of XSDRAWSTL. Used for plugin.
+  Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
+};
+
+#endif // _XSDRAWSTL_HeaderFile
diff --git a/src/XSDRAWSTL/XSDRAWSTL_DataSource.cxx b/src/XSDRAWSTL/XSDRAWSTL_DataSource.cxx
new file mode 100644 (file)
index 0000000..603dec6
--- /dev/null
@@ -0,0 +1,228 @@
+// Created on: 2004-06-10
+// Created by: Alexander SOLOVYOV
+// Copyright (c) 2004-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XSDRAWSTL_DataSource.hxx>
+
+#include <Precision.hxx>
+#include <Standard_Type.hxx>
+#include <TColStd_DataMapOfIntegerReal.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XSDRAWSTL_DataSource,MeshVS_DataSource)
+
+//================================================================
+// Function : Constructor
+// Purpose  :
+//================================================================
+XSDRAWSTL_DataSource::XSDRAWSTL_DataSource (const Handle(Poly_Triangulation)& aMesh)
+{
+  myMesh = aMesh;
+
+  if( !myMesh.IsNull() )
+  {
+    const Standard_Integer aNbNodes = myMesh->NbNodes();
+    myNodeCoords = new TColStd_HArray2OfReal (1, aNbNodes, 1, 3);
+    std::cout << "Nodes : " << aNbNodes << std::endl;
+
+    for (Standard_Integer i = 1; i <= aNbNodes; i++)
+    {
+      myNodes.Add( i );
+      gp_Pnt xyz = myMesh->Node (i);
+
+      myNodeCoords->SetValue(i, 1, xyz.X());
+      myNodeCoords->SetValue(i, 2, xyz.Y());
+      myNodeCoords->SetValue(i, 3, xyz.Z());
+    }
+
+    const Standard_Integer aNbTris = myMesh->NbTriangles();
+    myElemNormals = new TColStd_HArray2OfReal(1, aNbTris, 1, 3);
+    myElemNodes = new TColStd_HArray2OfInteger(1, aNbTris, 1, 3);
+
+    std::cout << "Elements : " << aNbTris << std::endl;
+
+    for (Standard_Integer i = 1; i <= aNbTris; i++)
+    {
+      myElements.Add( i );
+
+      const Poly_Triangle aTri = myMesh->Triangle (i);
+
+      Standard_Integer V[3];
+      aTri.Get (V[0], V[1], V[2]);
+
+      const gp_Pnt aP1 = myMesh->Node (V[0]);
+      const gp_Pnt aP2 = myMesh->Node (V[1]);
+      const gp_Pnt aP3 = myMesh->Node (V[2]);
+
+      gp_Vec aV1(aP1, aP2);
+      gp_Vec aV2(aP2, aP3);
+
+      gp_Vec aN = aV1.Crossed(aV2);
+      if (aN.SquareMagnitude() > Precision::SquareConfusion())
+        aN.Normalize();
+      else
+        aN.SetCoord(0.0, 0.0, 0.0);
+
+      for (Standard_Integer j = 0; j < 3; j++)
+      {
+        myElemNodes->SetValue(i, j+1, V[j]);
+      }
+
+      myElemNormals->SetValue (i, 1, aN.X());
+      myElemNormals->SetValue (i, 2, aN.Y());
+      myElemNormals->SetValue (i, 3, aN.Z());
+    }
+  }
+  std::cout << "Construction is finished" << std::endl;
+}
+
+//================================================================
+// Function : GetGeom
+// Purpose  :
+//================================================================
+Standard_Boolean XSDRAWSTL_DataSource::GetGeom
+( const Standard_Integer ID, const Standard_Boolean IsElement,
+ TColStd_Array1OfReal& Coords, Standard_Integer& NbNodes,
+ MeshVS_EntityType& Type ) const
+{
+  if( myMesh.IsNull() )
+    return Standard_False;
+
+  if( IsElement )
+  {
+    if( ID>=1 && ID<=myElements.Extent() )
+    {
+      Type = MeshVS_ET_Face;
+      NbNodes = 3;
+
+      for( Standard_Integer i = 1, k = 1; i <= 3; i++ )
+      {
+        Standard_Integer IdxNode = myElemNodes->Value(ID, i);
+        for(Standard_Integer j = 1; j <= 3; j++, k++ )
+          Coords(k) = myNodeCoords->Value(IdxNode, j);
+      }
+
+      return Standard_True;
+    }
+    else
+      return Standard_False;
+  }
+  else
+    if( ID>=1 && ID<=myNodes.Extent() )
+    {
+      Type = MeshVS_ET_Node;
+      NbNodes = 1;
+
+      Coords( 1 ) = myNodeCoords->Value(ID, 1);
+      Coords( 2 ) = myNodeCoords->Value(ID, 2);
+      Coords( 3 ) = myNodeCoords->Value(ID, 3);
+      return Standard_True;
+    }
+    else
+      return Standard_False;
+}
+
+//================================================================
+// Function : GetGeomType
+// Purpose  :
+//================================================================
+Standard_Boolean XSDRAWSTL_DataSource::GetGeomType
+( const Standard_Integer,
+ const Standard_Boolean IsElement,
+ MeshVS_EntityType& Type ) const
+{
+  if( IsElement )
+  {
+    Type = MeshVS_ET_Face;
+    return Standard_True;
+  }
+  else
+  {
+    Type = MeshVS_ET_Node;
+    return Standard_True;
+  }
+}
+
+//================================================================
+// Function : GetAddr
+// Purpose  :
+//================================================================
+Standard_Address XSDRAWSTL_DataSource::GetAddr
+( const Standard_Integer, const Standard_Boolean ) const
+{
+  return NULL;
+}
+
+//================================================================
+// Function : GetNodesByElement
+// Purpose  :
+//================================================================
+Standard_Boolean XSDRAWSTL_DataSource::GetNodesByElement
+( const Standard_Integer ID,
+ TColStd_Array1OfInteger& theNodeIDs,
+ Standard_Integer& /*theNbNodes*/ ) const
+{
+  if( myMesh.IsNull() )
+    return Standard_False;
+
+  if( ID>=1 && ID<=myElements.Extent() && theNodeIDs.Length() >= 3 )
+  {
+    Standard_Integer aLow = theNodeIDs.Lower();
+    theNodeIDs (aLow)     = myElemNodes->Value(ID, 1 );
+    theNodeIDs (aLow + 1) = myElemNodes->Value(ID, 2 );
+    theNodeIDs (aLow + 2) = myElemNodes->Value(ID, 3 );
+    return Standard_True;
+  }
+  return Standard_False;
+}
+
+//================================================================
+// Function : GetAllNodes
+// Purpose  :
+//================================================================
+const TColStd_PackedMapOfInteger& XSDRAWSTL_DataSource::GetAllNodes() const
+{
+  return myNodes;
+}
+
+//================================================================
+// Function : GetAllElements
+// Purpose  :
+//================================================================
+const TColStd_PackedMapOfInteger& XSDRAWSTL_DataSource::GetAllElements() const
+{
+  return myElements;
+}
+
+//================================================================
+// Function : GetNormal
+// Purpose  :
+//================================================================
+Standard_Boolean XSDRAWSTL_DataSource::GetNormal
+( const Standard_Integer Id, const Standard_Integer Max,
+ Standard_Real& nx, Standard_Real& ny,Standard_Real& nz ) const
+{
+  if( myMesh.IsNull() )
+    return Standard_False;
+
+  if( Id>=1 && Id<=myElements.Extent() && Max>=3 )
+  {
+    nx = myElemNormals->Value(Id, 1);
+    ny = myElemNormals->Value(Id, 2);
+    nz = myElemNormals->Value(Id, 3);
+    return Standard_True;
+  }
+  else
+    return Standard_False;
+}
+
diff --git a/src/XSDRAWSTL/XSDRAWSTL_DataSource.hxx b/src/XSDRAWSTL/XSDRAWSTL_DataSource.hxx
new file mode 100644 (file)
index 0000000..2e4e328
--- /dev/null
@@ -0,0 +1,99 @@
+// Created on: 2004-06-10
+// Created by: Alexander SOLOVYOV
+// Copyright (c) 2004-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XSDRAWSTL_DataSource_HeaderFile
+#define _XSDRAWSTL_DataSource_HeaderFile
+
+#include <Standard.hxx>
+
+#include <TColStd_HArray2OfInteger.hxx>
+#include <TColStd_HArray2OfReal.hxx>
+#include <MeshVS_DataSource.hxx>
+#include <Standard_Integer.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <MeshVS_EntityType.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <Poly_Triangulation.hxx>
+
+
+class XSDRAWSTL_DataSource;
+DEFINE_STANDARD_HANDLE(XSDRAWSTL_DataSource, MeshVS_DataSource)
+
+//! The sample DataSource for working with STLMesh_Mesh
+class XSDRAWSTL_DataSource : public MeshVS_DataSource
+{
+
+public:
+
+  
+  //! Constructor
+  Standard_EXPORT XSDRAWSTL_DataSource(const Handle(Poly_Triangulation)& aMesh);
+  
+  //! Returns geometry information about node (if IsElement is False) or element (IsElement is True) by coordinates.
+  //! For element this method must return all its nodes coordinates in the strict order: X, Y, Z and
+  //! with nodes order is the same as in wire bounding the face or link. NbNodes is number of nodes of element.
+  //! It is recommended to return 1 for node. Type is an element type.
+  Standard_EXPORT Standard_Boolean GetGeom (const Standard_Integer ID, const Standard_Boolean IsElement, TColStd_Array1OfReal& Coords, Standard_Integer& NbNodes, MeshVS_EntityType& Type) const Standard_OVERRIDE;
+  
+  //! This method is similar to GetGeom, but returns only element or node type. This method is provided for
+  //! a fine performance.
+  Standard_EXPORT Standard_Boolean GetGeomType (const Standard_Integer ID, const Standard_Boolean IsElement, MeshVS_EntityType& Type) const Standard_OVERRIDE;
+  
+  //! This method returns by number an address of any entity which represents element or node data structure.
+  Standard_EXPORT Standard_Address GetAddr (const Standard_Integer ID, const Standard_Boolean IsElement) const Standard_OVERRIDE;
+  
+  //! This method returns information about what node this element consist of.
+  Standard_EXPORT virtual Standard_Boolean GetNodesByElement (const Standard_Integer ID, TColStd_Array1OfInteger& NodeIDs, Standard_Integer& NbNodes) const Standard_OVERRIDE;
+  
+  //! This method returns map of all nodes the object consist of.
+  Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const Standard_OVERRIDE;
+  
+  //! This method returns map of all elements the object consist of.
+  Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const Standard_OVERRIDE;
+  
+  //! This method calculates normal of face, which is using for correct reflection presentation.
+  //! There is default method, for advance reflection this method can be redefined.
+  Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer Id, const Standard_Integer Max, Standard_Real& nx, Standard_Real& ny, Standard_Real& nz) const Standard_OVERRIDE;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(XSDRAWSTL_DataSource,MeshVS_DataSource)
+
+protected:
+
+
+
+
+private:
+
+
+  Handle(Poly_Triangulation) myMesh;
+  TColStd_PackedMapOfInteger myNodes;
+  TColStd_PackedMapOfInteger myElements;
+  Handle(TColStd_HArray2OfInteger) myElemNodes;
+  Handle(TColStd_HArray2OfReal) myNodeCoords;
+  Handle(TColStd_HArray2OfReal) myElemNormals;
+
+
+};
+
+
+
+
+
+
+
+#endif // _XSDRAWSTL_DataSource_HeaderFile
diff --git a/src/XSDRAWSTL/XSDRAWSTL_DataSource3D.cxx b/src/XSDRAWSTL/XSDRAWSTL_DataSource3D.cxx
new file mode 100644 (file)
index 0000000..256840a
--- /dev/null
@@ -0,0 +1,386 @@
+// Created on: 2014-08-04
+// Created by: Artem NOVIKOV
+// Copyright (c) 2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <Standard_Type.hxx>
+#include <TColgp_SequenceOfXYZ.hxx>
+#include <TColStd_DataMapOfIntegerInteger.hxx>
+#include <TColStd_DataMapOfIntegerReal.hxx>
+#include <XSDRAWSTL_DataSource3D.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XSDRAWSTL_DataSource3D,MeshVS_DataSource)
+
+//================================================================
+// Function : Constructor
+// Purpose  :
+//================================================================
+XSDRAWSTL_DataSource3D::XSDRAWSTL_DataSource3D()
+{
+  for (Standard_Integer aNodeID = 1; aNodeID <= 16; aNodeID++)
+  {
+    myNodes.Add( aNodeID );
+  }
+
+  for (Standard_Integer anElemID = 1; anElemID <= 5; anElemID++)
+  {
+    myElements.Add( anElemID );
+  }
+
+  myNodeCoords = new TColStd_HArray2OfReal(1, 16, 1, 3);
+
+  myNodeCoords->SetValue( 1, 1, 5 );
+  myNodeCoords->SetValue( 1, 2, 5 );
+  myNodeCoords->SetValue( 1, 3, 20 );
+
+  myNodeCoords->SetValue( 2, 1, 0 );
+  myNodeCoords->SetValue( 2, 2, 10 );
+  myNodeCoords->SetValue( 2, 3, 10 );
+
+  myNodeCoords->SetValue( 3, 1, 10 );
+  myNodeCoords->SetValue( 3, 2, 0 );
+  myNodeCoords->SetValue( 3, 3, 10 );
+
+  myNodeCoords->SetValue( 4, 1, 0 );
+  myNodeCoords->SetValue( 4, 2, 0 );
+  myNodeCoords->SetValue( 4, 3, 10 );
+
+  myNodeCoords->SetValue( 5, 1, -10 );
+  myNodeCoords->SetValue( 5, 2, 0 );
+  myNodeCoords->SetValue( 5, 3, 10 );
+
+  myNodeCoords->SetValue( 6, 1, -10 );
+  myNodeCoords->SetValue( 6, 2, 10 );
+  myNodeCoords->SetValue( 6, 3, 10 );
+
+  myNodeCoords->SetValue( 7, 1, -10 );
+  myNodeCoords->SetValue( 7, 2, 10 );
+  myNodeCoords->SetValue( 7, 3, 0 );
+
+  myNodeCoords->SetValue( 8, 1, -10 );
+  myNodeCoords->SetValue( 8, 2, 0 );
+  myNodeCoords->SetValue( 8, 3, 0 );
+
+  myNodeCoords->SetValue( 9, 1, 0 );
+  myNodeCoords->SetValue( 9, 2, 0 );
+  myNodeCoords->SetValue( 9, 3, 0 );
+
+  myNodeCoords->SetValue( 10, 1, 0 );
+  myNodeCoords->SetValue( 10, 2, 10 );
+  myNodeCoords->SetValue( 10, 3, 0 );
+
+  myNodeCoords->SetValue( 11, 1, 0 );
+  myNodeCoords->SetValue( 11, 2, -10 );
+  myNodeCoords->SetValue( 11, 3, 10 );
+
+  myNodeCoords->SetValue( 12, 1, 10 );
+  myNodeCoords->SetValue( 12, 2, -10 );
+  myNodeCoords->SetValue( 12, 3, 10 );
+
+  myNodeCoords->SetValue( 13, 1, 10 );
+  myNodeCoords->SetValue( 13, 2, -10 );
+  myNodeCoords->SetValue( 13, 3, 0 );
+
+  myNodeCoords->SetValue( 14, 1, 0 );
+  myNodeCoords->SetValue( 14, 2, -10 );
+  myNodeCoords->SetValue( 14, 3, 0 );
+
+  myNodeCoords->SetValue( 15, 1, 10 );
+  myNodeCoords->SetValue( 15, 2, 0 );
+  myNodeCoords->SetValue( 15, 3, 0 );
+
+  myNodeCoords->SetValue( 16, 1, 5 );
+  myNodeCoords->SetValue( 16, 2, 5 );
+  myNodeCoords->SetValue( 16, 3, -10 );
+
+  myElemNbNodes = new TColStd_HArray1OfInteger(1, 5);
+
+  myElemNbNodes->SetValue( 1, 4 );
+  myElemNbNodes->SetValue( 2, 8 );
+  myElemNbNodes->SetValue( 3, 6 );
+  myElemNbNodes->SetValue( 4, 8 );
+  myElemNbNodes->SetValue( 5, 4 );
+
+  myElemNodes = new TColStd_HArray2OfInteger(1, 5, 1, 8);
+
+  myElemNodes->SetValue(1, 1, 1);
+  myElemNodes->SetValue(1, 2, 2);
+  myElemNodes->SetValue(1, 3, 3);
+  myElemNodes->SetValue(1, 4, 4);
+
+  myElemNodes->SetValue(2, 1, 2);
+  myElemNodes->SetValue(2, 2, 4);
+  myElemNodes->SetValue(2, 3, 5);
+  myElemNodes->SetValue(2, 4, 6);
+  myElemNodes->SetValue(2, 5, 7);
+  myElemNodes->SetValue(2, 6, 8);
+  myElemNodes->SetValue(2, 7, 9);
+  myElemNodes->SetValue(2, 8, 10);
+
+  myElemNodes->SetValue(3, 1, 2);
+  myElemNodes->SetValue(3, 2, 3);
+  myElemNodes->SetValue(3, 3, 4);
+  myElemNodes->SetValue(3, 4, 10);
+  myElemNodes->SetValue(3, 5, 15);
+  myElemNodes->SetValue(3, 6, 9);
+
+  myElemNodes->SetValue(4, 1, 4);
+  myElemNodes->SetValue(4, 2, 3);
+  myElemNodes->SetValue(4, 3, 12);
+  myElemNodes->SetValue(4, 4, 11);
+  myElemNodes->SetValue(4, 5, 14);
+  myElemNodes->SetValue(4, 6, 13);
+  myElemNodes->SetValue(4, 7, 15);
+  myElemNodes->SetValue(4, 8, 9);
+
+  myElemNodes->SetValue(5, 1, 16);
+  myElemNodes->SetValue(5, 2, 15);
+  myElemNodes->SetValue(5, 3, 10);
+  myElemNodes->SetValue(5, 4, 9);
+}
+
+//================================================================
+// Function : GetGeom
+// Purpose  :
+//================================================================
+Standard_Boolean XSDRAWSTL_DataSource3D::GetGeom
+( const Standard_Integer theID, const Standard_Boolean theIsElement,
+ TColStd_Array1OfReal& theCoords, Standard_Integer& theNbNodes,
+ MeshVS_EntityType& theType ) const
+{
+  if (theIsElement)
+  {
+    if (theID >= 1 && theID <= myElements.Extent())
+    {
+      theType = MeshVS_ET_Volume;
+      theNbNodes = myElemNbNodes->Value(theID);
+
+      for (Standard_Integer aNodeI = 1, aGlobCoordI = 1; aNodeI <= theNbNodes; aNodeI++)
+      {
+        Standard_Integer anIdxNode = myElemNodes->Value(theID, aNodeI);
+        for(Standard_Integer aCoordI = 1; aCoordI <= 3; aCoordI++, aGlobCoordI++ )
+          theCoords(aGlobCoordI) = myNodeCoords->Value(anIdxNode, aCoordI);
+      }
+
+      return Standard_True;
+    }
+    else
+      return Standard_False;
+  }
+  else
+    if (theID >= 1 && theID <= myNodes.Extent())
+    {
+      theType = MeshVS_ET_Node;
+      theNbNodes = 1;
+
+      theCoords( 1 ) = myNodeCoords->Value(theID, 1);
+      theCoords( 2 ) = myNodeCoords->Value(theID, 2);
+      theCoords( 3 ) = myNodeCoords->Value(theID, 3);
+      return Standard_True;
+    }
+    else
+      return Standard_False;
+}
+
+//================================================================
+// Function : Get3DGeom
+// Purpose  :
+//================================================================
+Standard_Boolean XSDRAWSTL_DataSource3D::Get3DGeom
+( const Standard_Integer theID, Standard_Integer& theNbNodes,
+ Handle(MeshVS_HArray1OfSequenceOfInteger)& theData ) const
+{
+  Handle(MeshVS_HArray1OfSequenceOfInteger) aMeshData;
+  if (theID == 1 || theID == 5)
+  {
+    aMeshData = new MeshVS_HArray1OfSequenceOfInteger(1,4);
+    theNbNodes = 4;
+    for (Standard_Integer anElemI = 1; anElemI <= 4; anElemI++)
+    {
+      aMeshData->ChangeValue(anElemI).Append( (anElemI - 1) % 4 );
+      aMeshData->ChangeValue(anElemI).Append( anElemI % 4 );
+      aMeshData->ChangeValue(anElemI).Append( (anElemI + 1) % 4 );
+    }
+    theData = aMeshData;
+    return Standard_True;
+  }
+
+  if (theID == 2 || theID == 4)
+  {
+    aMeshData = new MeshVS_HArray1OfSequenceOfInteger(1,6);
+    theNbNodes = 8;
+    for (Standard_Integer anElemI = 1, k = 1; anElemI <= 4; anElemI++)
+    {
+      aMeshData->ChangeValue(anElemI).Append( (k - 1) % 8 );
+      aMeshData->ChangeValue(anElemI).Append( k % 8 );
+      aMeshData->ChangeValue(anElemI).Append( (k + 1) % 8 );
+      aMeshData->ChangeValue(anElemI).Append( (k + 2) % 8 );
+      k+=2;
+    }
+
+    aMeshData->ChangeValue(5).Append( 0 );
+    aMeshData->ChangeValue(5).Append( 3 );
+    aMeshData->ChangeValue(5).Append( 4 );
+    aMeshData->ChangeValue(5).Append( 7 );
+
+    aMeshData->ChangeValue(6).Append( 1 );
+    aMeshData->ChangeValue(6).Append( 2 );
+    aMeshData->ChangeValue(6).Append( 5 );
+    aMeshData->ChangeValue(6).Append( 6 );
+
+    theData = aMeshData;
+    return Standard_True;
+  }
+
+  if (theID == 3)
+  {
+    aMeshData = new MeshVS_HArray1OfSequenceOfInteger(1,5);
+    theNbNodes = 6;
+    for (Standard_Integer anElemI = 1; anElemI <= 2; anElemI++)
+    {
+      aMeshData->ChangeValue(anElemI).Append( (anElemI - 1) * 3 );
+      aMeshData->ChangeValue(anElemI).Append( (anElemI - 1) * 3 + 1 );
+      aMeshData->ChangeValue(anElemI).Append( (anElemI - 1) * 3 + 2 );
+    }
+    for (Standard_Integer anElemI = 1; anElemI <= 3; anElemI++)
+    {
+      aMeshData->ChangeValue(2 + anElemI).Append( (anElemI - 1) % 3 );
+      aMeshData->ChangeValue(2 + anElemI).Append( anElemI % 3 );
+      aMeshData->ChangeValue(2 + anElemI).Append( anElemI % 3 + 3 );
+      aMeshData->ChangeValue(2 + anElemI).Append( (anElemI - 1) % 3 + 3 );
+    }
+    theData = aMeshData;
+    return Standard_True;
+  }
+
+  return Standard_False;
+}
+
+//================================================================
+// Function : GetGeomType
+// Purpose  :
+//================================================================
+Standard_Boolean XSDRAWSTL_DataSource3D::GetGeomType
+( const Standard_Integer theID,
+ const Standard_Boolean theIsElement,
+ MeshVS_EntityType& theType ) const
+{
+  if (theIsElement)
+  {
+    if (theID >= 1 && theID <= myElements.Extent())
+    {
+      theType = MeshVS_ET_Volume;
+      return Standard_True;
+    }
+  }
+  else
+    if (theID >= 1 && theID <= myNodes.Extent())
+    {
+      theType = MeshVS_ET_Node;
+      return Standard_True;
+    }
+
+  return Standard_False;
+}
+
+//================================================================
+// Function : GetAddr
+// Purpose  :
+//================================================================
+Standard_Address XSDRAWSTL_DataSource3D::GetAddr
+( const Standard_Integer, const Standard_Boolean ) const
+{
+  return NULL;
+}
+
+//================================================================
+// Function : GetNodesByElement
+// Purpose  :
+//================================================================
+Standard_Boolean XSDRAWSTL_DataSource3D::GetNodesByElement
+( const Standard_Integer theID,
+ TColStd_Array1OfInteger& theNodeIDs,
+ Standard_Integer& theNbNodes ) const
+{
+  Standard_Integer aLow;
+  if (theID == 1 || theID == 5)
+  {
+    theNbNodes = 4;
+    aLow = theNodeIDs.Lower();
+    theNodeIDs (aLow)     = myElemNodes->Value(theID, 1 );
+    theNodeIDs (aLow + 1) = myElemNodes->Value(theID, 2 );
+    theNodeIDs (aLow + 2) = myElemNodes->Value(theID, 3 );
+    theNodeIDs (aLow + 3) = myElemNodes->Value(theID, 4 );
+    return Standard_True;
+  }
+
+  if (theID == 2 || theID == 4)
+  {
+    theNbNodes = 8;
+    aLow = theNodeIDs.Lower();
+    theNodeIDs (aLow)     = myElemNodes->Value(theID, 1 );
+    theNodeIDs (aLow + 1) = myElemNodes->Value(theID, 2 );
+    theNodeIDs (aLow + 2) = myElemNodes->Value(theID, 3 );
+    theNodeIDs (aLow + 3) = myElemNodes->Value(theID, 4 );
+    theNodeIDs (aLow + 4) = myElemNodes->Value(theID, 5 );
+    theNodeIDs (aLow + 5) = myElemNodes->Value(theID, 6 );
+    theNodeIDs (aLow + 6) = myElemNodes->Value(theID, 7 );
+    theNodeIDs (aLow + 7) = myElemNodes->Value(theID, 8 );
+    return Standard_True;
+  }
+
+    if (theID == 3)
+  {
+    theNbNodes = 6;
+    aLow = theNodeIDs.Lower();
+    theNodeIDs (aLow)     = myElemNodes->Value(theID, 1 );
+    theNodeIDs (aLow + 1) = myElemNodes->Value(theID, 2 );
+    theNodeIDs (aLow + 2) = myElemNodes->Value(theID, 3 );
+    theNodeIDs (aLow + 3) = myElemNodes->Value(theID, 4 );
+    theNodeIDs (aLow + 4) = myElemNodes->Value(theID, 5 );
+    theNodeIDs (aLow + 5) = myElemNodes->Value(theID, 6 );
+    return Standard_True;
+  }
+
+  return Standard_False;
+}
+
+//================================================================
+// Function : GetAllNodes
+// Purpose  :
+//================================================================
+const TColStd_PackedMapOfInteger& XSDRAWSTL_DataSource3D::GetAllNodes() const
+{
+  return myNodes;
+}
+
+//================================================================
+// Function : GetAllElements
+// Purpose  :
+//================================================================
+const TColStd_PackedMapOfInteger& XSDRAWSTL_DataSource3D::GetAllElements() const
+{
+  return myElements;
+}
+
+//================================================================
+// Function : GetNormal
+// Purpose  :
+//================================================================
+Standard_Boolean XSDRAWSTL_DataSource3D::GetNormal
+( const Standard_Integer /*theID*/, const Standard_Integer /*theMax*/,
+ Standard_Real& /*theNx*/, Standard_Real& /*theNy*/,Standard_Real& /*theNz*/ ) const
+{
+  return Standard_False;
+}
diff --git a/src/XSDRAWSTL/XSDRAWSTL_DataSource3D.hxx b/src/XSDRAWSTL/XSDRAWSTL_DataSource3D.hxx
new file mode 100644 (file)
index 0000000..d91e604
--- /dev/null
@@ -0,0 +1,104 @@
+// Created on: 2014-08-04
+// Created by: Artem NOVIKOV
+// Copyright (c) 2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XSDRAWSTL_DataSource3D_HeaderFile
+#define _XSDRAWSTL_DataSource3D_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <TColStd_HArray1OfInteger.hxx>
+#include <TColStd_HArray2OfReal.hxx>
+#include <TColStd_HArray2OfInteger.hxx>
+#include <MeshVS_DataSource.hxx>
+#include <Standard_Integer.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <MeshVS_EntityType.hxx>
+#include <MeshVS_HArray1OfSequenceOfInteger.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+
+
+class XSDRAWSTL_DataSource3D;
+DEFINE_STANDARD_HANDLE(XSDRAWSTL_DataSource3D, MeshVS_DataSource)
+
+//! The sample DataSource3D for working with STLMesh_Mesh
+class XSDRAWSTL_DataSource3D : public MeshVS_DataSource
+{
+
+public:
+
+  
+  //! Constructor
+  Standard_EXPORT XSDRAWSTL_DataSource3D();
+  
+  //! Returns geometry information about node (if IsElement is False) or element (IsElement is True) by coordinates.
+  //! For element this method must return all its nodes coordinates in the strict order: X, Y, Z and
+  //! with nodes order is the same as in wire bounding the face or link. NbNodes is number of nodes of element.
+  //! It is recommended to return 1 for node. Type is an element type.
+  Standard_EXPORT Standard_Boolean GetGeom (const Standard_Integer theID, const Standard_Boolean theIsElement, TColStd_Array1OfReal& theCoords, Standard_Integer& theNbNodes, MeshVS_EntityType& theType) const Standard_OVERRIDE;
+  
+  //! This method returns topology information about 3D-element
+  //! Returns false if element with ID isn't 3D or because other troubles
+  Standard_EXPORT virtual Standard_Boolean Get3DGeom (const Standard_Integer theID, Standard_Integer& theNbNodes, Handle(MeshVS_HArray1OfSequenceOfInteger)& theData) const Standard_OVERRIDE;
+  
+  //! This method is similar to GetGeom, but returns only element or node type. This method is provided for
+  //! a fine performance.
+  Standard_EXPORT Standard_Boolean GetGeomType (const Standard_Integer theID, const Standard_Boolean theIsElement, MeshVS_EntityType& theType) const Standard_OVERRIDE;
+  
+  //! This method returns by number an address of any entity which represents element or node data structure.
+  Standard_EXPORT Standard_Address GetAddr (const Standard_Integer theID, const Standard_Boolean theIsElement) const Standard_OVERRIDE;
+  
+  //! This method returns information about what node this element consist of.
+  Standard_EXPORT virtual Standard_Boolean GetNodesByElement (const Standard_Integer theID, TColStd_Array1OfInteger& theNodeIDs, Standard_Integer& theNbNodes) const Standard_OVERRIDE;
+  
+  //! This method returns map of all nodes the object consist of.
+  Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const Standard_OVERRIDE;
+  
+  //! This method returns map of all elements the object consist of.
+  Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const Standard_OVERRIDE;
+  
+  //! This method calculates normal of face, which is using for correct reflection presentation.
+  //! There is default method, for advance reflection this method can be redefined.
+  Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer theID, const Standard_Integer theMax, Standard_Real& theNx, Standard_Real& theNy, Standard_Real& theNz) const Standard_OVERRIDE;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(XSDRAWSTL_DataSource3D,MeshVS_DataSource)
+
+protected:
+
+
+
+
+private:
+
+
+  TColStd_PackedMapOfInteger myNodes;
+  TColStd_PackedMapOfInteger myElements;
+  Handle(TColStd_HArray1OfInteger) myElemNbNodes;
+  Handle(TColStd_HArray2OfReal) myNodeCoords;
+  Handle(TColStd_HArray2OfInteger) myElemNodes;
+
+
+};
+
+
+
+
+
+
+
+#endif // _XSDRAWSTL_DataSource3D_HeaderFile
diff --git a/src/XSDRAWSTL/XSDRAWSTL_DrawableMesh.cxx b/src/XSDRAWSTL/XSDRAWSTL_DrawableMesh.cxx
new file mode 100644 (file)
index 0000000..7681a25
--- /dev/null
@@ -0,0 +1,48 @@
+// Created on: 2004-06-11
+// Created by: Alexander SOLOVYOV
+// Copyright (c) 2004-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <Draw_Display.hxx>
+#include <MeshVS_Mesh.hxx>
+#include <Standard_Type.hxx>
+#include <XSDRAWSTL_DrawableMesh.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XSDRAWSTL_DrawableMesh,Draw_Drawable3D)
+
+//================================================================
+// Function : DrawOn
+// Purpose  :
+//================================================================
+XSDRAWSTL_DrawableMesh::XSDRAWSTL_DrawableMesh( const Handle( MeshVS_Mesh )& aMesh )
+{
+  myMesh = aMesh;
+}
+
+//================================================================
+// Function :
+// Purpose  :
+//================================================================
+void XSDRAWSTL_DrawableMesh::DrawOn(Draw_Display& /*d*/) const
+{
+}
+
+//================================================================
+// Function :
+// Purpose  :
+//================================================================
+Handle( MeshVS_Mesh ) XSDRAWSTL_DrawableMesh::GetMesh() const
+{
+  return myMesh;
+}
diff --git a/src/XSDRAWSTL/XSDRAWSTL_DrawableMesh.hxx b/src/XSDRAWSTL/XSDRAWSTL_DrawableMesh.hxx
new file mode 100644 (file)
index 0000000..1282ad2
--- /dev/null
@@ -0,0 +1,67 @@
+// Created on: 2004-06-11
+// Created by: Alexander SOLOVYOV
+// Copyright (c) 2004-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XSDRAWSTL_DrawableMesh_HeaderFile
+#define _XSDRAWSTL_DrawableMesh_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <Draw_Drawable3D.hxx>
+class MeshVS_Mesh;
+class Draw_Display;
+
+
+class XSDRAWSTL_DrawableMesh;
+DEFINE_STANDARD_HANDLE(XSDRAWSTL_DrawableMesh, Draw_Drawable3D)
+
+
+class XSDRAWSTL_DrawableMesh : public Draw_Drawable3D
+{
+
+public:
+
+  
+  Standard_EXPORT XSDRAWSTL_DrawableMesh(const Handle(MeshVS_Mesh)& aMesh);
+  
+  Standard_EXPORT virtual void DrawOn (Draw_Display& dis) const Standard_OVERRIDE;
+  
+  Standard_EXPORT Handle(MeshVS_Mesh) GetMesh() const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(XSDRAWSTL_DrawableMesh,Draw_Drawable3D)
+
+protected:
+
+
+
+
+private:
+
+
+  Handle(MeshVS_Mesh) myMesh;
+
+
+};
+
+
+
+
+
+
+
+#endif // _XSDRAWSTL_DrawableMesh_HeaderFile
diff --git a/src/XSDRAWSTLVRML/FILES b/src/XSDRAWSTLVRML/FILES
deleted file mode 100644 (file)
index 0541a21..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-XSDRAWSTLVRML.cxx
-XSDRAWSTLVRML.hxx
-XSDRAWSTLVRML_CoordsMap.hxx
-XSDRAWSTLVRML_DataMapIteratorOfCoordsMap.hxx
-XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap.hxx
-XSDRAWSTLVRML_DataSource.cxx
-XSDRAWSTLVRML_DataSource.hxx
-XSDRAWSTLVRML_DataSource3D.cxx
-XSDRAWSTLVRML_DataSource3D.hxx
-XSDRAWSTLVRML_DrawableMesh.cxx
-XSDRAWSTLVRML_DrawableMesh.hxx
-XSDRAWSTLVRML_ElemNodesMap.hxx
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx
deleted file mode 100644 (file)
index 62aaad6..0000000
+++ /dev/null
@@ -1,2583 +0,0 @@
-// Created on: 2000-05-30
-// Created by: Sergey MOZOKHIN
-// Copyright (c) 2000-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <XSDRAWSTLVRML.hxx>
-
-#include <AIS_InteractiveContext.hxx>
-#include <Aspect_TypeOfMarker.hxx>
-#include <Bnd_Box.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepLib_PointCloudShape.hxx>
-#include <DBRep.hxx>
-#include <DDocStd.hxx>
-#include <DDocStd_DrawDocument.hxx>
-#include <Draw.hxx>
-#include <Draw_Interpretor.hxx>
-#include <Draw_PluginMacro.hxx>
-#include <Draw_ProgressIndicator.hxx>
-#include <Graphic3d_MaterialAspect.hxx>
-#include <MeshVS_DataMapOfIntegerAsciiString.hxx>
-#include <MeshVS_DeformedDataSource.hxx>
-#include <MeshVS_Drawer.hxx>
-#include <MeshVS_DrawerAttribute.hxx>
-#include <MeshVS_ElementalColorPrsBuilder.hxx>
-#include <MeshVS_Mesh.hxx>
-#include <MeshVS_MeshEntityOwner.hxx>
-#include <MeshVS_MeshPrsBuilder.hxx>
-#include <MeshVS_NodalColorPrsBuilder.hxx>
-#include <MeshVS_PrsBuilder.hxx>
-#include <MeshVS_TextPrsBuilder.hxx>
-#include <MeshVS_VectorPrsBuilder.hxx>
-#include <OSD_Path.hxx>
-#include <Quantity_Color.hxx>
-#include <Quantity_HArray1OfColor.hxx>
-#include <Quantity_NameOfColor.hxx>
-#include <RWGltf_DracoParameters.hxx>
-#include <RWGltf_CafReader.hxx>
-#include <RWGltf_CafWriter.hxx>
-#include <RWMesh_FaceIterator.hxx>
-#include <RWStl.hxx>
-#include <RWObj.hxx>
-#include <RWObj_CafReader.hxx>
-#include <RWObj_CafWriter.hxx>
-#include <RWPly_CafWriter.hxx>
-#include <RWPly_PlyWriterContext.hxx>
-#include <SelectMgr_SelectionManager.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <StdSelect_ViewerSelector3d.hxx>
-#include <StlAPI.hxx>
-#include <StlAPI_Writer.hxx>
-#include <TColgp_SequenceOfXYZ.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <TColStd_HPackedMapOfInteger.hxx>
-#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
-#include <TDataStd_Name.hxx>
-#include <TDocStd_Application.hxx>
-#include <TDocStd_Document.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Shape.hxx>
-#include <UnitsAPI.hxx>
-#include <UnitsMethods.hxx>
-#include <V3d_View.hxx>
-#include <ViewerTest.hxx>
-#include <VrmlAPI.hxx>
-#include <VrmlAPI_Writer.hxx>
-#include <VrmlData_DataMapOfShapeAppearance.hxx>
-#include <VrmlData_Scene.hxx>
-#include <VrmlData_ShapeConvert.hxx>
-#include <XCAFDoc_DocumentTool.hxx>
-#include <XCAFDoc_ShapeTool.hxx>
-#include <XCAFPrs_DocumentExplorer.hxx>
-#include <XSAlgo.hxx>
-#include <XSAlgo_AlgoContainer.hxx>
-#include <XSDRAW.hxx>
-#include <XSDRAWIGES.hxx>
-#include <XSDRAWSTEP.hxx>
-#include <XSDRAWSTLVRML_DataSource.hxx>
-#include <XSDRAWSTLVRML_DataSource3D.hxx>
-#include <XSDRAWSTLVRML_DrawableMesh.hxx>
-
-#ifndef _STDIO_H
-#include <stdio.h>
-#endif
-
-extern Standard_Boolean VDisplayAISObject (const TCollection_AsciiString& theName,
-                                           const Handle(AIS_InteractiveObject)& theAISObj,
-                                           Standard_Boolean theReplaceIfExists = Standard_True);
-
-//! Parse RWMesh_NameFormat enumeration.
-static bool parseNameFormat (const char* theArg,
-                             RWMesh_NameFormat& theFormat)
-{
-  TCollection_AsciiString aName (theArg);
-  aName.LowerCase();
-  if (aName == "empty")
-  {
-    theFormat = RWMesh_NameFormat_Empty;
-  }
-  else if (aName == "product"
-        || aName == "prod")
-  {
-    theFormat = RWMesh_NameFormat_Product;
-  }
-  else if (aName == "instance"
-        || aName == "inst")
-  {
-    theFormat = RWMesh_NameFormat_Instance;
-  }
-  else if (aName == "instanceorproduct"
-        || aName == "instance||product"
-        || aName == "instance|product"
-        || aName == "instorprod"
-        || aName == "inst||prod"
-        || aName == "inst|prod")
-  {
-    theFormat = RWMesh_NameFormat_InstanceOrProduct;
-  }
-  else if (aName == "productorinstance"
-        || aName == "product||instance"
-        || aName == "product|instance"
-        || aName == "prodorinst"
-        || aName == "prod||inst"
-        || aName == "prod|inst")
-  {
-    theFormat = RWMesh_NameFormat_ProductOrInstance;
-  }
-  else if (aName == "productandinstance"
-        || aName == "prodandinst"
-        || aName == "product&instance"
-        || aName == "prod&inst")
-  {
-    theFormat = RWMesh_NameFormat_ProductAndInstance;
-  }
-  else if (aName == "productandinstanceandocaf"
-        || aName == "verbose"
-        || aName == "debug")
-  {
-    theFormat = RWMesh_NameFormat_ProductAndInstanceAndOcaf;
-  }
-  else
-  {
-    return false;
-  }
-  return true;
-}
-
-//! Parse RWMesh_CoordinateSystem enumeration.
-static bool parseCoordinateSystem (const char* theArg,
-                                   RWMesh_CoordinateSystem& theSystem)
-{
-  TCollection_AsciiString aCSStr (theArg);
-  aCSStr.LowerCase();
-  if (aCSStr == "zup")
-  {
-    theSystem = RWMesh_CoordinateSystem_Zup;
-  }
-  else if (aCSStr == "yup")
-  {
-    theSystem = RWMesh_CoordinateSystem_Yup;
-  }
-  else
-  {
-    return Standard_False;
-  }
-  return Standard_True;
-}
-
-//=============================================================================
-//function : ReadGltf
-//purpose  : Reads glTF file
-//=============================================================================
-static Standard_Integer ReadGltf (Draw_Interpretor& theDI,
-                                  Standard_Integer theNbArgs,
-                                  const char** theArgVec)
-{
-  TCollection_AsciiString aDestName, aFilePath;
-  Standard_Boolean toUseExistingDoc = Standard_False;
-  Standard_Boolean toListExternalFiles = Standard_False;
-  Standard_Boolean isParallel = Standard_False;
-  Standard_Boolean isDoublePrec = Standard_False;
-  Standard_Boolean toSkipLateDataLoading = Standard_False;
-  Standard_Boolean toKeepLateData = Standard_True;
-  Standard_Boolean toPrintDebugInfo = Standard_False;
-  Standard_Boolean toLoadAllScenes = Standard_False;
-  Standard_Boolean toPrintAssetInfo = Standard_False;
-  Standard_Boolean isNoDoc = (TCollection_AsciiString(theArgVec[0]) == "readgltf");
-  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
-  {
-    TCollection_AsciiString anArgCase (theArgVec[anArgIter]);
-    anArgCase.LowerCase();
-    if (!isNoDoc
-     && (anArgCase == "-nocreate"
-      || anArgCase == "-nocreatedoc"))
-    {
-      toUseExistingDoc = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArgCase == "-parallel")
-    {
-      isParallel = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArgCase == "-doubleprec"
-          || anArgCase == "-doubleprecision"
-          || anArgCase == "-singleprec"
-          || anArgCase == "-singleprecision")
-    {
-      isDoublePrec = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
-      if (anArgCase.StartsWith ("-single"))
-      {
-        isDoublePrec = !isDoublePrec;
-      }
-    }
-    else if (anArgCase == "-skiplateloading")
-    {
-      toSkipLateDataLoading = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArgCase == "-keeplate")
-    {
-      toKeepLateData = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArgCase == "-allscenes")
-    {
-      toLoadAllScenes = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArgCase == "-toprintinfo"
-          || anArgCase == "-toprintdebuginfo")
-    {
-      toPrintDebugInfo = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArgCase == "-listexternalfiles"
-          || anArgCase == "-listexternals"
-          || anArgCase == "-listexternal"
-          || anArgCase == "-external"
-          || anArgCase == "-externalfiles")
-    {
-      toListExternalFiles = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArgCase == "-assetinfo"
-          || anArgCase == "-metadata")
-    {
-      toPrintAssetInfo = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if (aDestName.IsEmpty())
-    {
-      aDestName = theArgVec[anArgIter];
-    }
-    else if (aFilePath.IsEmpty())
-    {
-      aFilePath = theArgVec[anArgIter];
-    }
-    else
-    {
-      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
-      return 1;
-    }
-  }
-  if (aFilePath.IsEmpty() && !aDestName.IsEmpty())
-  {
-    if (toListExternalFiles || toPrintAssetInfo)
-    {
-      std::swap (aFilePath, aDestName);
-    }
-  }
-  if (aFilePath.IsEmpty())
-  {
-    Message::SendFail() << "Syntax error: wrong number of arguments";
-    return 1;
-  }
-
-  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
-  Handle(TDocStd_Document) aDoc;
-  if (!aDestName.IsEmpty()
-   && !isNoDoc)
-  {
-    Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
-    Standard_CString aNameVar = aDestName.ToCString();
-    DDocStd::GetDocument (aNameVar, aDoc, Standard_False);
-    if (aDoc.IsNull())
-    {
-      if (toUseExistingDoc)
-      {
-        Message::SendFail() << "Error: document with name " << aDestName << " does not exist";
-        return 1;
-      }
-      anApp->NewDocument (TCollection_ExtendedString ("BinXCAF"), aDoc);
-    }
-    else if (!toUseExistingDoc)
-    {
-      Message::SendFail() << "Error: document with name " << aDestName << " already exists";
-      return 1;
-    }
-  }
-
-  Standard_Real aScaleFactorM = 1.;
-  if (!XCAFDoc_DocumentTool::GetLengthUnit(aDoc, aScaleFactorM, UnitsMethods_LengthUnit_Meter))
-  {
-    XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
-    aScaleFactorM = UnitsMethods::GetCasCadeLengthUnit(UnitsMethods_LengthUnit_Meter);
-  }
-
-  RWGltf_CafReader aReader;
-  aReader.SetSystemLengthUnit (aScaleFactorM);
-  aReader.SetSystemCoordinateSystem (RWMesh_CoordinateSystem_Zup);
-  aReader.SetDocument (aDoc);
-  aReader.SetParallel (isParallel);
-  aReader.SetDoublePrecision (isDoublePrec);
-  aReader.SetToSkipLateDataLoading (toSkipLateDataLoading);
-  aReader.SetToKeepLateData (toKeepLateData);
-  aReader.SetToPrintDebugMessages (toPrintDebugInfo);
-  aReader.SetLoadAllScenes (toLoadAllScenes);
-  if (aDestName.IsEmpty())
-  {
-    aReader.ProbeHeader (aFilePath);
-  }
-  else
-  {
-    aReader.Perform (aFilePath, aProgress->Start());
-    if (isNoDoc)
-    {
-      DBRep::Set (aDestName.ToCString(), aReader.SingleShape());
-    }
-    else
-    {
-      Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument (aDoc);
-      TDataStd_Name::Set (aDoc->GetData()->Root(), aDestName);
-      Draw::Set (aDestName.ToCString(), aDrawDoc);
-    }
-  }
-
-  bool isFirstLine = true;
-  if (toPrintAssetInfo)
-  {
-    for (TColStd_IndexedDataMapOfStringString::Iterator aKeyIter (aReader.Metadata()); aKeyIter.More(); aKeyIter.Next())
-    {
-      if (!isFirstLine)
-      {
-        theDI << "\n";
-      }
-      isFirstLine = false;
-      theDI << aKeyIter.Key() << ": " << aKeyIter.Value();
-    }
-  }
-  if (toListExternalFiles)
-  {
-    if (!isFirstLine)
-    {
-      theDI << "\n";
-    }
-    for (NCollection_IndexedMap<TCollection_AsciiString>::Iterator aFileIter (aReader.ExternalFiles()); aFileIter.More(); aFileIter.Next())
-    {
-      theDI << "\"" << aFileIter.Value() << "\" ";
-    }
-  }
-
-  return 0;
-}
-
-//=============================================================================
-//function : WriteGltf
-//purpose  : Writes glTF file
-//=============================================================================
-static Standard_Integer WriteGltf (Draw_Interpretor& theDI,
-                                   Standard_Integer theNbArgs,
-                                   const char** theArgVec)
-{
-  TCollection_AsciiString aGltfFilePath;
-  Handle(TDocStd_Document) aDoc;
-  Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
-  TColStd_IndexedDataMapOfStringString aFileInfo;
-  RWGltf_WriterTrsfFormat aTrsfFormat = RWGltf_WriterTrsfFormat_Compact;
-  RWMesh_CoordinateSystem aSystemCoordSys = RWMesh_CoordinateSystem_Zup;
-  bool toForceUVExport = false, toEmbedTexturesInGlb = true;
-  bool toMergeFaces = false, toSplitIndices16 = false;
-  bool isParallel = false;
-  RWMesh_NameFormat aNodeNameFormat = RWMesh_NameFormat_InstanceOrProduct;
-  RWMesh_NameFormat aMeshNameFormat = RWMesh_NameFormat_Product;
-  RWGltf_DracoParameters aDracoParameters;
-  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
-  {
-    TCollection_AsciiString anArgCase (theArgVec[anArgIter]);
-    anArgCase.LowerCase();
-    if (anArgCase == "-comments"
-     && anArgIter + 1 < theNbArgs)
-    {
-      aFileInfo.Add ("Comments", theArgVec[++anArgIter]);
-    }
-    else if (anArgCase == "-author"
-          && anArgIter + 1 < theNbArgs)
-    {
-      aFileInfo.Add ("Author", theArgVec[++anArgIter]);
-    }
-    else if (anArgCase == "-forceuvexport"
-          || anArgCase == "-forceuv")
-    {
-      toForceUVExport = true;
-      if (anArgIter + 1 < theNbArgs
-       && Draw::ParseOnOff (theArgVec[anArgIter + 1], toForceUVExport))
-      {
-        ++anArgIter;
-      }
-    }
-    else if (anArgCase == "-mergefaces")
-    {
-      toMergeFaces = true;
-      if (anArgIter + 1 < theNbArgs
-       && Draw::ParseOnOff (theArgVec[anArgIter + 1], toMergeFaces))
-      {
-        ++anArgIter;
-      }
-    }
-    else if (anArgCase == "-splitindices16"
-          || anArgCase == "-splitindexes16"
-          || anArgCase == "-splitindices"
-          || anArgCase == "-splitindexes"
-          || anArgCase == "-splitind")
-    {
-      toSplitIndices16 = true;
-      if (anArgIter + 1 < theNbArgs
-       && Draw::ParseOnOff (theArgVec[anArgIter + 1], toSplitIndices16))
-      {
-        ++anArgIter;
-      }
-    }
-    else if (anArgIter + 1 < theNbArgs
-          && (anArgCase == "-systemcoordinatesystem"
-           || anArgCase == "-systemcoordsystem"
-           || anArgCase == "-systemcoordsys"
-           || anArgCase == "-syscoordsys"))
-    {
-      if (!parseCoordinateSystem (theArgVec[++anArgIter], aSystemCoordSys))
-      {
-        Message::SendFail() << "Syntax error: unknown coordinate system '" << theArgVec[anArgIter] << "'";
-        return 1;
-      }
-    }
-    else if (anArgCase == "-trsfformat"
-          && anArgIter + 1 < theNbArgs)
-    {
-      TCollection_AsciiString aTrsfStr (theArgVec[++anArgIter]);
-      aTrsfStr.LowerCase();
-      if (aTrsfStr == "compact")
-      {
-        aTrsfFormat = RWGltf_WriterTrsfFormat_Compact;
-      }
-      else if (aTrsfStr == "mat4")
-      {
-        aTrsfFormat = RWGltf_WriterTrsfFormat_Mat4;
-      }
-      else if (aTrsfStr == "trs")
-      {
-        aTrsfFormat = RWGltf_WriterTrsfFormat_TRS;
-      }
-      else
-      {
-        Message::SendFail() << "Syntax error at '" << anArgCase << "'";
-        return 1;
-      }
-    }
-    else if (anArgCase == "-nodenameformat"
-          || anArgCase == "-nodename")
-    {
-      ++anArgIter;
-      if (anArgIter >= theNbArgs
-      || !parseNameFormat (theArgVec[anArgIter], aNodeNameFormat))
-      {
-        Message::SendFail() << "Syntax error at '" << anArgCase << "'";
-        return 1;
-      }
-    }
-    else if (anArgCase == "-meshnameformat"
-          || anArgCase == "-meshname")
-    {
-      ++anArgIter;
-      if (anArgIter >= theNbArgs
-      || !parseNameFormat (theArgVec[anArgIter], aMeshNameFormat))
-      {
-        Message::SendFail() << "Syntax error at '" << anArgCase << "'";
-        return 1;
-      }
-    }
-    else if (aDoc.IsNull())
-    {
-      Standard_CString aNameVar = theArgVec[anArgIter];
-      DDocStd::GetDocument (aNameVar, aDoc, false);
-      if (aDoc.IsNull())
-      {
-        TopoDS_Shape aShape = DBRep::Get (aNameVar);
-        if (aShape.IsNull())
-        {
-          Message::SendFail() << "Syntax error: '" << aNameVar << "' is not a shape nor document";
-          return 1;
-        }
-
-        anApp->NewDocument (TCollection_ExtendedString ("BinXCAF"), aDoc);
-        Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
-        // auto-naming doesn't generate meaningful instance names
-        //aShapeTool->SetAutoNaming (false);
-        aNodeNameFormat = RWMesh_NameFormat_Product;
-        aShapeTool->AddShape (aShape);
-      }
-    }
-    else if (aGltfFilePath.IsEmpty())
-    {
-      aGltfFilePath = theArgVec[anArgIter];
-    }
-    else if (anArgCase == "-texturesSeparate")
-    {
-      toEmbedTexturesInGlb = false;
-    }
-    else if (anArgCase == "-draco")
-    {
-      aDracoParameters.DracoCompression = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArgCase == "-compressionlevel" && (anArgIter + 1) < theNbArgs
-             && Draw::ParseInteger(theArgVec[anArgIter + 1], aDracoParameters.CompressionLevel))
-    {
-      ++anArgIter;
-    }
-    else if (anArgCase == "-quantizepositionbits" && (anArgIter + 1) < theNbArgs
-             && Draw::ParseInteger(theArgVec[anArgIter + 1], aDracoParameters.QuantizePositionBits))
-    {
-      ++anArgIter;
-    }
-    else if (anArgCase == "-quantizenormalbits" && (anArgIter + 1) < theNbArgs
-             && Draw::ParseInteger(theArgVec[anArgIter + 1], aDracoParameters.QuantizeNormalBits))
-    {
-      ++anArgIter;
-    }
-    else if (anArgCase == "-quantizetexcoordbits" && (anArgIter + 1) < theNbArgs
-             && Draw::ParseInteger(theArgVec[anArgIter + 1], aDracoParameters.QuantizeTexcoordBits))
-    {
-      ++anArgIter;
-    }
-    else if (anArgCase == "-quantizecolorbits" && (anArgIter + 1) < theNbArgs
-             && Draw::ParseInteger(theArgVec[anArgIter + 1], aDracoParameters.QuantizeColorBits))
-    {
-      ++anArgIter;
-    }
-    else if (anArgCase == "-quantizegenericbits" && (anArgIter + 1) < theNbArgs
-             && Draw::ParseInteger(theArgVec[anArgIter + 1], aDracoParameters.QuantizeGenericBits))
-    {
-      ++anArgIter;
-    }
-    else if (anArgCase == "-unifiedquantization")
-    {
-      aDracoParameters.UnifiedQuantization = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArgCase == "-parallel")
-    {
-      isParallel = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
-    }
-    else
-    {
-      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
-      return 1;
-    }
-  }
-  if (aGltfFilePath.IsEmpty())
-  {
-    Message::SendFail() << "Syntax error: wrong number of arguments";
-    return 1;
-  }
-
-  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
-
-  TCollection_AsciiString anExt = aGltfFilePath;
-  anExt.LowerCase();
-  Standard_Real aScaleFactorM = 1.;
-  if (!XCAFDoc_DocumentTool::GetLengthUnit(aDoc, aScaleFactorM, UnitsMethods_LengthUnit_Meter))
-  {
-    XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
-    aScaleFactorM = UnitsMethods::GetCasCadeLengthUnit(UnitsMethods_LengthUnit_Meter);
-  }
-
-  RWGltf_CafWriter aWriter (aGltfFilePath, anExt.EndsWith (".glb"));
-  aWriter.SetTransformationFormat (aTrsfFormat);
-  aWriter.SetNodeNameFormat (aNodeNameFormat);
-  aWriter.SetMeshNameFormat (aMeshNameFormat);
-  aWriter.SetForcedUVExport (toForceUVExport);
-  aWriter.SetToEmbedTexturesInGlb (toEmbedTexturesInGlb);
-  aWriter.SetMergeFaces (toMergeFaces);
-  aWriter.SetSplitIndices16 (toSplitIndices16);
-  aWriter.SetParallel(isParallel);
-  aWriter.SetCompressionParameters(aDracoParameters);
-  aWriter.ChangeCoordinateSystemConverter().SetInputLengthUnit (aScaleFactorM);
-  aWriter.ChangeCoordinateSystemConverter().SetInputCoordinateSystem (aSystemCoordSys);
-  aWriter.Perform (aDoc, aFileInfo, aProgress->Start());
-  return 0;
-}
-
-static Standard_Integer writestl
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-  if (argc < 3 || argc > 4) {
-    di << "Use: " << argv[0]
-    << " shape file [ascii/binary (0/1) : 1 by default]\n";
-  } else {
-    TopoDS_Shape aShape = DBRep::Get(argv[1]);
-    Standard_Boolean isASCIIMode = Standard_False;
-    if (argc == 4) {
-      isASCIIMode = (Draw::Atoi(argv[3]) == 0);
-    }
-    StlAPI_Writer aWriter;
-    aWriter.ASCIIMode() = isASCIIMode;
-    Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
-    Standard_Boolean isOK = aWriter.Write (aShape, argv[2], aProgress->Start());
-    if (!isOK)
-       di << "** Error **: Mesh writing has been failed.\n";
-  }
-  return 0;
-}
-
-//=============================================================================
-//function : readstl
-//purpose  : Reads stl file
-//=============================================================================
-static Standard_Integer readstl(Draw_Interpretor& theDI,
-                                Standard_Integer theArgc,
-                                const char** theArgv)
-{
-  TCollection_AsciiString aShapeName, aFilePath;
-  bool toCreateCompOfTris = false;
-  bool anIsMulti = false;
-  double aMergeAngle = M_PI / 2.0;
-  for (Standard_Integer anArgIter = 1; anArgIter < theArgc; ++anArgIter)
-  {
-    TCollection_AsciiString anArg (theArgv[anArgIter]);
-    anArg.LowerCase();
-    if (aShapeName.IsEmpty())
-    {
-      aShapeName = theArgv[anArgIter];
-    }
-    else if (aFilePath.IsEmpty())
-    {
-      aFilePath = theArgv[anArgIter];
-    }
-    else if (anArg == "-brep")
-    {
-      toCreateCompOfTris = true;
-      if (anArgIter + 1 < theArgc
-       && Draw::ParseOnOff (theArgv[anArgIter + 1], toCreateCompOfTris))
-      {
-        ++anArgIter;
-      }
-    }
-    else if (anArg == "-multi")
-    {
-      anIsMulti = true;
-      if (anArgIter + 1 < theArgc
-       && Draw::ParseOnOff (theArgv[anArgIter + 1], anIsMulti))
-      {
-        ++anArgIter;
-      }
-    }
-    else if (anArg == "-mergeangle"
-          || anArg == "-smoothangle"
-          || anArg == "-nomergeangle"
-          || anArg == "-nosmoothangle")
-    {
-      if (anArg.StartsWith ("-no"))
-      {
-        aMergeAngle = M_PI / 2.0;
-      }
-      else
-      {
-        aMergeAngle = M_PI / 4.0;
-        if (anArgIter + 1 < theArgc
-         && Draw::ParseReal (theArgv[anArgIter + 1], aMergeAngle))
-        {
-          if (aMergeAngle < 0.0 || aMergeAngle > 90.0)
-          {
-            theDI << "Syntax error: angle should be within [0,90] range";
-            return 1;
-          }
-
-          ++anArgIter;
-          aMergeAngle = aMergeAngle * M_PI / 180.0;
-        }
-      }
-    }
-    else
-    {
-      Message::SendFail() << "Syntax error: unknown argument '" << theArgv[anArgIter] << "'";
-      return 1;
-    }
-  }
-  if (aFilePath.IsEmpty())
-  {
-    Message::SendFail() << "Syntax error: not enough arguments";
-    return 1;
-  }
-
-  TopoDS_Shape aShape;
-  if (!toCreateCompOfTris)
-  {
-    Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI,1);
-    if(anIsMulti)
-    {
-      NCollection_Sequence<Handle(Poly_Triangulation)> aTriangList;
-      // Read STL file to the triangulation list.
-      RWStl::ReadFile(aFilePath.ToCString(),aMergeAngle,aTriangList,aProgress->Start());
-      BRep_Builder aB;
-      TopoDS_Face aFace;
-      if (aTriangList.Size() == 1)
-      {
-        aB.MakeFace (aFace);
-        aB.UpdateFace (aFace,aTriangList.First());
-        aShape = aFace;
-      }
-      else
-      {
-        TopoDS_Compound aCmp;
-        aB.MakeCompound (aCmp);
-      
-        NCollection_Sequence<Handle(Poly_Triangulation)>::Iterator anIt (aTriangList);
-        for (; anIt.More(); anIt.Next())
-        { 
-          aB.MakeFace (aFace);
-          aB.UpdateFace (aFace,anIt.Value());
-          aB.Add (aCmp,aFace);
-        }
-        aShape = aCmp;
-      }
-    }
-    else
-    {
-      // Read STL file to the triangulation.
-      Handle(Poly_Triangulation) aTriangulation = RWStl::ReadFile (aFilePath.ToCString(),aMergeAngle,aProgress->Start());
-
-      TopoDS_Face aFace;
-      BRep_Builder aB;
-      aB.MakeFace (aFace);
-      aB.UpdateFace (aFace,aTriangulation);
-      aShape = aFace;
-    }
-  }
-  else
-  {
-    Standard_DISABLE_DEPRECATION_WARNINGS
-    StlAPI::Read(aShape, aFilePath.ToCString());
-    Standard_ENABLE_DEPRECATION_WARNINGS
-  }
-  DBRep::Set (aShapeName.ToCString(), aShape);
-  return 0;
-}
-
-//=============================================================================
-//function : ReadObj
-//purpose  : Reads OBJ file
-//=============================================================================
-static Standard_Integer ReadObj (Draw_Interpretor& theDI,
-                                 Standard_Integer theNbArgs,
-                                 const char** theArgVec)
-{
-  TCollection_AsciiString aDestName, aFilePath;
-  Standard_Boolean toUseExistingDoc = Standard_False;
-  Standard_Real aFileUnitFactor = -1.0;
-  RWMesh_CoordinateSystem aResultCoordSys = RWMesh_CoordinateSystem_Zup, aFileCoordSys = RWMesh_CoordinateSystem_Yup;
-  Standard_Boolean toListExternalFiles = Standard_False, isSingleFace = Standard_False, isSinglePrecision = Standard_False;
-  Standard_Boolean isNoDoc = (TCollection_AsciiString(theArgVec[0]) == "readobj");
-  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
-  {
-    TCollection_AsciiString anArgCase (theArgVec[anArgIter]);
-    anArgCase.LowerCase();
-    if (anArgIter + 1 < theNbArgs
-     && (anArgCase == "-unit"
-      || anArgCase == "-units"
-      || anArgCase == "-fileunit"
-      || anArgCase == "-fileunits"))
-    {
-      const TCollection_AsciiString aUnitStr (theArgVec[++anArgIter]);
-      aFileUnitFactor = UnitsAPI::AnyToSI (1.0, aUnitStr.ToCString());
-      if (aFileUnitFactor <= 0.0)
-      {
-        Message::SendFail() << "Syntax error: wrong length unit '" << aUnitStr << "'";
-        return 1;
-      }
-    }
-    else if (anArgIter + 1 < theNbArgs
-          && (anArgCase == "-filecoordinatesystem"
-           || anArgCase == "-filecoordsystem"
-           || anArgCase == "-filecoordsys"))
-    {
-      if (!parseCoordinateSystem (theArgVec[++anArgIter], aFileCoordSys))
-      {
-        Message::SendFail() << "Syntax error: unknown coordinate system '" << theArgVec[anArgIter] << "'";
-        return 1;
-      }
-    }
-    else if (anArgIter + 1 < theNbArgs
-          && (anArgCase == "-resultcoordinatesystem"
-           || anArgCase == "-resultcoordsystem"
-           || anArgCase == "-resultcoordsys"
-           || anArgCase == "-rescoordsys"))
-    {
-      if (!parseCoordinateSystem (theArgVec[++anArgIter], aResultCoordSys))
-      {
-        Message::SendFail() << "Syntax error: unknown coordinate system '" << theArgVec[anArgIter] << "'";
-        return 1;
-      }
-    }
-    else if (anArgCase == "-singleprecision"
-          || anArgCase == "-singleprec")
-    {
-      isSinglePrecision = Standard_True;
-      if (anArgIter + 1 < theNbArgs
-       && Draw::ParseOnOff (theArgVec[anArgIter + 1], isSinglePrecision))
-      {
-        ++anArgIter;
-      }
-    }
-    else if (isNoDoc
-          && (anArgCase == "-singleface"
-           || anArgCase == "-singletriangulation"))
-    {
-      isSingleFace = Standard_True;
-    }
-    else if (!isNoDoc
-          && (anArgCase == "-nocreate"
-           || anArgCase == "-nocreatedoc"))
-    {
-      toUseExistingDoc = Standard_True;
-      if (anArgIter + 1 < theNbArgs
-       && Draw::ParseOnOff (theArgVec[anArgIter + 1], toUseExistingDoc))
-      {
-        ++anArgIter;
-      }
-    }
-    else if (anArgCase == "-listexternalfiles"
-          || anArgCase == "-listexternals"
-          || anArgCase == "-listexternal"
-          || anArgCase == "-external"
-          || anArgCase == "-externalfiles")
-    {
-      toListExternalFiles = Standard_True;
-    }
-    else if (aDestName.IsEmpty())
-    {
-      aDestName = theArgVec[anArgIter];
-    }
-    else if (aFilePath.IsEmpty())
-    {
-      aFilePath = theArgVec[anArgIter];
-    }
-    else
-    {
-      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
-      return 1;
-    }
-  }
-  if (aFilePath.IsEmpty())
-  {
-    Message::SendFail() << "Syntax error: wrong number of arguments";
-    return 1;
-  }
-
-  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
-  Handle(TDocStd_Document) aDoc;
-  if (!isNoDoc
-   && !toListExternalFiles)
-  {
-    Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
-    Standard_CString aNameVar = aDestName.ToCString();
-    DDocStd::GetDocument (aNameVar, aDoc, Standard_False);
-    if (aDoc.IsNull())
-    {
-      if (toUseExistingDoc)
-      {
-        Message::SendFail() << "Error: document with name " << aDestName << " does not exist";
-        return 1;
-      }
-      anApp->NewDocument (TCollection_ExtendedString ("BinXCAF"), aDoc);
-    }
-    else if (!toUseExistingDoc)
-    {
-      Message::SendFail() << "Error: document with name " << aDestName << " already exists";
-      return 1;
-    }
-  }
-  Standard_Real aScaleFactorM = 1.;
-  if (!XCAFDoc_DocumentTool::GetLengthUnit(aDoc, aScaleFactorM, UnitsMethods_LengthUnit_Meter))
-  {
-    XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
-    aScaleFactorM = UnitsMethods::GetCasCadeLengthUnit(UnitsMethods_LengthUnit_Meter);
-  }
-
-  RWObj_CafReader aReader;
-  aReader.SetSinglePrecision (isSinglePrecision);
-  aReader.SetSystemLengthUnit (aScaleFactorM);
-  aReader.SetSystemCoordinateSystem (aResultCoordSys);
-  aReader.SetFileLengthUnit (aFileUnitFactor);
-  aReader.SetFileCoordinateSystem (aFileCoordSys);
-  aReader.SetDocument (aDoc);
-  if (isSingleFace)
-  {
-    RWObj_TriangulationReader aSimpleReader;
-    aSimpleReader.SetSinglePrecision (isSinglePrecision);
-    aSimpleReader.SetCreateShapes (Standard_False);
-    aSimpleReader.SetTransformation (aReader.CoordinateSystemConverter());
-    aSimpleReader.Read (aFilePath.ToCString(), aProgress->Start());
-
-    Handle(Poly_Triangulation) aTriangulation = aSimpleReader.GetTriangulation();
-    TopoDS_Face aFace;
-    BRep_Builder aBuiler;
-    aBuiler.MakeFace (aFace);
-    aBuiler.UpdateFace (aFace, aTriangulation);
-    DBRep::Set (aDestName.ToCString(), aFace);
-    return 0;
-  }
-
-  if (toListExternalFiles)
-  {
-    aReader.ProbeHeader (aFilePath);
-    for (NCollection_IndexedMap<TCollection_AsciiString>::Iterator aFileIter (aReader.ExternalFiles()); aFileIter.More(); aFileIter.Next())
-    {
-      theDI << "\"" << aFileIter.Value() << "\" ";
-    }
-  }
-  else
-  {
-    aReader.Perform (aFilePath, aProgress->Start());
-    if (isNoDoc)
-    {
-      DBRep::Set (aDestName.ToCString(), aReader.SingleShape());
-    }
-    else
-    {
-      Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument (aDoc);
-      TDataStd_Name::Set (aDoc->GetData()->Root(), aDestName);
-      Draw::Set (aDestName.ToCString(), aDrawDoc);
-    }
-  }
-  return 0;
-}
-
-//=============================================================================
-//function : WriteObj
-//purpose  : Writes OBJ file
-//=============================================================================
-static Standard_Integer WriteObj (Draw_Interpretor& theDI,
-                                  Standard_Integer theNbArgs,
-                                  const char** theArgVec)
-{
-  TCollection_AsciiString anObjFilePath;
-  Handle(TDocStd_Document) aDoc;
-  Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
-  TColStd_IndexedDataMapOfStringString aFileInfo;
-  Standard_Real aFileUnitFactor = -1.0;
-  RWMesh_CoordinateSystem aSystemCoordSys = RWMesh_CoordinateSystem_Zup, aFileCoordSys = RWMesh_CoordinateSystem_Yup;
-  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
-  {
-    TCollection_AsciiString anArgCase (theArgVec[anArgIter]);
-    anArgCase.LowerCase();
-        if (anArgIter + 1 < theNbArgs
-     && (anArgCase == "-unit"
-      || anArgCase == "-units"
-      || anArgCase == "-fileunit"
-      || anArgCase == "-fileunits"))
-    {
-      const TCollection_AsciiString aUnitStr (theArgVec[++anArgIter]);
-      aFileUnitFactor = UnitsAPI::AnyToSI (1.0, aUnitStr.ToCString());
-      if (aFileUnitFactor <= 0.0)
-      {
-        Message::SendFail() << "Syntax error: wrong length unit '" << aUnitStr << "'";
-        return 1;
-      }
-    }
-    else if (anArgIter + 1 < theNbArgs
-          && (anArgCase == "-filecoordinatesystem"
-           || anArgCase == "-filecoordsystem"
-           || anArgCase == "-filecoordsys"))
-    {
-      if (!parseCoordinateSystem (theArgVec[++anArgIter], aFileCoordSys))
-      {
-        Message::SendFail() << "Syntax error: unknown coordinate system '" << theArgVec[anArgIter] << "'";
-        return 1;
-      }
-    }
-    else if (anArgIter + 1 < theNbArgs
-          && (anArgCase == "-systemcoordinatesystem"
-           || anArgCase == "-systemcoordsystem"
-           || anArgCase == "-systemcoordsys"
-           || anArgCase == "-syscoordsys"))
-    {
-      if (!parseCoordinateSystem (theArgVec[++anArgIter], aSystemCoordSys))
-      {
-        Message::SendFail() << "Syntax error: unknown coordinate system '" << theArgVec[anArgIter] << "'";
-        return 1;
-      }
-    }
-    else if (anArgCase == "-comments"
-          && anArgIter + 1 < theNbArgs)
-    {
-      aFileInfo.Add ("Comments", theArgVec[++anArgIter]);
-    }
-    else if (anArgCase == "-author"
-          && anArgIter + 1 < theNbArgs)
-    {
-      aFileInfo.Add ("Author", theArgVec[++anArgIter]);
-    }
-    else if (aDoc.IsNull())
-    {
-      Standard_CString aNameVar = theArgVec[anArgIter];
-      DDocStd::GetDocument (aNameVar, aDoc, false);
-      if (aDoc.IsNull())
-      {
-        TopoDS_Shape aShape = DBRep::Get (aNameVar);
-        if (aShape.IsNull())
-        {
-          Message::SendFail() << "Syntax error: '" << aNameVar << "' is not a shape nor document";
-          return 1;
-        }
-
-        anApp->NewDocument (TCollection_ExtendedString ("BinXCAF"), aDoc);
-        Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
-        aShapeTool->AddShape (aShape);
-      }
-    }
-    else if (anObjFilePath.IsEmpty())
-    {
-      anObjFilePath = theArgVec[anArgIter];
-    }
-    else
-    {
-      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
-      return 1;
-    }
-  }
-  if (anObjFilePath.IsEmpty())
-  {
-    Message::SendFail() << "Syntax error: wrong number of arguments";
-    return 1;
-  }
-
-  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
-
-  const Standard_Real aSystemUnitFactor = UnitsMethods::GetCasCadeLengthUnit() * 0.001;
-  RWObj_CafWriter aWriter (anObjFilePath);
-  aWriter.ChangeCoordinateSystemConverter().SetInputLengthUnit (aSystemUnitFactor);
-  aWriter.ChangeCoordinateSystemConverter().SetInputCoordinateSystem (aSystemCoordSys);
-  aWriter.ChangeCoordinateSystemConverter().SetOutputLengthUnit (aFileUnitFactor);
-  aWriter.ChangeCoordinateSystemConverter().SetOutputCoordinateSystem (aFileCoordSys);
-  aWriter.Perform (aDoc, aFileInfo, aProgress->Start());
-  return 0;
-}
-
-static Standard_Integer writevrml
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-  if (argc < 3 || argc > 5) 
-  {
-    di << "wrong number of parameters\n";
-    return 0;
-  }
-
-  TopoDS_Shape aShape = DBRep::Get(argv[1]);
-
-  // Get the optional parameters
-  Standard_Integer aVersion = 2;
-  Standard_Integer aType = 1;
-  if (argc >= 4)
-  {
-    aVersion = Draw::Atoi(argv[3]);
-    if (argc == 5)
-      aType = Draw::Atoi(argv[4]);
-  }
-
-  // Bound parameters
-  aVersion = Max(1, aVersion);
-  aVersion = Min(2, aVersion);
-  aType = Max(0, aType);
-  aType = Min(2, aType);
-
-  VrmlAPI_Writer writer;
-
-  switch (aType)
-  {
-  case 0: writer.SetRepresentation(VrmlAPI_ShadedRepresentation); break;
-  case 1: writer.SetRepresentation(VrmlAPI_WireFrameRepresentation); break;
-  case 2: writer.SetRepresentation(VrmlAPI_BothRepresentation); break;
-  }
-
-  if (!writer.Write(aShape, argv[2], aVersion))
-  {
-    di << "Error: File " << argv[2] << " was not written\n";
-  }
-
-  return 0;
-}
-
-//=======================================================================
-//function : loadvrml
-//purpose  :
-//=======================================================================
-
-static Standard_Integer loadvrml
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-  if (argc<3) di << "wrong number of parameters"    << "\n";
-  else {
-    TopoDS_Shape aShape ;
-    VrmlData_DataMapOfShapeAppearance aShapeAppMap;
-
-    //-----------------------------------------------------------
-    std::filebuf aFic;
-    std::istream aStream (&aFic);
-
-    if (aFic.open(argv[2], std::ios::in)) {
-
-      // Get path of the VRML file.
-      OSD_Path aPath(argv[2]);
-      TCollection_AsciiString aVrmlDir(".");
-      TCollection_AsciiString aDisk = aPath.Disk();
-      TCollection_AsciiString aTrek = aPath.Trek();
-      if (!aTrek.IsEmpty())
-      {
-        if (!aDisk.IsEmpty())
-          aVrmlDir = aDisk;
-        else
-          aVrmlDir.Clear();
-        aTrek.ChangeAll('|', '/');
-        aVrmlDir += aTrek;
-      }
-
-      VrmlData_Scene aScene;
-      XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
-      Standard_Real anOCCUnitMM = UnitsMethods::GetCasCadeLengthUnit();
-      aScene.SetLinearScale(1000. / anOCCUnitMM);
-
-      aScene.SetVrmlDir (aVrmlDir);
-      aScene << aStream;
-      const char * aStr = 0L;
-      switch (aScene.Status()) {
-
-      case VrmlData_StatusOK:
-        {
-          aShape = aScene.GetShape(aShapeAppMap);
-          break;
-        }
-      case VrmlData_EmptyData:            aStr = "EmptyData"; break;
-      case VrmlData_UnrecoverableError:   aStr = "UnrecoverableError"; break;
-      case VrmlData_GeneralError:         aStr = "GeneralError"; break;
-      case VrmlData_EndOfFile:            aStr = "EndOfFile"; break;
-      case VrmlData_NotVrmlFile:          aStr = "NotVrmlFile"; break;
-      case VrmlData_CannotOpenFile:       aStr = "CannotOpenFile"; break;
-      case VrmlData_VrmlFormatError:      aStr = "VrmlFormatError"; break;
-      case VrmlData_NumericInputError:    aStr = "NumericInputError"; break;
-      case VrmlData_IrrelevantNumber:     aStr = "IrrelevantNumber"; break;
-      case VrmlData_BooleanInputError:    aStr = "BooleanInputError"; break;
-      case VrmlData_StringInputError:     aStr = "StringInputError"; break;
-      case VrmlData_NodeNameUnknown:      aStr = "NodeNameUnknown"; break;
-      case VrmlData_NonPositiveSize:      aStr = "NonPositiveSize"; break;
-      case VrmlData_ReadUnknownNode:      aStr = "ReadUnknownNode"; break;
-      case VrmlData_NonSupportedFeature:  aStr = "NonSupportedFeature"; break;
-      case VrmlData_OutputStreamUndefined:aStr = "OutputStreamUndefined"; break;
-      case VrmlData_NotImplemented:       aStr = "NotImplemented"; break;
-      default:
-        break;
-      }
-      if (aStr) {
-        di << " ++ VRML Error: " << aStr << " in line "
-          << aScene.GetLineError() << "\n";
-      }
-      else {
-        DBRep::Set(argv[1],aShape);
-      }
-    }
-    else {
-      di << "cannot open file\n";
-    }
-
-
-    //-----------------------------------------------------------
-  }
-  return 0;
-}
-
-//-----------------------------------------------------------------------------
-static Standard_Integer createmesh
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv )
-{
-  if (argc<3)
-  {
-    di << "Wrong number of parameters\n";
-    di << "Use: " << argv[0] << " <mesh name> <stl file>\n";
-    return 0;
-  }
-
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if (aContext.IsNull())
-  {
-    di << "No active view. Please call 'vinit' first\n";
-    return 0;
-  }
-
-  // Progress indicator
-  OSD_Path aFile( argv[2] );
-  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di, 1);
-  Handle(Poly_Triangulation) aSTLMesh = RWStl::ReadFile (aFile, aProgress->Start());
-
-  di << "Reading OK...\n";
-  Handle( XSDRAWSTLVRML_DataSource ) aDS = new XSDRAWSTLVRML_DataSource( aSTLMesh );
-  di << "Data source is created successful\n";
-  Handle( MeshVS_Mesh ) aMesh = new MeshVS_Mesh();
-  di << "MeshVS_Mesh is created successful\n";
-
-  aMesh->SetDataSource( aDS );
-  aMesh->AddBuilder( new MeshVS_MeshPrsBuilder( aMesh.operator->() ), Standard_True );
-
-  aMesh->GetDrawer()->SetColor( MeshVS_DA_EdgeColor, Quantity_NOC_YELLOW );
-
-  // Hide all nodes by default
-  Handle(TColStd_HPackedMapOfInteger) aNodes = new TColStd_HPackedMapOfInteger();
-  const Standard_Integer aLen = aSTLMesh->NbNodes();
-  for ( Standard_Integer anIndex = 1; anIndex <= aLen; anIndex++ )
-    aNodes->ChangeMap().Add( anIndex );
-  aMesh->SetHiddenNodes( aNodes );
-  aMesh->SetSelectableNodes ( aNodes );
-
-  VDisplayAISObject(argv[1], aMesh);
-  aContext->Deactivate( aMesh );
-
-  Draw::Set( argv[1], new XSDRAWSTLVRML_DrawableMesh( aMesh ) );
-  Handle( V3d_View ) aView = ViewerTest::CurrentView();
-  if ( !aView.IsNull() )
-    aView->FitAll();
-
-  return 0;
-}
-//-----------------------------------------------------------------------------
-
-static Standard_Integer create3d
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv )
-{
-  if (argc<2)
-  {
-    di << "Wrong number of parameters\n";
-    di << "Use: " << argv[0] << " <mesh name>\n";
-    return 0;
-  }
-
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if (aContext.IsNull())
-  {
-    di << "No active view. Please call 'vinit' first\n";
-    return 0;
-  }
-
-  Handle( XSDRAWSTLVRML_DataSource3D ) aDS = new XSDRAWSTLVRML_DataSource3D();
-  di << "Data source is created successful\n";
-  Handle( MeshVS_Mesh ) aMesh = new MeshVS_Mesh();
-  di << "MeshVS_Mesh is created successful\n";
-
-  aMesh->SetDataSource( aDS );
-  aMesh->AddBuilder( new MeshVS_MeshPrsBuilder( aMesh.operator->() ), Standard_True );
-
-  aMesh->GetDrawer()->SetColor( MeshVS_DA_EdgeColor, Quantity_NOC_YELLOW );
-
-  // Hide all nodes by default
-  Handle(TColStd_HPackedMapOfInteger) aNodes = new TColStd_HPackedMapOfInteger();
-  Standard_Integer aLen = aDS->GetAllNodes().Extent();
-  for ( Standard_Integer anIndex = 1; anIndex <= aLen; anIndex++ )
-    aNodes->ChangeMap().Add( anIndex );
-  aMesh->SetHiddenNodes( aNodes );
-  aMesh->SetSelectableNodes ( aNodes );
-
-  VDisplayAISObject(argv[1], aMesh);
-  aContext->Deactivate( aMesh );
-
-  Draw::Set( argv[1], new XSDRAWSTLVRML_DrawableMesh( aMesh ) );
-  Handle( V3d_View ) aView = ViewerTest::CurrentView();
-  if ( !aView.IsNull() )
-    aView->FitAll();
-
-  return 0;
-}
-
-Handle( MeshVS_Mesh ) getMesh( const char* theName, Draw_Interpretor& di)
-{
-  Handle( XSDRAWSTLVRML_DrawableMesh ) aDrawMesh =
-    Handle( XSDRAWSTLVRML_DrawableMesh )::DownCast( Draw::Get( theName ) );
-
-  if( aDrawMesh.IsNull() )
-  {
-    di << "There is no such object\n";
-    return NULL;
-  }
-  else
-  {
-    Handle( MeshVS_Mesh ) aMesh = aDrawMesh->GetMesh();
-    if( aMesh.IsNull() )
-    {
-      di << "There is invalid mesh\n";
-      return NULL;
-    }
-    else
-      return aMesh;
-  }
-}
-
-//-----------------------------------------------------------------------------
-static Standard_Integer setcolor
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv, Standard_Integer theParam )
-{
-  if (argc<5)
-    di << "Wrong number of parameters\n";
-  else
-  {
-    Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
-    if( !aMesh.IsNull() )
-    {
-      Standard_Real aRed = Draw::Atof (argv[2]);
-      Standard_Real aGreen = Draw::Atof (argv[3]);
-      Standard_Real aBlue = Draw::Atof (argv[4]);
-      aMesh->GetDrawer()->SetColor( (MeshVS_DrawerAttribute)theParam,
-                                    Quantity_Color( aRed, aGreen, aBlue, Quantity_TOC_RGB ) );
-
-      Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
-
-      if( aContext.IsNull() )
-        di << "The context is null\n";
-      else
-        aContext->Redisplay (aMesh, Standard_True);
-    }
-  }
-  return 0;
-}
-//-----------------------------------------------------------------------------
-static Standard_Integer meshcolor
-(Draw_Interpretor& theInterp, Standard_Integer argc, const char** argv )
-{
-  return setcolor( theInterp, argc, argv, MeshVS_DA_InteriorColor );
-}
-//-----------------------------------------------------------------------------
-static Standard_Integer linecolor
-(Draw_Interpretor& theInterp, Standard_Integer argc, const char** argv )
-{
-  return setcolor( theInterp, argc, argv, MeshVS_DA_EdgeColor );
-}
-//-----------------------------------------------------------------------------
-static Standard_Integer meshmat
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv )
-{
-  if (argc<3)
-    di << "Wrong number of parameters\n";
-  else
-  {
-    Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
-    if( !aMesh.IsNull() )
-    {
-      Standard_Integer aMaterial = Draw::Atoi (argv[2]);
-
-      Graphic3d_MaterialAspect aMatAsp =
-        (Graphic3d_MaterialAspect)(Graphic3d_NameOfMaterial)aMaterial;
-
-      if (argc == 4)
-      {
-        Standard_Real aTransparency = Draw::Atof(argv[3]);
-        aMatAsp.SetTransparency (Standard_ShortReal (aTransparency));
-      }
-      aMesh->GetDrawer()->SetMaterial( MeshVS_DA_FrontMaterial, aMatAsp );
-      aMesh->GetDrawer()->SetMaterial( MeshVS_DA_BackMaterial, aMatAsp );
-
-      Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
-
-      if( aContext.IsNull() )
-        di << "The context is null\n";
-      else
-        aContext->Redisplay (aMesh, Standard_True);
-    }
-  }
-  return 0;
-}
-//-----------------------------------------------------------------------------
-static Standard_Integer shrink
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv )
-{
-  if (argc<3)
-    di << "Wrong number of parameters\n";
-  else
-  {
-    Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
-    if( !aMesh.IsNull() )
-    {
-      Standard_Real aShrinkCoeff = Draw::Atof (argv[2]);
-      aMesh->GetDrawer()->SetDouble( MeshVS_DA_ShrinkCoeff, aShrinkCoeff );
-
-      Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
-
-      if( aContext.IsNull() )
-        di << "The context is null\n";
-      else
-        aContext->Redisplay (aMesh, Standard_True);
-    }
-  }
-  return 0;
-}
-
-//-----------------------------------------------------------------------------
-static Standard_Integer closed (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
-{
-  if (theArgc < 3)
-  {
-    theDI << "Wrong number of parameters.\n";
-  }
-  else
-  {
-    Handle(MeshVS_Mesh) aMesh = getMesh (theArgv[1], theDI);
-    if (!aMesh.IsNull())
-    {
-      Standard_Boolean aFlag = Draw::Atoi (theArgv[2]) != 0;
-      aMesh->GetDrawer()->SetBoolean (MeshVS_DA_SupressBackFaces, aFlag);
-
-      Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
-      if (aContext.IsNull())
-      {
-        theDI << "The context is null\n";
-      }
-      else
-      {
-        aContext->Redisplay (aMesh, Standard_True);
-      }
-    }
-  }
-  return 0;
-}
-
-//-----------------------------------------------------------------------------
-
-static Standard_Integer mdisplay
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv )
-{
-  if (argc<2)
-    di << "Wrong number of parameters\n";
-  else
-  {
-    Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
-    if( !aMesh.IsNull() )
-    {
-      Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
-
-      if( aContext.IsNull() )
-        di << "The context is null\n";
-      else
-      {
-        aContext->Display (aMesh, Standard_True);
-      }
-    }
-  }
-  return 0;
-}
-//-----------------------------------------------------------------------------
-static Standard_Integer merase
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv )
-{
-  if (argc<2)
-    di << "Wrong number of parameters\n";
-  else
-  {
-    Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
-    if( !aMesh.IsNull() )
-    {
-      Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
-
-      if( aContext.IsNull() )
-        di << "The context is null\n";
-      else
-      {
-        aContext->Erase (aMesh, Standard_True);
-      }
-    }
-    else
-      di << "Mesh is null\n";
-  }
-  return 0;
-}
-//-----------------------------------------------------------------------------
-static Standard_Integer hidesel
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv )
-{
-  if (argc<2)
-  {
-    di << "Wrong number of parameters\n";
-    di << "Use: " << argv[0] << " <mesh name>\n";
-    return 0;
-  }
-
-  Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
-  Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
-  if( aMesh.IsNull() )
-  {
-    di << "The mesh is invalid\n";
-    return 0;
-  }
-
-  if( aContext.IsNull() )
-    di << "The context is null\n";
-  else
-  {
-    Handle(TColStd_HPackedMapOfInteger) aHiddenNodes = aMesh->GetHiddenNodes();
-    if (aHiddenNodes.IsNull())
-    {
-      aHiddenNodes = new TColStd_HPackedMapOfInteger();
-    }
-    Handle(TColStd_HPackedMapOfInteger) aHiddenElements = aMesh->GetHiddenElems();
-    if (aHiddenElements.IsNull())
-    {
-      aHiddenElements = new TColStd_HPackedMapOfInteger();
-    }
-    for( aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected() )
-    {
-      Handle( MeshVS_MeshEntityOwner ) anOwner =
-        Handle( MeshVS_MeshEntityOwner )::DownCast( aContext->SelectedOwner() );
-      if( !anOwner.IsNull() )
-      {
-        if( anOwner->Type()==MeshVS_ET_Node )
-        {
-          aHiddenNodes->ChangeMap().Add( anOwner->ID() );
-        }
-        else
-        {
-          aHiddenElements->ChangeMap().Add( anOwner->ID() );
-        }
-      }
-    }
-    aContext->ClearSelected (Standard_False);
-    aMesh->SetHiddenNodes( aHiddenNodes );
-    aMesh->SetHiddenElems( aHiddenElements );
-    aContext->Redisplay (aMesh, Standard_True);
-  }
-
-  return 0;
-}
-//-----------------------------------------------------------------------------
-static Standard_Integer showonly
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv )
-{
-  if (argc<2)
-  {
-    di << "Wrong number of parameters\n";
-    di << "Use: " << argv[0] << " <mesh name>\n";
-    return 0;
-  }
-
-
-  Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
-  Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
-  if( aMesh.IsNull() )
-  {
-    di << "The mesh is invalid\n";
-    return 0;
-  }
-
-  if( aContext.IsNull() )
-    di << "The context is null\n";
-  else
-  {
-    Handle(TColStd_HPackedMapOfInteger) aHiddenNodes =
-      new TColStd_HPackedMapOfInteger(aMesh->GetDataSource()->GetAllNodes());
-    Handle(TColStd_HPackedMapOfInteger) aHiddenElements =
-      new TColStd_HPackedMapOfInteger(aMesh->GetDataSource()->GetAllElements());
-    for( aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected() )
-    {
-      Handle( MeshVS_MeshEntityOwner ) anOwner =
-        Handle( MeshVS_MeshEntityOwner )::DownCast( aContext->SelectedOwner() );
-      if( !anOwner.IsNull() )
-      {
-        if( anOwner->Type() == MeshVS_ET_Node )
-        {
-          aHiddenNodes->ChangeMap().Remove( anOwner->ID() );
-        }
-        else
-        {
-          aHiddenElements->ChangeMap().Remove( anOwner->ID() );
-        }
-      }
-    }
-    aMesh->SetHiddenNodes( aHiddenNodes );
-    aMesh->SetHiddenElems( aHiddenElements );
-    aContext->Redisplay (aMesh, Standard_True);
-  }
-
-  return 0;
-}
-//-----------------------------------------------------------------------------
-static Standard_Integer showall
-(Draw_Interpretor& di, Standard_Integer argc, const char** argv )
-{
-  if (argc<2)
-  {
-    di << "Wrong number of parameters\n";
-    di << "Use: " << argv[0] << " <mesh name>\n";
-    return 0;
-  }
-
-  Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
-  Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
-  if( aMesh.IsNull() )
-  {
-    di << "The mesh is invalid\n";
-    return 0;
-  }
-
-  if( aContext.IsNull() )
-    di << "The context is null\n";
-  else
-  {
-    aMesh->SetHiddenNodes( new TColStd_HPackedMapOfInteger() );
-    aMesh->SetHiddenElems( new TColStd_HPackedMapOfInteger() );
-    aContext->Redisplay (aMesh, Standard_True);
-  }
-
-  return 0;
-}
-
-//-----------------------------------------------------------------------------
-static Standard_Integer meshcolors( Draw_Interpretor& di,
-                                    Standard_Integer argc,
-                                    const char** argv )
-{
-  try
-  {
-    OCC_CATCH_SIGNALS
-      if ( argc < 4 )
-      {
-        di << "Wrong number of parameters\n";
-        di << "Use : meshcolors <mesh name> <mode> <isreflect>\n";
-        di << "mode : {elem1|elem2|nodal|nodaltex|none}\n";
-        di << "       elem1 - different color for each element\n";
-        di << "       elem2 - one color for one side\n";
-        di << "       nodal - different color for each node\n";
-        di << "       nodaltex - different color for each node with texture interpolation\n";
-        di << "       none  - clear\n";
-        di << "isreflect : {0|1} \n";
-
-        return 0;
-      }
-
-      Handle( MeshVS_Mesh ) aMesh = getMesh( argv[ 1 ], di );
-
-      if ( aMesh.IsNull() )
-      {
-        di << "Mesh not found\n";
-        return 0;
-      }
-      Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext();
-      if ( anIC.IsNull() )
-      {
-        di << "The context is null\n";
-        return 0;
-      }
-      if( !aMesh.IsNull() )
-      {
-        TCollection_AsciiString aMode = TCollection_AsciiString (argv[2]);
-        Quantity_Color aColor1(Quantity_NOC_BLUE1);
-        Quantity_Color aColor2(Quantity_NOC_RED1);
-        if( aMode.IsEqual("elem1") || aMode.IsEqual("elem2") || aMode.IsEqual("nodal") || aMode.IsEqual("nodaltex") || aMode.IsEqual("none") )
-        {
-          Handle(MeshVS_PrsBuilder) aTempBuilder;
-          Standard_Integer aReflection = Draw::Atoi(argv[3]);
-
-          for (Standard_Integer aCount = 0 ; aCount < aMesh->GetBuildersCount(); aCount++ ){
-            aTempBuilder = aMesh->FindBuilder("MeshVS_ElementalColorPrsBuilder");
-            if( !aTempBuilder.IsNull())
-              aMesh->RemoveBuilderById(aTempBuilder->GetId());
-
-            aTempBuilder = aMesh->FindBuilder("MeshVS_NodalColorPrsBuilder");
-            if( !aTempBuilder.IsNull())
-              aMesh->RemoveBuilderById(aTempBuilder->GetId());
-          }
-
-          if( aMode.IsEqual("elem1") || aMode.IsEqual("elem2") )
-          {
-            Handle(MeshVS_ElementalColorPrsBuilder) aBuilder = new MeshVS_ElementalColorPrsBuilder(
-                aMesh, MeshVS_DMF_ElementalColorDataPrs | MeshVS_DMF_OCCMask );
-              // Color
-            const TColStd_PackedMapOfInteger& anAllElements = aMesh->GetDataSource()->GetAllElements();
-            TColStd_MapIteratorOfPackedMapOfInteger anIter( anAllElements );
-
-            if( aMode.IsEqual("elem1") )
-              for ( ; anIter.More(); anIter.Next() )
-              {
-                Quantity_Color aColor( (Quantity_NameOfColor)( anIter.Key() % Quantity_NOC_WHITE ) );
-                aBuilder->SetColor1( anIter.Key(), aColor );
-              }
-            else
-              for ( ; anIter.More(); anIter.Next() )
-                aBuilder->SetColor2( anIter.Key(), aColor1, aColor2 );
-
-            aMesh->AddBuilder( aBuilder, Standard_True );
-          }
-
-
-          if( aMode.IsEqual("nodal") )
-          {
-            Handle(MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder(
-                aMesh, MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask );
-            aMesh->AddBuilder( aBuilder, Standard_True );
-
-            // Color
-            const TColStd_PackedMapOfInteger& anAllNodes =
-              aMesh->GetDataSource()->GetAllNodes();
-            TColStd_MapIteratorOfPackedMapOfInteger anIter( anAllNodes );
-            for ( ; anIter.More(); anIter.Next() )
-            {
-              Quantity_Color aColor( (Quantity_NameOfColor)(
-                anIter.Key() % Quantity_NOC_WHITE ) );
-              aBuilder->SetColor( anIter.Key(), aColor );
-            }
-            aMesh->AddBuilder( aBuilder, Standard_True );
-          }
-
-          if(aMode.IsEqual("nodaltex"))
-          {
-            // assign nodal builder to the mesh
-            Handle(MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder(
-                   aMesh, MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask);
-            aMesh->AddBuilder(aBuilder, Standard_True);
-            aBuilder->UseTexture(Standard_True);
-
-            // prepare color map for texture
-            Aspect_SequenceOfColor aColorMap;
-            aColorMap.Append((Quantity_NameOfColor) Quantity_NOC_RED);
-            aColorMap.Append((Quantity_NameOfColor) Quantity_NOC_YELLOW);
-            aColorMap.Append((Quantity_NameOfColor) Quantity_NOC_BLUE1);
-
-            // prepare scale map for mesh - it will be assigned to mesh as texture coordinates
-            // make mesh color interpolated from minimum X coord to maximum X coord
-            Handle(MeshVS_DataSource) aDataSource = aMesh->GetDataSource();
-            Standard_Real aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ;
-
-            // get bounding box for calculations
-            aDataSource->GetBoundingBox().Get(aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ);
-            Standard_Real aDelta = aMaxX - aMinX;
-
-            // assign color scale map values (0..1) to nodes
-            TColStd_DataMapOfIntegerReal aScaleMap;
-            TColStd_Array1OfReal aCoords(1, 3);
-            Standard_Integer     aNbNodes;
-            MeshVS_EntityType    aType;
-
-            // iterate nodes
-            const TColStd_PackedMapOfInteger& anAllNodes =
-                  aMesh->GetDataSource()->GetAllNodes();
-            TColStd_MapIteratorOfPackedMapOfInteger anIter(anAllNodes);
-            for (; anIter.More(); anIter.Next())
-            {
-              //get node coordinates to aCoord variable
-              aDataSource->GetGeom(anIter.Key(), Standard_False, aCoords, aNbNodes, aType);
-
-              Standard_Real aScaleValue;
-              try {
-                OCC_CATCH_SIGNALS
-                aScaleValue = (aCoords.Value(1) - (Standard_Real) aMinX) / aDelta;
-              } catch(Standard_Failure const&) {
-                aScaleValue = 0;
-              }
-
-              aScaleMap.Bind(anIter.Key(), aScaleValue);
-            }
-
-            //set color map for builder and a color for invalid scale value
-            aBuilder->SetColorMap(aColorMap);
-            aBuilder->SetInvalidColor(Quantity_NOC_BLACK);
-            aBuilder->SetTextureCoords(aScaleMap);
-            aMesh->AddBuilder(aBuilder, Standard_True);
-          }
-
-          aMesh->GetDrawer()->SetBoolean (MeshVS_DA_ColorReflection, aReflection != 0);
-
-          anIC->Redisplay (aMesh, Standard_True);
-        }
-        else
-        {
-          di << "Wrong mode name\n";
-          return 0;
-        }
-      }
-  }
-  catch ( Standard_Failure const& )
-  {
-    di << "Error\n";
-  }
-
-  return 0;
-}
-//-----------------------------------------------------------------------------
-static Standard_Integer meshvectors( Draw_Interpretor& di,
-                                     Standard_Integer argc,
-                                     const char** argv )
-{
-  if ( argc < 3 )
-  {
-    di << "Wrong number of parameters\n";
-    di << "Use : meshvectors <mesh name> < -mode {elem|nodal|none} > [-maxlen len] [-color name] [-arrowpart ratio] [-issimple {1|0}]\n";
-    di << "Supported mode values:\n";
-    di << "       elem  - vector per element\n";
-    di << "       nodal - vector per node\n";
-    di << "       none  - clear\n";
-
-    return 0;
-  }
-
-  Handle( MeshVS_Mesh ) aMesh = getMesh( argv[ 1 ], di );
-
-  if ( aMesh.IsNull() )
-  {
-    di << "Mesh not found\n";
-    return 0;
-  }
-  Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext();
-  if ( anIC.IsNull() )
-  {
-    di << "The context is null\n";
-    return 0;
-  }
-
-  TCollection_AsciiString aParam;
-  TCollection_AsciiString aMode("none");
-  Standard_Real           aMaxlen(1.0);
-  Quantity_Color          aColor(Quantity_NOC_ORANGE);
-  Standard_Real           anArrowPart(0.1);
-  Standard_Boolean        isSimplePrs(Standard_False);
-
-  for (Standard_Integer anIdx = 2; anIdx < argc; anIdx++)
-  {
-    if (!aParam.IsEmpty())
-    {
-      if (aParam == "-mode")
-      {
-        aMode       = argv[anIdx];
-      }
-      else if (aParam == "-maxlen")
-      {
-        aMaxlen     = Draw::Atof(argv[anIdx]);
-      }
-      else if (aParam == "-color")
-      {
-        if (!Quantity_Color::ColorFromName (argv[anIdx], aColor))
-        {
-          Message::SendFail() << "Syntax error at " << aParam;
-          return 1;
-        }
-      }
-      else if (aParam == "-arrowpart")
-      {
-        anArrowPart = Draw::Atof(argv[anIdx]);
-      }
-      else if (aParam == "-issimple")
-      {
-        isSimplePrs = Draw::Atoi(argv[anIdx]) != 0;
-      }
-      aParam.Clear();
-    }
-    else if (argv[anIdx][0] == '-')
-    {
-      aParam = argv[anIdx];
-    }
-  }
-
-  if( !aMode.IsEqual("elem") && !aMode.IsEqual("nodal") && !aMode.IsEqual("none") )
-  {
-    di << "Wrong mode name\n";
-    return 0;
-  }
-
-  Handle(MeshVS_PrsBuilder) aTempBuilder;
-
-  aTempBuilder = aMesh->FindBuilder("MeshVS_VectorPrsBuilder");
-  if( !aTempBuilder.IsNull())
-    aMesh->RemoveBuilderById(aTempBuilder->GetId());
-
-  if( !aMode.IsEqual("none") )
-  {
-    Handle(MeshVS_VectorPrsBuilder) aBuilder = new MeshVS_VectorPrsBuilder( aMesh.operator->(), 
-                                                                            aMaxlen,
-                                                                            aColor,
-                                                                            MeshVS_DMF_VectorDataPrs,
-                                                                            0,
-                                                                            -1,
-                                                                            MeshVS_BP_Vector,
-                                                                            isSimplePrs);
-
-    Standard_Boolean anIsElement = aMode.IsEqual("elem");
-    const TColStd_PackedMapOfInteger& anAllIDs = anIsElement ? aMesh->GetDataSource()->GetAllElements() :
-                                                               aMesh->GetDataSource()->GetAllNodes();
-
-    Standard_Integer aNbNodes;
-    MeshVS_EntityType aEntType;
-
-    TColStd_Array1OfReal aCoords(1, 3);
-    aCoords.Init (0.);
-    TColStd_MapIteratorOfPackedMapOfInteger anIter( anAllIDs );
-    for ( ; anIter.More(); anIter.Next() )
-    {
-      Standard_Boolean IsValidData = Standard_False; 
-      if (anIsElement) {
-        aMesh->GetDataSource()->GetGeomType(anIter.Key(), anIsElement, aEntType);
-        if (aEntType == MeshVS_ET_Face)
-          IsValidData = aMesh->GetDataSource()->GetNormal(anIter.Key(), 3, aCoords.ChangeValue(1), aCoords.ChangeValue(2), aCoords.ChangeValue(3));
-      } else
-        IsValidData = aMesh->GetDataSource()->GetGeom(anIter.Key(), Standard_False, aCoords, aNbNodes, aEntType);
-
-      gp_Vec aNorm;
-      if(IsValidData)
-      { 
-        aNorm = gp_Vec(aCoords.Value(1), aCoords.Value(2), aCoords.Value(3));
-        if(aNorm.Magnitude() < gp::Resolution())
-        {
-          aNorm = gp_Vec(0,0,1); //method GetGeom(...) returns coordinates of nodes
-        }
-      }
-      else
-      {
-        aNorm = gp_Vec(0,0,1);
-      }
-      aBuilder->SetVector(anIsElement, anIter.Key(), aNorm.Normalized());
-    }
-
-    aMesh->AddBuilder( aBuilder, Standard_False );
-    aMesh->GetDrawer()->SetDouble ( MeshVS_DA_VectorArrowPart, anArrowPart );
-  }
-
-  anIC->Redisplay (aMesh, Standard_True);
-
-  return 0;
-}
-//-----------------------------------------------------------------------------
-
-static Standard_Integer meshtext( Draw_Interpretor& di,
-                                  Standard_Integer argc,
-                                  const char** argv )
-{
-  if ( argc < 2 )
-  {
-    di << "Wrong number of parameters\n";
-    di << "Use : meshtext <mesh name>\n";
-    return 0;
-  }
-
-  Handle( MeshVS_Mesh ) aMesh = getMesh( argv[ 1 ], di );
-
-  if ( aMesh.IsNull() )
-  {
-    di << "Mesh not found\n";
-    return 0;
-  }
-
-  Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext();
-  if ( anIC.IsNull() )
-  {
-    di << "The context is null\n";
-    return 0;
-  }
-
-  // Prepare triangle labels
-  MeshVS_DataMapOfIntegerAsciiString aLabels;
-  Standard_Integer aLen = aMesh->GetDataSource()->GetAllElements().Extent();
-  for ( Standard_Integer anIndex = 1; anIndex <= aLen; anIndex++ ){
-    aLabels.Bind( anIndex, TCollection_AsciiString( anIndex ) );
-  }
-
-  Handle(MeshVS_TextPrsBuilder) aTextBuilder = new MeshVS_TextPrsBuilder( aMesh.operator->(), 20., Quantity_NOC_YELLOW );
-  aTextBuilder->SetTexts( Standard_True, aLabels );
-  aMesh->AddBuilder( aTextBuilder );
-
-  return 0;
-}
-
-static Standard_Integer meshdeform( Draw_Interpretor& di,
-                                    Standard_Integer argc,
-                                    const char** argv )
-{
-  if ( argc < 3 )
-  {
-    di << "Wrong number of parameters\n";
-    di << "Use : meshdeform <mesh name> < -mode {on|off} > [-scale scalefactor]\n";
-    return 0;
-  }
-
-  Handle( MeshVS_Mesh ) aMesh = getMesh( argv[ 1 ], di );
-
-  if ( aMesh.IsNull() )
-  {
-    di << "Mesh not found\n";
-    return 0;
-  }
-  Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext();
-  if ( anIC.IsNull() )
-  {
-    di << "The context is null\n";
-    return 0;
-  }
-
-  TCollection_AsciiString aParam;
-  TCollection_AsciiString aMode("off");
-  Standard_Real           aScale(1.0);
-
-  for (Standard_Integer anIdx = 2; anIdx < argc; anIdx++)
-  {
-    if (!aParam.IsEmpty())
-    {
-      if (aParam == "-mode")
-      {
-        aMode = argv[anIdx];
-      }
-      else if (aParam == "-scale")
-      {
-        aScale = Draw::Atof(argv[anIdx]);
-      }
-      aParam.Clear();
-    }
-    else if (argv[anIdx][0] == '-')
-    {
-      aParam = argv[anIdx];
-    }
-  }
-
-  if(!aMode.IsEqual("on") && !aMode.IsEqual("off"))
-  {
-    di << "Wrong mode name\n";
-    return 0;
-  }
-
-  Handle ( MeshVS_DeformedDataSource ) aDefDS =
-    new MeshVS_DeformedDataSource( aMesh->GetDataSource() , aScale );
-
-  const TColStd_PackedMapOfInteger& anAllIDs = aMesh->GetDataSource()->GetAllNodes();
-
-  Standard_Integer aNbNodes;
-  MeshVS_EntityType aEntType;
-
-  TColStd_MapIteratorOfPackedMapOfInteger anIter( anAllIDs );
-  for ( ; anIter.More(); anIter.Next() )
-  {
-    TColStd_Array1OfReal aCoords(1, 3);
-    aMesh->GetDataSource()->GetGeom(anIter.Key(), Standard_False, aCoords, aNbNodes, aEntType);
-
-    gp_Vec aNorm = gp_Vec(aCoords.Value(1), aCoords.Value(2), aCoords.Value(3));
-    if( !aNorm.Magnitude() )
-      aNorm = gp_Vec(0,0,1);
-    aDefDS->SetVector(anIter.Key(), aNorm.Normalized());
-  }
-
-  aMesh->SetDataSource(aDefDS);
-
-  anIC->Redisplay (aMesh, Standard_False);
-
-  Handle( V3d_View ) aView = ViewerTest::CurrentView();
-  if ( !aView.IsNull() )
-    aView->FitAll();
-
-  return 0;
-}
-
-static Standard_Integer mesh_edge_width( Draw_Interpretor& di,
-                                        Standard_Integer argc,
-                                        const char** argv )
-{
-  try
-  {
-    OCC_CATCH_SIGNALS
-      if ( argc < 3 )
-      {
-        di << "Wrong number of parameters\n";
-        di << "Use : mesh_edge_width <mesh name> <width>\n";
-        return 0;
-      }
-
-      Handle(MeshVS_Mesh) aMesh = getMesh( argv[ 1 ], di );
-      if ( aMesh.IsNull() )
-      {
-        di << "Mesh not found\n";
-        return 0;
-      }
-
-      const char* aWidthStr = argv[ 2 ];
-      if ( aWidthStr == 0 || Draw::Atof( aWidthStr ) <= 0 )
-      {
-        di << "Width must be real value more than zero\n";
-        return 0;
-      }
-
-      double aWidth = Draw::Atof( aWidthStr );
-
-      Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext();
-      if ( anIC.IsNull() )
-      {
-        di << "The context is null\n";
-        return 0;
-      }
-
-      Handle(MeshVS_Drawer) aDrawer = aMesh->GetDrawer();
-      if ( aDrawer.IsNull() )
-      {
-        di << "The drawer is null\n";
-        return 0;
-      }
-
-      aDrawer->SetDouble( MeshVS_DA_EdgeWidth, aWidth );
-      anIC->Redisplay (aMesh, Standard_True);
-  }
-  catch ( Standard_Failure const& )
-  {
-    di << "Error\n";
-  }
-
-  return 0;
-}
-
-//-----------------------------------------------------------------------------
-
-static Standard_Integer meshinfo(Draw_Interpretor& di,
-                                 Standard_Integer argc,
-                                 const char** argv)
-{
-  if ( argc != 2 )
-  {
-    di << "Wrong number of parameters. Use : meshinfo mesh\n";
-    return 0;
-  }
-
-  Handle(MeshVS_Mesh) aMesh = getMesh(argv[ 1 ], di);
-  if ( aMesh.IsNull() )
-  {
-    di << "Mesh not found\n";
-    return 0;
-  }
-
-  Handle(XSDRAWSTLVRML_DataSource) stlMeshSource = Handle(XSDRAWSTLVRML_DataSource)::DownCast(aMesh->GetDataSource());
-  if (!stlMeshSource.IsNull())
-  {
-    const TColStd_PackedMapOfInteger& nodes = stlMeshSource->GetAllNodes();
-    const TColStd_PackedMapOfInteger& tris  = stlMeshSource->GetAllElements();
-
-    di << "Nb nodes = " << nodes.Extent() << "\n";
-    di << "Nb triangles = " << tris.Extent() << "\n";
-  }
-
-  return 0;
-}
-
-//=======================================================================
-//function : writeply
-//purpose  : write PLY file
-//=======================================================================
-static Standard_Integer WritePly (Draw_Interpretor& theDI,
-                                  Standard_Integer theNbArgs,
-                                  const char** theArgVec)
-{
-  Handle(TDocStd_Document) aDoc;
-  Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
-  TCollection_AsciiString aShapeName, aFileName;
-
-  Standard_Real aDist = 0.0;
-  Standard_Real aDens = Precision::Infinite();
-  Standard_Real aTol  = Precision::Confusion();
-  bool hasColors = true, hasNormals = true, hasTexCoords = false, hasPartId = true, hasFaceId = false;
-  bool isPntSet = false, isDensityPoints = false;
-  TColStd_IndexedDataMapOfStringString aFileInfo;
-  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
-  {
-    TCollection_AsciiString anArg (theArgVec[anArgIter]);
-    anArg.LowerCase();
-    if (anArg == "-normal")
-    {
-      hasNormals = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArg == "-nonormal")
-    {
-      hasNormals = !Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArg == "-color"
-          || anArg == "-nocolor"
-          || anArg == "-colors"
-          || anArg == "-nocolors")
-    {
-      hasColors = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArg == "-uv"
-          || anArg == "-nouv")
-    {
-      hasTexCoords = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if (anArg == "-partid")
-    {
-      hasPartId = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
-      hasFaceId = hasFaceId && !hasPartId;
-    }
-    else if (anArg == "-surfid"
-          || anArg == "-surfaceid"
-          || anArg == "-faceid")
-    {
-      hasFaceId = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
-      hasPartId = hasPartId && !hasFaceId;
-    }
-    else if (anArg == "-pntset"
-          || anArg == "-pntcloud"
-          || anArg == "-pointset"
-          || anArg == "-pointcloud"
-          || anArg == "-cloud"
-          || anArg == "-points")
-    {
-      isPntSet = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
-    }
-    else if ((anArg == "-dist"
-           || anArg == "-distance")
-          && anArgIter + 1 < theNbArgs
-          && Draw::ParseReal (theArgVec[anArgIter + 1], aDist))
-    {
-      ++anArgIter;
-      isPntSet = true;
-      if (aDist < 0.0)
-      {
-        theDI << "Syntax error: -distance value should be >= 0.0";
-        return 1;
-      }
-      aDist = Max (aDist, Precision::Confusion());
-    }
-    else if ((anArg == "-dens"
-           || anArg == "-density")
-          && anArgIter + 1 < theNbArgs
-          && Draw::ParseReal (theArgVec[anArgIter + 1], aDens))
-    {
-      ++anArgIter;
-      isDensityPoints = Standard_True;
-      isPntSet = true;
-      if (aDens <= 0.0)
-      {
-        theDI << "Syntax error: -density value should be > 0.0";
-        return 1;
-      }
-    }
-    else if ((anArg == "-tol"
-           || anArg == "-tolerance")
-          && anArgIter + 1 < theNbArgs
-          && Draw::ParseReal (theArgVec[anArgIter + 1], aTol))
-    {
-      ++anArgIter;
-      isPntSet = true;
-      if (aTol < Precision::Confusion())
-      {
-        theDI << "Syntax error: -tol value should be >= " << Precision::Confusion();
-        return 1;
-      }
-    }
-    else if (anArg == "-comments"
-          && anArgIter + 1 < theNbArgs)
-    {
-      aFileInfo.Add ("Comments", theArgVec[++anArgIter]);
-    }
-    else if (anArg == "-author"
-          && anArgIter + 1 < theNbArgs)
-    {
-      aFileInfo.Add ("Author", theArgVec[++anArgIter]);
-    }
-    else if (aDoc.IsNull())
-    {
-      if (aShapeName.IsEmpty())
-      {
-        aShapeName = theArgVec[anArgIter];
-      }
-
-      Standard_CString aNameVar = theArgVec[anArgIter];
-      DDocStd::GetDocument (aNameVar, aDoc, false);
-      if (aDoc.IsNull())
-      {
-        TopoDS_Shape aShape = DBRep::Get (aNameVar);
-        if (!aShape.IsNull())
-        {
-          anApp->NewDocument (TCollection_ExtendedString ("BinXCAF"), aDoc);
-          Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
-          aShapeTool->AddShape (aShape);
-        }
-      }
-    }
-    else if (aFileName.IsEmpty())
-    {
-      aFileName = theArgVec[anArgIter];
-    }
-    else
-    {
-      theDI << "Syntax error at '" << theArgVec[anArgIter] << "'";
-      return 1;
-    }
-  }
-  if (aDoc.IsNull()
-  && !aShapeName.IsEmpty())
-  {
-    theDI << "Syntax error: '" << aShapeName << "' is not a shape nor document";
-    return 1;
-  }
-  else if (aDoc.IsNull()
-        || aFileName.IsEmpty())
-  {
-    theDI << "Syntax error: wrong number of arguments";
-    return 1;
-  }
-
-  TDF_LabelSequence aRootLabels;
-  Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
-  aShapeTool->GetFreeShapes (aRootLabels);
-  if (aRootLabels.IsEmpty())
-  {
-    theDI << "Error: empty document";
-    return 1;
-  }
-
-  if (isPntSet)
-  {
-    class PointCloudPlyWriter : public BRepLib_PointCloudShape, public RWPly_PlyWriterContext
-    {
-    public:
-      PointCloudPlyWriter (Standard_Real theTol)
-      : BRepLib_PointCloudShape (TopoDS_Shape(), theTol) {}
-
-      void AddFaceColor (const TopoDS_Shape& theFace, const Graphic3d_Vec4ub& theColor)
-      { myFaceColor.Bind (theFace, theColor); }
-
-    protected:
-      virtual void addPoint (const gp_Pnt& thePoint,
-                             const gp_Vec& theNorm,
-                             const gp_Pnt2d& theUV,
-                             const TopoDS_Shape& theFace)
-      {
-        Graphic3d_Vec4ub aColor;
-        myFaceColor.Find (theFace, aColor);
-        RWPly_PlyWriterContext::WriteVertex (thePoint,
-                                             Graphic3d_Vec3 ((float )theNorm.X(), (float )theNorm.Y(), (float )theNorm.Z()),
-                                             Graphic3d_Vec2 ((float )theUV.X(), (float )theUV.Y()),
-                                             aColor);
-      }
-
-    private:
-      NCollection_DataMap<TopoDS_Shape, Graphic3d_Vec4ub> myFaceColor;
-    };
-
-    PointCloudPlyWriter aPlyCtx (aTol);
-    aPlyCtx.SetNormals (hasNormals);
-    aPlyCtx.SetColors (hasColors);
-    aPlyCtx.SetTexCoords (hasTexCoords);
-
-    TopoDS_Compound aComp;
-    BRep_Builder().MakeCompound (aComp);
-    for (XCAFPrs_DocumentExplorer aDocExplorer (aDoc, aRootLabels, XCAFPrs_DocumentExplorerFlags_OnlyLeafNodes);
-         aDocExplorer.More(); aDocExplorer.Next())
-    {
-      const XCAFPrs_DocumentNode& aDocNode = aDocExplorer.Current();
-      for (RWMesh_FaceIterator aFaceIter (aDocNode.RefLabel, aDocNode.Location, true, aDocNode.Style); aFaceIter.More(); aFaceIter.Next())
-      {
-        BRep_Builder().Add (aComp, aFaceIter.Face());
-        Graphic3d_Vec4ub aColorVec (255);
-        if (aFaceIter.HasFaceColor())
-        {
-          Graphic3d_Vec4 aColorF = aFaceIter.FaceColor();
-          aColorVec.SetValues ((unsigned char )int(aColorF.r() * 255.0f),
-                               (unsigned char )int(aColorF.g() * 255.0f),
-                               (unsigned char )int(aColorF.b() * 255.0f),
-                               (unsigned char )int(aColorF.a() * 255.0f));
-        }
-        aPlyCtx.AddFaceColor (aFaceIter.Face(), aColorVec);
-      }
-    }
-    aPlyCtx.SetShape (aComp);
-
-    Standard_Integer aNbPoints = isDensityPoints
-                               ? aPlyCtx.NbPointsByDensity (aDens)
-                               : aPlyCtx.NbPointsByTriangulation();
-    if (aNbPoints <= 0)
-    {
-      theDI << "Error: unable to generate points";
-      return 0;
-    }
-
-    if (!aPlyCtx.Open (aFileName)
-     || !aPlyCtx.WriteHeader (aNbPoints, 0, TColStd_IndexedDataMapOfStringString()))
-    {
-      theDI << "Error: unable to create file '" << aFileName << "'";
-      return 0;
-    }
-
-    Standard_Boolean isDone = isDensityPoints
-                            ? aPlyCtx.GeneratePointsByDensity (aDens)
-                            : aPlyCtx.GeneratePointsByTriangulation();
-    if (!isDone)
-    {
-      theDI << "Error: Point cloud was not generated in file '" << aFileName << "'";
-    }
-    else if (!aPlyCtx.Close())
-    {
-      theDI << "Error: Point cloud file '" << aFileName << "' was not written";
-    }
-    else
-    {
-      theDI << aNbPoints;
-    }
-  }
-  else
-  {
-    Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
-    RWPly_CafWriter aPlyCtx (aFileName);
-    aPlyCtx.SetNormals (hasNormals);
-    aPlyCtx.SetColors (hasColors);
-    aPlyCtx.SetTexCoords (hasTexCoords);
-    aPlyCtx.SetPartId (hasPartId);
-    aPlyCtx.SetFaceId (hasFaceId);
-    aPlyCtx.Perform (aDoc, aFileInfo, aProgress->Start());
-  }
-  return 0;
-}
-
-//-----------------------------------------------------------------------------
-
-void  XSDRAWSTLVRML::InitCommands (Draw_Interpretor& theCommands)
-{
-  const char* g = "XSTEP-STL/VRML";  // Step transfer file commands
-  //XSDRAW::LoadDraw(theCommands);
-
-  theCommands.Add ("ReadGltf",
-                   "ReadGltf Doc file [-parallel {on|off}] [-listExternalFiles] [-noCreateDoc] [-doublePrecision {on|off}] [-assetInfo]"
-                   "\n\t\t: Read glTF file into XDE document."
-                   "\n\t\t:   -listExternalFiles do not read mesh and only list external files"
-                   "\n\t\t:   -noCreateDoc read into existing XDE document"
-                   "\n\t\t:   -doublePrecision store triangulation with double or single floating point"
-                   "\n\t\t:                    precision (single by default)"
-                   "\n\t\t:   -skipLateLoading data loading is skipped and can be performed later"
-                   "\n\t\t:                    (false by default)"
-                   "\n\t\t:   -keepLate data is loaded into itself with preservation of information"
-                   "\n\t\t:             about deferred storage to load/unload this data later."
-                   "\n\t\t:   -allScenes load all scenes defined in the document instead of default one (false by default)"
-                   "\n\t\t:   -toPrintDebugInfo print additional debug information during data reading"
-                   "\n\t\t:   -assetInfo print asset information",
-                   __FILE__, ReadGltf, g);
-  theCommands.Add ("readgltf",
-                   "readgltf shape file"
-                   "\n\t\t: Same as ReadGltf but reads glTF file into a shape instead of a document.",
-                   __FILE__, ReadGltf, g);
-  theCommands.Add ("WriteGltf",
-                   "WriteGltf Doc file [-trsfFormat {compact|TRS|mat4}]=compact"
-                   "\n\t\t:            [-systemCoordSys {Zup|Yup}]=Zup"
-                   "\n\t\t:            [-comments Text] [-author Name]"
-                   "\n\t\t:            [-forceUVExport]=0 [-texturesSeparate]=0 [-mergeFaces]=0 [-splitIndices16]=0"
-                   "\n\t\t:            [-nodeNameFormat {empty|product|instance|instOrProd|prodOrInst|prodAndInst|verbose}]=instOrProd"
-                   "\n\t\t:            [-meshNameFormat {empty|product|instance|instOrProd|prodOrInst|prodAndInst|verbose}]=product"
-                   "\n\t\t:            [-draco]=0 [-compressionLevel {0-10}]=7 [-quantizePositionBits Value]=14 [-quantizeNormalBits Value]=10"
-                   "\n\t\t:            [-quantizeTexcoordBits Value]=12 [-quantizeColorBits Value]=8 [-quantizeGenericBits Value]=12"
-                   "\n\t\t:            [-unifiedQuantization]=0 [-parallel]=0"
-                   "\n\t\t: Write XDE document into glTF file."
-                   "\n\t\t:   -trsfFormat       preferred transformation format"
-                   "\n\t\t:   -systemCoordSys   system coordinate system; Zup when not specified"
-                   "\n\t\t:   -mergeFaces       merge Faces within the same Mesh"
-                   "\n\t\t:   -splitIndices16   split Faces to keep 16-bit indices when -mergeFaces is enabled"
-                   "\n\t\t:   -forceUVExport    always export UV coordinates"
-                   "\n\t\t:   -texturesSeparate write textures to separate files"
-                   "\n\t\t:   -nodeNameFormat   name format for Nodes"
-                   "\n\t\t:   -meshNameFormat   name format for Meshes"
-                   "\n\t\t:   -draco            use Draco compression 3D geometric meshes"
-                   "\n\t\t:   -compressionLevel draco compression level [0-10] (by default 7), a value of 0 will apply sequential encoding and preserve face order"
-                   "\n\t\t:   -quantizePositionBits quantization bits for position attribute when using Draco compression (by default 14)"
-                   "\n\t\t:   -quantizeNormalBits   quantization bits for normal attribute when using Draco compression (by default 10)"
-                   "\n\t\t:   -quantizeTexcoordBits quantization bits for texture coordinate attribute when using Draco compression (by default 12)"
-                   "\n\t\t:   -quantizeColorBits    quantization bits for color attribute when using Draco compression (by default 8)"
-                   "\n\t\t:   -quantizeGenericBits  quantization bits for skinning attribute (joint indices and joint weights)"
-                   "\n                        and custom attributes when using Draco compression (by default 12)"
-                   "\n\t\t:   -unifiedQuantization  quantization is applied on each primitive separately if this option is false"
-                   "\n\t\t:   -parallel             use multithreading for Draco compression",
-                   __FILE__, WriteGltf, g);
-  theCommands.Add ("writegltf",
-                   "writegltf shape file",
-                   __FILE__, WriteGltf, g);
-  theCommands.Add ("writevrml", "shape file [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 1 by default]",__FILE__,writevrml,g);
-  theCommands.Add ("writestl",  "shape file [ascii/binary (0/1) : 1 by default] [InParallel (0/1) : 0 by default]",__FILE__,writestl,g);
-  theCommands.Add ("readstl",
-                   "readstl shape file [-brep] [-mergeAngle Angle] [-multi]"
-                   "\n\t\t: Reads STL file and creates a new shape with specified name."
-                   "\n\t\t: When -brep is specified, creates a Compound of per-triangle Faces."
-                   "\n\t\t: Single triangulation-only Face is created otherwise (default)."
-                   "\n\t\t: -mergeAngle specifies maximum angle in degrees between triangles to merge equal nodes; disabled by default."
-                   "\n\t\t: -multi creates a face per solid in multi-domain files; ignored when -brep is set.",
-                   __FILE__, readstl, g);
-  theCommands.Add ("loadvrml" , "shape file",__FILE__,loadvrml,g);
-  theCommands.Add ("ReadObj",
-                   "ReadObj Doc file [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]"
-           "\n\t\t:                  [-resultCoordSys {Zup|Yup}] [-singlePrecision]"
-           "\n\t\t:                  [-listExternalFiles] [-noCreateDoc]"
-           "\n\t\t: Read OBJ file into XDE document."
-           "\n\t\t:   -fileUnit       length unit of OBJ file content;"
-           "\n\t\t:   -fileCoordSys   coordinate system defined by OBJ file; Yup when not specified."
-           "\n\t\t:   -resultCoordSys result coordinate system; Zup when not specified."
-           "\n\t\t:   -singlePrecision truncate vertex data to single precision during read; FALSE by default."
-           "\n\t\t:   -listExternalFiles do not read mesh and only list external files."
-           "\n\t\t:   -noCreateDoc    read into existing XDE document.",
-                   __FILE__, ReadObj, g);
-  theCommands.Add ("readobj",
-                   "readobj shape file [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]"
-           "\n\t\t:                    [-resultCoordSys {Zup|Yup}] [-singlePrecision]"
-           "\n\t\t:                    [-singleFace]"
-           "\n\t\t: Same as ReadObj but reads OBJ file into a shape instead of a document."
-           "\n\t\t:   -singleFace merge OBJ content into a single triangulation Face.",
-           __FILE__, ReadObj, g);
-  theCommands.Add ("WriteObj",
-                   "WriteObj Doc file [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]"
-           "\n\t\t:                   [-systemCoordSys {Zup|Yup}]"
-           "\n\t\t:                   [-comments Text] [-author Name]"
-           "\n\t\t: Write XDE document into OBJ file."
-           "\n\t\t:   -fileUnit       length unit of OBJ file content;"
-           "\n\t\t:   -fileCoordSys   coordinate system defined by OBJ file; Yup when not specified."
-           "\n\t\t:   -systemCoordSys system coordinate system; Zup when not specified.",
-                   __FILE__, WriteObj, g);
-  theCommands.Add ("writeobj",
-                   "writeobj shape file",
-                   __FILE__, WriteObj, g);
-
-  theCommands.Add ("meshfromstl",     "creates MeshVS_Mesh from STL file",            __FILE__, createmesh,      g );
-  theCommands.Add ("mesh3delem",      "creates 3d element mesh to test",              __FILE__, create3d,        g );
-  theCommands.Add ("meshshadcolor",   "change MeshVS_Mesh shading color",             __FILE__, meshcolor,       g );
-  theCommands.Add ("meshlinkcolor",   "change MeshVS_Mesh line color",                __FILE__, linecolor,       g );
-  theCommands.Add ("meshmat",         "change MeshVS_Mesh material and transparency", __FILE__, meshmat,         g );
-  theCommands.Add ("meshshrcoef",     "change MeshVS_Mesh shrink coeff",              __FILE__, shrink,          g );
-  theCommands.Add ("meshclosed",      "meshclosed meshname (0/1) \nChange MeshVS_Mesh drawing mode. 0 - not closed object, 1 - closed object", __FILE__, closed, g);
-  theCommands.Add ("meshshow",        "display MeshVS_Mesh object",                   __FILE__, mdisplay,        g );
-  theCommands.Add ("meshhide",        "erase MeshVS_Mesh object",                     __FILE__, merase,          g );
-  theCommands.Add ("meshhidesel",     "hide selected entities",                       __FILE__, hidesel,         g );
-  theCommands.Add ("meshshowsel",     "show only selected entities",                  __FILE__, showonly,        g );
-  theCommands.Add ("meshshowall",     "show all entities",                            __FILE__, showall,         g );
-  theCommands.Add ("meshcolors",      "display color presentation",                   __FILE__, meshcolors,      g );
-  theCommands.Add ("meshvectors",     "display sample vectors",                       __FILE__, meshvectors,     g );
-  theCommands.Add ("meshtext",        "display text labels",                          __FILE__, meshtext,        g );
-  theCommands.Add ("meshdeform",      "display deformed mesh",                        __FILE__, meshdeform,      g );
-  theCommands.Add ("mesh_edge_width", "set width of edges",                           __FILE__, mesh_edge_width, g );
-  theCommands.Add ("meshinfo",        "displays the number of nodes and triangles",   __FILE__, meshinfo,        g );
-  theCommands.Add ("WritePly", R"(
-WritePly Doc file [-normals {0|1}]=1 [-colors {0|1}]=1 [-uv {0|1}]=0 [-partId {0|1}]=1 [-faceId {0|1}]=0
-                  [-pointCloud {0|1}]=0 [-distance Value]=0.0 [-density Value] [-tolerance Value]
-Write document or triangulated shape into PLY file.
- -normals write per-vertex normals
- -colors  write per-vertex colors
- -uv      write per-vertex UV coordinates
- -partId  write per-element part index (alternative to -faceId)
- -faceId  write per-element face index (alternative to -partId)
-
-Generate point cloud out of the shape and write it into PLY file.
- -pointCloud write point cloud instead without triangulation indices
- -distance   sets distance from shape into the range [0, Value];
- -density    sets density of points to generate randomly on surface;
- -tolerance  sets tolerance; default value is Precision::Confusion();
-)", __FILE__, WritePly, g);
-  theCommands.Add ("writeply",
-                   "writeply shape file",
-                   __FILE__, WritePly, g);
-}
-
-//==============================================================================
-// XSDRAWSTLVRML::Factory
-//==============================================================================
-void XSDRAWSTLVRML::Factory(Draw_Interpretor& theDI)
-{
-  XSDRAWIGES::InitSelect();
-  XSDRAWIGES::InitToBRep(theDI);
-  XSDRAWIGES::InitFromBRep(theDI);
-  XSDRAWSTEP::InitCommands(theDI);
-  XSDRAWSTLVRML::InitCommands(theDI);
-  XSDRAW::LoadDraw(theDI);
-#ifdef OCCT_DEBUG
-  theDI << "Draw Plugin : All TKXSDRAW commands are loaded\n";
-#endif
-}
-
-// Declare entry point PLUGINFACTORY
-DPLUGIN(XSDRAWSTLVRML)
-
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.hxx
deleted file mode 100644 (file)
index f7fd4dd..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// Created on: 2000-05-30
-// Created by: Sergey MOZOKHIN
-// Copyright (c) 2000-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _XSDRAWSTLVRML_HeaderFile
-#define _XSDRAWSTLVRML_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Draw_Interpretor.hxx>
-
-
-
-class XSDRAWSTLVRML 
-{
-public:
-
-  DEFINE_STANDARD_ALLOC
-
-  //! Inits commands for writing to STL and VRML formats
-  Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands);
-  
-  //! Loads all Draw commands of TKXSDRAW. Used for plugin.
-  Standard_EXPORT static void Factory (Draw_Interpretor& theDI);
-
-};
-
-#endif // _XSDRAWSTLVRML_HeaderFile
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_CoordsMap.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_CoordsMap.hxx
deleted file mode 100644 (file)
index 509d059..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Created on: 2000-05-30
-// Created by: Sergey MOZOKHIN
-// Copyright (c) 2000-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef XSDRAWSTLVRML_CoordsMap_HeaderFile
-#define XSDRAWSTLVRML_CoordsMap_HeaderFile
-
-#include <TColStd_DataMapOfIntegerReal.hxx>
-#include <NCollection_DataMap.hxx>
-
-typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerReal> XSDRAWSTLVRML_CoordsMap;
-typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerReal>::Iterator XSDRAWSTLVRML_DataMapIteratorOfCoordsMap;
-
-
-#endif
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfCoordsMap.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfCoordsMap.hxx
deleted file mode 100644 (file)
index 7637bfd..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2015 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#ifndef XSDRAWSTLVRML_DataMapIteratorOfCoordsMap_HeaderFile
-#define XSDRAWSTLVRML_DataMapIteratorOfCoordsMap_HeaderFile
-
-#include <XSDRAWSTLVRML_CoordsMap.hxx>
-
-#endif
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap.hxx
deleted file mode 100644 (file)
index 3ca906c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2015 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#ifndef XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap_HeaderFile
-#define XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap_HeaderFile
-
-#include <XSDRAWSTLVRML_ElemNodesMap.hxx>
-
-#endif
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource.cxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource.cxx
deleted file mode 100644 (file)
index f6e95cc..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-// Created on: 2004-06-10
-// Created by: Alexander SOLOVYOV
-// Copyright (c) 2004-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <XSDRAWSTLVRML_DataSource.hxx>
-
-#include <Precision.hxx>
-#include <Standard_Type.hxx>
-#include <TColStd_DataMapOfIntegerReal.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource,MeshVS_DataSource)
-
-//================================================================
-// Function : Constructor
-// Purpose  :
-//================================================================
-XSDRAWSTLVRML_DataSource::XSDRAWSTLVRML_DataSource (const Handle(Poly_Triangulation)& aMesh)
-{
-  myMesh = aMesh;
-
-  if( !myMesh.IsNull() )
-  {
-    const Standard_Integer aNbNodes = myMesh->NbNodes();
-    myNodeCoords = new TColStd_HArray2OfReal (1, aNbNodes, 1, 3);
-    std::cout << "Nodes : " << aNbNodes << std::endl;
-
-    for (Standard_Integer i = 1; i <= aNbNodes; i++)
-    {
-      myNodes.Add( i );
-      gp_Pnt xyz = myMesh->Node (i);
-
-      myNodeCoords->SetValue(i, 1, xyz.X());
-      myNodeCoords->SetValue(i, 2, xyz.Y());
-      myNodeCoords->SetValue(i, 3, xyz.Z());
-    }
-
-    const Standard_Integer aNbTris = myMesh->NbTriangles();
-    myElemNormals = new TColStd_HArray2OfReal(1, aNbTris, 1, 3);
-    myElemNodes = new TColStd_HArray2OfInteger(1, aNbTris, 1, 3);
-
-    std::cout << "Elements : " << aNbTris << std::endl;
-
-    for (Standard_Integer i = 1; i <= aNbTris; i++)
-    {
-      myElements.Add( i );
-
-      const Poly_Triangle aTri = myMesh->Triangle (i);
-
-      Standard_Integer V[3];
-      aTri.Get (V[0], V[1], V[2]);
-
-      const gp_Pnt aP1 = myMesh->Node (V[0]);
-      const gp_Pnt aP2 = myMesh->Node (V[1]);
-      const gp_Pnt aP3 = myMesh->Node (V[2]);
-
-      gp_Vec aV1(aP1, aP2);
-      gp_Vec aV2(aP2, aP3);
-
-      gp_Vec aN = aV1.Crossed(aV2);
-      if (aN.SquareMagnitude() > Precision::SquareConfusion())
-        aN.Normalize();
-      else
-        aN.SetCoord(0.0, 0.0, 0.0);
-
-      for (Standard_Integer j = 0; j < 3; j++)
-      {
-        myElemNodes->SetValue(i, j+1, V[j]);
-      }
-
-      myElemNormals->SetValue (i, 1, aN.X());
-      myElemNormals->SetValue (i, 2, aN.Y());
-      myElemNormals->SetValue (i, 3, aN.Z());
-    }
-  }
-  std::cout << "Construction is finished" << std::endl;
-}
-
-//================================================================
-// Function : GetGeom
-// Purpose  :
-//================================================================
-Standard_Boolean XSDRAWSTLVRML_DataSource::GetGeom
-( const Standard_Integer ID, const Standard_Boolean IsElement,
- TColStd_Array1OfReal& Coords, Standard_Integer& NbNodes,
- MeshVS_EntityType& Type ) const
-{
-  if( myMesh.IsNull() )
-    return Standard_False;
-
-  if( IsElement )
-  {
-    if( ID>=1 && ID<=myElements.Extent() )
-    {
-      Type = MeshVS_ET_Face;
-      NbNodes = 3;
-
-      for( Standard_Integer i = 1, k = 1; i <= 3; i++ )
-      {
-        Standard_Integer IdxNode = myElemNodes->Value(ID, i);
-        for(Standard_Integer j = 1; j <= 3; j++, k++ )
-          Coords(k) = myNodeCoords->Value(IdxNode, j);
-      }
-
-      return Standard_True;
-    }
-    else
-      return Standard_False;
-  }
-  else
-    if( ID>=1 && ID<=myNodes.Extent() )
-    {
-      Type = MeshVS_ET_Node;
-      NbNodes = 1;
-
-      Coords( 1 ) = myNodeCoords->Value(ID, 1);
-      Coords( 2 ) = myNodeCoords->Value(ID, 2);
-      Coords( 3 ) = myNodeCoords->Value(ID, 3);
-      return Standard_True;
-    }
-    else
-      return Standard_False;
-}
-
-//================================================================
-// Function : GetGeomType
-// Purpose  :
-//================================================================
-Standard_Boolean XSDRAWSTLVRML_DataSource::GetGeomType
-( const Standard_Integer,
- const Standard_Boolean IsElement,
- MeshVS_EntityType& Type ) const
-{
-  if( IsElement )
-  {
-    Type = MeshVS_ET_Face;
-    return Standard_True;
-  }
-  else
-  {
-    Type = MeshVS_ET_Node;
-    return Standard_True;
-  }
-}
-
-//================================================================
-// Function : GetAddr
-// Purpose  :
-//================================================================
-Standard_Address XSDRAWSTLVRML_DataSource::GetAddr
-( const Standard_Integer, const Standard_Boolean ) const
-{
-  return NULL;
-}
-
-//================================================================
-// Function : GetNodesByElement
-// Purpose  :
-//================================================================
-Standard_Boolean XSDRAWSTLVRML_DataSource::GetNodesByElement
-( const Standard_Integer ID,
- TColStd_Array1OfInteger& theNodeIDs,
- Standard_Integer& /*theNbNodes*/ ) const
-{
-  if( myMesh.IsNull() )
-    return Standard_False;
-
-  if( ID>=1 && ID<=myElements.Extent() && theNodeIDs.Length() >= 3 )
-  {
-    Standard_Integer aLow = theNodeIDs.Lower();
-    theNodeIDs (aLow)     = myElemNodes->Value(ID, 1 );
-    theNodeIDs (aLow + 1) = myElemNodes->Value(ID, 2 );
-    theNodeIDs (aLow + 2) = myElemNodes->Value(ID, 3 );
-    return Standard_True;
-  }
-  return Standard_False;
-}
-
-//================================================================
-// Function : GetAllNodes
-// Purpose  :
-//================================================================
-const TColStd_PackedMapOfInteger& XSDRAWSTLVRML_DataSource::GetAllNodes() const
-{
-  return myNodes;
-}
-
-//================================================================
-// Function : GetAllElements
-// Purpose  :
-//================================================================
-const TColStd_PackedMapOfInteger& XSDRAWSTLVRML_DataSource::GetAllElements() const
-{
-  return myElements;
-}
-
-//================================================================
-// Function : GetNormal
-// Purpose  :
-//================================================================
-Standard_Boolean XSDRAWSTLVRML_DataSource::GetNormal
-( const Standard_Integer Id, const Standard_Integer Max,
- Standard_Real& nx, Standard_Real& ny,Standard_Real& nz ) const
-{
-  if( myMesh.IsNull() )
-    return Standard_False;
-
-  if( Id>=1 && Id<=myElements.Extent() && Max>=3 )
-  {
-    nx = myElemNormals->Value(Id, 1);
-    ny = myElemNormals->Value(Id, 2);
-    nz = myElemNormals->Value(Id, 3);
-    return Standard_True;
-  }
-  else
-    return Standard_False;
-}
-
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource.hxx
deleted file mode 100644 (file)
index ca59eac..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-// Created on: 2004-06-10
-// Created by: Alexander SOLOVYOV
-// Copyright (c) 2004-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _XSDRAWSTLVRML_DataSource_HeaderFile
-#define _XSDRAWSTLVRML_DataSource_HeaderFile
-
-#include <Standard.hxx>
-
-#include <TColStd_HArray2OfInteger.hxx>
-#include <TColStd_HArray2OfReal.hxx>
-#include <MeshVS_DataSource.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <MeshVS_EntityType.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <Poly_Triangulation.hxx>
-
-
-class XSDRAWSTLVRML_DataSource;
-DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource, MeshVS_DataSource)
-
-//! The sample DataSource for working with STLMesh_Mesh
-class XSDRAWSTLVRML_DataSource : public MeshVS_DataSource
-{
-
-public:
-
-  
-  //! Constructor
-  Standard_EXPORT XSDRAWSTLVRML_DataSource(const Handle(Poly_Triangulation)& aMesh);
-  
-  //! Returns geometry information about node (if IsElement is False) or element (IsElement is True) by coordinates.
-  //! For element this method must return all its nodes coordinates in the strict order: X, Y, Z and
-  //! with nodes order is the same as in wire bounding the face or link. NbNodes is number of nodes of element.
-  //! It is recommended to return 1 for node. Type is an element type.
-  Standard_EXPORT Standard_Boolean GetGeom (const Standard_Integer ID, const Standard_Boolean IsElement, TColStd_Array1OfReal& Coords, Standard_Integer& NbNodes, MeshVS_EntityType& Type) const Standard_OVERRIDE;
-  
-  //! This method is similar to GetGeom, but returns only element or node type. This method is provided for
-  //! a fine performance.
-  Standard_EXPORT Standard_Boolean GetGeomType (const Standard_Integer ID, const Standard_Boolean IsElement, MeshVS_EntityType& Type) const Standard_OVERRIDE;
-  
-  //! This method returns by number an address of any entity which represents element or node data structure.
-  Standard_EXPORT Standard_Address GetAddr (const Standard_Integer ID, const Standard_Boolean IsElement) const Standard_OVERRIDE;
-  
-  //! This method returns information about what node this element consist of.
-  Standard_EXPORT virtual Standard_Boolean GetNodesByElement (const Standard_Integer ID, TColStd_Array1OfInteger& NodeIDs, Standard_Integer& NbNodes) const Standard_OVERRIDE;
-  
-  //! This method returns map of all nodes the object consist of.
-  Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const Standard_OVERRIDE;
-  
-  //! This method returns map of all elements the object consist of.
-  Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const Standard_OVERRIDE;
-  
-  //! This method calculates normal of face, which is using for correct reflection presentation.
-  //! There is default method, for advance reflection this method can be redefined.
-  Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer Id, const Standard_Integer Max, Standard_Real& nx, Standard_Real& ny, Standard_Real& nz) const Standard_OVERRIDE;
-
-
-
-
-  DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource,MeshVS_DataSource)
-
-protected:
-
-
-
-
-private:
-
-
-  Handle(Poly_Triangulation) myMesh;
-  TColStd_PackedMapOfInteger myNodes;
-  TColStd_PackedMapOfInteger myElements;
-  Handle(TColStd_HArray2OfInteger) myElemNodes;
-  Handle(TColStd_HArray2OfReal) myNodeCoords;
-  Handle(TColStd_HArray2OfReal) myElemNormals;
-
-
-};
-
-
-
-
-
-
-
-#endif // _XSDRAWSTLVRML_DataSource_HeaderFile
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.cxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.cxx
deleted file mode 100644 (file)
index 6845cad..0000000
+++ /dev/null
@@ -1,386 +0,0 @@
-// Created on: 2014-08-04
-// Created by: Artem NOVIKOV
-// Copyright (c) 2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Standard_Type.hxx>
-#include <TColgp_SequenceOfXYZ.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-#include <TColStd_DataMapOfIntegerReal.hxx>
-#include <XSDRAWSTLVRML_DataSource3D.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource3D,MeshVS_DataSource)
-
-//================================================================
-// Function : Constructor
-// Purpose  :
-//================================================================
-XSDRAWSTLVRML_DataSource3D::XSDRAWSTLVRML_DataSource3D()
-{
-  for (Standard_Integer aNodeID = 1; aNodeID <= 16; aNodeID++)
-  {
-    myNodes.Add( aNodeID );
-  }
-
-  for (Standard_Integer anElemID = 1; anElemID <= 5; anElemID++)
-  {
-    myElements.Add( anElemID );
-  }
-
-  myNodeCoords = new TColStd_HArray2OfReal(1, 16, 1, 3);
-
-  myNodeCoords->SetValue( 1, 1, 5 );
-  myNodeCoords->SetValue( 1, 2, 5 );
-  myNodeCoords->SetValue( 1, 3, 20 );
-
-  myNodeCoords->SetValue( 2, 1, 0 );
-  myNodeCoords->SetValue( 2, 2, 10 );
-  myNodeCoords->SetValue( 2, 3, 10 );
-
-  myNodeCoords->SetValue( 3, 1, 10 );
-  myNodeCoords->SetValue( 3, 2, 0 );
-  myNodeCoords->SetValue( 3, 3, 10 );
-
-  myNodeCoords->SetValue( 4, 1, 0 );
-  myNodeCoords->SetValue( 4, 2, 0 );
-  myNodeCoords->SetValue( 4, 3, 10 );
-
-  myNodeCoords->SetValue( 5, 1, -10 );
-  myNodeCoords->SetValue( 5, 2, 0 );
-  myNodeCoords->SetValue( 5, 3, 10 );
-
-  myNodeCoords->SetValue( 6, 1, -10 );
-  myNodeCoords->SetValue( 6, 2, 10 );
-  myNodeCoords->SetValue( 6, 3, 10 );
-
-  myNodeCoords->SetValue( 7, 1, -10 );
-  myNodeCoords->SetValue( 7, 2, 10 );
-  myNodeCoords->SetValue( 7, 3, 0 );
-
-  myNodeCoords->SetValue( 8, 1, -10 );
-  myNodeCoords->SetValue( 8, 2, 0 );
-  myNodeCoords->SetValue( 8, 3, 0 );
-
-  myNodeCoords->SetValue( 9, 1, 0 );
-  myNodeCoords->SetValue( 9, 2, 0 );
-  myNodeCoords->SetValue( 9, 3, 0 );
-
-  myNodeCoords->SetValue( 10, 1, 0 );
-  myNodeCoords->SetValue( 10, 2, 10 );
-  myNodeCoords->SetValue( 10, 3, 0 );
-
-  myNodeCoords->SetValue( 11, 1, 0 );
-  myNodeCoords->SetValue( 11, 2, -10 );
-  myNodeCoords->SetValue( 11, 3, 10 );
-
-  myNodeCoords->SetValue( 12, 1, 10 );
-  myNodeCoords->SetValue( 12, 2, -10 );
-  myNodeCoords->SetValue( 12, 3, 10 );
-
-  myNodeCoords->SetValue( 13, 1, 10 );
-  myNodeCoords->SetValue( 13, 2, -10 );
-  myNodeCoords->SetValue( 13, 3, 0 );
-
-  myNodeCoords->SetValue( 14, 1, 0 );
-  myNodeCoords->SetValue( 14, 2, -10 );
-  myNodeCoords->SetValue( 14, 3, 0 );
-
-  myNodeCoords->SetValue( 15, 1, 10 );
-  myNodeCoords->SetValue( 15, 2, 0 );
-  myNodeCoords->SetValue( 15, 3, 0 );
-
-  myNodeCoords->SetValue( 16, 1, 5 );
-  myNodeCoords->SetValue( 16, 2, 5 );
-  myNodeCoords->SetValue( 16, 3, -10 );
-
-  myElemNbNodes = new TColStd_HArray1OfInteger(1, 5);
-
-  myElemNbNodes->SetValue( 1, 4 );
-  myElemNbNodes->SetValue( 2, 8 );
-  myElemNbNodes->SetValue( 3, 6 );
-  myElemNbNodes->SetValue( 4, 8 );
-  myElemNbNodes->SetValue( 5, 4 );
-
-  myElemNodes = new TColStd_HArray2OfInteger(1, 5, 1, 8);
-
-  myElemNodes->SetValue(1, 1, 1);
-  myElemNodes->SetValue(1, 2, 2);
-  myElemNodes->SetValue(1, 3, 3);
-  myElemNodes->SetValue(1, 4, 4);
-
-  myElemNodes->SetValue(2, 1, 2);
-  myElemNodes->SetValue(2, 2, 4);
-  myElemNodes->SetValue(2, 3, 5);
-  myElemNodes->SetValue(2, 4, 6);
-  myElemNodes->SetValue(2, 5, 7);
-  myElemNodes->SetValue(2, 6, 8);
-  myElemNodes->SetValue(2, 7, 9);
-  myElemNodes->SetValue(2, 8, 10);
-
-  myElemNodes->SetValue(3, 1, 2);
-  myElemNodes->SetValue(3, 2, 3);
-  myElemNodes->SetValue(3, 3, 4);
-  myElemNodes->SetValue(3, 4, 10);
-  myElemNodes->SetValue(3, 5, 15);
-  myElemNodes->SetValue(3, 6, 9);
-
-  myElemNodes->SetValue(4, 1, 4);
-  myElemNodes->SetValue(4, 2, 3);
-  myElemNodes->SetValue(4, 3, 12);
-  myElemNodes->SetValue(4, 4, 11);
-  myElemNodes->SetValue(4, 5, 14);
-  myElemNodes->SetValue(4, 6, 13);
-  myElemNodes->SetValue(4, 7, 15);
-  myElemNodes->SetValue(4, 8, 9);
-
-  myElemNodes->SetValue(5, 1, 16);
-  myElemNodes->SetValue(5, 2, 15);
-  myElemNodes->SetValue(5, 3, 10);
-  myElemNodes->SetValue(5, 4, 9);
-}
-
-//================================================================
-// Function : GetGeom
-// Purpose  :
-//================================================================
-Standard_Boolean XSDRAWSTLVRML_DataSource3D::GetGeom
-( const Standard_Integer theID, const Standard_Boolean theIsElement,
- TColStd_Array1OfReal& theCoords, Standard_Integer& theNbNodes,
- MeshVS_EntityType& theType ) const
-{
-  if (theIsElement)
-  {
-    if (theID >= 1 && theID <= myElements.Extent())
-    {
-      theType = MeshVS_ET_Volume;
-      theNbNodes = myElemNbNodes->Value(theID);
-
-      for (Standard_Integer aNodeI = 1, aGlobCoordI = 1; aNodeI <= theNbNodes; aNodeI++)
-      {
-        Standard_Integer anIdxNode = myElemNodes->Value(theID, aNodeI);
-        for(Standard_Integer aCoordI = 1; aCoordI <= 3; aCoordI++, aGlobCoordI++ )
-          theCoords(aGlobCoordI) = myNodeCoords->Value(anIdxNode, aCoordI);
-      }
-
-      return Standard_True;
-    }
-    else
-      return Standard_False;
-  }
-  else
-    if (theID >= 1 && theID <= myNodes.Extent())
-    {
-      theType = MeshVS_ET_Node;
-      theNbNodes = 1;
-
-      theCoords( 1 ) = myNodeCoords->Value(theID, 1);
-      theCoords( 2 ) = myNodeCoords->Value(theID, 2);
-      theCoords( 3 ) = myNodeCoords->Value(theID, 3);
-      return Standard_True;
-    }
-    else
-      return Standard_False;
-}
-
-//================================================================
-// Function : Get3DGeom
-// Purpose  :
-//================================================================
-Standard_Boolean XSDRAWSTLVRML_DataSource3D::Get3DGeom
-( const Standard_Integer theID, Standard_Integer& theNbNodes,
- Handle(MeshVS_HArray1OfSequenceOfInteger)& theData ) const
-{
-  Handle(MeshVS_HArray1OfSequenceOfInteger) aMeshData;
-  if (theID == 1 || theID == 5)
-  {
-    aMeshData = new MeshVS_HArray1OfSequenceOfInteger(1,4);
-    theNbNodes = 4;
-    for (Standard_Integer anElemI = 1; anElemI <= 4; anElemI++)
-    {
-      aMeshData->ChangeValue(anElemI).Append( (anElemI - 1) % 4 );
-      aMeshData->ChangeValue(anElemI).Append( anElemI % 4 );
-      aMeshData->ChangeValue(anElemI).Append( (anElemI + 1) % 4 );
-    }
-    theData = aMeshData;
-    return Standard_True;
-  }
-
-  if (theID == 2 || theID == 4)
-  {
-    aMeshData = new MeshVS_HArray1OfSequenceOfInteger(1,6);
-    theNbNodes = 8;
-    for (Standard_Integer anElemI = 1, k = 1; anElemI <= 4; anElemI++)
-    {
-      aMeshData->ChangeValue(anElemI).Append( (k - 1) % 8 );
-      aMeshData->ChangeValue(anElemI).Append( k % 8 );
-      aMeshData->ChangeValue(anElemI).Append( (k + 1) % 8 );
-      aMeshData->ChangeValue(anElemI).Append( (k + 2) % 8 );
-      k+=2;
-    }
-
-    aMeshData->ChangeValue(5).Append( 0 );
-    aMeshData->ChangeValue(5).Append( 3 );
-    aMeshData->ChangeValue(5).Append( 4 );
-    aMeshData->ChangeValue(5).Append( 7 );
-
-    aMeshData->ChangeValue(6).Append( 1 );
-    aMeshData->ChangeValue(6).Append( 2 );
-    aMeshData->ChangeValue(6).Append( 5 );
-    aMeshData->ChangeValue(6).Append( 6 );
-
-    theData = aMeshData;
-    return Standard_True;
-  }
-
-  if (theID == 3)
-  {
-    aMeshData = new MeshVS_HArray1OfSequenceOfInteger(1,5);
-    theNbNodes = 6;
-    for (Standard_Integer anElemI = 1; anElemI <= 2; anElemI++)
-    {
-      aMeshData->ChangeValue(anElemI).Append( (anElemI - 1) * 3 );
-      aMeshData->ChangeValue(anElemI).Append( (anElemI - 1) * 3 + 1 );
-      aMeshData->ChangeValue(anElemI).Append( (anElemI - 1) * 3 + 2 );
-    }
-    for (Standard_Integer anElemI = 1; anElemI <= 3; anElemI++)
-    {
-      aMeshData->ChangeValue(2 + anElemI).Append( (anElemI - 1) % 3 );
-      aMeshData->ChangeValue(2 + anElemI).Append( anElemI % 3 );
-      aMeshData->ChangeValue(2 + anElemI).Append( anElemI % 3 + 3 );
-      aMeshData->ChangeValue(2 + anElemI).Append( (anElemI - 1) % 3 + 3 );
-    }
-    theData = aMeshData;
-    return Standard_True;
-  }
-
-  return Standard_False;
-}
-
-//================================================================
-// Function : GetGeomType
-// Purpose  :
-//================================================================
-Standard_Boolean XSDRAWSTLVRML_DataSource3D::GetGeomType
-( const Standard_Integer theID,
- const Standard_Boolean theIsElement,
- MeshVS_EntityType& theType ) const
-{
-  if (theIsElement)
-  {
-    if (theID >= 1 && theID <= myElements.Extent())
-    {
-      theType = MeshVS_ET_Volume;
-      return Standard_True;
-    }
-  }
-  else
-    if (theID >= 1 && theID <= myNodes.Extent())
-    {
-      theType = MeshVS_ET_Node;
-      return Standard_True;
-    }
-
-  return Standard_False;
-}
-
-//================================================================
-// Function : GetAddr
-// Purpose  :
-//================================================================
-Standard_Address XSDRAWSTLVRML_DataSource3D::GetAddr
-( const Standard_Integer, const Standard_Boolean ) const
-{
-  return NULL;
-}
-
-//================================================================
-// Function : GetNodesByElement
-// Purpose  :
-//================================================================
-Standard_Boolean XSDRAWSTLVRML_DataSource3D::GetNodesByElement
-( const Standard_Integer theID,
- TColStd_Array1OfInteger& theNodeIDs,
- Standard_Integer& theNbNodes ) const
-{
-  Standard_Integer aLow;
-  if (theID == 1 || theID == 5)
-  {
-    theNbNodes = 4;
-    aLow = theNodeIDs.Lower();
-    theNodeIDs (aLow)     = myElemNodes->Value(theID, 1 );
-    theNodeIDs (aLow + 1) = myElemNodes->Value(theID, 2 );
-    theNodeIDs (aLow + 2) = myElemNodes->Value(theID, 3 );
-    theNodeIDs (aLow + 3) = myElemNodes->Value(theID, 4 );
-    return Standard_True;
-  }
-
-  if (theID == 2 || theID == 4)
-  {
-    theNbNodes = 8;
-    aLow = theNodeIDs.Lower();
-    theNodeIDs (aLow)     = myElemNodes->Value(theID, 1 );
-    theNodeIDs (aLow + 1) = myElemNodes->Value(theID, 2 );
-    theNodeIDs (aLow + 2) = myElemNodes->Value(theID, 3 );
-    theNodeIDs (aLow + 3) = myElemNodes->Value(theID, 4 );
-    theNodeIDs (aLow + 4) = myElemNodes->Value(theID, 5 );
-    theNodeIDs (aLow + 5) = myElemNodes->Value(theID, 6 );
-    theNodeIDs (aLow + 6) = myElemNodes->Value(theID, 7 );
-    theNodeIDs (aLow + 7) = myElemNodes->Value(theID, 8 );
-    return Standard_True;
-  }
-
-    if (theID == 3)
-  {
-    theNbNodes = 6;
-    aLow = theNodeIDs.Lower();
-    theNodeIDs (aLow)     = myElemNodes->Value(theID, 1 );
-    theNodeIDs (aLow + 1) = myElemNodes->Value(theID, 2 );
-    theNodeIDs (aLow + 2) = myElemNodes->Value(theID, 3 );
-    theNodeIDs (aLow + 3) = myElemNodes->Value(theID, 4 );
-    theNodeIDs (aLow + 4) = myElemNodes->Value(theID, 5 );
-    theNodeIDs (aLow + 5) = myElemNodes->Value(theID, 6 );
-    return Standard_True;
-  }
-
-  return Standard_False;
-}
-
-//================================================================
-// Function : GetAllNodes
-// Purpose  :
-//================================================================
-const TColStd_PackedMapOfInteger& XSDRAWSTLVRML_DataSource3D::GetAllNodes() const
-{
-  return myNodes;
-}
-
-//================================================================
-// Function : GetAllElements
-// Purpose  :
-//================================================================
-const TColStd_PackedMapOfInteger& XSDRAWSTLVRML_DataSource3D::GetAllElements() const
-{
-  return myElements;
-}
-
-//================================================================
-// Function : GetNormal
-// Purpose  :
-//================================================================
-Standard_Boolean XSDRAWSTLVRML_DataSource3D::GetNormal
-( const Standard_Integer /*theID*/, const Standard_Integer /*theMax*/,
- Standard_Real& /*theNx*/, Standard_Real& /*theNy*/,Standard_Real& /*theNz*/ ) const
-{
-  return Standard_False;
-}
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.hxx
deleted file mode 100644 (file)
index aac3345..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-// Created on: 2014-08-04
-// Created by: Artem NOVIKOV
-// Copyright (c) 2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _XSDRAWSTLVRML_DataSource3D_HeaderFile
-#define _XSDRAWSTLVRML_DataSource3D_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TColStd_HArray1OfInteger.hxx>
-#include <TColStd_HArray2OfReal.hxx>
-#include <TColStd_HArray2OfInteger.hxx>
-#include <MeshVS_DataSource.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <MeshVS_EntityType.hxx>
-#include <MeshVS_HArray1OfSequenceOfInteger.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-
-
-class XSDRAWSTLVRML_DataSource3D;
-DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource3D, MeshVS_DataSource)
-
-//! The sample DataSource3D for working with STLMesh_Mesh
-class XSDRAWSTLVRML_DataSource3D : public MeshVS_DataSource
-{
-
-public:
-
-  
-  //! Constructor
-  Standard_EXPORT XSDRAWSTLVRML_DataSource3D();
-  
-  //! Returns geometry information about node (if IsElement is False) or element (IsElement is True) by coordinates.
-  //! For element this method must return all its nodes coordinates in the strict order: X, Y, Z and
-  //! with nodes order is the same as in wire bounding the face or link. NbNodes is number of nodes of element.
-  //! It is recommended to return 1 for node. Type is an element type.
-  Standard_EXPORT Standard_Boolean GetGeom (const Standard_Integer theID, const Standard_Boolean theIsElement, TColStd_Array1OfReal& theCoords, Standard_Integer& theNbNodes, MeshVS_EntityType& theType) const Standard_OVERRIDE;
-  
-  //! This method returns topology information about 3D-element
-  //! Returns false if element with ID isn't 3D or because other troubles
-  Standard_EXPORT virtual Standard_Boolean Get3DGeom (const Standard_Integer theID, Standard_Integer& theNbNodes, Handle(MeshVS_HArray1OfSequenceOfInteger)& theData) const Standard_OVERRIDE;
-  
-  //! This method is similar to GetGeom, but returns only element or node type. This method is provided for
-  //! a fine performance.
-  Standard_EXPORT Standard_Boolean GetGeomType (const Standard_Integer theID, const Standard_Boolean theIsElement, MeshVS_EntityType& theType) const Standard_OVERRIDE;
-  
-  //! This method returns by number an address of any entity which represents element or node data structure.
-  Standard_EXPORT Standard_Address GetAddr (const Standard_Integer theID, const Standard_Boolean theIsElement) const Standard_OVERRIDE;
-  
-  //! This method returns information about what node this element consist of.
-  Standard_EXPORT virtual Standard_Boolean GetNodesByElement (const Standard_Integer theID, TColStd_Array1OfInteger& theNodeIDs, Standard_Integer& theNbNodes) const Standard_OVERRIDE;
-  
-  //! This method returns map of all nodes the object consist of.
-  Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const Standard_OVERRIDE;
-  
-  //! This method returns map of all elements the object consist of.
-  Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const Standard_OVERRIDE;
-  
-  //! This method calculates normal of face, which is using for correct reflection presentation.
-  //! There is default method, for advance reflection this method can be redefined.
-  Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer theID, const Standard_Integer theMax, Standard_Real& theNx, Standard_Real& theNy, Standard_Real& theNz) const Standard_OVERRIDE;
-
-
-
-
-  DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource3D,MeshVS_DataSource)
-
-protected:
-
-
-
-
-private:
-
-
-  TColStd_PackedMapOfInteger myNodes;
-  TColStd_PackedMapOfInteger myElements;
-  Handle(TColStd_HArray1OfInteger) myElemNbNodes;
-  Handle(TColStd_HArray2OfReal) myNodeCoords;
-  Handle(TColStd_HArray2OfInteger) myElemNodes;
-
-
-};
-
-
-
-
-
-
-
-#endif // _XSDRAWSTLVRML_DataSource3D_HeaderFile
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.cxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.cxx
deleted file mode 100644 (file)
index ef2dd5b..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-// Created on: 2004-06-11
-// Created by: Alexander SOLOVYOV
-// Copyright (c) 2004-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Draw_Display.hxx>
-#include <MeshVS_Mesh.hxx>
-#include <Standard_Type.hxx>
-#include <XSDRAWSTLVRML_DrawableMesh.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(XSDRAWSTLVRML_DrawableMesh,Draw_Drawable3D)
-
-//================================================================
-// Function : DrawOn
-// Purpose  :
-//================================================================
-XSDRAWSTLVRML_DrawableMesh::XSDRAWSTLVRML_DrawableMesh( const Handle( MeshVS_Mesh )& aMesh )
-{
-  myMesh = aMesh;
-}
-
-//================================================================
-// Function :
-// Purpose  :
-//================================================================
-void XSDRAWSTLVRML_DrawableMesh::DrawOn(Draw_Display& /*d*/) const
-{
-}
-
-//================================================================
-// Function :
-// Purpose  :
-//================================================================
-Handle( MeshVS_Mesh ) XSDRAWSTLVRML_DrawableMesh::GetMesh() const
-{
-  return myMesh;
-}
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.hxx
deleted file mode 100644 (file)
index d4fd63b..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-// Created on: 2004-06-11
-// Created by: Alexander SOLOVYOV
-// Copyright (c) 2004-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _XSDRAWSTLVRML_DrawableMesh_HeaderFile
-#define _XSDRAWSTLVRML_DrawableMesh_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Draw_Drawable3D.hxx>
-class MeshVS_Mesh;
-class Draw_Display;
-
-
-class XSDRAWSTLVRML_DrawableMesh;
-DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DrawableMesh, Draw_Drawable3D)
-
-
-class XSDRAWSTLVRML_DrawableMesh : public Draw_Drawable3D
-{
-
-public:
-
-  
-  Standard_EXPORT XSDRAWSTLVRML_DrawableMesh(const Handle(MeshVS_Mesh)& aMesh);
-  
-  Standard_EXPORT virtual void DrawOn (Draw_Display& dis) const Standard_OVERRIDE;
-  
-  Standard_EXPORT Handle(MeshVS_Mesh) GetMesh() const;
-
-
-
-
-  DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DrawableMesh,Draw_Drawable3D)
-
-protected:
-
-
-
-
-private:
-
-
-  Handle(MeshVS_Mesh) myMesh;
-
-
-};
-
-
-
-
-
-
-
-#endif // _XSDRAWSTLVRML_DrawableMesh_HeaderFile
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_ElemNodesMap.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_ElemNodesMap.hxx
deleted file mode 100644 (file)
index 65445ec..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Created on: 2000-05-30
-// Created by: Sergey MOZOKHIN
-// Copyright (c) 2000-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef XSDRAWSTLVRML_ElemNodesMap_HeaderFile
-#define XSDRAWSTLVRML_ElemNodesMap_HeaderFile
-
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-#include <NCollection_DataMap.hxx>
-
-typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerInteger> XSDRAWSTLVRML_ElemNodesMap;
-typedef NCollection_DataMap<Standard_Integer,TColStd_DataMapOfIntegerInteger>::Iterator XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap;
-
-
-#endif
diff --git a/src/XSDRAWVRML/FILES b/src/XSDRAWVRML/FILES
new file mode 100644 (file)
index 0000000..e2a81aa
--- /dev/null
@@ -0,0 +1,2 @@
+XSDRAWVRML.cxx
+XSDRAWVRML.hxx
diff --git a/src/XSDRAWVRML/XSDRAWVRML.cxx b/src/XSDRAWVRML/XSDRAWVRML.cxx
new file mode 100644 (file)
index 0000000..20541ee
--- /dev/null
@@ -0,0 +1,411 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XSDRAWVRML.hxx>
+
+#include <DBRep.hxx>
+#include <DDocStd.hxx>
+#include <DDocStd_DrawDocument.hxx>
+#include <Draw.hxx>
+#include <Draw_Interpretor.hxx>
+#include <Draw_PluginMacro.hxx>
+#include <Draw_ProgressIndicator.hxx>
+#include <OSD_Path.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDocStd_Application.hxx>
+#include <TopoDS_Shape.hxx>
+#include <UnitsAPI.hxx>
+#include <UnitsMethods.hxx>
+#include <VrmlAPI_CafReader.hxx>
+#include <VrmlAPI_Writer.hxx>
+#include <VrmlData_DataMapOfShapeAppearance.hxx>
+#include <VrmlData_Scene.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
+#include <XSAlgo.hxx>
+#include <XSAlgo_AlgoContainer.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <XSDRAW.hxx>
+
+//=============================================================================
+//function : parseCoordinateSystem
+//purpose  : Parse RWMesh_CoordinateSystem enumeration
+//=============================================================================
+static bool parseCoordinateSystem(const char* theArg,
+                                  RWMesh_CoordinateSystem& theSystem)
+{
+  TCollection_AsciiString aCSStr(theArg);
+  aCSStr.LowerCase();
+  if (aCSStr == "zup")
+  {
+    theSystem = RWMesh_CoordinateSystem_Zup;
+  }
+  else if (aCSStr == "yup")
+  {
+    theSystem = RWMesh_CoordinateSystem_Yup;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+
+//=======================================================================
+//function : ReadVrml
+//purpose  :
+//=======================================================================
+static Standard_Integer ReadVrml(Draw_Interpretor& theDI,
+                                 Standard_Integer  theArgc,
+                                 const char**      theArgv)
+{
+  if(theArgc < 3)
+  {
+    theDI.PrintHelp(theArgv[0]);
+    return 1;
+  }
+
+  Handle(TDocStd_Document) aDoc;
+  Standard_Real aFileUnitFactor = 1.0;
+  RWMesh_CoordinateSystem aFileCoordSys = RWMesh_CoordinateSystem_Yup, aSystemCoordSys = RWMesh_CoordinateSystem_Zup;
+  Standard_Boolean toUseExistingDoc = Standard_False;
+  Standard_Boolean toFillIncomplete = Standard_True;
+  Standard_CString aDocName = NULL;
+  TCollection_AsciiString aFilePath;
+
+  for(Standard_Integer anArgIt = 1; anArgIt < theArgc; anArgIt++)
+  {
+    TCollection_AsciiString anArg(theArgv[anArgIt]);
+    anArg.LowerCase();
+    if(anArgIt + 1 < theArgc && anArg == "-fileunit")
+    {
+      const TCollection_AsciiString aUnitStr(theArgv[++anArgIt]);
+      aFileUnitFactor = UnitsAPI::AnyToSI(1.0, aUnitStr.ToCString());
+      if (aFileUnitFactor <= 0.0)
+      {
+        Message::SendFail() << "Error: wrong length unit '" << aUnitStr << "'";
+        return 1;
+      }
+    }
+    else if (anArgIt + 1 < theArgc && anArg == "-filecoordsys")
+    {
+      if (!parseCoordinateSystem(theArgv[++anArgIt], aFileCoordSys))
+      {
+        Message::SendFail() << "Error: unknown coordinate system '" << theArgv[anArgIt] << "'";
+        return 1;
+      }
+    }
+    else if (anArgIt + 1 < theArgc && anArg == "-systemcoordsys")
+    {
+      if (!parseCoordinateSystem(theArgv[++anArgIt], aSystemCoordSys))
+      {
+        Message::SendFail() << "Error: unknown coordinate system '" << theArgv[anArgIt] << "'";
+        return 1;
+      }
+    }
+    else if (anArg == "-fillincomplete")
+    {
+      toFillIncomplete = true;
+      if (anArgIt + 1 < theArgc && Draw::ParseOnOff(theArgv[anArgIt + 1], toFillIncomplete))
+      {
+        ++anArgIt;
+      }
+    }
+    else if (anArg == "-nocreatedoc")
+    {
+      toUseExistingDoc = true;
+    }
+    else if (aDocName == nullptr)
+    {
+      aDocName = theArgv[anArgIt];
+      DDocStd::GetDocument(aDocName, aDoc, Standard_False);
+    }
+    else if(aFilePath.IsEmpty())
+    {
+      aFilePath = theArgv[anArgIt];
+    }
+    else
+    {
+      Message::SendFail() << "Syntax error at '" << theArgv[anArgIt] << "'";
+      return 1;
+    }
+  }
+
+  if (aFilePath.IsEmpty() || aDocName == nullptr)
+  {
+    Message::SendFail() << "Syntax error: wrong number of arguments";
+    return 1;
+  }
+  
+  if (aDoc.IsNull())
+  {
+    if(toUseExistingDoc)
+    {
+      Message::SendFail() << "Error: document with name " << aDocName << " does not exist";
+      return 1;
+    }
+    Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
+    anApp->NewDocument("BinXCAF", aDoc);
+  }
+  else if (!toUseExistingDoc)
+  {
+    Message::SendFail() << "Error: document with name " << aDocName << " already exists\n";
+    return 1;
+  }
+
+  Standard_Real aScaleFactor = 1.;
+  if (!XCAFDoc_DocumentTool::GetLengthUnit(aDoc, aScaleFactor))
+  {
+    XSAlgo::AlgoContainer()->PrepareForTransfer();
+    aScaleFactor = UnitsMethods::GetCasCadeLengthUnit();
+  }
+
+  VrmlAPI_CafReader aVrmlReader;
+  aVrmlReader.SetDocument(aDoc);
+  aVrmlReader.SetFileLengthUnit(aFileUnitFactor);
+  aVrmlReader.SetSystemLengthUnit(aScaleFactor);
+  aVrmlReader.SetFileCoordinateSystem(aFileCoordSys);
+  aVrmlReader.SetSystemCoordinateSystem(aSystemCoordSys);
+  aVrmlReader.SetFillIncompleteDocument(toFillIncomplete);
+
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI, 1);
+  if (!aVrmlReader.Perform(aFilePath, aProgress->Start()))
+  {
+    if (aVrmlReader.ExtraStatus() != RWMesh_CafReaderStatusEx_Partial)
+    {
+      Message::SendFail() << "Error: file reading failed '" << aFilePath << "'";
+      return 1;
+    }
+    Message::SendWarning() <<
+      "Warning: file has been read paratially (due to unexpected EOF, syntax error, memory limit) " << aFilePath;
+  }
+
+  TDataStd_Name::Set(aDoc->GetData()->Root(), aDocName);
+  Handle(DDocStd_DrawDocument) aDD = new DDocStd_DrawDocument(aDoc);
+  Draw::Set(aDocName, aDD);
+
+  return 0;
+}
+
+//=======================================================================
+//function : WriteVrml
+//purpose  : Write DECAF document to Vrml
+//=======================================================================
+static Standard_Integer WriteVrml(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3)
+  {
+    di << "Use: " << argv[0] << " Doc filename: write document to Vrml file\n";
+    return 0;
+  }
+
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull())
+  {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+
+  if (argc < 3 || argc > 5)
+  {
+    di << "wrong number of parameters\n";
+    return 0;
+  }
+
+  VrmlAPI_Writer writer;
+  writer.SetRepresentation(VrmlAPI_ShadedRepresentation);
+  Standard_Real aScaleFactorM = 1.;
+  if (!XCAFDoc_DocumentTool::GetLengthUnit(aDoc, aScaleFactorM))
+  {
+    XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
+    aScaleFactorM = UnitsMethods::GetCasCadeLengthUnit(UnitsMethods_LengthUnit_Meter);
+  }
+  if (!writer.WriteDoc(aDoc, argv[2], aScaleFactorM))
+  {
+    di << "Error: File " << argv[2] << " was not written\n";
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : loadvrml
+//purpose  :
+//=======================================================================
+
+static Standard_Integer loadvrml
+(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc<3) di << "wrong number of parameters"    << "\n";
+  else {
+    TopoDS_Shape aShape ;
+    VrmlData_DataMapOfShapeAppearance aShapeAppMap;
+
+    //-----------------------------------------------------------
+    std::filebuf aFic;
+    std::istream aStream (&aFic);
+
+    if (aFic.open(argv[2], std::ios::in)) {
+
+      // Get path of the VRML file.
+      OSD_Path aPath(argv[2]);
+      TCollection_AsciiString aVrmlDir(".");
+      TCollection_AsciiString aDisk = aPath.Disk();
+      TCollection_AsciiString aTrek = aPath.Trek();
+      if (!aTrek.IsEmpty())
+      {
+        if (!aDisk.IsEmpty())
+          aVrmlDir = aDisk;
+        else
+          aVrmlDir.Clear();
+        aTrek.ChangeAll('|', '/');
+        aVrmlDir += aTrek;
+      }
+
+      VrmlData_Scene aScene;
+      const Standard_Real anOCCUnitMM = XSDRAW::GetLengthUnit();
+      aScene.SetLinearScale(1000. / anOCCUnitMM);
+
+      aScene.SetVrmlDir (aVrmlDir);
+      aScene << aStream;
+      const char * aStr = 0L;
+      switch (aScene.Status()) {
+
+      case VrmlData_StatusOK:
+        {
+          aShape = aScene.GetShape(aShapeAppMap);
+          break;
+        }
+      case VrmlData_EmptyData:            aStr = "EmptyData"; break;
+      case VrmlData_UnrecoverableError:   aStr = "UnrecoverableError"; break;
+      case VrmlData_GeneralError:         aStr = "GeneralError"; break;
+      case VrmlData_EndOfFile:            aStr = "EndOfFile"; break;
+      case VrmlData_NotVrmlFile:          aStr = "NotVrmlFile"; break;
+      case VrmlData_CannotOpenFile:       aStr = "CannotOpenFile"; break;
+      case VrmlData_VrmlFormatError:      aStr = "VrmlFormatError"; break;
+      case VrmlData_NumericInputError:    aStr = "NumericInputError"; break;
+      case VrmlData_IrrelevantNumber:     aStr = "IrrelevantNumber"; break;
+      case VrmlData_BooleanInputError:    aStr = "BooleanInputError"; break;
+      case VrmlData_StringInputError:     aStr = "StringInputError"; break;
+      case VrmlData_NodeNameUnknown:      aStr = "NodeNameUnknown"; break;
+      case VrmlData_NonPositiveSize:      aStr = "NonPositiveSize"; break;
+      case VrmlData_ReadUnknownNode:      aStr = "ReadUnknownNode"; break;
+      case VrmlData_NonSupportedFeature:  aStr = "NonSupportedFeature"; break;
+      case VrmlData_OutputStreamUndefined:aStr = "OutputStreamUndefined"; break;
+      case VrmlData_NotImplemented:       aStr = "NotImplemented"; break;
+      default:
+        break;
+      }
+      if (aStr) {
+        di << " ++ VRML Error: " << aStr << " in line "
+          << aScene.GetLineError() << "\n";
+      }
+      else {
+        DBRep::Set(argv[1],aShape);
+      }
+    }
+    else {
+      di << "cannot open file\n";
+    }
+
+
+    //-----------------------------------------------------------
+  }
+  return 0;
+}
+
+//=============================================================================
+//function : writevrml
+//purpose  :
+//=============================================================================
+static Standard_Integer writevrml
+(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3 || argc > 5) 
+  {
+    di << "wrong number of parameters\n";
+    return 0;
+  }
+
+  TopoDS_Shape aShape = DBRep::Get(argv[1]);
+
+  // Get the optional parameters
+  Standard_Integer aVersion = 2;
+  Standard_Integer aType = 1;
+  if (argc >= 4)
+  {
+    aVersion = Draw::Atoi(argv[3]);
+    if (argc == 5)
+      aType = Draw::Atoi(argv[4]);
+  }
+
+  // Bound parameters
+  aVersion = Max(1, aVersion);
+  aVersion = Min(2, aVersion);
+  aType = Max(0, aType);
+  aType = Min(2, aType);
+
+  VrmlAPI_Writer writer;
+
+  switch (aType)
+  {
+  case 0: writer.SetRepresentation(VrmlAPI_ShadedRepresentation); break;
+  case 1: writer.SetRepresentation(VrmlAPI_WireFrameRepresentation); break;
+  case 2: writer.SetRepresentation(VrmlAPI_BothRepresentation); break;
+  }
+
+  if (!writer.Write(aShape, argv[2], aVersion))
+  {
+    di << "Error: File " << argv[2] << " was not written\n";
+  }
+
+  return 0;
+}
+
+//=============================================================================
+//function : Factory
+//purpose  :
+//=============================================================================
+void XSDRAWVRML::Factory(Draw_Interpretor& theDI)
+{
+  static Standard_Boolean anInitActor = Standard_False;
+  if (anInitActor)
+  {
+    return;
+  }
+  anInitActor = Standard_True;
+
+  Standard_CString aGroup = "XDE translation commands";
+  theDI.Add("ReadVrml",
+            "ReadVrml docName filePath [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]"
+            "\n\t\t:                   [-systemCoordSys {Zup|Yup}] [-noCreateDoc] [-fillIncomplete {ON|OFF}]"
+            "\n\t\t: Read Vrml file into XDE document."
+            "\n\t\t:   -fileCoordSys   coordinate system defined by Vrml file; Yup when not specified."
+            "\n\t\t:   -fileUnit       length unit of Vrml file content."
+            "\n\t\t:   -systemCoordSys result coordinate system; Zup when not specified."
+            "\n\t\t:   -noCreateDoc    read into existing XDE document."
+            "\n\t\t:   -fillIncomplete fill the document with partially retrieved data even if reader has failed with "
+            "error; true when not specified",
+            __FILE__, ReadVrml, aGroup);
+  theDI.Add("WriteVrml",
+            "WriteVrml Doc filename [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 0 by default]",
+            __FILE__, WriteVrml, aGroup);
+  theDI.Add("loadvrml", "shape file", __FILE__, loadvrml, aGroup);
+  theDI.Add("writevrml", "shape file [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 1 by default]", __FILE__, writevrml, aGroup);
+
+  // Load XSDRAW session for pilot activation
+  XSDRAW::LoadDraw(theDI);
+}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(XSDRAWVRML)
diff --git a/src/XSDRAWVRML/XSDRAWVRML.hxx b/src/XSDRAWVRML/XSDRAWVRML.hxx
new file mode 100644 (file)
index 0000000..bc969ff
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XSDRAWVRML_HeaderFile
+#define _XSDRAWVRML_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+
+#include <Draw_Interpretor.hxx>
+
+class XSDRAWVRML
+{
+  DEFINE_STANDARD_ALLOC
+public:
+
+  //! Loads all Draw commands of XSDRAWVRML. Used for plugin.
+  Standard_EXPORT static void Factory(Draw_Interpretor& theDI);
+};
+
+#endif // _XSDRAWVRML_HeaderFile
index 03f4e2d75096f6bd1a09a0c2a745f37b943d0d8f..5900af688c7435b6ce041ca0084df8335583fee5 100644 (file)
@@ -17,6 +17,6 @@ close $fd
 
 puts "# Load IGES file which is known to generate the message, and check it"
 puts "REQUIRED 14673 ALL: $message"
-pload XSDRAW
+pload XSDRAW IGES
 igesbrep [locate_data_file hammer.iges] a *
 tpstat c
index 6565838f346d18869bac607a8f4a09f7dbf4a776..3c6d85101cfc79ff7570ac4dbfedf45afa1fb937 100755 (executable)
@@ -6,7 +6,7 @@ puts ""
 # Visualization - randomly directed arrows on test v3d mesh B7
 ##########################################################################################################
 
-pload XSDRAW
+pload XSDRAW STL
 
 vinit
 vclear
index 0afa733714bdab4c96810f996fbbb886825f45ad..350c2931ceb7508700f51a65806d3910db227817 100755 (executable)
@@ -6,6 +6,8 @@ puts ""
 ## stack overflow during reading IGES in Test Harness
 #############################
 
+pload IGES
+
 restore [locate_data_file bug23722_face.brep]
 
 brepiges bug23722_face ${imagedir}/face.igs
index b985c886595b01b8a65696ebb2c46f80a5e84375..aa94f633c02676e92d93ad5067550afa2342cf0c 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 ## Faulty shape after IGES translation with xstep.cascade.unit set to M
 #######################################################################
 
-pload DATAEXCHANGEKERNEL
+pload DATAEXCHANGEKERNEL IGES
 
 param xstep.cascade.unit M
 
index 954bdeebf6347d20c5d3fb0e762a041cd2e307b5..271c05880e9211db7383a4913195692b6893a534 100644 (file)
@@ -2,6 +2,8 @@ puts "========"
 puts "0024983: For the incorrect seam edge in STEP file no fix is provided"
 puts "========"
 
+pload STEP
+
 stepread [locate_data_file bug24983_111FACE.stp] a *
 
 tpcompound result
index ad0b14358a4e24d62da66ce205c8744bb7ab6d56..feea5583ae5282a1f024bf44840db3f1c5e1c2b5 100755 (executable)
@@ -6,6 +6,8 @@ puts ""
 # ShapeFix_Wire tweaks for better results
 ##################################################
 
+pload STEP
+
 stepread [locate_data_file bug25013_25013faces.stp] a *
 
 tpcompound result
index 675c6584314dee6262ef3d4f18c376142edad701..c7cbc05b47b41b7bb6255b8de475a07e0431b180 100755 (executable)
@@ -6,6 +6,8 @@ puts ""
 # ShapeFix_Wire tweaks for better results
 ##################################################
 
+pload STEP
+
 stepread [locate_data_file bug25013_25013face.stp] a *
 
 tpcompound result
index 198c196655798bd18d76ffa38ae85ba7d12d6763..a6e2a2d0135bd105cffcc5ccb3156c029ffd07c2 100755 (executable)
@@ -6,6 +6,8 @@ puts ""
 # Self Intersecting wire translated from STEP file
 #######################################################################################
 
+pload STEP
+
 set BugNumber OCC25823
 
 set aFile [locate_data_file bug25823_280612.stp]
index 9e49db5afcef735a46187a7aa6ff862eb6cbfc99..b857a7a633a20c2cf2863e5370f9b0566b014167 100644 (file)
@@ -8,5 +8,7 @@ puts ""
 # Mechanism 'ShapeFix' is unable to heal a shape
 ##################################################
 
+pload STEP
+
 stepread [locate_data_file bug26280_1kento13-mld-b-cv-qubit.stp] r *
 checkshape r_1
index abdc6f4e171fd87fbbc43b65da860e17265d5d7c..6ab635e35a63992f5ab67ded45f3ba74568858b4 100644 (file)
@@ -2,6 +2,8 @@ puts "========================"
 puts "0026671: Infinite loop in ShapeFix_Wire::FixSelfIntersection()"
 puts "========================"                                                                                      
 
+pload IGES
+
 cpulimit 20
 igesbrep [locate_data_file bug26671.igs] result *
 
index 2f532c36e9cb3ea0dac29d0c8951347463c04197..c21c679240d8587b3927c14285221f8332e73a07 100644 (file)
@@ -2,6 +2,8 @@
 # OCC27078: Exception in ShapeFixIntersectionTool::UnionVertexes()
 ##################################################################
 
+pload IGES
+
 testreadiges [locate_data_file bug27078.igs] a
 
 # fixshape should not throw an exception
index 447bd9d7645982428222eac04189d572cc82e55d..8ea429b05395f63ba817ab88335e5f8fc2515e13 100644 (file)
@@ -6,6 +6,8 @@ puts ""
 ## Crash when calling ShapeUpgrade_UnifySameDomain
 ###############################
 
+pload STEP
+
 stepread [locate_data_file bug27894_usd_raises_Standard_NullObject.stp] a *
 renamevar a_1 a
 unifysamedom result a
index 4650b331aeddd19fde1123e234a7990f05aff4b5..871e9c768806122dc4d4e6882361f68a07612669 100644 (file)
@@ -3,6 +3,8 @@ puts " OCC33028: Standard_ConstructionError while using ShapeUpgrade_UnifySameDo
 puts "========================"
 puts ""
 
+pload STEP
+
 stepread [locate_data_file bug33028_kalip.stp] s *
 
 set nbsBefore "
index 099597bb9d766b636d57a28f7846cf967aeed0bd..d49d338ebaa4bb7078463cf0ded1df1575ff384a 100644 (file)
@@ -3,6 +3,8 @@ puts "0033398: Modeling Algorithms - ShapeUpgrade_UnifySameDomain fails on speci
 puts "========================================="
 puts ""
 
+pload STEP
+
 testreadstep [locate_data_file bug33398.step] s 
 unifysamedom result s 
 
index d27e71e68cd6190ce92fd094688954f454b8fb13..de6fa12669509ecd4bdf946b6afe9a6a09630830 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 # Mesh generation hangs then crashes
 ###########################################
 
-pload DATAEXCHANGEKERNEL
+pload DATAEXCHANGEKERNEL STEP
 
 testreadstep [locate_data_file bug28118_18547.stp] result
 vclear
index f222bbafed00f1d926847886a129e1f0ad1d771a..9dc70f3544fd0a846369f69cf3d8115feef22ee8 100644 (file)
@@ -3,7 +3,7 @@ puts "0029715: Mesh - Estimate the grid size of the acceleration structure by th
 puts "======="
 puts ""
 
-if {[info commands stepread] == ""} {pload XSDRAW}
+if {[info commands stepread] == ""} {pload XSDRAW STEP}
 
 stepread [locate_data_file bug29715_slow.stp] a *
 renamevar a_1 a
index 2cd32d7bf9697413fb383f99db3d337ab3dbb013..20e64327fd5f807f255682def75897e63608a50d 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index e31fdedff520312be7285377103d8cdfd1d97653..c73453d32e886450faf89831f2337ed0189ebfce 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index 55fb7187b55ce920ad3c8b19d4502e2829302d96..e3cc2c2b8b36b47fb2df4d7d8df4ad625347f114 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index 0852f3afe424739a03b0cb5daf5ef2a644a8ec16..fc113cff9fd2bb43b8770e188f06afa703687004 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index 1fa251f0b7f796aa24dd5935b44d182bb6139c62..82dbae1ae2f77f253b0e11fee4876f0444ec7df0 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index a7c954ab328ceb12e8e06c7870db64371e68d2a5..3ac88ab092bf7e233d3934e1ee08282d0c6c6477 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index fb00750bf20f04cc34537d158afe93c61bb4bc56..5adb694ba68255ee14908fafd34ccdd69ebeb1a1 100755 (executable)
@@ -9,7 +9,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index c8d4075ad64a43c840919b39d9fa257766c2bedf..d02d3786f9eb4a23ba7567736e66cd41d30158c1 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index 29a054a7fea8ff8211804d030a16ea0f5985b75e..70d9cfbaa26172ea70ccb4f8a7a747e779ef2a42 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index b21c170049e0ee22091503adff1898b21dae8ad9..bedb0f9b6eab11262632d42d29edb2f3912d7d2f 100755 (executable)
@@ -10,7 +10,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index f315de1a74801ef9f4b92754b6fe792d627e1846..7733db62beb070e55d643c8dc166e9e7452ad715 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index c3ab3fabdb760b16ca6c7ff7703be1ed6e2b44ec..ccf3c2c8769cfa57a6283d1dd185d3a85ef966b3 100755 (executable)
@@ -12,7 +12,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index c8d220c30227e576f673580e8ef67e4519cebd37..0f8411ae823235e9727c8dcf7de47ad8196a3190 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index 0f458a213a0bec16ba1bf61826a5354803dcd096..e0d877be1fb7c9b9c1be440d835e79b7e26dcfeb 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index eac4f7ae9bb739fade43a76b29a6b93b8ee337c2..b848933829748eaab39661247d8196e6b22ee44c 100755 (executable)
@@ -10,7 +10,7 @@ set BugNumber OCC8842
 
 cpulimit 500
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index 597ab23ac83e80e47d20f27254650a51ba004b0d..39504a2bdb9cc97b07d55343d066472ab194880c 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC8842
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload XSDRAW IGES}
 
 proc myoffset {result sh val tan} {
   if {$tan == 1} {
index ee7c73ee8286e1c0330058f61fe5c0375f4f18f8..426fc25d6a857a709f0e2b103d1998a3684ac91c 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 # BRepBuilderAPI_Sewing can crash if an edge without 3D curve is presented
 ###########################################################################
 
-pload XSDRAW
+pload XSDRAW IGES
 
 igesread [locate_data_file bug25175_3.igs] a *
 
index 61e53cc89a2502a5b1b1fde81f6d5b9717536f9a..9ab1681f7d97ea5d9a9ffe0c7675727183647d06 100755 (executable)
@@ -6,7 +6,7 @@ puts ""
 # Tool for extended check of validity of the curve on the surface
 ######################################################
 
-pload XSDRAW
+pload XSDRAW IGES
 
 testreadiges [locate_data_file bug25410_Tank8.igs] b1
 
index a3ae8a39c11346384c9bee45c6dcc5077b558c28..638faccf6c526a71121d7c465f55f2e771c5502e 100644 (file)
@@ -3,7 +3,7 @@ puts "0030595: Oriented Bounding Box seems not optimal for some shapes"
 puts "==============================================================="
 puts ""
 
-pload XSDRAW
+pload XSDRAW STEP
 
 stepread [locate_data_file bug30595_UC1.stp] s *
 incmesh s_1 0.1
index dcf37bf4487638482997621876d5a573172bff2d..7724fb0b807d8ddcfcf3959a07e44025acadb094 100644 (file)
@@ -3,7 +3,7 @@ puts "0030829: BRepExtrema_ShapeProximity crashes with shape from STL/WRL"
 puts "========"
 puts ""
 
-pload XSDRAW
+pload XSDRAW STL
 
 box b 10 10 10
 pcylinder c 5 10
index acc9a454afdd8169c5c84a89d02e5ddc23cad6e9..a736f527888f4cac2e81844d1d3c60846f164c43 100644 (file)
@@ -3,7 +3,7 @@ puts "0033165: Data exchange - Instance name is not saved during writing step fi
 puts "===================================="
 puts ""
 
-pload OCAF XDEDRAW
+pload OCAF XDEDRAW STEP
 
 box b 1 1 1
 reset b
index da7d65a52c36fdc45d3266d307cb165477bc4757..f3b0399c19f29709a0c85fb4493a23812113cddb 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 set BugNumber OCC22572
 
-catch { pload XSDRAW }
+catch { pload XSDRAW STL}
 vinit
 XProgress -t
 set List1 [meshfromstl result [locate_data_file bearing.stl]]
index c45bfe9f54a9cf477cf2ee28085583e4dfa40bb4..5b036b1cc8bfa04b4e3ee665d5ff666592fc4afc 100755 (executable)
@@ -1,3 +1,3 @@
-pload XSDRAW
+pload XSDRAW STL VRML
 
 set subgroup stlvrml
index 39bb04bee2bbf98a9e2151d48b589476b6bb1615..493de128cf6ac7b07099799254a9c6f1da6b2861 100644 (file)
@@ -1,6 +1,6 @@
 # Test performance of dynamic loading / unloading of large OCCT library
 
-set libname TKSTEP
+set libname TKDESTEP
 
 switch -nocase [checkplatform] {
   windows {set libname    ${libname}.dll}
index aa242c8aa4b418f35df324f18bf75e6e5bfe807f..bd6b7ccc8bba84b5bf0184cee75fafc9fd65c8fe 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 ## Slow import of IGES data
 ###############################
 
-pload QAcommands
+pload QAcommands IGES
 
 if { [regexp {Debug mode} [dversion]] } {
   cpulimit 8500
index aeedf833d1334f48223c016d20de4c8cc074e750..d92589107336e29520921eade473edfd9125a021 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 ## Slow import of IGES data
 ###############################
 
-pload QAcommands
+pload QAcommands IGES
 
 if { [regexp {Debug mode} [dversion]] } {
   cpulimit 8500
index fd62e6caa9ccfe5fe6ab48578410885017c24bee..0b1655ca584c6554f94a114a9439f518673c7606 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 # Extrema_GenExtPS needs to be optimized
 ##########################################
 
-pload DATAEXCHANGEKERNEL
+pload DATAEXCHANGEKERNEL STEP
 
 # Restore testing shape and get timing characteristics for operation stepread
 dchrono perf_h restart
index 75880354a323cd81979aa4c5a1ed9c6697cf0600..980af98e785335dbd4e0f901c6694b016f8eb76b 100644 (file)
@@ -8,7 +8,7 @@ puts ""
 
 cpulimit 1000
 
-pload DATAEXCHANGEKERNEL
+pload DATAEXCHANGEKERNEL STEP
 
 # Restore testing shape and get timing characteristics for operation stepread
 dchrono perf_h restart
index 386b3fd011b900a2c2aa1d2db227f08d9745c84a..b3032101680a7529dbcdcf15c4a7dbbf419da80a 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 #  Recalculation of BSpline cache causes a performance problems
 ############################################################################
 
-pload XSDRAW
+pload XSDRAW STEP
 
 dchrono t restart
 testreadstep [locate_data_file bug27048.stp] result
index ade491da383a0e3e6a008215f147f0ce4259c920..45b61a375186c52e1c1005be95791a559a41fbbe 100644 (file)
@@ -3,7 +3,7 @@ puts "CR23407: Draw face outlines for XDE objects"
 puts "============"
 puts ""
 
-pload XDEDRAW VISUALIZATION
+pload XDEDRAW VISUALIZATION STEP
 
 XNewDoc Doc1
 ReadStep Doc1 [locate_data_file screw.step]
index 2d57bea52a88af2687378801a465262901e504f8..5cf89d29057bed8e175c2a423e2b2dd725f6434a 100644 (file)
@@ -1,2 +1,2 @@
-pload MODELING VISUALIZATION XSDRAW
+pload MODELING VISUALIZATION XSDRAW STL
 vinit View1
index 982bd157b6972664ae5d15671bd0d6f653476052..c0d601039667fac2c05e2d3a1baa500c2cf8405f 100644 (file)
@@ -3,7 +3,7 @@ puts "OCC26566: Visualization - incorrect highlight after selection of owners wi
 puts "========"
 puts ""
 
-pload VISUALIZATION MODELING XSDRAW
+pload VISUALIZATION MODELING XSDRAW STL
 vinit View1
 
 # create an object with auto-highlight disabled
index 20d68ba0696c4aa13b3c492f97d7c1507c109cb3..18b738448217d6e96ca9c7ef88e3445ad87da390 100644 (file)
@@ -2,7 +2,7 @@ puts "========"
 puts "0029356: Modeling Algorithms - GCPnts_TangentialDeflection hangs on specific curve"
 puts "========"
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload IGES}
 testreadiges [locate_data_file bug29356.igs] a
 
 vinit View1
index 5f6968f5e6b06df33bc50f7dac0b11c3c85129a6..993ba57c26507d460abd6e40ee16cdd363fff62a 100644 (file)
@@ -1,6 +1,6 @@
 # isolines on infinite prism based on spline edge with poles closed to 1.4e+6
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload IGES}
 testreadiges [locate_data_file bug29356.igs] a
 
 mksurface s a
index da03c8eb1cef24a49dbfa7a70de919e79a862c19..b362c510406dce3e4f76ffef40c82f099c1aaa49 100644 (file)
@@ -1,6 +1,6 @@
 # isolines on finite prism based on spline edge with poles closed to 1.4e+6
 
-if {[info commands testreadiges] == ""} {pload XSDRAW}
+if {[info commands testreadiges] == ""} {pload IGES}
 testreadiges [locate_data_file bug29356.igs] a
 
 mksurface s a
index ceadac032c0f6bfb9a8f396efbdd900349661e56..37812a6ca34d925f8ecbdb8ad0af0cd7abf1811f 100644 (file)
@@ -13,7 +13,7 @@ TKVCAF
 TKView
 TKXSBase
 TKXCAF
-TKXDESTEP
+TKDESTEP
 TKXmlXCAF
 TKXml
 TKXmlL