Hello Guest it is March 29, 2024, 09:04:08 AM

Author Topic: DRO problem???  (Read 10108 times)

0 Members and 1 Guest are viewing this topic.

DRO problem???
« on: October 08, 2012, 12:48:55 AM »
Hello group, I just bought Mach3 and I am an addict...

Mike from MN here..

I am trying to take the shared serial number macro and make it my own.

I cut it up and replaced the "g-code" with my own and modifying it and works.

The problem is that I need to use an input with trailing zeros, example:

0001
00001
012
01112

The DROs default is either integer or double and it does not let you use trailing zeros.

I cannot explicitly define the number of trailing zeros because the number of digits will vary as you can tell my the example.

Ideally I have it setup to add +1 to the number so it is just a matter of typing it in and hitting cycle start with the proper "M-Code" but if there is some way I can place a "textbox" on the screen I would just manually type each serial in as I go (the Macro sub converts the data to a string anyways).

So can anyone help me out. In the screen editors I downloaded, neither has a textbox input option just labels that are hard coded.

Thank you,

Mike in MN

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: DRO problem???
« Reply #1 on: October 08, 2012, 03:12:14 AM »
What is the shared serial number macro ?
You can have a text box appear on screen from a macro so that you can input data and the macro will do whatever you ask it to do with it but not sure if that is really what you are wanting.
Not clear really on anything you are asking, that could well be just because I am thick or could be because I am not sure what this serial macro is ;D
Hood

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: DRO problem???
« Reply #2 on: October 08, 2012, 10:42:26 AM »
Actually you are needing leading zeros. YES you can set up the dro to take them BUT you cannot have variable length leading zeros you have to define the max number needed and work with that.

00000000
00000123
00909999

etc

OR you can do as Hood suggested and create a Value entry box in the macro to ASK you what the serial number is to be. A box would pop up and you put your value in and press enter(;-)

(;-) TP
Re: DRO problem???
« Reply #3 on: October 08, 2012, 10:50:14 AM »
Thanks for the response.

The macro I am referring to is here:  http://www.machsupport.com/forum/index.php/topic,11018.0.html

It's simple and to the point for a serial number system.

I searched a bit and haven't been able to find a string input to a screen solution.

Can you point me to an example of value entry box? I would certainly do a popup box, but I am just getting my feet wet to Mach3 and running through all the different forum threads and literature is a bit overwhelming.

It's appreciated.

Thank you,

Mike in MN

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: DRO problem???
« Reply #4 on: October 08, 2012, 11:11:20 AM »
Been a while since I worked on that one(;-).

You can add or modify the screen set to include a DRO from MACH SCREEN a screen writer program for building screens for MACH3 it can be downloaded from this site.

IF you wanted a Value box we can help with that.

There are 2 resources you may want to download, the "Customising Mach2" Manual AND the Mach programmers manual. 

(;-) TP

« Last Edit: October 08, 2012, 11:14:17 AM by BR549 »

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: DRO problem???
« Reply #5 on: October 08, 2012, 11:19:31 AM »
If you want leading zeroes just have 0* in the format string, example %06.f would have 6 leading zeroes

Hood
Re: DRO problem???
« Reply #6 on: October 08, 2012, 11:30:42 AM »
If you want leading zeroes just have 0* in the format string, example %06.f would have 6 leading zeroes

Hood

Thank you.

The problem lies in it being formatted as  a double or integer. It will not pass those leading zero's into the macro because of the way it is defined.

Which brings me to the idea of using a "string" input. Then it should hold all the values.

Also, for each different family of parts that I am trying to serialize, the length of the leading zero's vary. 0001, or 000001. So I would have to change the "screen" DRO format each time if I could somehow make the leading zero's get recognized.

BR549... I have already added a DRO to the screen and have played with it extensively. The problem lies in the formatting of the box.


Thank you,

Mike in MN

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: DRO problem???
« Reply #7 on: October 08, 2012, 11:35:33 AM »
You cannot have a leading zero as a variable length from the DRO.  You have to set the number of leading zeros and that is what you have to work with from a DRO.


Here is a simple example of a Value BOX and writing that value to the Mach3 status line

Value = Question( "What is the value ??" )   
Message(Value)

(;-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: DRO problem???
« Reply #8 on: October 08, 2012, 11:48:49 AM »
Mike To use the number from the DRO as you need it you would format the value to the defined length

Here is and example

Value = Format (GetUserDro(2009), "000000")

Message(Value)


BUT still you must work with a defined field length of leading zeros.

NOW working with the Value box you can get a string that is what you input so you can vary the filed length on the fly

000123
0987

(;-) TP
Re: DRO problem???
« Reply #9 on: October 08, 2012, 12:01:15 PM »
TP,

Thanks for the response.

I will look into the Value Box idea. I would much rather just type in the serial each time then going in and changing the leading value of a DRO. My goal is to set it up so any operator can go over and throw a part on the machine and hit go. Having them manually change the DRO leading zero value would be not the ideal production environment.

So just so I am clear, in my macro, would the value box go right at the beginning of the VB code?

My VB code skills are very limited, I can edit most code, but not write fresh.

Thank you,

Mike in MN