How to

This is where you talk about Plugins. How they are made and how they work, show examples.

How to

Postby medicusdkfz » Wed Jan 02, 2019 10:23 am

Hello,

my name is Pierre and I wrote a plugin for my manual 3D-probe from Tschorn to calculate the center of a circle. I probe 3 points and then my plugin calculates the midpoint. Then I want to run several G-Code commands in a row. But C# is too fast in processing. How can I run one command completely before the next one starts?

e.g.:
Code: Select all
private void button7_Click(object sender, EventArgs e)
        {
            UC.Callbutton(109); // Homing Z
            UC.Callbutton(108); // Homing Y
            UC.Callbutton(107); // Homing X
        }


When I click on the button, it shows a strange behaviour and do random homing...

Thank you for your help.

Kindly regards,
Pierre
medicusdkfz
 
Posts: 10
Joined: Sat Jun 23, 2018 10:30 pm

Re: How to

Postby medicusdkfz » Wed Jan 02, 2019 11:45 am

Hello,

I found a solution for my problem:

Code: Select all
private void button7_Click(object sender, EventArgs e)
        {
            UC.Callbutton(109); // Homing Z
            while(UC.IsMoving())
            {
               Application.DoEvents();
            }
            UC.Callbutton(108); // Homing Y
            while (UC.IsMoving())
            {
                Application.DoEvents();
            }
            UC.Callbutton(107); // Homing X
            while (UC.IsMoving())
            {
                Application.DoEvents();
            }
        }



Kindly regards,
Pierre
medicusdkfz
 
Posts: 10
Joined: Sat Jun 23, 2018 10:30 pm

Re: How to

Postby medicusdkfz » Wed Jan 02, 2019 11:55 am

Here I have another problem: I want to zero the actual x-position and then also the y-position. But after moving to the wanted coordinate, it doesen't zero...
Here is my code:

Code: Select all
if (label22.Text == "" || label18.Text == "")
            { }
            else
            {
                UC.Code("G00 X" + label22.Text + " Y" + label8.Text); // Move to the wanted coordinate, given in the labels
                while (UC.IsMoving())
                {
                    Application.DoEvents();
                }
   
                UC.Callbutton(100); // Zero x
                UC.Callbutton(101); // Zero y
            }


Thank you,
Pierre
medicusdkfz
 
Posts: 10
Joined: Sat Jun 23, 2018 10:30 pm

Re: How to

Postby medicusdkfz » Wed Jan 02, 2019 9:33 pm

Hello,

no help, no idea? Is this a suitable solution?


Code: Select all
                UC.Setfield(true, 0, 226); // Zeroing X-Axis
                UC.Validatefield(true, 226);

                UC.Setfield(true, 0, 227); // Zeroing Y-Axis
                UC.Validatefield(true, 227);


For what is the bool-statement? It`s not mentioned in the documentation!

Maybe I get an answer now...

Thank you,
Pierre
medicusdkfz
 
Posts: 10
Joined: Sat Jun 23, 2018 10:30 pm

Re: How to

Postby medicusdkfz » Sat Jan 05, 2019 7:33 am

Hello,

meanwhile there were 112 hits but still without a hint! I still have the problem that the coordinates are approached, but the zeroing doesn't work automatically. I have to start the zeroing manually. Do I need a wait cycle? How do I install it in C#? I would be very happy if someone would at least get in touch with me...

Friendly greetings,
Pierre

Code: Select all
private void button5_Click(object sender, EventArgs e)
        {

            if (label22.Text == "" || label18.Text == "")
            { }
            else
            {
                button5.ForeColor = System.Drawing.Color.Red;
                UC.Callbutton(109); // Safety first through Homing Z axis
                while (UC.IsMoving())
                {
                    Application.DoEvents();
                }

                UC.Code("X" + label22.Text + " Y" + label8.Text); // Move to the calculated coordinates for the circle center
                while (UC.IsMoving())
                {
                    Application.DoEvents();
                }

// ##################### from here on it gets faulty ######################

                UC.Wait(2000);
                UC.Setfield(true, 0, 226); // Zeroing X-Axis
                UC.Validatefield(true, 226);

                UC.Wait(2000);
                UC.Setfield(true, 0, 227); // Zeroing Y-Axis
                UC.Validatefield(true, 227);
            }
        }
medicusdkfz
 
Posts: 10
Joined: Sat Jun 23, 2018 10:30 pm

Re: How to

Postby Robertspark » Sat Jan 05, 2019 8:36 am

I don't know the rest of your plugin, but have you tried

Codesync instead of code?

Where is your move defined G0/G01?

Where is your feedrate defined? Ff

Why do you want / need a plugin? Can you not do via macro?
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: How to

Postby medicusdkfz » Sat Jan 05, 2019 9:42 am

Hello, Robert,

Thank you so much for your help. I first included "G00" and defined also the feed rate. But that's not the problem. I entered different values in the wait command and did not get any improvement.
The codesync command is not described in the manual. What does it do? My plugin is used to probe a manual 3D probe (Tschorn: https://www.tschorn-gmbh.de/en/products ... Mplus.html) in a circular pocket, in order to calculate the center point based on the 3 points and drive there. This all works very well except for the last step of zeroing. I'm a little confused why it doesn't work.
Why do I use a plugin? Because I wanted to use another possibility of UCCNC and because I can program C#. I also don't have to worry about the graphical interface as this step is made very easy for me in Visual Studio. And a Plugin is much more easier to share...
However, some routines have been revised and parameters are not well documented or not documented at all:

e.g. -> UC.Setfield(true, 0, 226); -> What do I use the bool statement for?

Thank you very much,
Pierre

image0.jpg
medicusdkfz
 
Posts: 10
Joined: Sat Jun 23, 2018 10:30 pm

Re: How to

Postby Robertspark » Sat Jan 05, 2019 9:54 am

Are you aware of the latest developments release of uccnc which has probing built into it?

The bool for UC.Setfield(true... Is because it is an AS3 (screenset ) related method, the bool is not required with plugins

Never used a manual probe I presume you jog it to the touchoff location and record the points and then calculate the distance as half the two probed points?

When you say zero, can you use G92 X0, Y0? Or do you want something else?
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: How to

Postby Robertspark » Sat Jan 05, 2019 9:56 am

Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: How to

Postby Robertspark » Sat Jan 05, 2019 9:57 am

Development releases

viewtopic.php?f=2&t=240
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Next

Return to Plugins

Who is online

Users browsing this forum: No registered users and 12 guests