0031458: Visualization - refine classes across Prs3d and StdPrs packages
[occt.git] / samples / tcl / DataExchangeDemo.tcl
1 # Copyright (c) 1999-2014 OPEN CASCADE SAS
2 #
3 #Category: Demos
4 #Title: Import and export
5 #
6 # This file is part of Open CASCADE Technology software library.
7 #
8 # This library is free software; you can redistribute it and / or modify it
9 # under the terms of the GNU Lesser General Public version 2.1 as published
10 # by the Free Software Foundation, with special exception defined in the file
11 # OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 # distribution for complete text of the license and disclaimer of any warranty.
13 #
14 # Alternatively, this file may be used under the terms of Open CASCADE
15 # commercial license or contractual agreement.
16
17 # Command to log a message to both command-line and dialog window
18 proc sage { a} {
19     if { ![winfo exists .h ] } {
20         toplevel .h -bg azure3
21         wm title .h "INFO TEST HARNESS"
22         wm geometry .h +320+20
23     } 
24     if { [winfo exists .h.m ] } {
25         set astring [.h.m cget  -text]
26         set newstring "${astring} \n $a"
27         .h.m configure -text $newstring 
28         puts $a
29     } else {
30         message .h.m -justify left -bg azure2 -width 13c -relief ridge -bd 4 -text $a
31         puts $a
32     } 
33     pack .h.m
34     update
35 }
36
37 pload DATAEXCHANGE
38
39 smallview
40 if { [winfo exists .h ] } {
41     destroy .h
42 }
43
44 set ddir .
45 if { [info exists env(CSF_OCCTDataPath)] } {
46     set ddir [file join $env(CSF_OCCTDataPath) occ]
47 } elseif { [info exists env(CASROOT)] } {
48     set ddir [file join $env(CASROOT) data occ]
49 }
50
51 set tdir .
52 if { [info exist env(TEMP)] } {
53     set tdir $env(TEMP)
54 }
55
56 sage " First, we retrieve a BREP File "
57 sage "    restore $ddir/wing.brep wing"
58 sage " "
59 datadir .
60 restore $ddir/wing.brep wing
61 disp wing
62 fit
63
64 sage "Generate the IGES File of this BREP"
65 sage "   brepiges wing $tdir/wing.igs"
66 sage " "
67 brepiges wing $tdir/wing.igs
68 wait 3
69
70 sage "we delete all DRAW data"
71 sage ""
72 dall
73 fit
74 wait 3
75
76 sage "Restore this IGES File we have created " 
77 sage "   igesbrep $tdir/wing.igs new *"
78 sage ""
79 igesbrep $tdir/wing.igs new *
80 disp new
81 fit
82
83 puts "End IGES Elementary Test " 
84 sage " "
85 file delete $tdir/wing.igs