Need Help! X or Y 1/2 macro

Results 1 to 6 of 6

Thread: X or Y 1/2 macro

  1. #1
    Registered
    Join Date
    Dec 2016
    Location
    Denmark
    Posts
    4
    Downloads
    0
    Uploads
    0

    Default X or Y 1/2 macro

    Hi.
    I am new to UCCNC, and have studies the functions in UCCNC, but i would like very much to have a 1/2 X or 1/2 Y macrobutton on my screen.
    A macro that gets the actual DRO position, divide it by 2 and put the result back in the DRO.
    It would be a good help to have together with my edgefinder to get the center of my material.
    I have done some screen editing and a macrobutton "goto Zero" for each of the axis, so dividing the DRO by 2, type it in again, and press my new macro works, but it would be great with a "X1/2" and "Y1/2" macro.
    Can anyone help??
    Thanks in advance

    /Caul, Denmark

    Similar Threads:


  2. #2
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: X or Y 1/2 macro

    I don't have the docs here, and c# is case sensitive, which you need to fix, but something like this:

    double CurrentX = exec.Getfielddouble(226); // Get X DRO value
    double half = CurrentX / 2;
    SetField(half, 226);
    ValidateField(226);

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  3. #3
    Registered
    Join Date
    Dec 2016
    Location
    Denmark
    Posts
    4
    Downloads
    0
    Uploads
    0

    Default Re: X or Y 1/2 macro

    Quote Originally Posted by ger21 View Post
    I don't have the docs here, and c# is case sensitive, which you need to fix, but something like this:

    double CurrentX = exec.Getfielddouble(226); // Get X DRO value
    double half = CurrentX / 2;
    SetField(half, 226);
    ValidateField(226);

    Thanks Gerry.
    Thanks for the code example.
    Will try it as soon as possible
    /Carsten



  4. #4
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: X or Y 1/2 macro

    Actually, it should be this:

    Code:
    double CurrentX = AS3.Getfielddouble(226); // Get X DRO value
    double half = CurrentX / 2;
    AS3.Setfield(half, 226);
    AS3.Validatefield(226);
    For the Y axis, change 226 to 227.

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  5. #5
    Registered
    Join Date
    Dec 2016
    Location
    Denmark
    Posts
    4
    Downloads
    0
    Uploads
    0

    Default Re: X or Y 1/2 macro

    Quote Originally Posted by caul View Post
    Thanks Gerry.
    Thanks for the code example.
    Will try it as soon as possible
    /Carsten
    Hi again.
    I succeded in writing the macro's with a minor rewrite of the code:

    Here are my files:

    // Macro for 1/2 X

    double Xposvariable = exec.GetXpos(); //Get X DRO value
    double half = Xposvariable/2;

    AS3.Setfield(half, 226);
    AS3.Validatefield(226);



    // Macro for 1/2 Y

    double Yposvariable = exec.GetYpos(); //Get Y DRO value
    double half = Yposvariable/2;

    AS3.Setfield(half, 227);
    AS3.Validatefield(227);

    Attached Files Attached Files
    Last edited by caul; 12-20-2016 at 04:28 AM.


  6. #6
    Registered
    Join Date
    Dec 2016
    Location
    Denmark
    Posts
    4
    Downloads
    0
    Uploads
    0

    Default Re: X or Y 1/2 macro

    To finish my project about the X and Y 1/2 macroes, i made the buttons for the function in UCCNC.
    Feel free to use them.
    /Carsten

    Attached Thumbnails Attached Thumbnails X or Y 1/2 macro-x2_down-png   X or Y 1/2 macro-x2_up-png   X or Y 1/2 macro-y2_down-png   X or Y 1/2 macro-y2_up-png  



Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

X or Y 1/2 macro

X or Y 1/2 macro