[Gmsh] Get coordinate of a point from STEP geometry

Joel Cugnoni joel.cugnoni at gmail.com
Wed May 7 09:51:38 CEST 2014


Hello all,

I am trying to develop a simple meshing plugin for Salome using GMSH as 
a back-end (in script mode). Right now I am just prototyping the basic 
features...

To define refinement regions, I would like to be able to select all the 
Points within a certain radius from a given coordinate X,Y,Z.
I wrote functions in GMSH scripting language to do that but it needs to 
retrieve the coordinate of each Point in the model.

Using the latest version 2.8.5 it seems that we cannot access the Point 
coordinates from imported STEP geometry even though it works for 
geometry defined directly in GMSH.

My function looks like that:

// GetPointsNearPt: get a list of Points close to coordinates 
argGetX,Y,Z within a radius of argGetROI
// returns the list of points in retGetLst
argGetX=0; argGetY=0; argGetZ=0; argGetROI=0; retGetLst={};
Function GetPointsNearPt
   retGetLst={};
   l__AllPts=Point "*";
   For l__i In {0 : #l__AllPts[]-1}
     l__pt[]=Point{l__AllPts[l__i]};
     l__dx=argGetX-l__pt[0];
     l__dy=argGetY-l__pt[1];
     l__dz=argGetZ-l__pt[2];
     l__d2=l__dx^2+l__dy^2+l__dz^2;
     If (l__d2 <= argGetROI^2)
       retGetLst+={l__AllPts[l__i]};
     EndIf
   EndFor
Return

and the error that I get is "Unknown point '1' "  at the line 
l__pt[]=Point{ l__AllPts[l__i] };   (I get the same error for all points 
in the model).
I have checked in the GUI, the point with id 1 exists and I can get its 
coordinates in GUI by hovering the mouse on it...

Is there a way to circumvent that limitation?

Or any hint to fix this in the code? (which function / source file to 
look at?)

Thanks in advance for your help.

Joel Cugnoni