[GiDlist] Re: how to count the number of 3D elems in a volum
Posted: Tue Apr 15, 2003 2:40 pm
Enrique, thank you very much for your help.
I'd like to know if it is possible to assign the number of volumes
to a variable in a bas file.
For example, something like :
*set var N=tcl(Nvol)
where Nvol is this tcl procedure :
proc NVol { } {
set a [.central.s info list_entities Status]
regexp -nocase {number of volumes: ([0-9]+)} $a none num
return $num
}
------------------------------------------------------------------------
I'm still trying to build the table of volumes in the output file.
To do so, I included this condition in the .cnd file
which assigns volume labels to mesh elems:
NUMBER: 1 CONDITION: VolId
Question: Volume_Num#FUNC#(NumEntity)
Value:0
state: hidden
END CONDITION
------------------------------------------------------------------------
And here are the lines that I am trying to use
in my bas file, in order to get a table of volumes and their number of elems
as an output.
This would work provided that the variable Nvol is initialized with the
number of volumes created in the project, and this is what I don't know how
to do.
*set elems(Tetrahedra)
*set cond VolId
*for(vol=1;vol=Nvol;vol=vol+1)
*set var NelemsVol=0
*loop elems
*if(cond(1,int) == vol)
*set var NelemsVol = NelemsVol + 1
*end if
*end
Volume = *vol ; Number of elems = *NelemsVol
*end
-------------------------------------------------------------------------
In general, is there any way to assign the result of a tcl function to a variable in a bas file ?
Sorry to bother you, and thank you very much for your help
best regards,
Andres
I'd like to know if it is possible to assign the number of volumes
to a variable in a bas file.
For example, something like :
*set var N=tcl(Nvol)
where Nvol is this tcl procedure :
proc NVol { } {
set a [.central.s info list_entities Status]
regexp -nocase {number of volumes: ([0-9]+)} $a none num
return $num
}
------------------------------------------------------------------------
I'm still trying to build the table of volumes in the output file.
To do so, I included this condition in the .cnd file
which assigns volume labels to mesh elems:
NUMBER: 1 CONDITION: VolId
Question: Volume_Num#FUNC#(NumEntity)
Value:0
state: hidden
END CONDITION
------------------------------------------------------------------------
And here are the lines that I am trying to use
in my bas file, in order to get a table of volumes and their number of elems
as an output.
This would work provided that the variable Nvol is initialized with the
number of volumes created in the project, and this is what I don't know how
to do.
*set elems(Tetrahedra)
*set cond VolId
*for(vol=1;vol=Nvol;vol=vol+1)
*set var NelemsVol=0
*loop elems
*if(cond(1,int) == vol)
*set var NelemsVol = NelemsVol + 1
*end if
*end
Volume = *vol ; Number of elems = *NelemsVol
*end
-------------------------------------------------------------------------
In general, is there any way to assign the result of a tcl function to a variable in a bas file ?
Sorry to bother you, and thank you very much for your help
best regards,
Andres