# \[GiDlist\] creating and generating mesh of optical fiber with

**URL:** <https://forum.gidsimulation.com/t/gidlist-creating-and-generating-mesh-of-optical-fiber-with/288>\
**Category:** 2013 - 2005\
**Created:** [June 30, 2013, 6:22pm UTC](https://forum.gidsimulation.com/t/gidlist-creating-and-generating-mesh-of-optical-fiber-with/288 "2013-06-30T18:22:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sohel\_sher](https://forum.gidsimulation.com/letter_avatar_proxy/v4/letter/s/d78d45/32.png) [@sohel\_sher](https://forum.gidsimulation.com/u/sohel_sher)\
**Post date:** [June 30, 2013, 6:22pm UTC](https://forum.gidsimulation.com/t/gidlist-creating-and-generating-mesh-of-optical-fiber-with/288/1 "2013-06-30T18:22:08Z")

</div>

Hi GID experts,  
  
  
Using GiD I want to create the cross section of an optical fiber consisting of core and cladding. First i create two circles, one inside other, as follows: geometry-create-object-circle. I get a trouble while assigning material to core and cladding. How can i make the NURBS surface distinct for the core and cladding section so that i can assign different refractive index to each part. I would also like to generate mesh of this structure with the core part having higher number of mesh elements. Your kind suggestion will be much appreciated.

Sohel  
-------------- next part --------------  
An HTML attachment was scrubbed…  
URL: [http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130630/3f31fdb8/attachment.htm](http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130630/3f31fdb8/attachment.htm)

---

<div class="post-metadata">

**Author:** ![Agnese\_Murianni](https://forum.gidsimulation.com/letter_avatar_proxy/v4/letter/a/b487fb/32.png) [@Agnese\_Murianni](https://forum.gidsimulation.com/u/Agnese_Murianni)\
**Post date:** [July 1, 2013, 7:08am UTC](https://forum.gidsimulation.com/t/gidlist-creating-and-generating-mesh-of-optical-fiber-with/288/2 "2013-07-01T07:08:29Z")

</div>

Hi Sohel.  
I think that you have to work by layers, so it’s more simple to assign different properties to different section switching off each time the layer of interest.

Agnese

From: [gidlist-bounces at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist) [mailto:[gidlist-bounces at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)] On Behalf Of sohel sher  
Sent: domenica 30 giugno 2013 20:22  
To: [gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
Subject: [GiDlist] creating and generating mesh of optical fiber with GiD

Hi GID experts,

Using GiD I want to create the cross section of an optical fiber consisting of core and cladding. First i create two circles, one inside other, as follows: geometry-create-object-circle. I get a trouble while assigning material to core and cladding. How can i make the NURBS surface distinct for the core and cladding section so that i can assign different refractive index to each part. I would also like to generate mesh of this structure with the core part having higher number of mesh elements. Your kind suggestion will be much appreciated.

Sohel

-------------- next part --------------  
An HTML attachment was scrubbed…  
URL: [http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130701/eddc8331/attachment.htm](http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130701/eddc8331/attachment.htm)

---

<div class="post-metadata">

**Author:** ![sohel\_sher](https://forum.gidsimulation.com/letter_avatar_proxy/v4/letter/s/d78d45/32.png) [@sohel\_sher](https://forum.gidsimulation.com/u/sohel_sher)\
**Post date:** [July 1, 2013, 5:38pm UTC](https://forum.gidsimulation.com/t/gidlist-creating-and-generating-mesh-of-optical-fiber-with/288/3 "2013-07-01T17:38:38Z")

</div>

Thanks, Agnese! Following your feedback i have been able to assign different materials to different layer(core and cladding) of the fiber. However, i face a difficulty when generating mesh for the structure. I want to mesh the structure layer by layer but it didn’t work that way. I found that the mesh elements are kind of overlapped with each layer. How can i have the distinct meshes for each layer(core and cladding)? Any suggestion will be highly appreciated.  
  
  
  
\

* * *

From: Agnese Murianni [agnese.murianni at dappolonia.it](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
To: “[gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)” [gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)&gt sohel sher [sohelsher at yahoo.com](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
Sent: Monday, July 1, 2013 1:08 PM  
Subject: Re: [GiDlist] creating and generating mesh of optical fiber with GiD  
  
  
  
  
Hi Sohel.  
I think that you have to work by layers, so it’s more simple to  
assign different properties to different section switching off each time the layer  
of interest.

Agnese

From:[gidlist-bounces at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
[mailto:[gidlist-bounces at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)] On Behalf Of sohel sher  
Sent: domenica 30 giugno 2013 20:22  
To: [gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
Subject: [GiDlist] creating and generating mesh of optical fiber with  
GiD

Hi GID  
experts,

Using GiD I want to create the cross section of an optical fiber consisting of  
core and cladding. First i create two circles, one inside other, as follows:  
geometry-create-object-circle. I get a trouble while assigning  
material to core and cladding. How can i make the NURBS surface distinct for  
the core and cladding section so that i can assign different refractive index  
to each part. I would also like to generate mesh of this structure with the  
core part having higher number of mesh elements. Your kind suggestion  
will be much appreciated.

Sohel

* * *

GiDlist mailing list  
[GiDlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
[http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
-------------- next part --------------  
An HTML attachment was scrubbed…  
URL: [http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130701/184c88a8/attachment.htm](http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130701/184c88a8/attachment.htm)

---

<div class="post-metadata">

**Author:** ![escolano](https://forum.gidsimulation.com/user_avatar/forum.gidsimulation.com/escolano/32/6_2.png) [@escolano](https://forum.gidsimulation.com/u/escolano)\
**Post date:** [July 1, 2013, 6:48pm UTC](https://forum.gidsimulation.com/t/gidlist-creating-and-generating-mesh-of-optical-fiber-with/288/4 "2013-07-01T18:48:41Z")

</div>

It seems that you have created two overlapped circles.  
probably you must create a ring filled with the other circle, and both circles connected sharing the same circumference curve.

You can create a hole in a surface for example with:  
Geometry-Edit-Hole NURBS surface  
then select the surface and the curve/s that define its hole  
and press escape to finish the command

To fill the hole you must simply create another surface (I recommend to use different layers to visualize better)  
Geometry-Create-NURBS surface-By contour.

About your desire to concentrate finer mesh in some parts, you can assign mesh sizes to geometric entities to specify the required size  
(e.g. could apply a small size to the shared line, and to the inner surface, and left the general mesh size to the rest of entities without any specified size)

I recommend you to follow some ‘GiD user manual’ tutorial to start learning GiD ([http://www.gidhome.com/support/tutorials](http://www.gidhome.com/support/tutorials))

## Enrique Escolano ----- Original Message ----- From: sohel sher To: [gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist) Sent: Monday, July 01, 2013 7:38 PM Subject: Re: [GiDlist] creating and generating mesh of optical fiber with GiD Thanks, Agnese! Following your feedback i have been able to assign different materials to different layer(core and cladding) of the fiber. However, i face a difficulty when generating mesh for the structure. I want to mesh the structure layer by layer but it didn’t work that way. I found that the mesh elements are kind of overlapped with each layer. How can i have the distinct meshes for each layer(core and cladding)? Any suggestion will be highly appreciated. \

From: Agnese Murianni [agnese.murianni at dappolonia.it](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
To: “[gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)” [gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)&gt sohel sher [sohelsher at yahoo.com](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
Sent: Monday, July 1, 2013 1:08 PM  
Subject: Re: [GiDlist] creating and generating mesh of optical fiber with GiD  
  
  
  
Hi Sohel.  
I think that you have to work by layers, so it’s more simple to assign different properties to different section switching off each time the layer of interest.

Agnese

From: [gidlist-bounces at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist) [mailto:[gidlist-bounces at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)] On Behalf Of sohel sher  
Sent: domenica 30 giugno 2013 20:22  
To: [gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
Subject: [GiDlist] creating and generating mesh of optical fiber with GiD

Hi GID experts,

Using GiD I want to create the cross section of an optical fiber consisting of core and cladding. First i create two circles, one inside other, as follows: geometry-create-object-circle. I get a trouble while assigning material to core and cladding. How can i make the NURBS surface distinct for the core and cladding section so that i can assign different refractive index to each part. I would also like to generate mesh of this structure with the core part having higher number of mesh elements. Your kind suggestion will be much appreciated.

Sohel  
  
\

* * *

## GiDlist mailing list [GiDlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist) [http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist](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)  
[http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
-------------- next part --------------  
An HTML attachment was scrubbed…  
URL: [http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130701/1f166e43/attachment.htm](http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130701/1f166e43/attachment.htm)

---

<div class="post-metadata">

**Author:** ![sohel\_sher](https://forum.gidsimulation.com/letter_avatar_proxy/v4/letter/s/d78d45/32.png) [@sohel\_sher](https://forum.gidsimulation.com/u/sohel_sher)\
**Post date:** [July 2, 2013, 2:14am UTC](https://forum.gidsimulation.com/t/gidlist-creating-and-generating-mesh-of-optical-fiber-with/288/5 "2013-07-02T02:14:29Z")

</div>

Thanks a lot, Enrique Escolano! Your instructions were very helpful. I have been able to make it now.🙂

Best regards  
Sohel  
  
  
\

* * *

From: Enrique Escolano [escolano at cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
To: [gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist); sohel sher [sohelsher at yahoo.com](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
Sent: Tuesday, July 2, 2013 12:48 AM  
Subject: Re: [GiDlist] creating and generating mesh of optical fiber with GiD  
  
  
  
﻿  
It seems that you have created two overlapped  
circles.  
probably you must create a ring filled with the  
other circle, and both circles connected sharing the same circumference  
curve.

You can create a hole in a surface for example  
with:  
Geometry-Edit-Hole NURBS  
surface  
then select the surface and the curve/s that define  
its hole  
and press escape to finish the command

To fill the hole you must simply create another  
surface (I recommend to use different layers to visualize better)  
Geometry-Create-NURBS surface-By  
contour.

About your desire to concentrate finer mesh in some  
parts, you can assign mesh sizes to geometric entities to specify the required  
size  
(e.g. could apply a small size to the shared line,  
and to the inner surface, and left the general mesh size to the rest of entities  
without any specified size)

I recommend you to follow some ‘GiD user manual’  
tutorial to start learning GiD ([http://www.gidhome.com/support/tutorials](http://www.gidhome.com/support/tutorials))

Enrique Escolano  
----- Original Message -----  
_From: sohel sher_  
_To: [gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)_  
_Sent: Monday, July 01, 2013 7:38 PM_  
_Subject: Re: [GiDlist] creating and generating mesh of optical fiber with GiD_

_Thanks, Agnese! Following your feedback i have been able to assign different materials to different layer(core and cladding) of the fiber. However, i face a difficulty when generating mesh for the structure. I want to mesh the structure layer by layer but it didn’t work that way. I found that the mesh elements are kind of overlapped with each layer. How can i have the distinct meshes for each layer(core and cladding)? Any suggestion will be highly appreciated._  
  
  
  
\

* * *

_From: Agnese Murianni [agnese.murianni at dappolonia.it](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)_  
_To: “[gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)” [gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)&gt sohel sher [sohelsher at yahoo.com](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)_  
_Sent: Monday, July 1, 2013 1:08 PM_  
_Subject: Re: [GiDlist] creating and generating mesh of optical fiber with GiD_  
  
  
  
_Hi Sohel._  
_I think that you have to work by layers, so it’s more simple to assign different properties to different section switching off each time the layer of interest._  
_Agnese_  
_From:[gidlist-bounces at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist) [mailto:[gidlist-bounces at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)] On Behalf Of sohel sher_  
_Sent: domenica 30 giugno 2013 20:22_  
_To: [gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)_  
_Subject: [GiDlist] creating and generating mesh of optical fiber with GiD_  
_Hi GID experts,_  
_Using GiD I want to create the cross section of an_  
optical fiber consisting of core and cladding. First i create two circles, one  
inside other, as follows: geometry-create-object-circle. I get a  
trouble while assigning material to core and cladding. How can i make the  
NURBS surface distinct for the core and cladding section so that i can assign  
different refractive index to each part. I would also like to generate mesh of  
this structure with the core part having higher number of mesh elements.  
Your kind suggestion will be much  
appreciated.

_Sohel_

* * *

_GiDlist_  
mailing list  
_[GiDlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)_  
\_[http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist\_](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)_  
\_[http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist\_](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)  
[http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
-------------- next part --------------  
An HTML attachment was scrubbed…  
URL: [http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130702/f5932c2e/attachment-0001.htm](http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130702/f5932c2e/attachment-0001.htm)

---

<div class="post-metadata">

**Author:** ![tom.probst\_at\_tuhh.d](https://forum.gidsimulation.com/letter_avatar_proxy/v4/letter/t/ac91a4/32.png) [@tom.probst\_at\_tuhh.d](https://forum.gidsimulation.com/u/tom.probst_at_tuhh.d)\
**Post date:** [July 3, 2013, 12:58pm UTC](https://forum.gidsimulation.com/t/gidlist-creating-and-generating-mesh-of-optical-fiber-with/288/6 "2013-07-03T12:58:42Z")

</div>

Hi all,

I would like to know if it is possible to parameterize the geometry of a  
GiD model. For example after modelling a cube I want to assign a parameter  
to the side length of the cube.

Thanks a lot for your help!  
-------------- next part --------------  
An HTML attachment was scrubbed…  
URL: [http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130703/ed754613/attachment.htm](http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130703/ed754613/attachment.htm)

---

<div class="post-metadata">

**Author:** ![escolano](https://forum.gidsimulation.com/user_avatar/forum.gidsimulation.com/escolano/32/6_2.png) [@escolano](https://forum.gidsimulation.com/u/escolano)\
**Post date:** [July 3, 2013, 2:10pm UTC](https://forum.gidsimulation.com/t/gidlist-creating-and-generating-mesh-of-optical-fiber-with/288/7 "2013-07-03T14:10:22Z")

</div>

No, it is not possible this parametrization.

What you can do for simple cases is to create a Tcl procedure that build the geometry that you want, based on your parameters (e.g. cube sizes),  
and then you can invoke this procedure with the parameters you want

Enrique Escolano  
----- Original Message -----  
From: [tom.probst at tuhh.de](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
To: [gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
Sent: Wednesday, July 03, 2013 2:58 PM  
Subject: [GiDlist] How to parameterize the geometry of a GiD model?  
  
  
Hi all,

I would like to know if it is possible to parameterize the geometry of a GiD model. For example after modelling a cube I want to assign a parameter to the side length of the cube.

## Thanks a lot for your help! \

\

* * *

GiDlist mailing list  
[GiDlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
[http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
-------------- next part --------------  
An HTML attachment was scrubbed…  
URL: [http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130703/64635df2/attachment.htm](http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130703/64635df2/attachment.htm)

---

<div class="post-metadata">

**Author:** ![Guillaume\_De\_Nayer](https://forum.gidsimulation.com/letter_avatar_proxy/v4/letter/g/eada6e/32.png) [@Guillaume\_De\_Nayer](https://forum.gidsimulation.com/u/Guillaume_De_Nayer)\
**Post date:** [July 9, 2013, 12:30pm UTC](https://forum.gidsimulation.com/t/gidlist-creating-and-generating-mesh-of-optical-fiber-with/288/8 "2013-07-09T12:30:29Z")

</div>

Hi,

I’m new on this list, but I’m using GiD for 2 years.

Here is my problem:  
I have a file containing a structured grid (just the X, Y, Z  
coordinates). I can import this file into GiD, but I get only the nodes  
shown.

Is it possible to generate a structured grid from the given coordinates  
in the file in GiD ?

If yes, what must be done ?

Best Regards,  
Guillaume

---

<div class="post-metadata">

**Author:** ![escolano](https://forum.gidsimulation.com/user_avatar/forum.gidsimulation.com/escolano/32/6_2.png) [@escolano](https://forum.gidsimulation.com/u/escolano)\
**Post date:** [July 9, 2013, 2:34pm UTC](https://forum.gidsimulation.com/t/gidlist-creating-and-generating-mesh-of-optical-fiber-with/288/9 "2013-07-09T14:34:30Z")

</div>

The option to create the structured grid of quadrilaterals from a file with XYZ coordinates not exists, because in general these XYZ could be unstructured.

But importing XYZ files exists an option to create a Delaunay mesh of triangles that connect your points. This option is more general and works also for unstructured clouds of points.  
You can convert the XYZ into geometrical or mesh entities (Files-Import-XYZ points or Files-Import-XYZ nodes)

To create the triangles, in the window that select the filename you must click the “Import options” arrow, and select the “Triangulate” checkbox  
(Note: the triangulation is created projecting the 3D coordinates to the Z=0 plane)

A tool that could be interesting to you is Geometry-Create-NURBS surface-By points…, and select the points.  
It create a NURBS surface that approximate smoothly a cloud of irregular points, and you can remesh this surface again to have a structured mesh of quadrilaterals.

Finally, with Tcl/Tk scripting it is relativelly easy to read a XYZ ASCII file, and create the structured mesh, assumig that the XYZ are structured also.  
This is a procedure that to this, (in fact is a little more general, because it accepts if the rectangle of the XYZ grid are rotated an angle in the XY plane)  
I copy two procedures, one that really do the task, and another that allow you to select the filename with a filebrowser window.

#assumed that is a grid (can be rotated) in x,y and try to detect  
#the number of rows, cols and rotation angle  
proc ReadGridRotated { filename } {  
variable RAD\_TO\_DEGREE  
if { ![file exists $filename] } {  
return 1  
}  
set fp [open $filename r]  
set all [split [read $fp] \n]  
close $fp  
set prevnpoin [GiD\_Info mesh MaxNumNodes]  
set xprev “”  
set d2ref 0  
set nx -1  
set i 1  
foreach line $all {  
if { $line == “” } continue  
foreach {x y z} $line break  
if { ![string is double $z] || $z == “” } {  
set z 0  
} else {  
set z [expr -1\*$z]  
}  
GiD\_Mesh create node append “$x $y $z”  
if { $nx== -1 && $xprev != “” } {  
set d2 [expr {($x-$xprev)_($x-$xprev)+($y-$yprev)_($y-$yprev)}]  
if { $d2ref == 0 } {  
set d2ref [expr {$d2\*1.1}]  
} else {  
if { $d2$d2ref } {  
set nx [expr {$i-1}]  
}  
}  
}  
set xprev $x  
set yprev $y  
incr i  
}

unset all

set newnpoin [expr {[GiD\_Info mesh MaxNumNodes]-$prevnpoin}]  
set ny [expr {$newnpoin/$nx}]  
set p1 [GiD\_Info mesh nodes [expr {$prevnpoin+1}]]  
set p2 [GiD\_Info mesh nodes [expr {$prevnpoin+$nx}]]  
set vx [expr {[lindex $p2 1]-[lindex $p1 1]}]  
set vy [expr {[lindex $p2 2]-[lindex $p1 2]}]  
set angle [expr {acos(double($vx)/sqrt($vx\*$vx+$vy\*$vy))\*$RAD\_TO\_DEGREE}]  
set et quadrilateral  
set nn 4

for { set j 1 } { $j$ny } { incr j } {  
for { set i 1 } { $i$nx } { incr i } {  
set p [expr {($j-1)\*$nx+$i+$prevnpoin}]  
GiD\_Mesh create element append $et $nn “$p [expr {$p+1}] [expr {$p+$nx+1}] [expr {$p+$nx}]”  
}  
}

return [list $nx $ny $angle]  
}

proc ReadGridRotatedWindow { } {  
variable gridfilename  
if { ![info exists gridfilename] } {  
set gridfilename “”  
}  
set types [list [list [= “Grid ASCII file”] “.dat”] [list [\_ “All files”] “.\*”]]  
set defaultextension .dat  
set title [= “Read grid ASCII file”]  
set gridfilename [Browser-ramR file read .gid $title $gridfilename $types $defaultextension 0]  
if { $gridfilename != “” } {  
set t0 [clock seconds]  
GidUtils::WaitState .  
set res [ReadGridRotated $gridfilename]  
foreach “nx ny angle” $res break  
GidUtils::EndWaitState .  
GidUtils::SetWarnLine [= “Time= %s seconds, %sx%s angle=%s degrees”   
[expr [clock seconds]-$t0] $nx $ny $angle]  
if { [GiD\_Info project ViewMode] != “MESHUSE” } {  
GiD\_Process Mescape Meshing MeshView escape  
}  
GiD\_Process Zoom Frame  
#GiD\_Redraw  
}  
}

#invoke the window  
ReadGridRotatedWindow  
  
  
You can create for example add a macro button to the macro buttons toolbar and paste my blue code to be invoked by this button.

Another simple way to test it is to save the blue code in a file (e.g. in “C:\tmp\myfile.tcl”), and write this in the lower command line of GiD to load it:  
-np- source {C:\tmp\myfile.tcl}  
  
  
Regards

Enrique Escolano

----- Original Message -----  
From: “Guillaume De Nayer” [denayer at hsu-hh.de](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
To: [gidlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)  
Sent: Tuesday, July 09, 2013 2:30 PM  
Subject: [GiDlist] Import a structured grid (X,Y,Z coordinates) into GiD  
  
  
_Hi,_  
_I’m new on this list, but I’m using GiD for 2 years._  
_Here is my problem:_  
_I have a file containing a structured grid (just the X, Y, Z_  
_coordinates). I can import this file into GiD, but I get only the nodes_  
_shown._  
_Is it possible to generate a structured grid from the given coordinates_  
_in the file in GiD ?_  
_If yes, what must be done ?_  
_Best Regards,_  
_Guillaume_

* * *

_GiDlist mailing list_  
_[GiDlist at listas.cimne.upc.edu](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist)_  
\_[http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist\_](http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist_)  
-------------- next part --------------  
An HTML attachment was scrubbed…  
URL: [http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130709/be60dac6/attachment.htm](http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20130709/be60dac6/attachment.htm)
