f



Opening a TCL program from within another TCL program in ANSYS Tcl-Tk

Hi everyone,

I have been pulling my hair with this one for a couple of days and
still have not found a fix. I'm working within ANSYS Tcl-Tk
implementation.

I created a Tcl-Tk script that generates a simple window with three
buttons. Each button opens another window which is created in a
separate Tcl file. The second window have a lot of text entries,
variables, procedures, etc. I can open the second Tcl file by itself
and everything works as supposed, but when I open it using the button
in the first window, it opens but any procedure called by the widgets
on the second window are not found...

Here's the deal... Since I'm working within the ANSYS implementation
of Tcl-Tk, I'm actually using an ANSYS command to open the second
window. The command I use is:

###
ans_sendcommand ~eui,'source O:/mad_projects_2/ANSYS/Macros/
IBR_CAS.tcl'
###

It actually sends a command back to ANSYS telling it to execute a Tcl
command... I know this is not pretty but its the only way i was able
to make it at least show the window.

##############################
#Main Tcl (excerpt):
##############################
namespace eval Tools {
	proc IBRCambpell {} {
		#source O:/mad_projects_2/ANSYS/Macros/IBR_CAS.tcl
		ans_sendcommand ~eui,'source O:/mad_projects_2/ANSYS/Macros/
IBR_CAS.tcl'
	}

	proc viewManager {} {
		ans_sendcommand ~eui,'source O:/mad_projects_2/ANSYS/Macros/
ViewManager.tcl'
	}

	proc powerAnnotation {} {
		ans_sendcommand ~eui,'source O:/mad_projects_2/ANSYS/Macros/
PowerAnnotation.tcl'
	}
}

namespace eval MADTools {
	proc BuildGui {} {
		destroy .dlgMADTools
set parent [toplevel .dlgMADTools -class Ansys]
		#Sets its title
		wm title $parent "MAD TCL-TK Tools     by Jose Miranda"
		image create photo .dlgMADTools.ibr_Campbell_Image -format GIF -file
"O:/mad_projects_2/ANSYS/Macros/Images_for_TCL_TK/default.gif"
		button .dlgMADTools.ibrCampbell_Button -
image .dlgMADTools.ibr_Campbell_Image -text "IBR Campbell Analysis
Submitter" -compound top -command "Tools::IBRCambpell" -background
$bgColor
grid .dlgMADTools.ibrCampbell_Button -in .dlgMADTools.midFrame -row 2 -
column 1 -columnspan 1 -sticky ew

#Disable window resizing
		wm resizable .dlgMADTools 0 0
}

BuildGui
}


###########################
#Second Tcl file (Excerpt of IBR_CAS.tcl):
###########################

namespace eval CAS {
	proc proc1 {} {
		...
		...
	}
	proc proc2 {} {
		...
		...
	}

	destroy .dlgCAS

	set parent [toplevel .dlgCAS -class Ansys]
	#Sets its title
	wm title $parent "IBR Campbell Analysis Submitter v1.0      By Carlos
Fernandez (IAS)"

	button .dlgCAS.browse3DDatabase_Button -text "Browse" -command
"CAS::BrowseDB 3DDatabase"  -background $bgColor

	grid .dlgCAS.browse3DDatabase_Button -in .dlgCAS.topFrame -row 3 -
column 3 -columnspan 1
}
0
4/25/2012 6:38:03 PM
comp.lang.tcl 23428 articles. 2 followers. Post Follow

0 Replies
3211 Views

Similar Articles

[PageSpeed] 8

Reply: