I tried to accomplish this by "surface filling" but it results in a surface that has some distance from the given points as shown in a simple example below. Also, since I have roughly 100x100 points in the actual problem, "surface filling" takes very long time.

Code: Select all

```
import FreeCAD as App
import Draft
import numpy as np
doc = App.newDocument()
L=16
a = App.Vector(-L, -L, 0)
b = App.Vector(-L, L, 0)
c = App.Vector(L, L, 0)
d = App.Vector(L, -L, 0)
obj1=Draft.make_line(a,b)
obj2=Draft.make_line(b,c)
obj3=Draft.make_line(c,d)
obj4=Draft.make_line(d,a)
surf = doc.addObject("Surface::Filling", "Surface")
surf.BoundaryEdges = [(obj1, "Edge1"),
(obj2, "Edge1"),
(obj3, "Edge1"),
(obj4, "Edge1")]
doc.recompute()
n=11
x=np.linspace(-L+L/(n-1),L-L/(n-1),n)
y=np.linspace(-L+L/(n-1),L-L/(n-1),n)
X, Y =np.meshgrid(x,y)
p=[]
pv=[]
rng = np.random.default_rng(1)
a=rng.random(X.shape)
for k in np.arange(X.shape[0]):
for kk in np.arange(X.shape[1]):
p.append(Draft.make_point(App.Vector(X[k,kk],Y[k,kk], (1-0.5*a[k,kk])*10*np.sin(X[k,kk]/L*np.pi)*np.cos(0.5*Y[k,kk]/L*np.pi))))
pv.append((p[-1],"Vertex1"))
surf.Points=pv
doc.recompute()
```

https://forum.freecadweb.org/viewtopic.php?t=16473