Page 1 of 3 123 LastLast
Results 1 to 12 of 30

Thread: Is a Macro what I want...if not what is?

  1. #1
    Registered
    Join Date
    Jun 2006
    Location
    USA
    Posts
    47
    Downloads
    0
    Uploads
    0

    Is a Macro what I want...if not what is?

    Hi everyone,
    I've got my small router working under Mach3 and now I need to write a program to create g-code for a specific engraving job which I will perform regularly (this isn't a one-off).

    I need to engrave a scale on anodized alum bar stock. Determining my x y and z coordinates is easy enough. At this point I'm trying to determine what the fastest way to put a value on various increments of the scale is - (For example a scale which has increments between 200 and 900 by 100 - so the bottom of the scale is 200 next increment is 300, etc. ) because I'll need these numbers at various times throughout each engraving job. Because, I'll need an array of different numbers, maybe being able to call a "2" and a "0" twice is my best choice so I can mix and match values?

    If a macro is the best way - where would I get the g-code to engrave "200" to fill the macro? and then how would I call it in my program in order to start the "200" at any given coordinate? (I haven't yet but can purchase the add-ons so I can use the write wizard.)

    Am I making sense? I guess it's like a canned cycle, but those are specifically for drilling and tapping as far as I could tell from the manual.

    I can certainly explain further, but I want to see if I'm even barking up the right tree.

    Many Thanks-


  2. #2
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Twp, MI....USA
    Posts
    22,285
    Downloads
    0
    Uploads
    0
    First, you don't need to purchase anything to use the Write wizard. It's free, as are most of the Wizards. Only the Newfangled Solutions addons require a license.

    I'd say that your best bet would be to write a VB macro to do what you want.
    You'll need the macro to create the g-code for the numbers, or possibly call them from other macros. If you don't have any VB experience, you may be in for a steep learning curve. Or maybe not.

    Depending on how many different numbers you'll need, then yes, it may be easier to do individual digits, rather than complete numbers.

    You probably have more questions now?
    Gerry

    Mach3 2010 Screenset
    http://home.comcast.net/~cncwoodworker/2010.html

    (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
    Jun 2006
    Location
    USA
    Posts
    47
    Downloads
    0
    Uploads
    0
    thanks Gerry, I do have more questions and unfortunately my web searches aren't revealing much - to me at least.

    I am fairly familiar with VB so that part should be ok. I'm using a form in Access to take custom coordinates for various scales and then programatically create gcode files for me based on coordinates I enter. (The horizontal lines on the scale are simple moves and quick to assemble in a text file.)

    As far as how many numbers I need to engrave - one scale goes in inches 0-60 with numbers at each inch - then another is 0-31 - another is 0-11 - another type of scale has numbers from about 50 up to 5000 in various increments...so probably it's best to set up each individual digit and just combine digits.

    I still don't understand how I position the digits where I want them. Is this the time to use G52? Or is there another G code which will *add* the values of the following group of Gcodes to the DRO positions - instead of returning the spindle back to 0,0 and working from there?

    Has anyone else done something like this - and documented it on the web somewhere? I'm trying to understand what the likely workflow is. Do I need to create an individual gcode file for each digit or can I create a single file with subroutines for each digit or number which can be called while the program is running?

    Also, is there more documentation on Macros online? I read about them in the manual and came away with an overview of what they are - not so much what can be done with them. I'm definitely going to read about them again, but extra info isn't going to hurt me here.


  4. #4
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Twp, MI....USA
    Posts
    22,285
    Downloads
    0
    Uploads
    0
    Not real familiar with G52, but it looks like you could do it. Maybe also use incremental code to do the numbers? You know where you want them, so positioning them should be fairly straightforward, once you have the g-code for them and you know what size they are. And know how you're going to do them. Basically, you keep track of where you are, move to the numbers start position, and either create the code and run it, or call it from an external file. Then move to the next position and repeat.

    The Mach2 customization guide should have some examples, but are probably a bit outdated. The Wiki has most of the functions listed.
    http://www.machsupport.com/MachCusto...itle=Main_Page

    You can also find a lot of example code on the Mach forum, if you poke around.
    Gerry

    Mach3 2010 Screenset
    http://home.comcast.net/~cncwoodworker/2010.html

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


  • #5
    Registered
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    1,137
    Downloads
    0
    Uploads
    0
    Please post a drawing of the layout and text font/size you require.
    If a standalone VB program generated the code, would downloading to your controller be workable.


  • #6
    Registered
    Join Date
    Jun 2006
    Location
    USA
    Posts
    47
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Kiwi View Post
    Please post a drawing of the layout and text font/size you require.
    If a standalone VB program generated the code, would downloading to your controller be workable.
    Downloading to the controller will be via usb thumb drive.

    I'm not sure I understand what you want to learn from a drawing.


  • #7
    Registered
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    1,137
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Dan Craig View Post
    I'm not sure I understand what you want to learn from a drawing.
    Font size and style.
    Layout, are the numbers side by side or one under the other.
    Do they lineup, left side, right side.


  • #8
    Registered
    Join Date
    Jun 2006
    Location
    USA
    Posts
    47
    Downloads
    0
    Uploads
    0
    oh, sure, of course. I don't know why I didn't quite understand.

    I'll make a sketch a little later this evening.

    I've been reading about sub-routines at the mach support site and it seems that might be the way I should go - combine that with g52 (iirc) and locate the numbers I want where I want them.

    Advantageously, the numbers for the various items I'll be engraving will be the same size height wise - so I can re-use the same code for them where necessary. Because I know what all the different number combinations will be, it seems wisest to create subroutine files with each number I'll need to engrave and then just call them as needed while creating the g-code.

    I'll get a sketch of the scale up later on and thanks for bearing with me as I delve into stuff I've never thought seriously about how to implement - though I know it's possible to implement.


  • #9
    Registered
    Join Date
    Jun 2006
    Location
    USA
    Posts
    47
    Downloads
    0
    Uploads
    0
    I haven't had the opportunity to draw a sketch, but here's a representative picture. The anodized bar is 1" wide.

    The numbers will be located just above their respective line because two scales will be engraved on a single bar for some orders. Making the whole line .375", the half line .25" and the tenth line .125" and still leaving a clear separation down the middle.

    I haven't measured the text in height but it's probably .375" or so. As for font style - something stick or simple - no serifs or fancy stuff. Clear and readable is all we're looking for.

    I do know that I don't want the number touching it's line, I'd like a small bit of empty space above the line, below the number. How much space will really depend on how fine a line my engraving cutters will give me. As for depth - I was thinking .030" but I haven't been able to take any test cuts with the engraving bits yet.

    Does that help give an overview of what I'm working toward?
    Attached Thumbnails Attached Thumbnails Is a Macro what I want...if not what is?-image1.jpg  


  • #10
    Registered
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    1,137
    Downloads
    0
    Uploads
    0
    Dan
    Is the bar to be held along the X axis or Y axis while machining?


  • #11
    Registered
    Join Date
    Jun 2006
    Location
    USA
    Posts
    47
    Downloads
    0
    Uploads
    0
    I'm planning a simple fixture which will allow the bar to be held lengthwise along the X.

    But back to my original question - is G52 the code which is appropriate for locating/offsetting the spindle when I go to engrave the text?

    As in - I'll have a series of .tap files with g-code for a sequence of digits or text. I've already determined where each horizontal line goes and plan to either intersperse the number subroutines with M98 as I work along the X axis (likely a better use of time) or go back and call the subroutines after engraving all the horizontal lines and engrave the numbers.

    The thing I want to confirm though is that G52 will allow my subroutine file to have origins at x0 y0 and will, based on my calculated offset, put the text in the desired location.


  • #12
    Registered
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    1,137
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Dan Craig View Post
    ....But back to my original question - is G52 the code which is appropriate for locating/offsetting the spindle when I go to engrave the text?....
    Sorry not much help with advice using G52 or writing a Macro.
    I had a play and wrote a VB program. I'm sure there is room for improvements.
    Attached Files Attached Files


  • Page 1 of 3 123 LastLast

    Similar Threads

    1. "difference between Custom Macro A and Custom Macro B"
      By arulthambi in forum Parametric Programing
      Replies: 4
      Last Post: 10-05-2009, 04:34 PM
    2. Need help with macro??????
      By lokey in forum Mach Mill
      Replies: 1
      Last Post: 04-27-2009, 11:04 PM
    3. Replies: 2
      Last Post: 03-27-2009, 04:15 PM
    4. Convert Fanuc Macro to Fadal Macro
      By bfoster59 in forum Fadal
      Replies: 1
      Last Post: 11-09-2007, 12:41 AM
    5. Macro
      By gm3211 in forum Mazak, Mitsubishi, Mazatrol
      Replies: 2
      Last Post: 09-06-2007, 08:02 AM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.