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 Vmax549 » Sat Jan 11, 2020 7:18 pm

UCCNC can already calculate the angle . It just needs to push that value to a # var say #4000. Then from either MDI call M68 Xxx Yyy R#4000 OR apply teh Gcode call directly into your Gcode file. OR Simply apply teh Value via MDI.


(New Gcode File)
G50 G90 G80 G94
G68 Xxx Yyy R#4000 (Rotate Coord base)
etc
etc

Just a thought , (;-) TP
Vmax549
 
Posts: 331
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: G68 alignment macro

Postby Delco » Sat Jan 11, 2020 9:47 pm

Vmax549 wrote:UCCNC can already calculate the angle . It just needs to push that value to a # var say #4000. Then from either MDI call M68 Xxx Yyy R#4000 OR apply teh Gcode call directly into your Gcode file. OR Simply apply teh Value via MDI.


(New Gcode File)
G50 G90 G80 G94
G68 Xxx Yyy R#4000 (Rotate Coord base)
etc
etc

Just a thought , (;-) TP



Thats is a good solution , once I probed the angle how would I push that value into a variable field ?

I see ?#4 will return the value stored invariable 4 , is it jut a case of entering #4 55.4 to store 55.4 in variable location 4 via the mdi ?

If I do a angle probe then isnt this value already stored to a variable location ?
do I just need to find what that location is ?
Delco
 
Posts: 354
Joined: Tue Apr 02, 2019 4:23 am

Re: G68 alignment macro

Postby Vmax549 » Sat Jan 11, 2020 10:26 pm

Once you have solved for the angle from a probe function then apply the Value to a #var from MDI.

#4000 = 55.5

Then either from teh MDI or from Gcode directly

G68 Xxxx Yyyy R#4000.

UCCNC SHOULD be applying the probed values automatically to # VARs but they never think of that when they create special functions . Once a value is pushed to a #var you can use it any way you want in Gcode . As is YOU have to do all the work to retreive and apply those values. Instead of UCCNC doing the hard work for YOU automatically.

For example if you were to probe for the corner of a part by probing 2 points in X and 2 points in Y then you could solve for the POO ( point of origin) and the rotation point AND get teh angle of rotation ALL in one function. And IF those values were pushed to # vars you could use the values in many ways.

G0 X#4001 Y#4002 (move to the corner location)
G92 X0 Y0 ( set the point of origin of the part to X0 Y0 )
G68 X0 Y0 R#4000 ( rotate the coord base)


BUT it is what it is, (;-) TP
Vmax549
 
Posts: 331
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: G68 alignment macro

Postby cncdrive » Sat Jan 11, 2020 10:57 pm

Well, probed values are applied to variables, read the manual...
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: G68 alignment macro

Postby Delco » Sun Jan 12, 2020 12:02 am

cncdrive wrote:Well, probed values are applied to variables, read the manual...

I reread the manuals again today but could not find whete the variable us stored . I also looked in the edit screen for the value location .
Problem is i dont really kniw what i am looking for . - i know just enough to get myself in trouble
Delco
 
Posts: 354
Joined: Tue Apr 02, 2019 4:23 am

Re: G68 alignment macro

Postby Vmax549 » Sun Jan 12, 2020 1:45 am

So what is teh # var for teh Rotation angle ? How about teh #vars for teh X point of origin and teh Y point of origin based on teh probing functions ??

The only #vars I am aware of are that UCCNC outputs are trip point values for XYZABC

You guys have a half way decent probing section but you are forced to deal with those values manually.

Just a thought, (;-)
Vmax549
 
Posts: 331
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: G68 alignment macro

Postby Delco » Mon Jan 13, 2020 9:44 pm

Well I read all the manuals again scouring for the variable location for the probed angle of rotation , cant find anything - actually I can find nothing at all on the new probe screens in the latest version ?

Is the information hidden in the screen setup ?


Has anyone found the saved variable values for the new probe screen ???

settings probe.png
Delco
 
Posts: 354
Joined: Tue Apr 02, 2019 4:23 am

Re: G68 alignment macro

Postby cncdrive » Mon Jan 13, 2020 11:10 pm

You can read any textfields via it's labelnumber.
Then you can use a macro to read the value from the textfield and then do with it whatever you want, for example you can copy it to a #variable.
Copied from the macro manual:

Code: Select all
Function: string Getfield(int fieldnumber)
Description: This function reads the value of a field object and returns the value in a string.
Example: string fieldvalue = AS3.Getfield(100);
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: G68 alignment macro

Postby Delco » Sun Jan 19, 2020 9:09 am

So we need to be a programmer that can write macros ????
Delco
 
Posts: 354
Joined: Tue Apr 02, 2019 4:23 am

Re: G68 alignment macro

Postby dezsoe » Mon Jan 20, 2020 9:39 am

Hi Delco,

Sorry, I totally forgot you... Here is the macro to read the last result from the probe screen and rotate the coordinate system. You can call this macro from the g-code too. Just save as e.g. M1234.txt into your Profiles\Macro_<yourprofilename> folder and then you can write M1234 into your g-code.

Code: Select all
double angle = AS3.Getfielddouble(2715);                                        // Angle probe result from probe screen

exec.AddStatusmessage("Rotate: G68 A0 B0 R" + angle.ToString("F6"));

exec.Code("G68 A0 B0 R" + angle.ToString("F6"));                                // Rotate at 0,0 with angle degrees
while (exec.IsMoving());
dezsoe
 
Posts: 2049
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

PreviousNext

Return to Macros

Who is online

Users browsing this forum: No registered users and 9 guests