Probing stock macro help

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Re: Probing stock macro help

Postby Dan911 » Fri Dec 28, 2018 8:28 am

On Xmas vacation and have some play time, I expended on the example form from the UCCNC manual.

Dress the form up as you like, I added keypress events on textbox's to only allow digits and 1 decimal are allowed. I commented in macro where to add rectangle and circle probe macro's.

Test Form.JPG
Test Form.JPG (20.43 KiB) Viewed 13331 times


M21222.txt
(4.93 KiB) Downloaded 778 times
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Probing stock macro help

Postby Dan911 » Fri Dec 28, 2018 6:47 pm

I realized you may need negative values for the X and Y textbox's so replace X and Y keypress events with code below. This will allow minus sign(negative) only on start.

Don't mean to insult if mentioning the obvious but.... these textbox strings will need to be converted to double to use in your probe macro's.

Have Fun,
Dan

Code: Select all
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) &&
                   (e.KeyChar != '.') && (e.KeyChar != '-'))
            {
                e.Handled = true;
            }

            // only allow one decimal point
            if ((e.KeyChar == '.') && ((sender as TextBox).Text.IndexOf('.') > -1))
            {
                e.Handled = true;
            }

            //0nly allow minus on start
            if (e.KeyChar == '-' && (textBox1.SelectionStart != 0 || textBox1.Text.Contains("-")))
            {
                e.Handled = true;
            }
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Probing stock macro help

Postby Dan911 » Sat Dec 29, 2018 9:18 pm

Hi Gabi, I hope you don't mind but going to answer your PM here, it's threads like this that help others.

There are many probe macro's available that can easily be edited to what you want/posted. For starters take a look in your default macro folder(M31).

Check out A_Camera thread/macro's that can be found here.... viewtopic.php?f=9&t=538

Also, you can purchase the 2017 screenset..... http://www.thecncwoodworker.com/2017.html the macro's alone are well worth the 20 buc cost. There is also a Macro thread on the zone.

As far as the TextBox being strings...............

double Tbox1 = Convert.ToDouble(textBox1.Text)
double Tbox2 = Convert.ToDouble(textBox2.Text)
double Tbox3 = Convert.ToDouble(textBox3.Text)

Take a look at some of the probe macro/links I posted and any questions I will be happy to help.

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Probing stock macro help

Postby Dan911 » Sun Dec 30, 2018 3:38 pm

Hi Gabi,

I didn't give any thought to this other than what you requested in post. My form example was taken from the UCCNC manual and I expanded with textboxes and checkbox's to show how to use the textbox info based on what was checked. With that being said......

Looking at first line of program>>>> exec.Code("G31 X" + Xmin + " F" + ProbeFeedrate);

Xmin is a variable for "X"
ProbeFeedrate is a variable for "F"( feedrate)

In the start of the macro you would declare these variables.

string Xmin = textbox4.text;
string ProbeFeedrate = textbox5.text;

or

double Xmin = Convert.ToDouble(textBox4.Text);
double ProbeFeedrate = Convert.ToDouble(textBox5.Text);

Since a probing macro can be complicated I suggest using a written 1, read manual first before making any attempt in editing it. In the Documentation folder in your UCCNC directory there's tons of info.

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Probing stock macro help

Postby dezsoe » Mon Dec 31, 2018 7:17 pm

Hi Gabi,

You could check the latest test version for a probing collection.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Probing stock macro help

Postby Dan911 » Tue Jan 01, 2019 1:59 am

dezsoe wrote:Hi Gabi,

You could check the latest test version for a probing collection.


Wow....Looks great!!!!
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Probing stock macro help

Postby dezsoe » Tue Jan 01, 2019 11:52 am

Hi,

I didn't make any videos, I think the drawings, the status line and the detailed doc should be enough. Take care of the C clearance: it has to be negative to lower the Z when finding outers. The dot on the mode buttons always shows where the probe has to be when you start a probing sequence.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary


Return to Macros

Who is online

Users browsing this forum: No registered users and 7 guests