Home
Downloads
Mach3
Plugins
CAM Post Processors
Screensets
Purchase
Support
Forum
Tutorial Videos
Documentation
Yahoo Group
Mach Wiki
Resources
Contact Us
Links
CNCZone
German Forum
Italian Forum
Korean Forum
Portugese (Brazil) Forum
Russian Forum (RSK CNCROUTER)
Thai Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 28, 2012, 11:28:10 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Select from and to languages
Chinese-simp to English
Chinese-trad to English
English to Chinese-simp
English to Chinese-trad
English to Dutch
English to French
English to German
English to Greek
English to Italian
English to Japanese
English to Korean
English to Portuguese
English to Russian
English to Spanish
Dutch to English
Dutch to French
French to English
French to German
French to Greek
French to Italian
French to Portuguese
French to Dutch
French to Spanish
German to English
German to French
Greek to English
Greek to French
Italian to English
Italian to French
Japanese to English
Korean to English
Portuguese to English
Portuguese to French
Russian to English
Spanish to English
Spanish to French
Machsupport Forum
Mach Discussion
VB and the development of wizards
Saving DRO values in .txt file?
Pages:
1
Go Down
« previous
next »
Author
Topic: Saving DRO values in .txt file? (Read 1621 times)
0 Members and 1 Guest are viewing this topic.
DennisCNC
Active Member
Offline
Posts: 200
Saving DRO values in .txt file?
«
on:
January 30, 2008, 09:25:53 PM »
Is there any code examples for saving DRO values in a .txt file that can opened later for review? For instance GetDRO x and y (encoder values) and save to a .txt file when a input is activated.
Thanks
Logged
Bodini
Active Member
Offline
Posts: 112
Re: Saving DRO values in .txt file?
«
Reply #1 on:
January 31, 2008, 12:46:26 PM »
Ok, i got curious...
i took this:
http://www.vbforums.com/archive/index.php/t-342619.html
and added a getoemdro
and got:
Code:
Dim sFileText As String
Dim iFileNo As Integer
iFileNo = FreeFile
'open the file for writing
Open "C:\Test.txt" For Output As #iFileNo
'please note, if this file already exists it will be overwritten!
xd00d=getoemdro (800)
yd00d=getoemdro (801)
zd00d=getoemdro (802)
'write some example text to the file
Print #iFileNo, "X= ", xd00d
Print #iFileNo, "Y= ", yd00d
Print #iFileNo, "Z= ", zd00d
'close the file (if you dont do this, you wont be able to open it again!)
Close #iFileNo
and then when you view that file as spec'd in the code, it has the dro info at the moment the code was ran (although if the axis was in motion, i dont think it would be accurate, that takes a dll).
-Nick
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: Saving DRO values in .txt file?
«
Reply #2 on:
January 31, 2008, 01:19:26 PM »
Interesting perhaps if you did and experiment and ran that in the Macro pump, it would update at least 40 times per second.........
just a thought.
Scott
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
DennisCNC
Active Member
Offline
Posts: 200
Re: Saving DRO values in .txt file?
«
Reply #3 on:
January 31, 2008, 08:19:00 PM »
Nick,
Thank you very much for the code example!
Also a big Thank you to Scott for helping all the learners here with your time and examples!
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: Saving DRO values in .txt file?
«
Reply #4 on:
February 01, 2008, 06:35:55 PM »
Wow!
Your welcome!
Thanks,
scott
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
DennisCNC
Active Member
Offline
Posts: 200
Re: Saving DRO values in .txt file?
«
Reply #5 on:
February 01, 2008, 10:01:05 PM »
Few more question on this VB stuff. I have this code working and dong exactly what I want in VB software:
Dim sFileText As String
Dim iFileNo As Integer
Dim myvar As String
Dim place As String
Private Sub Command1_Click()
iFileNo = FreeFile
myvar = InputBox("Enter place")
place = "c:\" + myvar + ".txt"
Open place For Output As #iFileNo
End Sub
Private Sub Command2_Click()
xd00d = 123
yd00d = 123
Print #iFileNo, "X= ", xd00d
Print #iFileNo, "Y= ", yd00d
End Sub
Private Sub Command3_Click()
Close #iFileNo
End Sub
When you click the first button a window comes up to type in File name. Then the second button saves "123" in a vertical column as many times as you click it. The last button Closes the file.
Now I moved this code to Mach the first button and the last button work fine but the button to save the coordinates from GetOEMDro (800) and (801) instead of the the "123" value does not work.
I think it's because the Open command is a private deal. How do I make the second button work?
What I did was made one button and put this code in it:
Dim sFileText As String
Dim iFileNo As Integer
Dim myvar As String
Dim place As String
iFileNo = FreeFile
myvar = InputBox("Enter place")
place = "c:\" + myvar + ".txt"
Open place For Output As #iFileNo
For the second button this part of the code:
xd00d = getoemdro (800)
yd00d = getoemdro (801)
Print #iFileNo, "X= ", xd00d
Print #iFileNo, "Y= ", yd00d
Last button:
Close #iFileNo
Logged
stirling
Global Moderator
Offline
Posts: 1,190
UK
Re: Saving DRO values in .txt file?
«
Reply #6 on:
February 05, 2008, 12:10:49 PM »
Hi DennisCNC - If I understand you're explanation correctly, your problem is scope. In the first file your 4 variables are global with respect to your subs (i.e. "visible" to the subs). When you put your code in Mach buttons however the scope of one button does not extend to another. Your 4 variables are "invisible" outside of the first button. (are you getting a "bad file number" error on button 2? Actually I suspect that your 3rd button isn't actually doing anything either but the flaky VB in Mach is not reporting the error - the file is being opened AND closed by the script in button one - (explicitly opened by your "open" code and implicitly closed by going out of VB scope at the end of file).
Incidentally have you taken a look at the plugin download section - Brian has a thing there called jcode - a jog to gcode tool.
Ian
Logged
DennisCNC
Active Member
Offline
Posts: 200
Re: Saving DRO values in .txt file?
«
Reply #7 on:
February 06, 2008, 05:37:51 PM »
I kind of figured that variables don't go from one button to the next. I think I need to put this in a macro and have it run a part of the code when a button is pressed, something like GetUserButton() or GetUserLed()?
I looked at the jog to gcode plugin but you need to jog for it to take the dro value and save it, I need to save the encoder dro's that are on setting tab.
Logged
Pages:
1
Go Up
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Mach Discussion
-----------------------------
=> General Mach Discussion
=> Mach3 under Vista
=> Quantum
=> Mach SDK plugin questions and answers.
===> Finished Plugins for Download
=> VB and the development of wizards
=> Brains Development
=> Video P*r*o*b*i*n*g
=> Mach Screens
===> Screen designer tips and tutorials
===> Works in progress
===> Finished Screens
===> Flash Screens
===> JetCam screen designer
===> Machscreen Screen Designer
===> CVI MachStdMill (MSM)
=> Feature Requests
=> Non English Forums
===> Italian
===> French
===> Spanish
===> Chinese
===> German
===> Russian
===> Romanian
===> Japanese
===> Vietnamese
=> FAQs
-----------------------------
*****VIDEOS*****
-----------------------------
=> *****VIDEOS*****
-----------------------------
General CNC Chat
-----------------------------
=> Share Your GCode
=> Show"N"Tell ( What you have made with your CNC machine.)
=> Building or Buying a Wood routing table.. Beginnners guide..
=> Show"N"Tell ( Your Machines)
-----------------------------
G-Code, CAD, and CAM
-----------------------------
=> G-Code, CAD, and CAM discussions
=> LazyCam (Beta)
-----------------------------
Third party software and hardware support forums.
-----------------------------
=> LazyTurn
=> GearoticMotion Preliminary testing
=> Tempest Trajectory Planner
=> Contec
=> dspMC/IP Motion Controller
=> HiCON Motion Controller
=> Third party software and hardware support forums.
=> Galil
=> Newfangled Solutions Wizards
=> Mach3 and G-Rex
=> Mesa
=> Modbus
=> NC Pod
=> PoKeys
=> SmoothStepper USB
=> Sieg Machines
=> Promote and discuss your product
-----------------------------
Tangent Corner
-----------------------------
=> Tangent Corner
=> Competitions
=> Polls
=> Bargain Basement
-----------------------------
Support
-----------------------------
=> Downloads
===> XML files
===> Post Processors
===> Macros
===> Tutorials
===> Others
===> Beta Brains
===> Screen Sets
===> Documents
===> MACH TOOL BOX
=> One on one phone support.
=> Forum suggestions and report forum problems.
-----------------------------
Mach4
-----------------------------
=> Mach4 pre-Alpha Testing
Loading...