[GiDlist] TCL GiD_Process Geometry Create Line

Hi there,
I am trying to create a line between two points via TCL.
The line should go from point A to point B.
Point A already exists in the model, so I want to refer to it by its id number
(stored in the variable $Id_A)
Point B is defined in terms of its 3D coordinates, stored in the list $x_B
Once the line is create I would like to Mescape, to continue adding more
commands

The code is as follows:

set Id_A 15
set x_B { 2 5 0 }
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B
GiD_Process Mescape

This code works ok, except for the case when there is a point previously defined
with coordinates $x_B.
In this case, I get a window prompting the user to decide whether to use the
existing point or create a new one (new/old).
This messes up with the rest of the code that follows, and the line does not get
created.

Is there a way to tell in advance that I always want a new point from tcl?
Or perhaps, can we avoid this interaction?
Many thanks
Andres



-------------- next part --------------
An HTML attachment was scrubbed…
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20101115/bc68a418/attachment.htm

TRy:

FNoJoin


Compass Ing. y Sistemas Dr. Ramon Ribo
http://www.compassis.com ramsan at compassis.com
c/ Tuset, 8 7-2 tel. +34 93 218 19 89
08006 Barcelona, Spain fax. +34 93 396 97 46



2010/11/15 Andres Peratta andres_peratta at yahoo.co.uk:
Hi there,
I am trying to create a line between two points via TCL.
The line should go from point A to point B.
Point A already exists in the model, so I want to refer to it by its id
number (stored in the variable $Id_A)
Point B is defined in terms of its 3D coordinates, stored in the list $x_B
Once the line is create I would like to Mescape, to continue adding more
commands
The code is as follows:
set Id_A 15
set x_B { 2 5 0 }
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B
GiD_Process Mescape
This code works ok, except for the case when there is a point previously
defined with coordinates $x_B.
In this case, I get a window prompting the user to decide whether to use the
existing point or create a new one (new/old).
This messes up with the rest of the code that follows, and the line does not
get created.
Is there a way to tell in advance that I always want a new point from tcl?
Or perhaps, can we avoid this interaction?
Many thanks
Andres


GiDlist mailing list
GiDlist at listas.cimne.upc.edu
_http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist_

NoJoin was ok, because you were before in Join state
FNojoin is also ok, the difference is tha FNoJoin mean ‘force no join’ and doesn’t complain if the current state was already ‘no join’

Your bug is that your variable x_B has the x y z coordinates separated by spaces { 2 5 0 }
do you have two solutions:
1- use a single word, separating x,y,z with commas, and without spaces
e.g.
set x_B { 2,5,0 }
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B


2- or separet x,y,z by spaces, but then send it as three words to the command processor
e.g.
set x_B { 2 5 0 }
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin {*}$x_B

Note the use of {*} Tcl 8.5.x command, to flat the Tcl list of coordinates

that is moreless like this:
set x_B 2
set y_B 5
set z_B 0
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B $y_B $z_B

To avoid prompting the user to decide whether to use the existing point or create a new one (new/old), you can temporary set the GiD variable CreateAlwaysNewPoint to 1

set PreviousValue [GiD_Set CreateAlwaysNewPoint]
GiD_Set CreateAlwaysNewPoint 1

GiD_Set CreateAlwaysNewPoint $PreviousValue

Regards

Enrique Escolano



----- Original Message -----
From: “Ramon Ribó” ramsan at compassis.com
To: gidlist at listas.cimne.upc.edu
Sent: Tuesday, November 16, 2010 10:06 AM
Subject: Re: [GiDlist] TCL GiD_Process Geometry Create Line


TRy:

FNoJoin


Compass Ing. y Sistemas Dr. Ramon Ribo
http://www.compassis.com ramsan at compassis.com
c/ Tuset, 8 7-2 tel. +34 93 218 19 89
08006 Barcelona, Spain fax. +34 93 396 97 46



2010/11/15 Andres Peratta andres_peratta at yahoo.co.uk:
Hi there,
I am trying to create a line between two points via TCL.
The line should go from point A to point B.
Point A already exists in the model, so I want to refer to it by its id
number (stored in the variable $Id_A)
Point B is defined in terms of its 3D coordinates, stored in the list $x_B
Once the line is create I would like to Mescape, to continue adding more
commands
The code is as follows:
set Id_A 15
set x_B { 2 5 0 }
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B
GiD_Process Mescape
This code works ok, except for the case when there is a point previously
defined with coordinates $x_B.
In this case, I get a window prompting the user to decide whether to use the
existing point or create a new one (new/old).
This messes up with the rest of the code that follows, and the line does not
get created.
Is there a way to tell in advance that I always want a new point from tcl?
Or perhaps, can we avoid this interaction?
Many thanks
Andres


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
-------------- next part --------------
An HTML attachment was scrubbed…
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20101116/37260250/attachment.htm

Hi Enrique, Ramon

Many thanks for the prompt reply.
I tried this:

GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B $y_B $z_B
GiD_Process Mescape
and this:

GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin {*}$x_B
GiD_Process Mescape
as well as all combinations with FNoJoin at the end.

They all behave ok only while debugging (step by step with the built-in
RamDebugger). The comma separated list version that I posted initially also
worked fine only while debugging.
The problem arises whenrunning the script without the debugger and point B is
already present. In this case I get the usual window prompting whether to “Join”
the existing point or not, and hit the same problem.


It seems that whatever is seleceted by the user in the Join / No Join
interactive window, GiD will try to execute it as an independent command and
cancels the line creation.

(i.e. selecting a new point issues the command “new” which is recognised as if
I was trying to create a new window, while selecting the existing point issues
the command “old” which then gets unrecognised by GiD) If I take away all the
code from the script that follows after the instruction
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin {*}$x_B
then the job gets done. But this involves the user to press escape few times to
cancel line creation, and then launching the continuation of the script with a
separate command which is quite an auckward solution.

The following solution of avoiding prompting the user to decide whether to use
the existing point or create a new one (new/old) , suggested by Enrique, has
worked fine for me (but is restricted to force always NoJoin)

set PreviousValue [GiD_Set CreateAlwaysNewPoint]
GiD_Set CreateAlwaysNewPoint 1

GiD_Set CreateAlwaysNewPoint $PreviousValue

We will stick to this solution for the moment.

Best regards
Andres Peratta

tcl version: 8.5.6
GiD version 9.0.6

\


From: Enrique Escolano escolano at cimne.upc.edu
To: gidlist at listas.cimne.upc.edu
Sent: Tue, 16 November, 2010 11:31:39
Subject: Re: [GiDlist] TCL GiD_Process Geometry Create Line


NoJoin was ok, because you were before in Join state
FNojoin is also ok, the difference is tha FNoJoin mean ‘force no join’ and
doesn’t complain if the current state was already ‘no join’

Your bug is that your variable x_B has the x y z coordinates separated by spaces
{ 2 5 0 }
do you have two solutions:
1- use a single word, separating x,y,z with commas, and without spaces
e.g.
set x_B { 2,5,0 }
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B


2- or separet x,y,z by spaces, but then send it as three words to the command
processor
e.g.
set x_B { 2 5 0 }
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin {*}$x_B

Note the use of {*} Tcl 8.5.x command, to flat the Tcl list of coordinates

that is moreless like this:
set x_B 2
set y_B 5
set z_B 0
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B $y_B $z_B

To avoid prompting the user to decide whether to use the existing point or
create a new one (new/old), you can temporary set the GiD variable
CreateAlwaysNewPoint to 1

set PreviousValue [GiD_Set CreateAlwaysNewPoint]
GiD_Set CreateAlwaysNewPoint 1

----- Original Message -----
From: “Ramon Ribó” ramsan at compassis.com
To: gidlist at listas.cimne.upc.edu
Sent: Tuesday, November 16, 2010 10:06 AM
Subject: Re: [GiDlist] TCL GiD_Process Geometry Create Line
TRy:

FNoJoin


Compass Ing. y Sistemas Dr. Ramon Ribo
http://www.compassis.comramsan@compassis.com
c/ Tuset, 8 7-2 tel. +34 93 218 19 89
08006 Barcelona, Spain fax. +34 93 396 97 46



2010/11/15 Andres Peratta andres_peratta at yahoo.co.uk:
Hi there,
I am trying to create a line between two points via TCL.
The line should go from point A to point B.
Point A already exists in the model, so I want to refer to it by its id
number (stored in the variable $Id_A)
Point B is defined in terms of its 3D coordinates, stored in the list $x_B
Once the line is create I would like to Mescape, to continue adding more
commands
The code is as follows:
set Id_A 15
set x_B { 2 5 0 }
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B
GiD_Process Mescape
This code works ok, except for the case when there is a point previously
defined with coordinates $x_B.
In this case, I get a window prompting the user to decide whether to use the
existing point or create a new one (new/old).
This messes up with the rest of the code that follows, and the line does not
get created.
Is there a way to tell in advance that I always want a new point from tcl?
Or perhaps, can we avoid this interaction?
Many thanks
Andres


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

GiD_Set CreateAlwaysNewPoint $PreviousValue

Regards

Enrique Escolano




-------------- next part --------------
An HTML attachment was scrubbed…
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20101116/b88de0ce/attachment-0001.htm

Join/No join only change the mode of expect an identifier number of a point or its real coordinates,
but in this second mode (No Join), the new point is tested agains “close” points, and if there is one very close, user is asked to join with it (if CreateAlwaysNewPoint preference is 0 == Ask)

When do you work in an automatic mode (without user intervention) in the creation of new points, you don’t know ‘a priori’ if GiD will ask you about create new or use a previous close point, to answer “old” or “new”
(is you send always this word “old” or “new” when is not expeced, it will raise errors: ‘old’ will be unknown, and ‘new’ will be considered as ‘open a new window’
then the solution is to set CreateAlwaysNewPoint =1 to say that do you want always the new point you are setting by coordinates, also if there is another point close to this location:

set PreviousValue [GiD_Set CreateAlwaysNewPoint]
GiD_Set CreateAlwaysNewPoint 1
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin {*}$x_B
GiD_Process Mescape
GiD_Set CreateAlwaysNewPoint $PreviousValue

Off course you could obtain ‘overlapped’ points, is your resposability to handle them, or collapse them after with your tolerance.
----- Original Message -----
From: Andres Peratta
To: gidlist at listas.cimne.upc.edu
Sent: Tuesday, November 16, 2010 2:14 PM
Subject: Re: [GiDlist] TCL GiD_Process Geometry Create Line


Hi Enrique, Ramon

Many thanks for the prompt reply.
I tried this:

GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B $y_B $z_B
GiD_Process Mescape
and this:

GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin {*}$x_B
GiD_Process Mescape
as well as all combinations with FNoJoin at the end.

They all behave ok only while debugging (step by step with the built-in RamDebugger). The comma separated list version that I posted initially also worked fine only while debugging.
The problem arises when running the script without the debugger and point B is already present. In this case I get the usual window prompting whether to “Join” the existing point or not, and hit the same problem.

It seems that whatever is seleceted by the user in the Join / No Join interactive window, GiD will try to execute it as an independent command and cancels the line creation.
(i.e. selecting a new point issues the command “new” which is recognised as if I was trying to create a new window, while selecting the existing point issues the command “old” which then gets unrecognised by GiD) If I take away all the code from the script that follows after the instruction
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin {*}$x_B
then the job gets done. But this involves the user to press escape few times to cancel line creation, and then launching the continuation of the script with a separate command which is quite an auckward solution.

The following solution of avoiding prompting the user to decide whether to use the existing point or create a new one (new/old) , suggested by Enrique, has worked fine for me (but is restricted to force always NoJoin)

set PreviousValue [GiD_Set CreateAlwaysNewPoint]
GiD_Set CreateAlwaysNewPoint 1

GiD_Set CreateAlwaysNewPoint $PreviousValue

We will stick to this solution for the moment.

Best regards
Andres Peratta

tcl version: 8.5.6
GiD version 9.0.6

\

From: Enrique Escolano escolano at cimne.upc.edu
To: gidlist at listas.cimne.upc.edu
Sent: Tue, 16 November, 2010 11:31:39
Subject: Re: [GiDlist] TCL GiD_Process Geometry Create Line


NoJoin was ok, because you were before in Join state
FNojoin is also ok, the difference is tha FNoJoin mean ‘force no join’ and doesn’t complain if the current state was already ‘no join’

Your bug is that your variable x_B has the x y z coordinates separated by spaces { 2 5 0 }
do you have two solutions:
1- use a single word, separating x,y,z with commas, and without spaces
e.g.
set x_B { 2,5,0 }
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B


2- or separet x,y,z by spaces, but then send it as three words to the command processor
e.g.
set x_B { 2 5 0 }
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin {*}$x_B

Note the use of {*} Tcl 8.5.x command, to flat the Tcl list of coordinates

that is moreless like this:
set x_B 2
set y_B 5
set z_B 0
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B $y_B $z_B

To avoid prompting the user to decide whether to use the existing point or create a new one (new/old), you can temporary set the GiD variable CreateAlwaysNewPoint to 1

set PreviousValue [GiD_Set CreateAlwaysNewPoint]
GiD_Set CreateAlwaysNewPoint 1

GiD_Set CreateAlwaysNewPoint $PreviousValue

Regards

Enrique Escolano



----- Original Message -----
From: “Ramon Ribó” ramsan at compassis.com
To: gidlist at listas.cimne.upc.edu
Sent: Tuesday, November 16, 2010 10:06 AM
Subject: Re: [GiDlist] TCL GiD_Process Geometry Create Line


TRy:

FNoJoin


Compass Ing. y Sistemas Dr. Ramon Ribo
http://www.compassis.com ramsan at compassis.com
c/ Tuset, 8 7-2 tel. +34 93 218 19 89
08006 Barcelona, Spain fax. +34 93 396 97 46



2010/11/15 Andres Peratta andres_peratta at yahoo.co.uk:
Hi there,
I am trying to create a line between two points via TCL.
The line should go from point A to point B.
Point A already exists in the model, so I want to refer to it by its id
number (stored in the variable $Id_A)
Point B is defined in terms of its 3D coordinates, stored in the list $x_B
Once the line is create I would like to Mescape, to continue adding more
commands

The code is as follows:

set Id_A 15
set x_B { 2 5 0 }
GiD_Process Mescape Geometry Create Line Join $Id_A NoJoin $x_B
GiD_Process Mescape

This code works ok, except for the case when there is a point previously
defined with coordinates $x_B.
In this case, I get a window prompting the user to decide whether to use the
existing point or create a new one (new/old).
This messes up with the rest of the code that follows, and the line does not
get created.
Is there a way to tell in advance that I always want a new point from tcl?
Or perhaps, can we avoid this interaction?
Many thanks
Andres


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
-------------- next part --------------
An HTML attachment was scrubbed…
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20101116/fc9eed85/attachment.htm

An HTML attachment was scrubbed…
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20101116/1b40d9a7/attachment.htm

You are having problems with your graphic card / driver and OpenGL

To try to avoid them, go to our Utilities-Preferences… window
and in Graphical, select
‘Safe visualization mode’
and/or
‘Selection lines by software’

Regards

Enrique
----- Original Message -----
From: Li Yu/UPC
To: gidlist at listas.cimne.upc.edu
Cc: lyu at sckcen.be
Sent: Tuesday, November 16, 2010 5:35 PM
Subject: Re: [GiDlist] TCL GiD_Process Geometry Create Line


Dear GIDlist

When we use GID in Windows 7.0, there is much problem with the display of the operation, for example, if we draw a line, the points and line can not be shown on the screen, only when we click redraw, the points and line we just drew can be displayed.

Does somebody also meet this problem, and we look forward to your solution!



Kind regards,

Li Yu


\


\


GiDlist mailing list
GiDlist at listas.cimne.upc.edu
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/20101117/9c18d73e/attachment.htm