Who can crack the code?

More
13 years 3 months ago #36253 by jd896
I'm automating a machine we already have I've now got the drives and such working on a desk and while I wait for my Mesa cards to come wanted to nail this

Here's what I have now this will be in an ngcgui panel when done

#<base-holes> = 3
#<base-centres> = 50
#<first-hole> = 53
#<distance-to-main> = 509
#<main-centres> = 150
#<number-main-holes> = 26


G0 X#<first-hole>
#<current-x> = #<first-hole>
o103 repeat [#<base-holes>]
G4 p1
#<current-x> = #<current-x> + #<base-centres>
G0 X#<current-x>
o103 endrepeat

#<current-x> = #<distance-to-main> + #<current-x>
G0 x#<current-x>
o104 repeat [#<number-main-centres>]
G4 p1
#<current-x> = #<current-x> + #<main-centres>
G0 X#<current-x>
o104 endrepeat
Go xo
M2

( the g4 is in place of the punch command as I'm trying to get this code worked out in a sim )

Main issue is that this only takes into account for the one punch head on this machine and there's two at a 600mm offset so the program needs to start on that and then when the math works out ( and the machine is at x600 plus ) the second head needs to join the race

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #36257 by BigJohnT
Replied by BigJohnT on topic Who can crack the code?
What works for me is to write out in pseudo code first for complex things like this.

What is the rule for the second head to punch?

JT

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #36261 by jd896
Replied by jd896 on topic Who can crack the code?
The second punch basically needs to copy what the first has done only 600mm later down the job

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #36272 by BigJohnT
Replied by BigJohnT on topic Who can crack the code?
It takes both punches to complete a hole? It's not clear to me what the second punch does.

JT

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #36273 by jd896
Replied by jd896 on topic Who can crack the code?
No they work on different sides of the same job one mirrors the other 600mm later

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #36284 by BigJohnT
Replied by BigJohnT on topic Who can crack the code?
Sounds interesting... so what ever pattern you have on the first punch you repeat that 600 mm later. That sounds like it will take a few logic loops to see what hole is next to move to. I assume that there could be an instance where neither punch punches at the same time and times when both punches punch at the same time. So I'm back to my earlier statement about writing it out in pseudo code first...

Something like this comes to mind:
punch1 first hole = some distance
punch2 first hole = punch1 first hole + 600
then move to first hole and punch
check to see what is the next hole
move to next hole
if punch1and punch2 then punch both
if punch1 not punch2 then punch1
if not punch 1 and punch2 then punch2
move to next hole

JT

Please Log in or Create an account to join the conversation.

Time to create page: 0.342 seconds
Powered by Kunena Forum