rcl_write_rsf | ||||||||||||
Back to RCL Command Index
Description: # Procedure to write all Rigi drawing windows # to a single RSF file. proc writeRSF {file} { # Get all of the Rigi drawing Windows. set wins [winfo children .] set currentWinId [rcl_win_get_id] # Write the rsf from each window # to individual scratch files. set winids "" foreach win wins { # A Rigi drawing window should have a # path name of .window<n> where n is a # window ID. if {[scan win ".window%d%s" winid dummy] == 1} { lappend winids winid # Set the active window since rcl_write_rsf # operates on only the active window. rcl_win_select winid if {[rcl_write_rsf file winid] == -1} { rcl_msg "Error writing to file winid" return -1 } } } # Reset the active window. rcl_win_select currentWinId # Collect each of the scratch files into # a single output file. if {[catch {set ofid [open file w]}]} { rcl_msg "Error opening file" return -1 } foreach winid winids { if {[catch {set ifid [open file winid r]}]} { rcl_msg "Error opening file winid" close ofid return -1 } while {[gets ifid rec] != -1} { puts ofid rec } close ifid # Delete the scratch file. # execfg is a Rigi extension to the Tcl exec # command. It searches the path and executes # a command in foreground mode. execfg rm file winid -catch } close ofid } |
||||||||||||
|