Hi,
I was wondering if I could get some hints on adding a tcl command to opensees.
Here's what I'd like to say, but it in C++:
GUI gui =new GUI();
gui.createGUI( Domain * d );
OK, so any hints (general or specific) on how to wrap this in tcl would be great!
thanks,
alisa
adding a tcl command
Moderators: silvia, selimgunay, Moderators
the easiest way would be to modify OpenSees/SRC/commands.cpp
int guiCommands(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv);
int g3AppInit(Tcl_Interp *interp) {
.. existing code
Tcl_CreateObjCommand(interp, "gui", guiCommands,
(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
..
}
int
guiCommands(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
{
... your code
}
int guiCommands(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv);
int g3AppInit(Tcl_Interp *interp) {
.. existing code
Tcl_CreateObjCommand(interp, "gui", guiCommands,
(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
..
}
int
guiCommands(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
{
... your code
}
adding a tcl command in VC++
That worked fine on the linux side - but it seems command.cpp is a lot touchier in VC++ if you try to include other files- could you mention anything about doing
int
TclModelBuilderVisCommand (ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv, TclModelBuilder *theTclBuilder);
and getting the tcl interpreter to recognize the command?
I've created a subproject in OpenSees with my visualization files that compiles & builds a lib file nicely so I think I'm ready. (I've also tested the code in quickMain and the gui runs fine).
Thanks!
alisa
int
TclModelBuilderVisCommand (ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv, TclModelBuilder *theTclBuilder);
and getting the tcl interpreter to recognize the command?
I've created a subproject in OpenSees with my visualization files that compiles & builds a lib file nicely so I think I'm ready. (I've also tested the code in quickMain and the gui runs fine).
Thanks!
alisa
if I add to commands.cpp:fmk wrote:can you be a bit more specific about the problems you are encountering on the windows side?
#include <GlutWin.h>
Build-> Build Opensees.exe
--------------------Configuration: openSees - Win32Debug--------------------
Compiling...
commands.cpp
c:\program files\microsoft visual studio\vc98\include\windef.h(145) : error C2378: 'FLOAT' : redefinition; symbol cannot be overloaded with a typedef
c:\opensees1.7.0\opensees\other\superlu_3.0\src\util.h(99) : see declaration of 'FLOAT'
:
more similar
openSees.exe - 102 error(s), 0 warning(s)
As an aside, without #include <GlutWin.h> I still get errors (link errors) but if I do
Build -> Execute OpenSees.exe
it forces linking, completes the build & runs the OpenSees command line.
I've since figured how to put the new gui command into TclModelBuilder.cpp and reference my extern function, that lives in the subproject (similar to the element command) - its running fine.