Hello Guest it is April 19, 2024, 05:18:32 AM

Author Topic: Export DRO values (again)  (Read 2256 times)

0 Members and 1 Guest are viewing this topic.

Export DRO values (again)
« on: September 29, 2016, 04:39:25 PM »
Hello all,

I have read through the post in regards to exporting the DRO values and I cant seem to make it work all that well. so I hope maybe I can get some assistance with VB. here is exactly what I need to end up with... I need to export the X,Y,Z part coords and the line number DRO. I also need a system time stamp in milliseconds for each value. The XYZ and Line values can be on a single stamp.

This will run in the macro pump so I will need to add a on/off button to only activate the recording when I need it. I know how to add buttons and leds to my screenset. I just have no experience with VB.

If I could export the information to excel that would be the cats meow!

Thanks in advance for any help! Dave T.
Re: Export DRO values (again)
« Reply #1 on: October 01, 2016, 11:22:13 AM »
This is the macro that I am trying to use. It works as an Mcode but not as a macro pump. any ideas?

Private Type SYSTEMTIME

Year As Integer

Month As Integer

Day As Integer

Hour As Integer

Minute As Integer

Second As Integer

Milliseconds As Integer

End Type

Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)

Public Function GetMySecond() As String

Dim tSystem As SYSTEMTIME

Dim sRet

GetSystemTime tSystem

sRet = Format(tSystem.second, "0000")

GetMySecond = sRet


Open "c:\TESTFILE.txt" For Output As #1 ' Open to write file.

 oldX = GetOEMDRO (800)
 oldY = GetOEMDRO (801)
 oldZ = GetOEMDRO (802)
 oldL = GetOEMDRO (816)

 Write #1, oldX , oldY, oldZ, oldl
 
   While GetoemLED (999)
 
     newx = GetOEMDRO (800)
     newy = GetOEMDRO (801)
     newz = GetOEMDRO (802)
     newl = GetOEMDRO (816)     

 If oldX <> newX Or oldY <> newY Or oldZ <> newZ Or oldl <> newl Then
  oldX = newX
  oldY = newY
  oldZ = newZ
  oldl = newl
  Write #1,"X",oldX ,   "Y",oldY,   "Z", oldZ,   "Line",oldl
 
     End If
 
Wend
Close #1

END Function