From 69da6e7ae33604d0fa873bdde02811c0d6630241 Mon Sep 17 00:00:00 2001 From: abv Date: Fri, 22 Jun 2012 11:19:15 +0400 Subject: [PATCH] 0023185: DrawAppliInit must be loaded from current directory 1. File src/DrawResources/DrawAppliInit removed; code loading QA commands moved from DrawAppliInit to DrawDefaults (temporarily) 2. In src/DrawResources/DrawDefaults: - change of tcl_precision removed (following advise in Tcl 8.5 documentation) - code loading file init.tcl removed as obsolete - if environment variable CSF_DrawAppliInit is defined, it is assumed to be the name of the application-defined file to load; otherwise it is searched as file DrawAppliInit in current directory DrawAppliInit removed from FILES --- src/DrawResources/DrawAppliInit | 18 ---------- src/DrawResources/DrawDefault | 62 +++++++++++++++++++++++---------- src/DrawResources/FILES | 1 - 3 files changed, 43 insertions(+), 38 deletions(-) delete mode 100644 src/DrawResources/DrawAppliInit diff --git a/src/DrawResources/DrawAppliInit b/src/DrawResources/DrawAppliInit deleted file mode 100644 index dc77141c4b..0000000000 --- a/src/DrawResources/DrawAppliInit +++ /dev/null @@ -1,18 +0,0 @@ -global tcl_platform - -if {[array get env QA_DUMP] != "" && $env(QA_DUMP) == "1"} { - set env(CSF_DrawPluginQADefaults) $env(CASROOT)/src/DrawResources/. - ###catch {pload ALL} - catch {pload FULL} - #catch {pload -DrawPluginProducts ALL} - catch {pload -DrawPluginProducts OMF CANONICALRECOGNITION EMESH PARASOLID DXF SAT } - catch {pload QAcommands} - - ###foreach h [array names Draw_Groups] { - ### foreach f $Draw_Groups($h) { - ### QARebuild $f - ### } - ###} - -catch {source $env(CSF_DrawPluginQADefaults)/QARebuildCommands} -} \ No newline at end of file diff --git a/src/DrawResources/DrawDefault b/src/DrawResources/DrawDefault index b1ee1dd27e..f612bd8b59 100755 --- a/src/DrawResources/DrawDefault +++ b/src/DrawResources/DrawDefault @@ -1,9 +1,14 @@ -set tcl_interactive 1 -set tcl_precision 17 +# This script is to be executed automatically at DRAWEXE start. +# +# For that to happen, either environment DRAWDEFAULT should be set pointing +# to this file, or CASROOT variable should be set, so that the script is +# found as $CASROOT/src/DrawResources/DrawDefault -if [info exists library] { - source [file join $library init.tcl] -} +# indicate that DRAW is interactive environment +set tcl_interactive 1 + +# define location of standard DRAW scripts; normally it is +# $CASROOT/src/DrawResources set dir "" if { [info exists env(DRAWHOME) ] } { set dir $env(DRAWHOME) @@ -11,22 +16,20 @@ if { [info exists env(DRAWHOME) ] } { if { [info exists env(CASROOT) ] } { set dir [file join $env(CASROOT) src DrawResources] } else { - puts " CASROOT is Mandatory to Run OpenCascade" + puts "Warning: CASROOT is not defined, some features may not load correctly" + set dir [file dirname [info script]] } } -# san - 02/08/2002 - In Tcl8.3 it is no longer necessary to load Tix explicitly on WNT -#if { [info exists env(STATION)] } { -# if { $env(STATION) == "wnt" } { -# load tix8183.dll Tix -# } -#} - -if { [file exist $dir] } { - source [file join $dir StandardCommands.tcl] - source [file join $dir StandardViews.tcl] - source [file join $dir Geometry.tcl] +# load standard DRAW scripts +if { [file isdirectory $dir] } { + foreach script {StandardCommands.tcl Geometry.tcl StandardViews.tcl} { + if [file exist [file join $dir $script]] { + source [file join $dir $script] + } + } + # and TK extensions set stationname $tcl_platform(platform) if [info exists tk_version] { source [file join $dir DrawTK.tcl] @@ -35,8 +38,29 @@ if { [file exist $dir] } { wm iconbitmap . -default [file join $dir lamp.ico] } } +} - if { [ file readable [ file join $dir DrawAppliInit ] ] } { - source [file join $dir DrawAppliInit ] +# load application-defined initialization script, which is expected to +# be found either in the file pointed by environment variable CSF_DrawAppliInit, +# or in the file DrawAppliInit in the current directory +set draw_appli_init_file DrawAppliInit +if { [info exists env(CSF_DrawAppliInit)] } { + set draw_appli_init_file $env(CSF_DrawAppliInit) +} +if { [file readable $draw_appli_init_file] } { + if { [catch {source $draw_appli_init_file} res] } { + puts "Warning: problem while loading file $draw_appli_init_file: $res" } } + +# Temporary: load specific QA commands and handlers +if {[array get env QA_DUMP] != "" && $env(QA_DUMP) == "1"} { + set env(CSF_DrawPluginQADefaults) $env(CASROOT)/src/DrawResources/. + catch {pload FULL} + catch {pload -DrawPluginProducts OMF CANONICALRECOGNITION EMESH PARASOLID DXF SAT } + catch {pload QAcommands} + catch {source $env(CSF_DrawPluginQADefaults)/QARebuildCommands} +} + +# silent return from the script +return diff --git a/src/DrawResources/FILES b/src/DrawResources/FILES index f2d837a65a..01885ce1c2 100755 --- a/src/DrawResources/FILES +++ b/src/DrawResources/FILES @@ -31,4 +31,3 @@ srcinc:::DrawPlugin srcinc:::TKTopTest.tcl srcinc:::dftree.tcl srcinc:::QARebuildCommands -srcinc:::DrawAppliInit