Listing node numbers of an element with specific condition

Moderator: GiD Team

Post Reply
wfmoralesp
Posts: 8
Joined: Fri Apr 10, 2015 1:30 pm

Listing node numbers of an element with specific condition

Post by wfmoralesp »

Hi,

I want to apply a condition on some linear elements, and later to loop through the elements that have that condition applied and listing their corresponding node connectivities.

I tried using:

NUMBER:30 CONDITION: Structure
CONDTYPE: over lines
CONDMESHTYPE: over body elements
QUESTION: X
VALUE: 1
END CONDITION

and in the BAS file:

*Set Cond Structure *elems
*loop *elems *OnlyInCond
*elemsconec(1) *elemsconec(2)
*end elems

Unfortunately, it's not working. It doesn't show any error message, but it doesn't write the nodes of the elements. Any suggestion?

thx
User avatar
escolano
Posts: 1922
Joined: Sun Sep 05, 1982 10:51 pm

Re: Listing node numbers of an element with specific conditi

Post by escolano »

Your code is ok, and it works (I have created a minimal problemtype and example and works well)

a comment, it is not neccesary to specify NUMBER:xx to conditions (or materials)
then it is easier to be maintained in the future (insert or remove conditions,...)

Are you sure that your model has any mesh line with this condition applied over them?

You must apply the condition to a geometric line and then generate the mesh (or directly apply to the mesh line elements, but this is unrecommended)
maybe you line belong to a surface, and then is not meshed
(if do you want also its mesh must specify it with Mesh->Mesh criteria->Mesh->Lines, and select them)
wfmoralesp
Posts: 8
Joined: Fri Apr 10, 2015 1:30 pm

Re: Listing node numbers of an element with specific conditi

Post by wfmoralesp »

Hi,

At the beginning I thought the same. That no linear elements were being generated, and I did the same you suggested (Mesh->Mesh criteria->Mesh->Lines). Now, I'm sure there are linear elements in the model (also said by the dialog window when the mesh is generated) even when I 'draw' the condition with the mesh on, I can see how each element has the condition assigned. but nothing is printed, even more if I specify *condnumentities I get 0, which would mean that no entities have that condition assigned. Now, I have no clue :(
User avatar
escolano
Posts: 1922
Joined: Sun Sep 05, 1982 10:51 pm

Re: Listing node numbers of an element with specific conditi

Post by escolano »

test what happen if you piece of code is at the beginning of the .bas file
It works? (I expect that it does)

then maybe in other parts of the .bas code other previous commands have filtered the table of elements
try, in the true location, to add before your code *set elems(all)

*set elems(all)
*Set Cond Structure *elems
*loop *elems *OnlyInCond
*elemsconec(1) *elemsconec(2)
*end elems
wfmoralesp
Posts: 8
Joined: Fri Apr 10, 2015 1:30 pm

Re: Listing node numbers of an element with specific conditi

Post by wfmoralesp »

Hi Miguel,

Muchas gracias!! It works like a charm!! I'd have never realized of that by myself.
Post Reply