eebe2c0bdc046e20fa30ae779193d45286f77223
[occt.git] / src / BRepSweep / BRepSweep_Replace.tcl
1 # Copyright (c) 1999-2014 OPEN CASCADE SAS
2 #
3 # This file is part of Open CASCADE Technology software library.
4 #
5 # This library is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Lesser General Public License version 2.1 as published
7 # by the Free Software Foundation, with special exception defined in the file
8 # OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 # distribution for complete text of the license and disclaimer of any warranty.
10 #
11 # Alternatively, this file may be used under the terms of Open CASCADE
12 # commercial license or contractual agreement.
13
14 proc BRepSweep_Replace:AdmFileType {} {
15     return "dbadmfile";
16 }
17
18 proc BRepSweep_Replace:OutputDirTypeName {} {
19     return "dbtmpfile";
20 }
21
22
23 proc BRepSweep_Replace:HandleInputFile { ID } { 
24
25     scan $ID "%\[^:\]:%\[^:\]:%\[^:\]"  unit type name
26
27     switch $name {
28         BRepSweep_NumLinearRegularSweep.hxx {return 1;}
29         default {
30             return 0;
31         }
32     }
33 }
34
35 proc BRepSweep_Replace:Execute { unit args } {
36     
37     global tcl_interactive
38
39     set tcl_interactive 1
40     package require Wokutils
41
42     msgprint -i -c "BRepSweep_Replace:Execute" "Copying of BRepSweep includes"
43
44     if { [wokparam -e %Station $unit] != "wnt" } {
45         set copycmd "cp -p "
46         set replstr "/"
47     } {
48         set copycmd "cmd /c copy"
49         set replstr "\\\\\\\\"
50     }
51     
52     foreach file  $args {
53         scan $file "%\[^:\]:%\[^:\]:%\[^:\]"  Unit type name
54         
55         regsub ".hxx" $name ".hxx" sourcename
56
57         set source    [woklocate -p BRepSweep:source:$sourcename     [wokinfo -N $unit]]
58         set vistarget [woklocate -p BRepSweep:pubinclude:$name [wokinfo -N $unit]]
59         set target    [wokinfo   -p pubinclude:$name          $unit]
60
61         regsub -all "/" " $source $target" $replstr  TheArgs
62
63         msgprint -i -c "BRepSweep_Replace:Execute" "Copy $source to $target"
64         if { [file exist $target] && [wokparam -e %Station $unit] != "wnt" } {
65                 eval exec "chmod u+w $target"
66         }
67         eval exec "$copycmd $TheArgs"
68
69     }
70     return 0;
71 }