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