Here is a Coordinate capture Macro I just helped a guy with.
Sub Main ()
Open "c:\TESTFILE.txt" For Output As #1 ' Open to write file.
oldX = GetOEMDRO (800)
oldY = GetOEMDRO (801)
oldZ = GetOEMDRO (802)
Write #1, oldX , oldY, oldZ
While GetUserLED (1005)
newx = GetOEMDRO (800)
newy = GetOEMDRO (801)
newz = GetOEMDRO (802)
if oldX <> newX or oldY <> newY or oldZ <> newZ Then
oldX = newX
oldY = newY
oldZ = newZ
Write #1, oldX , oldY, oldZ
End If
Wend
Close #1
End Sub
Here is the "Brain" that goes with it.
What it does, is the Brain "Strobes" and LED at a set interval (you can modify the timer in it for your situation), when it goes to ON, the Write coordinates will execute. (NOTE you have to have another on/off button with a Control LED, that you use as your Record Function.
The code it self will compare, coordinates and only update changed coordinates in the file.
In your Case you can ADD or Change the Z value to "GetUserDRO(*********x)" that is the DRO where you are dropping your Analog value.
Further: You can have that Analog value dynamically control the Z axis hiegth, through Brains as well. (If you need to do that). You would "0" your Z axis to some minimum hiegth. Then the Analog value Range would scale through a formula in brains and that result would goto another Terminator UserDRO. This would be units, above your "0" point. Then I would in the Macro pump, put in a statement to grab this dro and put those units into a movement Code for your Z. (I would probably put another Control LED in there that would allow me to turn on and off that ability). Since it would be running in the Macro pump it would execute anywhere from 4-10 hrts frequency (depending on your comps speed, and if you already have other Macropump overhead issues.
Scott