Geometry and mesh parameterization

Moderator: GiD Team

eduardrocas
Posts: 30
Joined: Thu Dec 11, 2014 2:34 pm

Geometry and mesh parameterization

Post by eduardrocas »

Hello,

I would like to know if it is possible somehow to parameterize the input values for the geometry and mesh, instead of doing it manually for every element. And if it exists a way, which is the optimum way to do it. For example, we would like to define geometry values based on some parameters; for example, the position 'X' of a rectangle is defined by a parameter 'W', like 'X=2*W', where 'W' can have any value given apriori (for example the width of an element).

Other than that, I would appreciate if you can provide information on where and how to use “Tcl/Tk scripting language” in GiD, and if it would be helpful to this regard.

Thanks,
Eduard
User avatar
escolano
Posts: 1922
Joined: Sun Sep 05, 1982 10:51 pm

Re: Geometry and mesh parameterization

Post by escolano »

GiD itself is not parametric, but for simple cases you could try two approachs:
a) write a batch text file with the 'GiD process' word commands to be done by GiD to create your simple shape.
Externally with some program you can automatically replace some values (e.g. width and height of a rectangle) that are your parameters.
Then to create the new shape you create the new specific batch file with its specific values, and evaluate this batch file in GiD
e.g. from the console command line:
gid.exe -b your_batch_file
or inside GiD from the menu Files->Read batch...

this allow you for example use GiD as a black-box in an external optimization loop.

b) write a Tcl procedure, intepreted inside GiD, that create your simple shape based on some parameters.
You can send GiD commands to GiD with our special GiD-tcl command GiD_Process, and also use other more specialized GiD-Tcl commands like GiD_Geometry to create or get information of geometrical entities.

You can invoke your Tcl code in several ways:
  • Adding a macro button to the 'macros toolbar' to invoke your tcl procedure when clicking this button
  • sourcing your .tcl file saved on disk, from the GiD lower command line, with
    -np- source full_path_to_your_filename.tcl
  • writting the code in a <problemtype>.tcl that is automatically sourced when loading the problemtype (this code could for example add your option to some menu)
About Tcl/Tk scripting in GiD, there is a lot of information available:
1- You could use all standard Tcl/Tk commands (Tcl 8.6.1), can see for example its manuals at: http://www.tcl.tk/man
2- Could use all standard Tcl packages included in our \scripts folder (find its information in the Internet)
3- GiD add extra commands, like GiD_Info, GiD_Process, etc. This commands are explained in our help: GiD Customization manual (see specially the Tcl-Tk extension chapter)
4- Have a look to our /scripts/dev_kit.tcl file, it has Tcl procedures of interest for GiD-Tcl advanced developers
5- We provide inside GiD 'Ramdebugger': a Tcl/Tk text editor and debugger (menu: Data->Problemtype->Debugger...)
The help of Ramdebugger includes the reference manuals of Tcl/Tk and some packages
6- In our web page http://www.gidhome.com/support/tutorials you can download the documentation of GiD courses of past GiD conferences. Some chapters have examples that explain thinks about GiD-tcl ,
read in special the chapters 8 (tool of mesh edition) and 9 (Debugging Tcl code) of the 2004 course
and the chapter A3 (Extending GiD with Tcl/Tk) of the advanced course of 2002
eduardrocas
Posts: 30
Joined: Thu Dec 11, 2014 2:34 pm

Re: Geometry and mesh parameterization

Post by eduardrocas »

Thanks a lot, that sounds very helpful!
eduardrocas
Posts: 30
Joined: Thu Dec 11, 2014 2:34 pm

Re: Geometry and mesh parameterization

Post by eduardrocas »

Hello,

In relation to your reply, I will trying making a "macro" with Tcl-Tk to parameterize the geometry; for example a "macro" to make a rectangle or a 3D volume. I've read that the RamDebugger, integrated in GiD, needs Tcl-Tk installed to work properly. My question is, do I first have to install Tcl-Tk and then install Gid? Or it will work anyway if I install Tcl-Tk afterwards?

Thanks,
Eduard
eduardrocas
Posts: 30
Joined: Thu Dec 11, 2014 2:34 pm

Re: Geometry and mesh parameterization

Post by eduardrocas »

...I meant "should it will work anyway if I install Tcl-Tk afterwards?". Because the fact is that it's not working this way, so either I have to reinstall GiD or something is wrong.

Thanks,
Eduard
User avatar
escolano
Posts: 1922
Joined: Sun Sep 05, 1982 10:51 pm

Re: Geometry and mesh parameterization

Post by escolano »

GiD has its own Tcl/Tk interpreter embedded, you don't need to install anything more.
To start ramdebugger from inside GiD simple press the <F12> key or go to menu Data->Problemtype->Debugger...
This open the debugger, to start debugging press <F5> in ramdebugger.

(Ramdebugger could be loaded also in an external Tcl/Tk console. Can install Tcl/Tk from the ActiveTcl distribution but you don't need it, GiD is self-contained)

Enrique
eduardrocas
Posts: 30
Joined: Thu Dec 11, 2014 2:34 pm

Re: Geometry and mesh parameterization

Post by eduardrocas »

It happens that RamDebugger does not seem to debug (it does nothing) when executed from GiD (with or withous another Tcl/Tk installation). On the other hand, running Ramdebugger externally, as a stand-alone application, works fine and debugs fine. I've tried it with a "hello world" example.

I'm wondering if this is related to "debugging locally" or "debugging remotely"; as I've noticed some code has to be configured accordingly. Although I've tried that and it doesn't work. Any idea? Inside RamDebugger, in File->Debug on I don't see the options I should see to debugremotely.

Thanks,
Eduard

P.D: by the way, I'm using the professional evaluation version, which should be fully functional, right?
User avatar
escolano
Posts: 1922
Joined: Sun Sep 05, 1982 10:51 pm

Re: Geometry and mesh parameterization

Post by escolano »

Starting RamDebugger inside GiD it works 'debuggin locally'

Only if RamDebugger is started in an external process (e.g. installing another Tcl/Tk iterpreted, that is unneeded) then to debug GiD code must use 'degugging remotely', just to connect with the external GiD program.
Then GiD must be running and in RamDebugger must select:
File->Debug on->gid
(if 'gid' doesn't appear try to use File->Debug on->Update remotes)


But the easiest way is start Ramdebugger in GiD and 'debuggin locally'

for example, write a file with this code (write the code and save it to a filename) that must open a window whith "hello world"

Code: Select all

proc my_test { } {
  set text "hello world"
  WarnWinText "text=$text"
}

my_test ;#to invoke it
Then you can set some stop for example in the line "WarnWinText" with the key F9 (or set it from menus)
and press <F5> or Debug->Continue/Go to start debugging

then when reaching this line the debug will stop and you can see/set variables, press again <F5> to continue

If do you edin and change the procedure at run time, could use Debug->Reinstrument to be sure that the procedure definition is updated.
eduardrocas
Posts: 30
Joined: Thu Dec 11, 2014 2:34 pm

Re: Geometry and mesh parameterization

Post by eduardrocas »

Debugging locally, it doesn't work. I've tested your "hello world" code and does nothing.

I also tried remotely, but it doesn't work either. In menu "File->Debug on" there are only two options:
-Start debug
-Disconnect/stop

How can it be that RamDebugger does nothing?

Thanks,
Eduard
eduardrocas
Posts: 30
Joined: Thu Dec 11, 2014 2:34 pm

Re: Geometry and mesh parameterization

Post by eduardrocas »

Actually, I have uninstalled it and reinstalled and still doesn't work. The "begin/continue execution" button is in grey, seems not to be active.
Post Reply