Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate 3dSurface plot starting from x,y,z txt file

Hallo guys,
I need to generate a 3Dsurface plot starting from unordered coordinates data available in the following
text file:
xs,   ys,   zs
-20,-70,1500
-30,-55,1500
-30,-79,1500
-40,-70,1500
-10,-70,2000
-30,-42,2000
-30,-90,2000
-53,-70,2000
-5,-70,2500
-30,-30,2500
-70,-70,2500
-30,-100,2500
 
I tried with 3DMesh using the following VB6 code (without valuable results):
 
[code]
rsurf.Open "Select * From surf.txt", _
       connCSV, adOpenStatic, adLockReadOnly, adCmdText
l = rsurf.RecordCount
surflbl.Caption = "records" & l
ReDim xs(l), ys(l), zs(l)
For i = 1 To l
            xs(i) = rsurf.Fields(0) 'EW (m)
            ys(i) = rsurf.Fields(1) 'NS (m)
            zs(i) = rsurf.Fields(2) 'DEPTH (m)
            rsurf.MoveNext
Next i
rsurf.Close
connCSV.Close
CWGraph3D1.Plot3DMesh xs, ys, zs
[/code]
 
When i try to convert 3dmesh into 3dsurface, in order to have a smooth surface, i really don't know how to  build the zs(i,j) matrix
 
I don't know, further, why data displayed on the plot always start from 0,0,0 coordinates
 
Any help and example would be very appreciated
 
Beta66
 
 
0 Kudos
Message 1 of 4
(7,169 Views)

Hy

maybe this question is not so appealing, but i would have really appreciated any suggestion  on how to built a 3dsurface grid starting from  x,y,depth data on a txt file

thanks

 

beta66

 

 

0 Kudos
Message 2 of 4
(7,124 Views)

If your still interested I had some luck doing this....

 

Dim xs, ys, zs As Variant
Dim j

Dim ArrX(0 To 11) As Double
Dim ArrY(0 To 11) As Double
Dim ArrZ(0 To 11) As Double

xs = Array(-20, , -30, -30, -40, -10, -30, -30, -53, -5, -30, -70, -30)
ys = Array(-70, -55, -79, -70, -70, -42, -90, -70, -70, -30, -70, -100)
zs = Array(1500, 1500, 1500, 1500, 2000, 2000, 2000, 2000, 2500, 2500, 2500, 2500)


For j = 0 To 11
    ArrX(j) = CDbl(xs(j))  'I don't know why but this type cast was required
    ArrY(j) = CDbl(ys(j))
    ArrZ(j) = CDbl(zs(j))
Next j

CWGraph3D1.Plot3DMesh ArrX, ArrY, ArrZ

 

good luck with your project

Curt

 

0 Kudos
Message 3 of 4
(7,076 Views)

hi curt c

The code you kindly submitted is, actually, similar to the one I'm already using. Infact both codes use the method 3dmesh. What i would use is the method 3dsurface or 3dsimplesurface in order to plot contourlines on the surface, but the problem is that I don't know how to built the z(i,j) matrix from available "z" data present on txt file. 

 

Thanks

 

Beta66

0 Kudos
Message 4 of 4
(7,062 Views)