the email for avoiding confusion. But still, I get the same error.
Thanks,
Arash
On Mon, Feb 20, 2012 at 12:35 PM, Enrique Escolano
escolano at cimne.upc.edu wrote:
In order to be automatically sourced by GiD, the name of the tcl file must
be "FLODEF V11.tcl "
(the same as the problemtype and .tcl extension)
Enrique
----- Original Message -----
From: "Farzam-Student,STW, Arash" farzam at ostatemail.okstate.edu
To: gidlist at listas.cimne.upc.edu
Sent: Monday, February 20, 2012 7:08 PM
Subject: Re: [GiDlist] Set Materials
Hello,
I made a .tcl file in my problem type containing:
proc Example_GetNodesOfElementType { element_type } {
set nodes
- foreach item [lindex [lindex [GiD_Info Mesh Elements $element_type
-array] 0] 2] {
lappend nodes {*}$item
}
set nodes [lsort -integer -unique $nodes]
return $nodes
}
and in my .bas file,
I have written
*tcl(Example_GetNodesOfElementType Hexahedra)
*NodesNum *NodesCoord
to get the nodal coordinates all hexahedra elements. It is not working
and it gives the error:
Error in base file C:/Program Files/GiD/GiD 9.0.2/problemtypes/FLODEF
V11.gid/FLODEF V11-post.bas at line number 3: Error in TCL expression:
'invalid command name "Example_GetNodesOfElement_Type"'
I would be happy to have your comment.
Thank You,
Arash Farzam
On Tue, Feb 14, 2012 at 4:22 AM, Enrique Escolano
escolano at cimne.upc.edu wrote:
No, you can't do a loop on the nodes of a type of elements with simple
.bas
commands.
you can do the loop on the elements of a type, and inside write all its
nodes, but then you will obtain the list of nodes of this kind of element,
but with repetitions.
to do this kind of special thinks you must go to Tcl scripting level. You
can define a tcl procedure (inside a problemtype.tcl file it is
automatically sourced) that
return what you want (the list of nodes of a type of element unrepeated)
You can invoke this Tcl procedure from the .bas file, with a
*tcl(your_procedure) command, then the value returned by the procedure is
directly printed in the output file.
This is an example of the procedure you need to write in your
problemtype.tcl file
proc Example_GetNodesOfElementType { element_type } {
set nodes- foreach item [lindex [lindex [GiD_Info Mesh Elements $element_type
-array] 0] 2] {
lappend nodes {*}$item
}
set nodes [lsort -integer -unique $nodes]
return $nodes
}
GiD_Info Mesh is a special GiD-Tcl command (you can see the its syntax at
GiD Help (GiD Customization - Tcl/Tk extension)
the rest is Tcl standard scripting language (can see documentation on
Internet, and also in the help of Ramdebugger that is our Tcl/Tk editor
and
debugger), could open RamDebugger from the menu
Data-Problemtype-Debugger...
and in the .bas file you must write something like this:
Hexahedra nodes:
*tcl(Example_GetNodesOfElementType Hexahedra)
Quadrilateral nodes:
*tcl(Example_GetNodesOfElementType Quadrilateral)
Note that I prefixed the Tcl procedure with 'Example', to avoid conflicts
with other possible Tcl procedure that could use the same name
GetNodesOfElementType
I recommend you to use a prefix or namespace related with the name of your
problemtype.
Note: you can obtain multiple .dat output files, writting multiple .bas
templates. a increasing number if added to the name of each .dat file (and
templates are evaluated sorted alphabetically by its name)
Regards
Enrique
----- Original Message -----
From: "Farzam-Student,STW, Arash" farzam at ostatemail.okstate.edu
To: gidlist at listas.cimne.upc.edu
Sent: Tuesday, February 14, 2012 12:45 AM
Subject: Re: [GiDlist] Set Materials
Thank You very much,
I have another qustion. I have two types of elements, hexahedron and
rectangular. Can I set element type for each one and loop the nodes of
each one? I want to have all the nodes of hexahedron elements only in
one file and all the nodes of the rectangular elements only in another
file.
Best Regards,
Arash
On Wed, Feb 1, 2012 at 4:37 AM, Enrique Escolano escolano at cimne.upc.edu
wrote:
You can do two loops, and inside take in account only the kind of
material
you want
And you can have in the material a hidden field, named for example
'class',
to identify its category
MATERIAL:xxx
Question:class
Value:soil
State:hidden
...
END MATERIAL
*loop materials
*if(strcmp(Matprop(class),"soil")==0)
write its properties
*endif
*end materials
*loop materials
*if(strcmp(Matprop(class),"concrete")==0)
write its properties
*endif
*end materials
----- Original Message -----
From: "Farzam-Student,STW, Arash" farzam at ostatemail.okstate.edu
To: gidlist at listas.cimne.upc.edu
Sent: Tuesday, January 31, 2012 10:05 PM
Subject: [GiDlist] Set Materials
Hello,
I have two kinds of materials in my code: soil materials and concrete
materials. Is there a way to ask GiD to loop only soil materials at
one stage and loop concrete materials at another time in the .bas file
instead of having the command Loop materials which will cover all
soils and concretes? Can I use the set command to select only the soil
/ concrete materials?
Thank You,
Arash
_______________________________________________
GiDlist mailing list
GiDlist at listas.cimne.upc.edu
http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist
_______________________________________________
GiDlist mailing list
GiDlist at listas.cimne.upc.edu
http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist
_______________________________________________
GiDlist mailing list
GiDlist at listas.cimne.upc.edu
http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist
_______________________________________________
GiDlist mailing list
GiDlist at listas.cimne.upc.edu
http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist
_______________________________________________
GiDlist mailing list
GiDlist at listas.cimne.upc.edu
http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist
_______________________________________________
GiDlist mailing list
GiDlist at listas.cimne.upc.edu
http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist
- foreach item [lindex [lindex [GiD_Info Mesh Elements $element_type