Hello,
I would like to know which is the easiest way to create a rectangle, of specific dimensions and position, using Tcl/Tk. In GiD's graphical user interface there's the possibility of drawing a rectangle, so I'm wondering if it already exists such a function available for Tcl/Tk.
Thanks,
Eduard
Creating a rectangle in TCL
Moderator: GiD Team
Re: Creating a rectangle in TCL
You can use for example GiD_Process to invoke the GiD tool to create a rectangle, e.g.
Or you can create the four points, the four lines, and a the surface explicitly, using GiD_Process commands
or without use the GiD process loop, using the GiD-Tcl procedure GiD_Geometry (see GiD Help on customization to know its syntax)
Code: Select all
proc MyCreateRectangle { x y width height } {
GiD_Process Mescape Geometry Create Object Rectangle $x,$y,0 [expr $x+$width],[expr $y+$height],0 escape
}
Or you can create the four points, the four lines, and a the surface explicitly, using GiD_Process commands
or without use the GiD process loop, using the GiD-Tcl procedure GiD_Geometry (see GiD Help on customization to know its syntax)
-
- Posts: 30
- Joined: Thu Dec 11, 2014 2:34 pm
Re: Creating a rectangle in TCL
Great. Thanks!
Re: Creating a rectangle in TCL
The canvas widget is Tk's workhorse for 2D graphical display, and can handle both bitmap and vector graphics. It was inspired by Joel Bartlett's ezd program, which provides structured graphics in a Scheme environment. A canvas is one of the most powerful concepts in Tk. It acts as a drawing plane for lines, rectangles, ovals, polygons, text, arcs (e.g. pieslices) as well as container widget to group other widgets, and it provides the ability to group elements together for creation, deletion, moving, etc.
Re: Creating a rectangle in TCL
Both answer are correct depending on what you want to achieve. I think that escolano one is what eduardrocas was searching.
For creating a geometry rectangle inside GiD follow escolano answer.
For creating a rectangle on the interface of GiD, for example inside a window, follow SatuSalo answer.
Thanks both for your answers.
For creating a geometry rectangle inside GiD follow escolano answer.
For creating a rectangle on the interface of GiD, for example inside a window, follow SatuSalo answer.
Thanks both for your answers.