[GiDlist] Re: write file problem

Moderator: GiD Team

Post Reply
Thomas Chan

[GiDlist] Re: write file problem

Post by Thomas Chan »

Hi GiD staff,

I'm working on a *.tcl file and I'm trying to write a file into the
problemtype folder. Here my line of code:

...
set fid [open /Programs/GidWin6.3.0b/problemtypes/FEM.gid/$projname.par w]
puts $fid [ ... ]
close $fid
...

For some reason it keeps appending "My current GiD project directory" at
the end of "My desired directory". Why? Is there a way to write a file
into a different directory? My current GiD project is at
d:\programs\GiDWin6.3.0b. Here is a screen capture of my error box.

Pls advice, thanks!
Tom

1606ee58.jpg



Thomas Chan
R&D Engineer
EMAG Technologies, Inc.
www.emagtechnologies.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20030117/d3d95045/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1606ee58.jpg
Type: image/jpeg
Size: 39883 bytes
Desc: not available
Url : http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20030117/d3d95045/attachment.jpg
Enrique Escolano

[GiDlist] Re: write file problem

Post by Enrique Escolano »

1) You can use the global variable GIDDEFAULT to locate the GiD directory
(a relative path is important if you move your problemtype to another machine)

2) Your variable projname contain the full path (d:\programs\GidWin6.3.0b\tests),
use file tail to obtain only the last filename (tests):

3) if projname contain blank spaces for example is not valid the order
open a/b/$projname w
because open expects two parameters, not more.

This is a corrected code:

global GIDDEFAULT
set filename [file join $GIDDEFAULT problemtypes FEM.gid [file tail $projname].par]
set fid [open $filename w]
if { !$fid } {
WarnWin "Error, file '$filename' cannot be open"
return
}
...

Regards

Enrique Escolano

----- Original Message -----
From: Thomas Chan
To: gidlist at gatxan.cimne.upc.es
Sent: Friday, January 17, 2003 9:35 PM
Subject: [GiDlist] Re: write file problem


Hi GiD staff,

I'm working on a *.tcl file and I'm trying to write a file into the problemtype folder. Here my line of code:

...
set fid [open /Programs/GidWin6.3.0b/problemtypes/FEM.gid/$projname.par w]
puts $fid [ ... ]
close $fid
...

For some reason it keeps appending "My current GiD project directory" at the end of "My desired directory". Why? Is there a way to write a file into a different directory? My current GiD project is at d:\programs\GiDWin6.3.0b. Here is a screen capture of my error box.

Pls advice, thanks!
Tom





Thomas Chan
R&D Engineer
EMAG Technologies, Inc.
www.emagtechnologies.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20030117/e9ac4a99/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 39883 bytes
Desc: not available
Url : http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20030117/e9ac4a99/attachment.jpeg
Ramon Ribó

[GiDlist] Re: write file problem

Post by Ramon Ribó »

Hello,

You probably want something like:

set fid [open /Programs/GidWin6.3.0b/problemtypes/FEM.gid/[file tail
$projname].par w]

Probably, you do not want to use and absolute path for writing a file.
Doing so, you will not be able to use your
software in any other computer installation.

An additional trick that can be useful to someone is that, when a TCL
error window appears, you can press
middle mouse button over the window and more information will be displayed
about the error.

Regards,
--
Compass Ing. y Sistemas Dr. Ramon Ribó
http://www.compassis.com ramsan at compassis.com
c/ Manuel Girona, 61 bajos tel. +34 93 204 10 82
08034 Barcelona, Spain fax. +34 93 204 19 09

-----Mensaje original-----
De: gidlist-admin at gatxan.cimne.upc.es
[mailto:gidlist-admin at gatxan.cimne.upc.es]En nombre de Thomas Chan
Enviado el: viernes, 17 de enero de 2003 21:36
Para: gidlist at gatxan.cimne.upc.es
Asunto: [GiDlist] Re: write file problem


Hi GiD staff,

I'm working on a *.tcl file and I'm trying to write a file into the
problemtype folder. Here my line of code:

...
set fid [open /Programs/GidWin6.3.0b/problemtypes/FEM.gid/$projname.par w]
puts $fid [ ... ]
close $fid
...

For some reason it keeps appending "My current GiD project directory" at
the end of "My desired directory". Why? Is there a way to write a file
into a different directory? My current GiD project is at
d:\programs\GiDWin6.3.0b. Here is a screen capture of my error box.

Pls advice, thanks!
Tom





Thomas Chan
R&D Engineer
EMAG Technologies, Inc.
www.emagtechnologies.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20030120/2fe4c4f8/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 39883 bytes
Desc: not available
Url : http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20030120/2fe4c4f8/attachment.jpeg
VSayako Willy

[GiDlist] Can GiD generate the mesh based on the Error estim

Post by VSayako Willy »

Hi GiD team
I'm now working also on "Error Estimation" and want
to use GiD generate (or add) the new mesh based upon
the Error estimation on that element (Triangular
element).

Please Look over on the attached file.


Best regards.

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mesh of Error Estimation.doc
Type: application/msword
Size: 53760 bytes
Desc: Mesh of Error Estimation.doc
Url : http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20030122/9d75ce8b/attachment.doc
Enrique Escolano

[GiDlist] Can GiD generate the mesh based on the Error estim

Post by Enrique Escolano »

For this pourposes, it exists in GiD the concept of "mesh size assignation
by background mesh"
Your analysis calculate a new node or element desired size, based on the
error estimation, and write this information
in a "background mesh" file. GiD read this file and the new mesh is
generated based on this sizes.
Now it's possible to assign sizes using a background mesh of triangles or
tetrahedrons. The background mesh must cover all the domain (usually the
background mesh will be a previous mesh of the same model).

To load this "background mesh" file use the menu
Meshing-Assign Unstructured Sizes-Background Mesh...
If you load a background mesh, you can visualize the sizes (as points,
filled elemens or spheres) to detect bugs:
Meshing-Draw Sizes-BackgroundMesh

Background mesh file example:

BackgroundMesh V 1.0
MESH dimension 2 ElemType Triangle Nnode 3
Coordinates
1 5.61705 4.81504 0.00000
...
51 -5.64191 -1.53335 0.00000
end coordinates
Elements
1 24 16 26
2 16 10 14
...
76 34 31 28
end elements
DesiredSize Nodes
1 0.20
2 0.25
...
51 1.5
End DesiredSize

Regards

Enrique Escolano

----- Original Message -----
From: "VSayako Willy" vilaysako at yahoo.com
To: gidlist at gatxan.cimne.upc.es
Sent: Wednesday, January 22, 2003 3:22 AM
Subject: [GiDlist] Can GiD generate the mesh based on the Error estimation


Hi GiD team
I'm now working also on "Error Estimation" and want
to use GiD generate (or add) the new mesh based upon
the Error estimation on that element (Triangular
element).

Please Look over on the attached file.


Best regards.

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
Post Reply