Improving my Interface

Moderator: GiD Team

Post Reply
Oswaldo
Posts: 4
Joined: Thu Aug 06, 2015 3:31 pm

Improving my Interface

Post by Oswaldo »

Hello;
I would like to know if GiD could provide me tools or commands that could help me to improve my interfaces.
As an example of the interface I am talking about, please, take a look at the example below (Surface Element Group), many "Questions" were created there.

Code: Select all

CONDITION: Surface_ElementGroup
CONDTYPE: over surfaces
CONDMESHTYPE: over body elements
TITLE: GROUP
   QUESTION: Group_Number:
   VALUE:10
   QUESTION: Element_Order:
   VALUE:1a
TITLE: PROBLEM_PARAMETERS
   QUESTION: Problem_type:#CB#(PLANE-STRESS,PLANE-STRAIN,STRUCT-AXIS,STRUCT-SOLID,POISSON,BEAM,TRUSS,CONTACT,SHELL,PLATE,MEMBRANE)
   VALUE:PLANE-STRAIN
   DEPENDENCIES: (PLANE-STRESS,restore,Thickness,#CURRENT#)\
                         (#DEFAULT#,hide,Thickness,#CURRENT#)
   QUESTION: Thickness:
   VALUE:   
   QUESTION: Mass_matrix:#CB#(LUMPED,CONSISTENT,EIGENVALUE)
   VALUE:LUMPED
   QUESTION: Stiffness_matrix:#CB#(TRANSFORMED,CONSISTENT,EIGENVALUE,MINIMUM_ENERGY)
   VALUE:TRANSFORMED
   QUESTION: Kinematics:#CB#(INFINITESIMAL,FINITE)
   VALUE:INFINITESIMAL
   DEPENDENCIES: (FINITE,restore,Finite_formulation,#CURRENT#,restore,Strain_measure,#CURRENT#)\
                         (#DEFAULT#,hide,Finite_formulation,#CURRENT#,hide,Strain_measure,#CURRENT#)
   QUESTION: Finite_formulation#CB#(TOTAL-LAGRANGIAN,UPDATED-LAGRANGIAN,EULERIAN)
   VALUE: TOTAL_LAGRANGIAN
   QUESTION: Strain_measure#CB#(MATERIAL,SPATIAL,LOGARITHMIC)
   VALUE:MATERIAL
1) All "Questions" are aligned to the left, always vertical, leaving a blank space at the right portion of the window. Is there any way to position some "Questions" to the right, so they would be much better distributed on the screen, or some way to make two "Question" appear side by side horizontally?

2) In some cases it is necessary to add a separation line to separate Questions included on the same screen; is there a command to add this separation line?

3) Other way to separate the questions mentioned before is using what is called "Group Box", with a title of this group being included at the window. Is there a easy way to create these boxes?

4) I also need to add a title or info text on the screen. It is not a Question with values or check boxes, but a simple free text as a label, how can I do that?
User avatar
escolano
Posts: 1922
Joined: Sun Sep 05, 1982 10:51 pm

Re: Improving my Interface

Post by escolano »

Without any Tcl/Tk programming it is not possible to do the appearance improvements you want. With scripting programming it is possible to do everything.

about the last question: 4) I also need to add a title or info text on the screen. It is not a Question with values or check boxes, but a simple free text as a label, how can I do that?
you can use as trick a question with #CB# combobox option but with a single option, then it will appear as a label. e.g.

Code: Select all

QUESTION: _#CB#(Hello_world)
VALUE:Hello_world
It is also possible to customize a single row of question/value and replace the standard widgets by other, with a special 'TKWIDGET field' that invoke a Tcl procedure that do this replacement.
As an example, in the file scripts/dev_kit.tcl there are some predefined 'tkwidget-like procedures to do some common things, like select a filename or pick some coordinate

Code: Select all

CONDITION: Point_Tkwidget
CONDTYPE: over points
CONDMESHTYPE: over nodes
QUESTION: Filename
VALUE:
TKWIDGET: GidUtils::TkwidgetGetFilenameButton
QUESTION: Layername
VALUE:
TKWIDGET: GidUtils::TkwidgetGetLayername
QUESTION: Materialname
VALUE:
TKWIDGET: GidUtils::TkwidgetGetMaterialname
QUESTION: PointOrNodeId
VALUE:
TKWIDGET: GidUtils::TkwidgetPickPointOrNode
QUESTION: vector_3d
VALUE: 1 0 0
TKWIDGET: GidUtils::TkwidgetGetVector3D
END CONDITION
tkwidget_fields.png
tkwidget_fields.png (12.45 KiB) Viewed 5064 times
It is possible also to replace the whole content of conditions or other windows and grid inside what you want (and use the conditions, materials or problem data only to store the data), like next image of a 'material' window used to define X-Y graph tables (of the Nastran problemtype)
tables_nastran.png
tables_nastran.png (36.71 KiB) Viewed 5064 times
Oswaldo
Posts: 4
Joined: Thu Aug 06, 2015 3:31 pm

Re: Improving my Interface

Post by Oswaldo »

1. Into the file “scripts\dev_kit.tcl” my predefined Tkwidgets procedures are only four: (TkwidgetGetFilenameButton, TkwidgetPickNode,TkwidgetPickPointOrNode e TkwidgetGetLayername). I don’t have the "TkwidgetGetVector3D" in this file. Is available other file where can I find the predefined file Tkwidget ?

2. In order to edit the script file with a new predefined Tkwidget , what is the process?
Is enough to save the file scripst\dev_kit.tcl , and then call it in the files with extension .cnd or .prb (TKWIDGET:GidUtils::New_PredefinedTkwidge)? Will be necessary something more?

3. Do you have an example step by step or a tutorial where is replaced the whole conditions content, the windows and the grid? The customization manual maybe explains this topic?

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

Re: Improving my Interface

Post by escolano »

1- GiD is evolving, the TkwidgetGetVector3D procedure exists only in last developer versions. (current developer version is the 12.1.7d)

2- You MUST NEVER edit our scripts, because updating to next GiD version you will lost your changes (or manually merge them again)
All your code must be placed in your tcl files of your problemtype.
If do you want to customize a 'question/value' field of a condition, material, etc. with a tkwidget: special field that invoke a Tcl procedure you could use a predifined procedure if it exists in some or our scripts, like our 'GidUtils::TkwidgetGetVector3D' or define your own procedure in your scripts (and source your tcl files when loading your problemtype)

3- To know something about 'tkwidget' read in GiD customization manual about "TCL AND TK EXTENSION>Custom data windows>TkWidget"

You could consider as examples our source code of the GidUtils::TkwidgetXXX procedures of \scripts\dev_kit.tcl
these procedure are replacing the label and entry of a standard row of the data windows by other Tk objects (like other fields or a pick point button)

To replace all question/value fields you could simple declare all fields as STATE:HIDDEN and in one of them add a TKWIDGET: field that invoke your own procedure to pack what you want. Read some standart Tk manual to start learning Tk.
in order to have persitent value of your own variables they could be copied to/from some hidden questions to be saved by GiD (or you can save/read from your own additional model files, invoked from some GiD_Tcl events.
Post Reply