Hello Guest it is April 19, 2024, 12:32:18 PM

Author Topic: MDI input (Abs & Inc) through DRO to move axis....a working example  (Read 5311 times)

0 Members and 1 Guest are viewing this topic.

This is in response to a request by Pedio. He would like to input a number value into a DRO and have the axis jog to that position instead of going to the MDI input page, writing the block and pressing Cycle Start. I believe his intent is to maximize time efficiency by jogging to a known position from his home page. ie "Enter value, press enter" => axis jogs to desired position. This example is simple without error checking or safety checking (ie. rc values, is axis homed, or is Z axis clear before movement, etc) To implement direct input into a DRO as a text box I will do my best to describe the instructions below. By the way, this was a great idea! Thanx Pedio (If you don't mind, I would like to add this feature to my Blackout Screenset --which is open code for everyone to use, edit, play, add their own features, repost, etc....) You guys are gonna be like "That's it?!?!?" Yep, gotta love m4! I demonstrate a mc.mcCntlMdiExecute function to jog to an absolute coordinate position (G90) and then using mc.mcJogIncStart function call instead of mc.mcCntlMdiExecute G91 command. Hope this helps!

Absolute Position:[/color]
1. Operator -> Edit Screen
2. Add DRO --to wherever you would like for this MDI input to be
3. DRO properties are: DRO Code = Blank, Editor = Keypad
4. On Modify Script =
           local inst = mc.mcGetInstance()
           local gCode = ""
           local Xmove = scr.GetProperty('droXMdiAbs', 'Value')

           Xmove = tonumber(Xmove)
           if Xmove == nil then Xmove = '0' end
           gCode = gCode ..string.format("G0 G90 X%.3f\n", Xmove)

           mc.mcCntlMdiExecute (inst, gCode)

Incremental Movement:[/color][/color]
1. Operator -> Edit Screen
2. Add DRO --to wherever you would like for this MDI input to be
3. DRO properties are: DRO Code = Blank, Editor = Keypad
4. On Modify Script =
           local inst = mc.mcGetInstance()
           local Xmove = scr.GetProperty('droXMdiInc', 'Value')

           Xmove = tonumber(Xmove)
           if Xmove == nil then Xmove = 0 end
           mc.mcJogIncStart (inst, 0, Xmove)

[/color]
That's it folks! I'll post some screen shots below in the next post to help you guys visualize the concept. It's pretty cool. Pedio had a great time-saving idea.

--josh
  

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: MDI input (Abs & Inc) through DRO to move axis....a working example
« Reply #1 on: June 30, 2015, 03:29:11 AM »
well dude your hired you can start Monday
Re: MDI input (Abs & Inc) through DRO to move axis....a working example
« Reply #2 on: June 30, 2015, 04:01:13 AM »
hold on a sec...I need to work on the increment DRO (I am using both the absolute and increment  coordinates G90/G91 at the same time...let me work this through)

I think I double posted...can a moderator delete the repeat post please?

Dude, this is soooo gonna work!

What's up Pedio? I sware you meant Pedro but Pedio? I think of PedioBear....lol! just kidding. Don't kick my ass...
« Last Edit: June 30, 2015, 04:10:50 AM by Screwie Louie »
Re: MDI input (Abs & Inc) through DRO to move axis....a working example
« Reply #3 on: June 30, 2015, 08:47:01 AM »
very nice, but  i have one question

 what do the [/color]  and [/color] [/color] functions do ?
Re: MDI input (Abs & Inc) through DRO to move axis....a working example
« Reply #4 on: June 30, 2015, 11:07:25 AM »
They are just from the forum when selecting a font color.

They are usually invisible but somehow got doubled up and pasted in this time.

Russ
Re: MDI input (Abs & Inc) through DRO to move axis....a working example
« Reply #5 on: June 30, 2015, 11:57:45 AM »
Sorry Pedio...sometimes I have a little whiskey, open my mouth and insert my foot.

Offline Pedio

*
  •  200 200
    • View Profile
Re: MDI input (Abs & Inc) through DRO to move axis....a working example
« Reply #6 on: June 30, 2015, 01:41:16 PM »
Louie - No problem with the free use of the idea. I like having people innovate around M4. It can only help all of us!

I intend to use this to move the head out of the way when I load work pieces and to move it to fixed fixturing locations on the table (I have a 7'X10' table it takes a good deal of time to move the head around when loading different size pieces. It will be great to say move X=48 to load the pieces. I also like to park the head for different functions (change tool, etc). Often it depends on where I will be working around the table.

My name is Peter and Pedio is an derivative of Fabio. When I was at career day at High School the guidance councilor never even mentioned the career choice of "Romance Novel Cover Model". I would have soooooooo gone for that one!  (It is even funnier if you meet me in person)

Is the code posted above ready for test by newbies like me?

Offline Pedio

*
  •  200 200
    • View Profile
Re: MDI input (Abs & Inc) through DRO to move axis....a working example
« Reply #7 on: June 30, 2015, 01:48:39 PM »
Louie - just to be double sure. The absolute is the distance from the machine 0 and the incremental is from the current location of the head on the table?

Also, the way I am reading it is that the script for absolute is to move the X axis. If I want to make another DRO for the Y axis I replace "X" with "Y" in the script. Is that correct?

Thanks for this - it will make my life much easier.

Finally, where do I find the Blackout Screenset? I would like to take a look.

Offline Pedio

*
  •  200 200
    • View Profile
Re: MDI input (Abs & Inc) through DRO to move axis....a working example
« Reply #8 on: June 30, 2015, 01:57:31 PM »
Found the screen set below. Looks cool.
Re: MDI input (Abs & Inc) through DRO to move axis....a working example
« Reply #9 on: June 30, 2015, 02:14:23 PM »
Yep! You're getting it.

The absolute distance is from work coordinate position 0.0
To utilize this script in machine coordinates you would use the G53 command; something like :
     gCode = gCode ..string.format("G0 G90 G53 X%.3f\n", Xmove)

Be careful just replacing X with Y. You are right in a sense but notice in this function:
     mc.mcJogIncStart (inst, 0, Xmove)

"0" is the X axis identifier for mach4, as you set it up in your config.

You would change the function to:
     mc.mcJogIncStart (inst, 1, Ymove)

"1" is the Y axis identifier.