[GRASS-dev] Re: [GRASS-user] GRASS6.3 on Windows, nviz

Michael Barton michael.barton at asu.edu
Sat Aug 25 12:42:19 EDT 2007


Helena,

I did some poking around in the nviz code.

It looks like the state is being saved correctly, with only the map at mapset
name (no paths). Position is always coming up 000 000 000, so that seems
wrong. This is called by the line

puts $file_hook "[Nsurf$i get_trans]"

This is a C command and I don't know if it is correct or not. "get_trans"
seems like an odd name for a command to get position.

Reading in the state file is probably the big issue. This is the part of the
code that reads a file.


proc load_state_aux { new_file} {
    global Nv_

    if {[catch {set file_hook [open $new_file r]} error_code] != 0} then {
        display_error "While opening file: $error_code"
        return
    }

    # Close all panels fist
    Nv_closeAllPanels

    # First line before panel data contains the name of the panel which
    # saved the data.  Use this name to build the command which will
    # read in the data and call the appropriate routine.
    while {[gets $file_hook i] != -1} {
        set cmd_name "Nviz_$i"
        append cmd_name "_load"
        if {[catch {$cmd_name $file_hook} error_code] != 0} then {
            puts "Diagnostic: $error_code --  Load procedure for panel $i
may not be defined"
        }
    }

...

As best I can tell, it is *supposed* to look for the beginning of a section
related to an nviz panel (e.g., "surf" relates to panel_surf.tcl) and launch
that panel. 

However, AFAICT, the loading loop, beginning with "while", parses every line
in a state file and attempts to convert it into a command named
"Nviz_[name]_load", where [name]  is the state file line. "Nviz_surf_load"
is valid, but a command created from the logical name of the surface is not,
generating this error on my system...

"Diagnostic: invalid command name "Nviz_surf*1188058769_load" --  Load
procedure for panel surf*1188058769 may not be defined"

The loop also sends the whole state file to the load command for each
correct panel section it identifies, rather than sending it only the
relevant parts. That is, the surface panel also gets all the stuff for
vector lines, lighting, etc. even though it cannot parse this, generating
more error codes. 

When I tried to touch up NVIZ last December, I didn't mess with the
scripting or state saving/loading. So I don't know if anyone else changed
this code. But I don't see how it could possibly work the way it is written.
If this is the same code that is in 6.1 I don't know how that worked either.

Michael

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton





More information about the grass-dev mailing list