Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 10:44:54 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  General Mach Discussion
| | |-+  VB calculation behind button is possible?
Pages: 1   Go Down
Print
Author Topic: VB calculation behind button is possible?  (Read 217 times)
0 Members and 1 Guest are viewing this topic.
SimKel
Active Member

Offline Offline

Posts: 7


View Profile
« on: January 13, 2012, 10:47:00 AM »

Hi,
I'm new using Mach3. I'd like to know if it is possible to create button that will execute calculation and return A and B axis angle values. I'd like to be able to enter 4 measured points. I would enter the four coordinates of each point and I'd like to calculate the plan and then the angles between reference coordinates system and the plan. The goal is to orient(A,B) the part in order to mill in a single pass with the Axis. the geometry of my part is a rectangle and i new to mill the determined plan on the upside face.

Is it possible to enter points coordinates and then have Mach3 do calculation and return the value of the angle as an input for the A and B axis.

Thanks!
Logged
Hood
Active Member

Offline Offline

Posts: 17,368


Carnoustie, Scotland


View Profile
« Reply #1 on: January 13, 2012, 04:19:44 PM »

Not really sure what you are attempting but it is likely that could be done as most of the wizards work from code in a button.
Hood
Logged
SimKel
Active Member

Offline Offline

Posts: 7


View Profile
« Reply #2 on: January 16, 2012, 08:23:39 AM »

What i'm trying to do is to give 4 points (x,y,z) as an input. Those four points being processed by an algorithm and then return the value of the A axis and B axis in order to obtain the plan calculate by the algorithm. Is it possible, to take the output of the algorithm and use it as the input for the command of the A and B axis? I'd like to add four field to enter the points (x,y,z) and have a button to run the algorithm on the interface.

Logged
cjmerlin
Active Member

Offline Offline

Posts: 180


View Profile
« Reply #3 on: January 17, 2012, 07:56:10 AM »


It should be possible, You could create your four user Dro's using MachScreen

http://www.kd-dietz.de/index_eng

Add a calc button with your code in.

Have a browse in the documentation for the Mach3 programmers reference PDF which will give you all the info you'll need.

Also a reference to the VB script

www.indusoft.com/pdf/VBScript%20Reference.pdf
Logged
SimKel
Active Member

Offline Offline

Posts: 7


View Profile
« Reply #4 on: January 17, 2012, 08:51:37 AM »

Thanks for helping me out! I'll need a couple hours to go trough all this literature
 
Logged
Tweakie.CNC
Active Member

Online Online

Posts: 3,263


Super Kitty.


View Profile WWW
« Reply #5 on: January 17, 2012, 10:53:48 AM »

It is my understanding that Mach supports a subset of VB which is Cypress Enable. Not all of the current VB commands are available to be used in Macro's / Button Scripts etc. so it would be best to use the CB reference guide for all your VB expressions http://www.machsupport.com/MachCustomizeWiki/pdfs/VB-Script-Commands.pdf.

Tweakie.
Logged

Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.
SimKel
Active Member

Offline Offline

Posts: 7


View Profile
« Reply #6 on: January 18, 2012, 09:03:53 AM »

I have a little problem that might be simple for someone. I've generated with VBscript a text file containing some GCode as it follows:

G00 A0. B0.
A0.7562497658762
B21.764485993774
M99

When I load this text file, there is nothing in the Gcode MDI. Here is how I generate the text file:

Dim fs,f As Object

Set fs =CreateObject("Scripting.FileSystemObject")
Set f=fs.CreateTextFile("c:\mach3\GCode\result_orient_shim.txt",2,true)
f.writeline("G00 A0.B0.")
f.writeline("A"&teta)
f.writeline("B"&zeta)
f.writeline("M99")
f.close

Set f=Nothing
Set fs=Nothing

Is there something wrong with my textfile!?!?
Logged
SimKel
Active Member

Offline Offline

Posts: 7


View Profile
« Reply #7 on: January 18, 2012, 09:51:34 AM »

I found out what was happening! The problem was in this code line

Set f=fs.CreateTextFile("c:\mach3\GCode\result_orient_shim.txt",2,true)

I should have used the parameter false instead of true. The MDI read text file in ASCII which corresponds to the value false. True corresponds to Unicode which is not compatible with the interface.
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!