Message by Clucas Simon:
I know this is a GMSH issue, but i thought I would post here for expediency and maybe other have the same issue.
I am trying to include one file within the mail gGMSH file. The success of this seems to depend upon where I place the include statement.
All elementary object numbers are generated by GMSH (i.e. xxx = newp etc) and the the included file has no dependencies on the main file yet and visa-versa.
However, I get errors complaining about variables (i.e. the arrays i declare to hold the surfaces etc) are not being initialised unless I place the include command lower down in the main file.
Has anyone had this issue and know what is happening?
Regards,
Simon
Message by Benoit Thiebault:
I don’t know this problem, I will ask Julien
Message by Benoit Thiebault:
Hi Simon !
I have some answers for you !
- When you declare variables within a GMSH file, they are global : i.e. you can use them in included files and when you modify them somewhere, they are modified in all the files. Moreover, the declaration of such variables should be done BEFORE including other files
// global variables transArrayX = 0.1transArrayY = -1.900
transArrayZ = 0.03
// Includes
Include “hub.geo”Include “solarArray.geo”
2) Beware that the elements numbers (points, lines, physicals, etc.) are different in all the files. The best way to be sure is to use variables like this (with a different start point for every file):
startPointId = 1000startCurveId = 1000
startSurfId = 1000
// global translation
transX = 0.0transY = 0.0
transZ = 0.0
// main structure of the hub
Point(startPointId+1) = {transX+0, transY+0.0, transZ+0, resHub*0.75}Point(startPointId+2) = {transX+0, transY+0, transZ+0.560, resHub*0.75}
3) When you perform an operation (translation, rotation, etc.), it is done on elements having the same IDs, i.e. if you have points in different files but with the same IDs, they will be transformed as well without any warning.
Hope this helps !
Benoît