CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > LinuxCNC (formerly EMC2)


LinuxCNC (formerly EMC2) Discuss LinuxCNC (formerly EMC2) Controlers here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 10-22-2011, 08:41 AM
greybeard's Avatar  
Join Date: Jun 2005
Location: UK
Age: 73
Posts: 1,368
greybeard is on a distinguished road
Using G90 or G91 in "step and repeat" coding ?

I'm coding for my own design E-chain, and have a milling program that cuts the end of one link and the start of another as a single cut.
This will be repeated across the material in a step/repeat fashion until the sheet is covered in several lines of links.
Onto the saw table and out pops all the pieces .
Well, that's the idea.

Question.
The code I have written is in absolute movements for the single pass, and I want to be able to step the pattern by a set distance each time.
If my code had been incremental, I can see that using an O-code repeat/endrepeat would be the way to do it, and I expect I shall have to do this.
But is there an alternative coding method I could use, where, at the end of the "step", the code could repeat at the "new" start position ?

Regards
John
__________________
It's like doing jigsaw puzzles in the dark.
Enjoy today's problems, for tomorrow's may be worse.
Reply With Quote

  #2   Ban this user!
Old 10-22-2011, 11:29 AM
acondit's Avatar  
Join Date: Apr 2005
Location: USA
Posts: 1,774
acondit is on a distinguished road

I would code using a subroutine, then pass the subroutine a x, y start point and change the g55 offset inside the subroutine then cut the part. You could call the subroutine from inside a do-while loop adding the necessary column offset for each link and nest that do-while loop inside another do-while loop to reset the starting column offset and increment the row offset to start the next row.

Alan
__________________
http://www.alansmachineworks.com
Reply With Quote

  #3  
Old 10-22-2011, 12:53 PM
dertsap's Avatar
Gold Member
 
Join Date: Oct 2005
Location: canada
Posts: 3,668
dertsap is on a distinguished road
Buy me a Beer?

you could simply program in absolute for one part and use a looped sub call with a g52 shift .
if you use a macro variable for the shift then it would be dead simple ( see eg below)
g52 is one of the greatest programming tools to utilize , it saves from using a lot of code when programming multi part fixtures , if a guy picks up one work shift and uses a g 52 shift to each part then the code is shorter , easier to edit , and it makes it much easier to set up a job because only one shift needs to be picked up rather than a pile of work shifts
I've created macro routines to trig and calculate shifts for rotary's and still i only need to pick up one work shift , the machine calculates the g52 shift for any rotational position with the use of the sub routine , which is to say that I've saved myself from possibly manually picking up or calculating 100's of work shifts on a complicated rotary part
its not always simple but with macro variables to use in a calculative sub routine and a g52 , then a guy can let his imagination run fairly wild

eg

%
O1212
#101=0
t1m6
m98p1000 / or m97p1000(depending upon control)
m98p1100L20
g91g28z0
m30

O1100/or n1100 (depending upon control)
g52 x#101+2(2 was random add whatever is necessary for the shift )
O1000/or n1000
g0g90xy
g43 z2.
blah blah
blah blah
;
;
g52x0(cancels shift)
g0z2.
m99
%
__________________
A poet knows no boundary yet he is bound to the boundaries of ones own mind !! http://cnctoybox.org

Last edited by dertsap; 10-22-2011 at 01:40 PM.
Reply With Quote

  #4   Ban this user!
Old 10-22-2011, 03:26 PM
greybeard's Avatar  
Join Date: Jun 2005
Location: UK
Age: 73
Posts: 1,368
greybeard is on a distinguished road

Thanks both.

Bit puzzled at the reference to the G52 and G55 as they didn't seem familiar.

Checked out my printed copy of EMC User Manual - it's dated November 2009, so I think it's time to update and do some serious reading !
__________________
It's like doing jigsaw puzzles in the dark.
Enjoy today's problems, for tomorrow's may be worse.
Reply With Quote

  #5  
Old 10-22-2011, 10:04 PM
dertsap's Avatar
Gold Member
 
Join Date: Oct 2005
Location: canada
Posts: 3,668
dertsap is on a distinguished road
Buy me a Beer?

g55 is a simple work shift which is same as g54
typically most people use g54 g55 g56 g57 for work shift positions

hopefully i can explain g52 so that it makes sense .
lets say that your qualifying your part as usual and you pick up the g54 position , and your g54 values are x-10 y-10 .
when you call g0g90g54x0y0 in your program your tool will go to that point that you've just picked up as x0 y0 ,
now lets throw in a g52 shift
g0g90g54
g52 x-2.
x0y0
now the tool will move an increment of -2 inches from the point that you've picked up , which is to say that the g54 shift is no longer x-10 but it is now x-12. , the machine will calculate the g52 shift of -2. inches .
g52 will not physically change the g54 value but simply adds to it , until you use g52 x0 which will cancel that value and you've original position will be restored

so say we've got a fixture that has 6 parts which are 3" apart . we can program for one part at g54 then use a sub routine and a g52 shift for the rest of the parts
so we'll qualify g54 x0 y0 z0 from part # 1
now the program will look sort of like this


t1m6
g0g90 g54
m97p1000
g52x3.(shift for part 2)
m97p1000(sub call)
g52x6.(shift for part 3)
m97p1000)
g52x9.(shift for part 4)
m97p1000
g52x12.(shift for part 5)
m97p1000
g52x14.(shift for part 6)
m97p1000
g0g91g28z0
g90
m30

N1000(sub routine)
x @$# y%$
g43 h
blah
blah
g52x0
m99
%
now we can also take the same parts and program with the addition of macro variables which can make things a bit cleaner
%
O0001
#101=0 (important to reset back to zero for next batch of parts)
t1m6
g0g90 g54
m97p1000
m97p1100 L5 (loops 5 times)
g91g28z0
g90
m30

n1100
g52 x(#101+3.) (need brackets for calculations)
N1000(sub routine)
x @$# y%$
g43 h
blah
blah
g52x0(cancels the g52 shift)
m99

g52 can be used on all axis , I've only gave x as an example , I use this stuff on a daily basis but I'm not the best guys for explaining crap and don't like too much typing so if I've forgotten something or my explanation isn't that great then I'm sure someone else will speak up and help




.
__________________
A poet knows no boundary yet he is bound to the boundaries of ones own mind !! http://cnctoybox.org
Reply With Quote

Sponsored Links
  #6  
Old 10-22-2011, 11:18 PM
dertsap's Avatar
Gold Member
 
Join Date: Oct 2005
Location: canada
Posts: 3,668
dertsap is on a distinguished road
Buy me a Beer?

ok so after that winded explanation I checked out the emc codes and g52 isn't implimented yet :

so another way is with the use of a g10
g10 will physically change the work shift values permanently
g90 g10 L2 P1 x10 y10 z-6. will change the work shift values in the control to x10 y10 z-6 .
l2 is the change work shift call , P is the shift to change , P1 changes g54 P2 changes g55 and so on
now if you use a g91 instead of a g90 then the workshift will change incrementally , which is to say that if your g54 work shift is x10 y10
and you put in the program g91g10 L2 P1 x2 y5 , then your workshift will now be changed to x12 y15
so we'll go back to the example i showed previously but modified to use a g10

first qualify your g54 position for x y z , now add those values to the g10 below
%
O1212
g90 g10 l2 p1 x10 y10 z-2.( the original workshift needs to be recalled and this will do it )
t1m6
g0g90 g54
m97p1000
g91g10L2P1x3 (shift for part 2)
g90( back to absolute)
m97p1000(sub call)
g91g10L2P1x3
g90
m97p1000
g91g10L2P1x3(shift for part 4)
g90
m97p1000
g91g10L2P1x3(shift for part 5)
g90
m97p1000
g91g10L2P1x3(shift for part 6)
g90
m97p1000
g0g91g28z0
g90
m30

N1000(sub routine)
x @$# y%$
g43 h
blah
blah
m99
%

or back to using loops


O0001
t1m6
g0g90 g54
m97p1000
m97p1100 L5 (loops 5 times)
g91g28z0
g90
m30

n1100
g91 g10 l2 p1 x3. (sub routine)
g90
n1000
x @$# y%$
g43 h
blah
blah
m99
__________________
A poet knows no boundary yet he is bound to the boundaries of ones own mind !! http://cnctoybox.org
Reply With Quote

  #7   Ban this user!
Old 10-23-2011, 03:18 AM
greybeard's Avatar  
Join Date: Jun 2005
Location: UK
Age: 73
Posts: 1,368
greybeard is on a distinguished road

Dertsap, many many thanks for your efforts.
The beauty of Axis(from my point of view, anyway) is that I can enter your code along with my modifications, and see what the tool paths look like.
For me, this is the quickest way to understand, learn, and use.
Regards
John
__________________
It's like doing jigsaw puzzles in the dark.
Enjoy today's problems, for tomorrow's may be worse.
Reply With Quote

  #8   Ban this user!
Old 10-24-2011, 04:55 PM
greybeard's Avatar  
Join Date: Jun 2005
Location: UK
Age: 73
Posts: 1,368
greybeard is on a distinguished road

Hi dertsap.
I had a bit of a problem getting my head round it all, but managed to work my way through OK.
However, as I thought that I would need to cut more than 10 units per line,
I had a go at using G92 to reset the tool position to a new zero, and enclosed it all in an O-code repeat.
Here's the result -

(Code for cutting the end/start of a series of complete links)

G17 G21 G40 G49 G54 G80 G90 G94
#3= 500
#4= 300
(Tool is 3mm diameter straight bit)
G0 x[0.000] y[0.000] z[10.000] F#3(machine start)

O101 repeat [15]

G1 z[-4.000] F#4
G1 x[4.757] y[4.757]
G2 x[10.500] y[14.809] I[4.243] J[4.243] F#4
G1 x[10.500] y[21.000]
G1 x[16.500]
G1 y[16.500]
G0 z[10.000] F#3
G0 x[18.000] y[9.000] F#3
G1 z[-4.000] F#4 (Drill pivot hole)
G0 z[10.000] F#3
G0 x[17.890] y[0.000] F#3
G1 z[-4.000] F#4
G2 x[16.500] y[17.890] I[0.000] J[9.000] F#4
G0 z[10.000] F#3

G0 x[35] y[0] (step to next start position)
G92 x0 y0 z10 (set new position as start)
O101 endrepeat
(I've yet to add the "next line" bit of coding to get a repeated line.)

The concept is to cut a set of identical pieces which, when glued together in pairs, back to back, you get a 3D link from a 2D cut.
Two sets of these form the sides of the chain, and they are glued either side of short lengths of rectangular plastic conduit(trunking).

By separating the function of the chain into two parts - 1. pivoting 2. constraining, I can make my e-chain very cheaply and to whatever size fits the available material.
Regards
John
__________________
It's like doing jigsaw puzzles in the dark.
Enjoy today's problems, for tomorrow's may be worse.

Last edited by greybeard; 10-24-2011 at 05:01 PM. Reason: afterthought
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Diseno de la Tarjeta Controladora Micro-Step Unipolar "Mardus-Kreutz" kreutz Spanish CNCzone 266 Yesterday 04:45 PM
"Repeat" event Fighter Dynapath 3 09-10-2011 03:30 PM
"Flip" DSTV coding pikamonk General Metal Working Machines 1 01-20-2011 12:08 PM
Can someone explain "Full step", "Half step", "Quater step", etc. ??? danmst3k DIY-CNC Router Table Machines 4 12-04-2008 11:13 AM
Help finding information on Sanyo Denki "Step Syn" IBM stepper motor Oracle_9 Stepper Motors and Drives 12 06-08-2007 12:55 PM




All times are GMT -5. The time now is 05:07 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361