G68 alignment macro

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

Re: G68 alignment macro

Postby cncdrive » Sun Jan 26, 2020 2:49 pm

Its the little things that arn't documented ,like I just discovered the label number is also the stored variable location . If I knew C+ then that may be obvious but I havent looked or thought about C for 20+ years and even then it was rudimentary . Seems to me you need to be a programmer to be able to use a lot of the functions in UCCNC , hopefully that wont be the case as it matures.


No, you do not have to be a programmer, you just have to be open minded to learn, but I think it is like that with everything tech related in the world today, except things which are "idioted down for sales reasons" to let even fools think that they know anything about technology and to make them happy about themselves. :)
Our goal is not that, but to offer the possible highest flexibility with keeping things still as simple as possible. Ofcourse there is a balance between flexibility and the easiness to handle things in a software like this.
We always tried to keep the balance and my opinion is that scripting the UCCNC is not harder than how it is with mach3 and it is much simpler than how it is with mach4 and linuxcnc, but it is still very flexible.
cncdrive
Site Admin
 
Posts: 4741
Joined: Tue Aug 12, 2014 11:17 pm

Re: G68 alignment macro

Postby cncdrive » Sun Jan 26, 2020 2:50 pm

And BTW Java is very similar to C#.
cncdrive
Site Admin
 
Posts: 4741
Joined: Tue Aug 12, 2014 11:17 pm

Re: G68 alignment macro

Postby Robertspark » Sun Jan 26, 2020 3:03 pm

+1 agreed with CNCdrive uccnc macros are very easy to learn / understand (with a bit of trial and error, and keeping an eye on the error log file .... Don't write the whole macro at once.... Build a complex one slowly in small chunks)
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: G68 alignment macro

Postby cncdrive » Sun Jan 26, 2020 7:50 pm

Hi Rob,

One sidenote is that there is also the Console plugin with which you can redirect the logfile to the plugin window, that way it is even faster and easier to see macro compiler errors.
cncdrive
Site Admin
 
Posts: 4741
Joined: Tue Aug 12, 2014 11:17 pm

Re: G68 alignment macro

Postby Delco » Tue Jan 28, 2020 7:10 am

Delco wrote:in the process of trying to understand the macros ,

double angle = AS3.Getfielddouble(2715); // Angle probe result from probe screen ( i now understand the label number is also the variable location ? (2715)

exec.AddStatusmessage("Rotate: G68 A0 B0 R" + angle.ToString("F6")); // this writes the message to the screen

exec.Code("G68 A0 B0 R" + angle.ToString("F6")); // Rotate at 0,0 with angle degrees
while (exec.IsMoving());


but where is " +angle.ToString("F6") " coming from ??? my logic brain would have thought it should have been "double angle" ??


Got a chance to give this a proper tryout , all good BUT found the angle value is not unique to just a angle probe.
A normal workflow is to probe for x0y0 , then to probe to work the angle out. then install the tool to be used and probe for Z zero.Then load gcode and start job , When this happens the simple probe for Z overwrites the angle value determined earlier to zero as its not used on a simple probe but still written to the variable spot.

It seems variable #2715 is not unique to the angle probe routine.
my workaround is to program a toolchange into gcode after the angle probe is done and the macro called.
Delco
 
Posts: 356
Joined: Tue Apr 02, 2019 4:23 am

Re: G68 alignment macro

Postby Delco » Tue Jan 28, 2020 7:28 am

And that was a fail as you cant do a probe routine while a rotate is active.
Delco
 
Posts: 356
Joined: Tue Apr 02, 2019 4:23 am

Re: G68 alignment macro

Postby beefy » Tue Jan 28, 2020 11:13 am

As previously mentioned you need to learn some basic C# so that you understand what is going on.

What you have indirectly told us in your post is that you have no understanding of programming and want someone to explain it to you from scratch.

2715 in not a variable. It is a parameter of the method/function Getfielddouble(). The value of field 2715 on the screen is copied to this parameter in the method, then the method uses that value. The method returns the value as a "double" type value.

The variable "angle" is declared as a "double" type, but in the method/function "Addstatusmessage()", the double variable "angle" needs to be converted to a "string" type variable, so "angle.ToString()" accomplished this.

Your "logic brain" is going to be second guessing all sorts of things if you don't learn the basics of the C# language.

As mentioned several times in this thread, learn basic C# (heaps of free ebooks and Youtube videos, that's how I learned), learn the built-in UCCNC functions/methods from the UCCNC documentation (learning basic C# will give you an understanding of what they do).
beefy
 
Posts: 449
Joined: Mon Sep 05, 2016 10:34 am

Re: G68 alignment macro

Postby dezsoe » Tue Jan 28, 2020 11:50 am

Hi Delco,

Every probe sequence begins with deleting the last results from the screen, so you can use them only after a probe. And yes, the probe screen won't probe if G68 is enabled. Try to zero Z first and only after that probe the angle. (I put it on my list to find out what to do / how to probe when G68 is active.)
dezsoe
 
Posts: 2079
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: G68 alignment macro

Postby Robertspark » Tue Jan 28, 2020 5:01 pm

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

Re: G68 alignment macro

Postby Delco » Wed Jan 29, 2020 6:41 am

dezsoe wrote:Hi Delco,

Every probe sequence begins with deleting the last results from the screen, so you can use them only after a probe. And yes, the probe screen won't probe if G68 is enabled. Try to zero Z first and only after that probe the angle. (I put it on my list to find out what to do / how to probe when G68 is active.)


Its no issue to come out of g68 to do the probe , the issue is the value for the probed angle is not actually stored in a unique location but if a field that is overwritten by every probe so it cant be used by a macro unless the macro then stores it to a specific location .

I cant do a tool Z probe first as I would then need to remove the tool to put the probe to do the and probe and then I need to do a Z probe once the tool is back in and on every manual tool change.

Back to measuring the angle , manually inputting it into the g68 into gcode


This C# stuff is like some secret club , first forum I have ever been on where posters just bag you out as they have more experience ......................................

I like uccnc but cant say its a helpful site....

I will just crawl back into my hole now and get back to liking my hobby
Delco
 
Posts: 356
Joined: Tue Apr 02, 2019 4:23 am

PreviousNext

Return to Macros

Who is online

Users browsing this forum: No registered users and 7 guests