[Gid_info Condition ... mesh] and #FUNC#(NumEntity)

Moderator: GiD Team

Post Reply
JFlock_BE
Posts: 15
Joined: Thu Jul 11, 2019 6:57 am
Location: Liège, Belgium
Contact:

[Gid_info Condition ... mesh] and #FUNC#(NumEntity)

Post by JFlock_BE »

Hi GiD Team,

I have an issue with the return of the tcl function [GiD_info Condition cond_name mesh].
For some conditions (CONDTYPE = over lines, CONDMESH = over elements, CANREPEAT = Yes), we are using the special function #FUNC#(NumEntity) in a hidden question of the condition to retrieve the line id in our tcl procedures after meshing.
When calling [GiD_info Condition cond_name mesh] in a tcl file after meshing, it should return the id of the geometrical line from where the element is generated for the hidden question.
Most of the time, it's working fine. However, sometimes the id of the geometrical line from where the element is generated returns by [GiD_info Condition cond_name mesh] is equal to 0. This causes our tcl procedure to fail afterwards as we are doing some treatments based on the id of the geometrical line. When this error occurs, I mesh again and there's no more error.

I don't understand why this id is equal to 0 and why it only happens sometimes. Can you help me with that?

Thanks !
JFlock_BE
Posts: 15
Joined: Thu Jul 11, 2019 6:57 am
Location: Liège, Belgium
Contact:

Re: [Gid_info Condition ... mesh] and #FUNC#(NumEntity)

Post by JFlock_BE »

I forgot to mention that we are using GiD v14.0
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: [Gid_info Condition ... mesh] and #FUNC#(NumEntity)

Post by escolano »

I guess that the problem is because your problemtype will be automatically assigning the 'special conditions' to store the geometric id with GiD_Process commands inside the
proc GiD_Event_BeforeMeshGeneration { elementsize } {
}

and the problem is that the new process keywords added at this moment will be queued after the current keywords to generate the mesh,
then the mesh is first generated, and then the conditions assigned to the geometry, and then don't appear in the mesh.
And if do you mesh a second time the conditions of the first time were applied and then appear also in the generated mesh.

Instead of using GiD_Process commands in this delicated events, try to use direct Tcl commands (in case they exists in your GiD manual)
e.g. try to do it with
GiD_AssignData condition ...
(see the syntax in the Help->Customization manual of your GiD version)
JFlock_BE
Posts: 15
Joined: Thu Jul 11, 2019 6:57 am
Location: Liège, Belgium
Contact:

Re: [Gid_info Condition ... mesh] and #FUNC#(NumEntity)

Post by JFlock_BE »

This condition is not automatically assigned inside the event BeforeMeshGeneration. It is assigned by the user and the special function #FUNC#(NumEntity) is used as one of the questions this specific condition (and this specific question is hidden so that the user doesn't see it but it still applied).

But I think you've pointed out something with the GiD_Process commands. Our problemtype has its own tcl proc for launching the meshing. This proc first makes some checks and sets some MeshCriteria on entities with GiD_Process commands (for example, this is done to impose the meshing of some lines that doesn’t have materials but have some specific conditions). Once all these checks and sets are done, the meshing is launched with the command [GiD_Process Mescape Meshing Generate]. And once the meshing is done (i.e. once the AfterMeshGeneration event is raised), there are some post-processing where we are using the problematic proc [GiD_info Condition ... mesh].
Do you think that this way of working could lead to that kind of problem?
By the way, I tried to find direct Tcl commands equivalent to [GiD_Process Meshing …] commands but I found nothing in the manual/forum. Is there something else I can use instead of [GiD_Process Meshing … ] to automatically assign some specific meshing criteria on entities before meshing?
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: [Gid_info Condition ... mesh] and #FUNC#(NumEntity)

Post by escolano »

The Tcl command to handle 'mesh data' is called

GiD_MeshData

It is explained in the help of
GiD customization manual - > TCL AND TK EXTENSION -> Special Tcl commands ->Mesh data
(if it appear in the help manual of your version, then your version has this command)

It is present in latest GiD 15.1.xd developer versions, if to you have a GiD 15.s password can download the last developer version.

In the what's new document seems that the first version of this command appeared in GiD 14.1.2d
JFlock_BE
Posts: 15
Joined: Thu Jul 11, 2019 6:57 am
Location: Liège, Belgium
Contact:

Re: [Gid_info Condition ... mesh] and #FUNC#(NumEntity)

Post by JFlock_BE »

It's all clear now and everything works fine!
Many thanks for your answers.
Post Reply