587,513 active members*
2,856 visitors online*
Register for free
Login
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2010
    Posts
    72

    PP code format

    Hi Guys,
    I noted in another thread that somebody suggested that they had 50K lines of code within a program.
    I'm very interested in how that code has been written.
    I noted that while using a Conversational function the other day, it too used over 2000 lines of code to cut a small pocket.
    I thought that it might be because those conversational functions might be seen as a "training venue" for want of a better term.

    Anyone care to put a code sample from say a Fusion360 or BobCad/Cam program??

    Thanks in advance.

    Regards

    Peter

  2. #2
    Join Date
    Dec 2013
    Posts
    267

    Re: PP code format

    I use Sprutcam to generate my g-code. Basically, the CAM process is:

    1) Import a solid model (usually drawn with a CAD program)
    2) Define your operations
    2a) Each operation is assigned tools, toolpaths, width of cut, depth of cut, RPM, feed rate, etc...
    2b) Some operations like 3d machining are assigned ball end mills and use the bottom and sides of the end mill. This is all calculated using the internal software algorithms - things that would be nearly impossible to do by hand.
    3) Post-process ("post") your code. This converts from Sprutcam's internal representation (move to location x,y,z) to your machine's representation (g01 x,y,z). This is where the g-code is actually written for your specific machine controller.

    Sample code, as you can see this snippet is from ~28,000 lines of code in:

    Code:
    (3D Machining)
    N28300 T43 G43 H43 M6
    (1/4  Ball EM)
    N28310 S5100 M3 M8
    N28320 G0 X-2.371 Y-0.5632 Z0.05
    N28330 Z0.0101
    N28340 G1 Z-0.0649 F20
    N28350 G2 X-2.3299 Y-0.5515 Z-0.0649 I0.049 J-0.094
    N28360 G1 X-1.8999
    N28370 G2 X-1.8584 Y-0.5632 Z-0.0649 I-0.0072 J-0.1048
    N28380 G1 X-1.8398
    N28390 Z-0.0798
    N28400 G3 X-1.9007 Y-0.5407 Z-0.0798 I-0.0667 J-0.0868
    N28410 G1 X-2.3298
    N28420 G3 X-2.3902 Y-0.5632 Z-0.0798 I0.0067 J-0.11
    N28430 G1 X-2.406
    N28440 Z-0.1
    N28450 G2 X-2.3298 Y-0.5294 Z-0.1 I0.0823 J-0.0828
    N28460 G1 X-1.8994
    N28470 G2 X-1.824 Y-0.5632 Z-0.1 I-0.0077 J-0.1183
    N28480 G1 X-1.8143
    N28490 Z-0.1202
    N28500 G3 X-1.9009 Y-0.5214 Z-0.1202 I-0.0925 J-0.0808
    N28510 G1 X-2.3288
    N28520 G3 X-2.4157 Y-0.5632 Z-0.1202 I0.0046 J-0.1205
    N28530 G1 X-2.4219
    ...
    LOTS more lines of code
    ...

  3. #3
    Join Date
    Nov 2007
    Posts
    2151

    Re: PP code format

    A couple pictures showing the cam setups they would be similar fusion or whatever cam you use.
    As wtopace mentions 3d mill operations generate a great deal of code lines

    Attachment 287436

    This generates between 20k and 50k lines of code depending on scallop, steps and or type of operations.
    Also post processor and how efficient it is effects the code file size. I notice some differences in file sizes from post to post on same part and design.
    If there are people that can code parts like this by hand they are awesome

    Attachment 287438

    The machining results

  4. #4
    Join Date
    Mar 2010
    Posts
    72

    Re: PP code format

    Quote Originally Posted by wtopace View Post
    I use Sprutcam to generate my g-code. Basically, the CAM process is:

    1) Import a solid model (usually drawn with a CAD program)
    2) Define your operations
    2a) Each operation is assigned tools, toolpaths, width of cut, depth of cut, RPM, feed rate, etc...
    2b) Some operations like 3d machining are assigned ball end mills and use the bottom and sides of the end mill. This is all calculated using the internal software algorithms - things that would be nearly impossible to do by hand.
    3) Post-process ("post") your code. This converts from Sprutcam's internal representation (move to location x,y,z) to your machine's representation (g01 x,y,z). This is where the g-code is actually written for your specific machine controller.

    Sample code, as you can see this snippet is from ~28,000 lines of code in:

    Code:
    (3D Machining)
    
    N28300 T43 G43 H43 M6
    (1/4  Ball EM)
    N28310 S5100 M3 M8
    N28320 G0 X-2.371 Y-0.5632 Z0.05
    N28330 Z0.0101
    N28340 G1 Z-0.0649 F20
    N28350 G2 X-2.3299 Y-0.5515 Z-0.0649 I0.049 J-0.094
    N28360 G1 X-1.8999
    N28370 G2 X-1.8584 Y-0.5632 Z-0.0649 I-0.0072 J-0.1048
    N28380 G1 X-1.8398
    N28390 Z-0.0798
    N28400 G3 X-1.9007 Y-0.5407 Z-0.0798 I-0.0667 J-0.0868
    N28410 G1 X-2.3298
    N28420 G3 X-2.3902 Y-0.5632 Z-0.0798 I0.0067 J-0.11
    N28430 G1 X-2.406
    N28440 Z-0.1
    N28450 G2 X-2.3298 Y-0.5294 Z-0.1 I0.0823 J-0.0828
    N28460 G1 X-1.8994
    N28470 G2 X-1.824 Y-0.5632 Z-0.1 I-0.0077 J-0.1183
    N28480 G1 X-1.8143
    N28490 Z-0.1202
    N28500 G3 X-1.9009 Y-0.5214 Z-0.1202 I-0.0925 J-0.0808
    N28510 G1 X-2.3288
    N28520 G3 X-2.4157 Y-0.5632 Z-0.1202 I0.0046 J-0.1205
    N28530 G1 X-2.4219
    ...
    LOTS more lines of code
    ...
    Oh I see, 10 spacing, thats not so bad.
    Doesn't PP have auto numbering, which would mean that when you edit(say delete or add) a line it will automatically renumber?
    If that is the case, why increments of 10?
    thanks for the code sample......nice and clean.
    I was(had been looking at the code generated using the PP conversational functions, where the code is very cluttered, given that it contains so many comments and some codes on a single line by themselves.

    Regards

    Peter

  5. #5
    Join Date
    Dec 2013
    Posts
    267

    Re: PP code format

    Quote Originally Posted by dirtridn2010 View Post
    Oh I see, 10 spacing, thats not so bad.
    Doesn't PP have auto numbering, which would mean that when you edit(say delete or add) a line it will automatically renumber?
    If that is the case, why increments of 10?
    thanks for the code sample......nice and clean.
    I was(had been looking at the code generated using the PP conversational functions, where the code is very cluttered, given that it contains so many comments and some codes on a single line by themselves.

    Regards

    Peter
    I don't believe PP itself can do anything with line numbers, the built-in "editor" is just the Linux gedit tool (similar to Windows notepad).

    I guess Sprutcam chose to use increments of 10 so we can add lines in between if necessary? It's probably configurable somewhere, I just have never looked since i haven't ever had the need to.

  6. #6
    Join Date
    Mar 2010
    Posts
    72

    Re: PP code format

    Quote Originally Posted by wtopace View Post
    I don't believe PP itself can do anything with line numbers, the built-in "editor" is just the Linux gedit tool (similar to Windows notepad).

    I guess Sprutcam chose to use increments of 10 so we can add lines in between if necessary? It's probably configurable somewhere, I just have never looked since i haven't ever had the need to.
    I understand, many thanks for clearing that up.
    I wasn't to sure at all.

    Peter

Similar Threads

  1. VB6, PLT-format, g-code? etc.
    By Alpout in forum Visual Basic
    Replies: 1
    Last Post: 05-10-2013, 05:24 PM
  2. g-code format modification app
    By Peter H in forum G-Code Programing
    Replies: 13
    Last Post: 03-02-2012, 01:11 AM
  3. 5 a xis nc code in this format
    By happytriger2000 in forum Rhinocam
    Replies: 0
    Last Post: 04-06-2011, 04:37 PM
  4. mach3 g code format
    By eloid in forum DIY CNC Router Table Machines
    Replies: 0
    Last Post: 08-21-2009, 04:25 AM
  5. Equation format in g-code
    By Jester966 in forum G-Code Programing
    Replies: 5
    Last Post: 07-09-2007, 02:39 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •