[GiDlist] Array in Problem Type

Moderator: GiD Team

Post Reply
ascosta at portugalmail.pt

[GiDlist] Array in Problem Type

Post by ascosta at portugalmail.pt »

An embedded and charset-unspecified text was scrubbed...
Name: not available
Url: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20051020/cd56c001/attachment.txt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20051020/cd56c001/attachment.htm
User avatar
escolano
Posts: 1961
Joined: Sun Sep 05, 1982 10:51 pm

[GiDlist] Array in Problem Type

Post by escolano »

Hello,

I don't understand what do you want.
What they contain ProblemTypePriv(pointnames) and ProblemTypePriv(facenames) ?
a list of names? like ProblemTypePriv(pointnames)="a1 {a 2} a3", ProblemTypePriv(facenames)="b1 b2 b3"
and do you want ProblemTypePriv(combo)="a1 {a 2} a3 b1 b2 b3"? Then you can use some like "concat":
set ProblemTypePriv(combo) [concat $ProblemTypePriv(pointnames) $ProblemTypePriv(facenames)]

if you want to store two sublists: ProblemTypePriv(combo)="{a1 {a 2} a3} {b1 b2 b3}", can use "list"
set ProblemTypePriv(combo) [list $ProblemTypePriv(pointnames) $ProblemTypePriv(facenames)]

Can read standard help about Tcl/Tk syntax at:
http://www.gid.cimne.upc.es/ManHtml/tcl8.4.9/html/contents.htm

Regards

----- Original Message -----
From: ascosta at portugalmail.pt
To: gidlist at gatxan.cimne.upc.es
Sent: Thursday, October 20, 2005 9:59 PM
Subject: [GiDlist] Array in Problem Type


Hi everybody,

I have two arrays: $ProblemTypePriv(pointnames) and $ProblemTypePriv(facenames).

How can i create a new array ProblemTypePriv(combo), that includes the 2 arrays.

The due is to include the two arrays in a combobox.



Another question is how can i save data in conditions menu, like in materials? When i select a name in combobox, this value will be associated to some values in some entry's.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20051021/badd62ae/attachment.htm
ascosta at portugalmail.pt

[GiDlist] Array in Problem Type

Post by ascosta at portugalmail.pt »

An embedded and charset-unspecified text was scrubbed...
Name: not available
Url: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20051024/0283858b/attachment.txt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20051024/0283858b/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: point.JPG
Type: image/pjpeg
Size: 21146 bytes
Desc: not available
Url : http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20051024/0283858b/attachment.bin
User avatar
miguel
Posts: 361
Joined: Thu Sep 25, 2014 9:04 am

[GiDlist] Array in Problem Type

Post by miguel »

Hi, under the page:

http://www.gidhome.com/ManHtml



we've post the Manual Pages for Tcl, Tk and some packages we use incide GiD,
like Tcl & Tk:



http://www.gid.cimne.upc.es/ManHtml/tcl8.4.9/html/contents.htm



BWidget: (comboxes, notebooks, etc.)



http://www.gid.cimne.upc.es/ManHtml/BWidget/index.html



And for the combobox:



http://www.gid.cimne.upc.es/ManHtml/BWidget/ComboBox.html



With the option -modifycmd you can specify a tcl procedure which will be
called every time the user selects one entry of the combobox,



Here you have an example:



set ::XValue -1

set ::XValueStr "XValue is $::XValue"



proc ChooseXValue { w} {

if { [ string eq $::LoadSelection P1]} {

set ::XValue 10

} elseif { [ string eq $::LoadSelection P1]} {

set ::XValue 0

}

set ::XValueStr "XValue is $::XValue"

tk_messageBox -message "XValue set to $::XValue" -icon info -title
"Info" -parent $w -type ok

}



toplevel .w

ComboBox .w.cb -textvariable ::LoadSelection -values {P1 P2} -modifycmd
"::ChooseXValue .w.cb"

label .w.l -textvariable ::XValueStr

button .w.b -text Close -command "destroy .w"

grid .w.cb -sticky ew

grid .w.l -sticky ew

grid .w.b

grid rowconfigure .w 0 -weight 1

grid rowconfigure .w 1 -weight 1



miguel



_____

De: gidlist-admin at gatxan.cimne.upc.edu
[mailto:gidlist-admin at gatxan.cimne.upc.edu] En nombre de
ascosta at portugalmail.pt
Enviado el: lunes, 24 de octubre de 2005 14:01
Para: gidlist at gatxan.cimne.upc.es
Asunto: Re: [GiDlist] Array in Problem Type



Thanks Enrique for your help. "Concat" works very well.

Another question is how can I associate the names of a combobox with some
values x, y, z, ...

Please see the file point.jpg.

I want do like in materials: when we modify de parameters of one material,

we have one button to update the changes.

I create a new point load P1 with value X 10 and after that i create a point
load P2 with value X 0.

What I want is: when i select in combobox the point load P1, the value that
apears for X is 10

as it was created behind and not 0 (the last value for X) or empty.

Thanks all.

I hope you all understand my doubt.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20051025/899827b5/attachment.htm
ascosta at portugalmail.pt

[GiDlist] Array in Problem Type

Post by ascosta at portugalmail.pt »

Thank you Miguel.
But the value X is not always 10 or 0. Is the value we write in entry for X.
Next you have some lines of my code:
proc tkpoint::initwindow { parent GDN PARENT} {
set lx [label $parent.lx -text "X:"]
set ex [entry $parent.ex -textvariable tkpoint::x -width 10 -bd 2]
tkpoint::InicioJanela $PARENT $GDN
}
proc tkpoint::InicioJanela { parent GDN } {
global ProblemTypePriv
global wdataw
(...)
set ProblemTypePriv(pointcombo) [combobox $wdataw.f1b.c -editable 1 \
-keephistory 0 -history $lcns -textvar ProblemTypePriv(pointcombotext)]
$wdataw.f1b.c del 0 end
$wdataw.f1b.c ins end $cname
$wdataw.f1b.c conf -editable 0
GidHelp $wdataw.f1b.c "This is a list of all created point loads. In this menu it is "\
"selected the active point load."
trace var ProblemTypePriv(pointcombotext) w "ChangeToPointCombo ;#"

(ChangeToPointCombo is equal to ChangeToLoadCase of Load Cases in Nastran, where we have the possibility of create a new point load, rename or delete)

button $wdataw.f1b.b1 -image $ProblemTypePriv(loadcaseimgcheck) -padx 0 -bd 1 -pady 0 \
-command "NewPoint {} $wdataw"
button $wdataw.f1b.b2 -image $ProblemTypePriv(loadcaseimgrename) -padx 0 -bd 1 -pady 0 \
-command "RenamePoint $wdataw"
button $wdataw.f1b.b3 -image $ProblemTypePriv(loadcaseimgerase-cross) -padx 0 -bd 1 -pady 0 \
-command "DeletePoint $wdataw"

(...)
}
Supose we create the point load P1.
Then we write on entry $parent.ex for example 10, it could be any other value.
Therefore, i want to have one button, that when we click on it, the written value can be saved.
What i want is: Supose i create a new point load, for example P2, with the same values of X or different
from P1. After saving this values, i select in combobox the point load P1, and in $parent.ex appears the
the values of X saved for P1, and not the values of P2.
I think that this button will be similiar to the button "Update Changes" in the Material's menu.
Thanks




With the option –modifycmd you can specify a tcl procedure which will be called every time the user selects one entry of the combobox,

Here you have an example:

set ::XValue -1
set ::XValueStr "XValue is $::XValue"

proc ChooseXValue { w} {
if { [ string eq $::LoadSelection P1]} {
set ::XValue 10
} elseif { [ string eq $::LoadSelection P1]} {
set ::XValue 0
}
set ::XValueStr "XValue is $::XValue"
tk_messageBox -message "XValue set to $::XValue" -icon info -title "Info" -parent $w -type ok
}

toplevel .w
ComboBox .w.cb -textvariable ::LoadSelection -values {P1 P2} -modifycmd "::ChooseXValue .w.cb"
label .w.l -textvariable ::XValueStr
button .w.b -text Close -command "destroy .w"
grid .w.cb -sticky ew
grid .w.l -sticky ew
grid .w.b
grid rowconfigure .w 0 -weight 1
grid rowconfigure .w 1 -weight 1

miguel




De: gidlist-admin at gatxan.cimne.upc.edu [mailto:gidlist-admin at gatxan.cimne.upc.edu] En nombre de ascosta at portugalmail.pt
Enviado el: lunes, 24 de octubre de 2005 14:01
Para: gidlist at gatxan.cimne.upc.es
Asunto: Re: [GiDlist] Array in Problem Type

Thanks Enrique for your help. "Concat" works very well.
Another question is how can I associate the names of a combobox with some values x, y, z, ...
Please see the file point.jpg.
I want do like in materials: when we modify de parameters of one material,
we have one button to update the changes.
I create a new point load P1 with value X 10 and after that i create a point load P2 with value X 0.
What I want is: when i select in combobox the point load P1, the value that apears for X is 10
as it was created behind and not 0 (the last value for X) or empty.
Thanks all.
I hope you all understand my doubt.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20051025/c0b98427/attachment.htm
User avatar
escolano
Posts: 1961
Joined: Sun Sep 05, 1982 10:51 pm

[GiDlist] Array in Problem Type

Post by escolano »

The Miguel's code is only a sample with fixed values (0 or 10), but you can have stored
your validated values inside a tcl array variable, using for example the combobox item as key index

proc ChooseXValue { w } {
global MyLoadValues
set XValue $MyLoadValues($::LoadSelection,x)
set YValue $MyLoadValues($::LoadSelection,y)

... update the desired widgets (setting his linked variables, or his widget properties)
}



----- Original Message -----
From: ascosta at portugalmail.pt
To: gidlist at gid.cimne.upc.es
Sent: Tuesday, October 25, 2005 6:59 PM
Subject: RE: [GiDlist] Array in Problem Type


Thank you Miguel.
But the value X is not always 10 or 0. Is the value we write in entry for X.
Next you have some lines of my code:
proc tkpoint::initwindow { parent GDN PARENT} {
set lx [label $parent.lx -text "X:"]
set ex [entry $parent.ex -textvariable tkpoint::x -width 10 -bd 2]
tkpoint::InicioJanela $PARENT $GDN
}
proc tkpoint::InicioJanela { parent GDN } {
global ProblemTypePriv
global wdataw
(...)
set ProblemTypePriv(pointcombo) [combobox $wdataw.f1b.c -editable 1
-keephistory 0 -history $lcns -textvar ProblemTypePriv(pointcombotext)]
$wdataw.f1b.c del 0 end
$wdataw.f1b.c ins end $cname
$wdataw.f1b.c conf -editable 0
GidHelp $wdataw.f1b.c "This is a list of all created point loads. In this menu it is "
"selected the active point load."
trace var ProblemTypePriv(pointcombotext) w "ChangeToPointCombo ;#"

(ChangeToPointCombo is equal to ChangeToLoadCase of Load Cases in Nastran, where we have the possibility of create a new point load, rename or delete)

button $wdataw.f1b.b1 -image $ProblemTypePriv(loadcaseimgcheck) -padx 0 -bd 1 -pady 0
-command "NewPoint {} $wdataw"
button $wdataw.f1b.b2 -image $ProblemTypePriv(loadcaseimgrename) -padx 0 -bd 1 -pady 0
-command "RenamePoint $wdataw"
button $wdataw.f1b.b3 -image $ProblemTypePriv(loadcaseimgerase-cross) -padx 0 -bd 1 -pady 0
-command "DeletePoint $wdataw"

(...)
}
Supose we create the point load P1.
Then we write on entry $parent.ex for example 10, it could be any other value.
Therefore, i want to have one button, that when we click on it, the written value can be saved.
What i want is: Supose i create a new point load, for example P2, with the same values of X or different
from P1. After saving this values, i select in combobox the point load P1, and in $parent.ex appears the
the values of X saved for P1, and not the values of P2.
I think that this button will be similiar to the button "Update Changes" in the Material's menu.
Thanks




With the option -modifycmd you can specify a tcl procedure which will be called every time the user selects one entry of the combobox,

Here you have an example:

set ::XValue -1
set ::XValueStr "XValue is $::XValue"

proc ChooseXValue { w} {
if { [ string eq $::LoadSelection P1]} {
set ::XValue 10
} elseif { [ string eq $::LoadSelection P1]} {
set ::XValue 0
}
set ::XValueStr "XValue is $::XValue"
tk_messageBox -message "XValue set to $::XValue" -icon info -title "Info" -parent $w -type ok
}

toplevel .w
ComboBox .w.cb -textvariable ::LoadSelection -values {P1 P2} -modifycmd "::ChooseXValue .w.cb"
label .w.l -textvariable ::XValueStr
button .w.b -text Close -command "destroy .w"
grid .w.cb -sticky ew
grid .w.l -sticky ew
grid .w.b
grid rowconfigure .w 0 -weight 1
grid rowconfigure .w 1 -weight 1

miguel




De: gidlist-admin at gatxan.cimne.upc.edu [mailto:gidlist-admin at gatxan.cimne.upc.edu] En nombre de ascosta at portugalmail.pt
Enviado el: lunes, 24 de octubre de 2005 14:01
Para: gidlist at gatxan.cimne.upc.es
Asunto: Re: [GiDlist] Array in Problem Type

Thanks Enrique for your help. "Concat" works very well.
Another question is how can I associate the names of a combobox with some values x, y, z, ...
Please see the file point.jpg.
I want do like in materials: when we modify de parameters of one material,
we have one button to update the changes.
I create a new point load P1 with value X 10 and after that i create a point load P2 with value X 0.
What I want is: when i select in combobox the point load P1, the value that apears for X is 10
as it was created behind and not 0 (the last value for X) or empty.
Thanks all.
I hope you all understand my doubt.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20051027/e2b40fc4/attachment.htm
Post Reply