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 > G-Code Programing


G-Code Programing Discuss G-code programing and problems here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 07-05-2011, 11:39 PM
 
Join Date: Jul 2011
Location: USA
Posts: 4
ZSamuels28 is on a distinguished road
Programming a Display Program for GCode

Hi,
I'm currently a software engineering for a laser company and am programming a GCode display program in C#. How would I go about displaying arcs using I/J values?

As far as drawing arcs goes here are my options:
x, y, width, height, startAngle, sweepAngle
Rectangle, startAngle, sweepAngle

How would I gather the startAngle and sweepAngle from the GCode? Another option would be just to draw an arc using straight lines... How should I approach this?
Reply With Quote

  #2   Ban this user!
Old 07-06-2011, 05:45 AM
doorknob's Avatar  
Join Date: Jan 2010
Location: USA
Posts: 1,240
doorknob is on a distinguished road
Buy me a Beer?

There is some info here that may give you some ideas:

http://www.cnczone.com/forums/austra...e_indexer.html
Reply With Quote

  #3   Ban this user!
Old 07-06-2011, 10:04 PM
 
Join Date: Jul 2011
Location: USA
Posts: 4
ZSamuels28 is on a distinguished road

Don't think that's what I'm looking for...
Reply With Quote

  #4   Ban this user!
Old 07-06-2011, 11:13 PM
 
Join Date: Jun 2008
Location: Canada
Posts: 70
george4657 is on a distinguished road

The best place I found that describes the different methods of arcs in G code is the Mach3 manual.
It can be found at http://www.machsupport.com/docs/Mach3Mill_1.84.pdf
Look at section 10.7.3.1 and 10.7.3.2

George
Reply With Quote

  #5   Ban this user!
Old 07-07-2011, 01:30 AM
 
Join Date: Jul 2011
Location: USA
Posts: 4
ZSamuels28 is on a distinguished road

Originally Posted by george4657 View Post
The best place I found that describes the different methods of arcs in G code is the Mach3 manual.
It can be found at http://www.machsupport.com/docs/Mach3Mill_1.84.pdf
Look at section 10.7.3.1 and 10.7.3.2

George
Thanks I'll take a look! If anyone else has any input I'd love some more help, I'm fairly new to the GCode scene (Only been working at this job for a few weeks).
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 07-07-2011, 06:58 AM
 
Join Date: May 2005
Location: canada
Posts: 1,149
cyclestart is on a distinguished road

Originally Posted by ZSamuels28 View Post
Hi,
I'm currently a software engineering for a laser company and am programming a GCode display program in C#.
A graphical display, what most of us here would call a backplotter ?
Example NCPlot.
NCPlot.com - Tools for CNC Programmers

How would I gather the startAngle and sweepAngle from the GCode?
Arc Buddy is a simple python script that does what you want in reverse. I'm not sure if it helps at all but the code won't cost much time to read.
EMC Documentation Wiki: Simple EMC G-Code Generators

"Axis" does the backplotting for EMC2. It's open source but wading through the code will take a lot of effort. More python.

Another option would be just to draw an arc using straight lines... How should I approach this?
No idea.
G02 and G03 defines arcs so why go there ?

edit/ G02 and G03 use 'start point/end point/distance from center' (or alternatively R). If sweep is needed the program will need to make the calculation, it helps to think in quadrants.
__________________
Anyone who says "It only goes together one way" has no imagination.
Reply With Quote

  #7   Ban this user!
Old 07-07-2011, 07:27 AM
 
Join Date: Jul 2011
Location: USA
Posts: 4
ZSamuels28 is on a distinguished road

Originally Posted by cyclestart View Post

Arc Buddy is a simple python script that does what you want in reverse. I'm not sure if it helps at all but the code won't cost much time to read.
EMC Documentation Wiki: Simple EMC G-Code Generators

"Axis" does the backplotting for EMC2. It's open source but wading through the code will take a lot of effort. More python.


No idea.
G02 and G03 defines arcs so why go there ?

edit/ G02 and G03 use 'start point/end point/distance from center' (or alternatively R). If sweep is needed the program will need to make the calculation, it helps to think in quadrants.
Thank You! Looks good! I'll have to test it out and see if it does what I need.
Reply With Quote

  #8   Ban this user!
Old 07-07-2011, 10:54 AM
 
Join Date: Sep 2010
Location: Australia
Posts: 733
angelw is on a distinguished road

Originally Posted by ZSamuels28 View Post
Hi,
I'm currently a software engineering for a laser company and am programming a GCode display program in C#. How would I go about displaying arcs using I/J values?

As far as drawing arcs goes here are my options:
x, y, width, height, startAngle, sweepAngle
Rectangle, startAngle, sweepAngle

How would I gather the startAngle and sweepAngle from the GCode? Another option would be just to draw an arc using straight lines... How should I approach this?
Using the X,Y plane as the example, circular interpolation (G02, G03) is coded using I,J or R. In some controls the I and J values describe the Absolute coordinates of the arc center point and in others, the Incremental distance from the start point of the arc. When using R in the circular interpolation coding, the R value is passed to the control where the arc center is calculated based on the start and end point of the arc.

When writing software to display the tool path, you can:
1. Easily calculate the arc center point in systems using I and J to describe the center point incrementally, by applying the I and J values to the arc start point.
2. In systems using I and J to describe the arc center in Absolute terms, the center requires no calculation.
3. In systems using R, the center point is calculated using the Start, End points and the R value. I can give you the algorithm for this if its a help to you.

Once the arc center is known the Start and End angle of the arc is calculated using simple trigonometry.

If the software is to display the cutter path of a laser machine (top view of XY plane) then using arc center, start angle, sweep angle, and radius is the best solution. If the display is an Isometric view, then the properties of the arc will still have to be calculated based on the G code data, but the acr will be drawn using short, straight lines because the representative curve drawn in the display will not be a true arc.

Regards,

Bill
Reply With Quote

  #9   Ban this user!
Old 07-11-2011, 08:00 PM
BobWarfield's Avatar  
Join Date: May 2005
Location: USA
Posts: 2,395
BobWarfield is on a distinguished road

ZSamuels, if I understand your question correctly, you're trying to write a g-code simulator in C++ to be used with your laser. Is that correct?

If so, there's quite a lot for you to consider. I've got a simulator in Beta Test called G-Wizard Editor:

GWizard Editor: A G-Code Editor and Simulator

Something you may find useful about GWE is it has a facility called "Hints" for folks that are not dyed in the wool g-code experts (actually it is helpful to many experts too, LOL). It pumps out a lot of information about each line of g-code in easy to understand English.

Here is a typical hint with information on an arc, for example:



You might find it useful just because it provides a lot of information about the arc that is not immediately obvious just looking at the raw g-code.

As for the other considerations of a g-code simulator, the language has all sorts of ways to modify what's going on that you'll need to be aware of depending on which dialect your laser's controller plans to support.

For example, you'll need to be prepared to plot the arc when scaling, work offsets, coordinate rotation, and various other factors are in play. Quite a bit of work required to build a general purpose simulator, LOL.

Probably the best place to drill down and see at least one way things are done is to go check out the source code for EMC2.

Best,

BW
__________________
Try G-Wizard Machinist's Calculator for free:
http://www.cnccookbook.com/CCGWizard.html
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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gcode sub program example needed MrWild LinuxCNC (formerly EMC2) 14 09-03-2010 05:51 PM
4th-Axis GCode Programming twehr G-Code Programing 6 09-17-2009 06:31 PM
Newbie Q: (Mach/Gcode/Tormach?) display vars? rc33 Tormach PCNC 10 11-18-2008 03:16 PM
Can you use the graph feature to display sub program moves? Shotout Haas Mills 15 11-27-2007 02:27 PM
Toolchanging and offsets gcode programming ddanutz G-Code Programing 12 11-04-2006 04:39 PM




All times are GMT -5. The time now is 07:58 PM.





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