• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

[Plugin] 2.5D CAM Plugin 20121202

Scheduled Pinned Locked Moved Plugins
80 Posts 32 Posters 91.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    jgro11
    last edited by jgro11 22 May 2012, 18:47

    Hi all. I've been working on a plugin that will create gcode for my CNC router. This plug-in will take your 3D model and create 2.5D toolpaths for use on your CNC. Just download the Ruby file and put it in your plugins folder. I'm not a programmer by trade. I just started learning at the beginning of this year. This script took me that last 5 months to create and it probably is not coded the greatest, but it works!

    = CNC 2.5D Profile
    Copyright 2012, John Groeschel
    All Rights Reserved

    == Disclaimer
    THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
    INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
    FOR A PARTICULAR PURPOSE. PLEASE VERIFY GCODE CREATED PRIOR TO RUNNING ON CNC. I AM NOT
    RESPONSIBLE FOR DAMAGE AS A RESULT OF USING THIS SCRIPT.

    Permission to use, copy, modify, and distribute this software for
    any purpose and without fee is hereby granted, provided that the above
    copyright notice appear in all copies.

    == Information
    Author:: John Groeschel
    Pieces of this code came from the following:
    -Hatchfaces.rb by Joel Gustafsson
    -Offset.rb by Rick Wilson
    Organization:: none
    Name:: CNC 2.5D Profile
    Version:: 0.5
    SU Version:: I developed this on SketchUp version 8. I have not tested on previous versions.
    Date:: 05-May-2012
    Description:: Creates gcode for CNC applications using 3D models in Sketchup
    Requires:: TIG's Smart Offset http://sketchucation.com/forums/viewtopic.php?f=323&t=49624 V1.9 or higher (version 2.1 included in zip file)
    History::
    0.1 beta:: 22-May-2012

    • Original release
      0.2:: Corrected final cut from going in opposite direction from rest of cut.
      Fixed inside only and outside only cuts.
      0.3:: Updated to work on MACs and to make the code unit independent, so now it works with metric parts.
      Added stock size to output file.
      Revised so that z axis does not lift between cuts on single hole inside cuts.
      Now more than one part can be cut at a time. They have to be grouped together.
      It now sets the G90 or G91 automatically in the gcode file based on model units
      You no longer need to supress the units symbol. This has been turned off in the plugin
      0.4:: Added require 'offset.rb'
      0.5:: Revised group checking on line 167. Fixed a bug that would not change the layer status back to default. Incorporated TIG's Smart Offset. Added "Stock to Leave for inside & outside cuts.

    Usage:

    There are a couple of settings within Sketchup that need to be set. Select Window/Model Info and this window pops up:

    http://i1094.photobucket.com/albums/i450/jgroesch/SketchupCNC_settings502x365.jpg

    Uncheck the "Display units format" If you don't, the inches symbol (") will show up in your gcode and your controller software will not recognize it.You can also set your precision to what you want in your gcode file. Whatever the precision is set to here, is what your gcode file's decimal places will be. (This has been changed in V03. The default decimal places is 3)

    A few more rules to using this script. First, the part cannot be below the X-Y plane (tabletop). It will give an error if it is. Second, the script is set up that if looks for the closest point to the origin in the X-Y plane to determine where to plunge down. The best place to put your part is in the +X/+Y quadrant. If you do not, there could be a possibility that there are two closest points to origin and Sketchup will pick one at random, which could cause the tool to plunge where you don't want it to. Third, inside radii need to be modeled slightly larger than half of the cutter diameter. For example, if I'm using a .25 diameter endmill, I need to model my INSIDE fillets to .13 inches. If you really need a .125 radius, you can use a smaller endmill or model the inside corner sharp. This is not a problem on outside radii.This is changed in V05 with the incorporation of TIG's Smart Offset

    Here is the model that I want to machine. The model is placed in the +X/+Y quadrant.

    http://i1094.photobucket.com/albums/i450/jgroesch/SketchupCNC_1640x360.jpg

    Your part must be in a group or this script will not work. If your model is not in a group, the script will give you an pop-up window stating that your selection is not a group. Once it is in a group, select it and select CNC 2.5D Profile from the plugin menu.

    http://i1094.photobucket.com/albums/i450/jgroesch/SketchupCNC_2640x360.jpg

    The option menu pops up. Fill in what you want for this cut. The values that you enter are stored in a text file in your plugins folder. The next time you run the script, the plugin will read these values back into the options panel.

    http://i1094.photobucket.com/albums/i450/jgroesch/SketchupCNC_3640x360.jpg

    The script will run. When it is done, a file save menu will pop up asking you where you want to save your gcode file.

    http://i1094.photobucket.com/albums/i450/jgroesch/SketchupCNC_4640x360.jpg

    When completed, the cutter paths are displayed on the screen. The cutter paths are put on a separate layer, so you can toggle them on and off.

    http://i1094.photobucket.com/albums/i450/jgroesch/SketchupCNC_5640x360.jpg

    Here is the output of the gcode file in NCplot

    http://i1094.photobucket.com/albums/i450/jgroesch/SketchupCNC_7640x360.jpg

    %(#FF0000)[Please delete previous versions before installing V04!
    Extract zip file to your plugins folder. You should see CNC-profile.rb in the plugins folder and you should see a new folder called CNC_Files. This is required for macs.]


    CNC-profile_v05.zip

    1 Reply Last reply Reply Quote 0
    • P Offline
      pilou
      last edited by 22 May 2012, 19:23

      Seems a true gem! ☀

      Frenchy Pilou
      Is beautiful that please without concept!
      My Little site :)

      1 Reply Last reply Reply Quote 0
      • J Offline
        jgro11
        last edited by 23 May 2012, 04:10

        I fixed a couple of bugs that I found tonight while testing. I uploaded the latest file to the first thread.

        jgro

        1 Reply Last reply Reply Quote 0
        • C Offline
          crash5050
          last edited by 25 May 2012, 06:16

          I keep getting this error:

          Safety height is lower than top of part. Please correct.

          1 Reply Last reply Reply Quote 0
          • J Offline
            jgro11
            last edited by 26 May 2012, 01:58

            What is the thickness of your part and what safety height did you set? I put a comparison in the code that checks the part thickness (bounding box size) against the safety height. If the safety height (which is measured from the table top X/Y plane or Z 0) is lower than the part thickness, the message pops up. I put this in because I can't tell you how many times I changed the part thickness and forgot to change the safety height. I've ruined quite a few pieces of MDF. 😳

            jgro

            1 Reply Last reply Reply Quote 0
            • M Offline
              Michaelv
              last edited by 1 Jun 2012, 22:54

              Awesome!

              I've been wanting to do a CAM plugin for a long time, just never got to it.
              I tried it on Mac, didn't work, but I'm fixing it.
              It was looking for my default text file, which of course doesn't exist since I never ran it, so it's stuck. Like I said I will debug on Mac and keep you posted.

              Michael

              1 Reply Last reply Reply Quote 0
              • M Offline
                Michaelv
                last edited by 2 Jun 2012, 00:28

                @crash5050 said:

                I keep getting this error:

                Safety height is lower than top of part. Please correct.

                Are you working in mm? This version is inches by default, and the default safety height is 1 inch.
                So unless you enter a safety higher than your part it won't work. If working in mm and the part is let's say 40mm high, it requires a 41 inches default.

                1 Reply Last reply Reply Quote 0
                • S Offline
                  saikhamhein
                  last edited by 6 Jun 2012, 15:22

                  I cant save the gcode. There is no save window.

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    trock2957
                    last edited by 21 Jun 2012, 02:52

                    Unable to get anything the generate code sceen. No warnings, just blank results....
                    Tried a simple square and grouped it, No action after clicking OK in the Gcode Screen..Tried several basic primitive shapes and grouped.
                    Any Idea?
                    Thanks,

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      squartochi
                      last edited by 2 Jul 2012, 15:12

                      Same as above, looks like it makes some passes. But no popup save window. This is from the ruby console

                      C:/Program Files/Google/Google SketchUp 7/Plugins/CNC-profile_v02.rb:833:in `call'
                      (eval):892

                      Thanks,
                      Scott

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        crash5050
                        last edited by 26 Jul 2012, 20:27

                        Ok, I must be doing something wrong.

                        1. I went out to 3d warehouse and grabbed a hutch that I want to cut on my CNC. http://sketchup.google.com/3dwarehouse/details?mid=792d164e6a059ae8958113d6831abae2&prevstart=0

                        I Imported it into Sketchup, and selected all and made it a group amdI still keep getting this darned error. Am I doing something that is impossible?

                        1 Reply Last reply Reply Quote 0
                        • F Offline
                          Fritzache
                          last edited by 2 Dec 2012, 10:21

                          Hi. Interesting plugin. So? no more support for it? I have the same problem as the guys above.
                          No save window appears. thank you in advance.

                          1 Reply Last reply Reply Quote 0
                          • J Offline
                            jgro11
                            last edited by 2 Dec 2012, 13:22

                            I need more details. Do you have the ruby console open? What does it say when you run the plugin.

                            jgro

                            1 Reply Last reply Reply Quote 0
                            • Dave RD Offline
                              Dave R
                              last edited by 2 Dec 2012, 15:17

                              Hi Joel,

                              I gave your plugin a try and I seem to be getting the same result. No Save window. I also don't seem to see the tool path as you show in your images, either. Here are some screen shots for you.

                              CNC1.png
                              the setup. Note that Units is set to Decimal and units aren't displayed. The thing is a group.

                              CNC2.png
                              Immediately after running the plugin. No save option.

                              CNC3.png
                              And the same in X-ray.

                              Etaoin Shrdlu

                              %

                              (THERE'S NO PLACE LIKE)

                              G28 X0.0 Y0.0 Z0.0

                              M30

                              %

                              1 Reply Last reply Reply Quote 0
                              • J Offline
                                jgro11
                                last edited by 2 Dec 2012, 19:23

                                I just uploaded the latest version V03. (look at the first post) Give that a try. It has been changed to work for english and metric units and it should work on macs. (Special thanks to MichaelV for helping me with that!) Hopefully this should fix the problem. If not, upload the .skp file here and I'll take a look at it.

                                jgro

                                1 Reply Last reply Reply Quote 0
                                • Dave RD Offline
                                  Dave R
                                  last edited by 2 Dec 2012, 20:03

                                  Joel, I tried the latest version. Still no Save box. Here's the dump from the Console.

                                  C:/Program Files/Google/Google SketchUp 8/Plugins/CNC_Files/CNC_Profile_Defaults.txt

                                  2

                                  Error: #<NoMethodError: undefined method offset' for #<Sketchup::Face:0xab8d4cc>> C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:712:in inside_offset'
                                  C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:655:in each' C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:655:in inside_offset'
                                  C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:215:in mode' C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:72:in activate'
                                  C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:912:in `select_tool'
                                  C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:912

                                  This time the green face displayed at the bottom instead of the top.

                                  Another odd thing is that unticking the visibility box for the 'path' layer makes no change.

                                  I would like to also suggest that when the path layer is created it is not made as the active layer. Layer 0 should remain active. And it would be nice if the .rb file kept the same name through version changes so installing a new version just overwrites the old.

                                  Thanks for taking a look at this.

                                  Etaoin Shrdlu

                                  %

                                  (THERE'S NO PLACE LIKE)

                                  G28 X0.0 Y0.0 Z0.0

                                  M30

                                  %

                                  1 Reply Last reply Reply Quote 0
                                  • TIGT Offline
                                    TIG Moderator
                                    last edited by 2 Dec 2012, 20:16

                                    Looks like you need ' offset.rb' in the Plugins folder - it's freely available from http://Smustard.com ... http://www.smustard.com/script/Offset
                                    That file should also have a 'require' at the start of your script's code, as it needs to loaded before the script...

                                    TIG

                                    1 Reply Last reply Reply Quote 0
                                    • Dave RD Offline
                                      Dave R
                                      last edited by 2 Dec 2012, 20:41

                                      I thought I had that file installed already from long ago. It is now and I get the following:

                                      C:/Program Files/Google/Google SketchUp 8/Plugins/CNC_Files/CNC_Profile_Defaults.txt
                                      Error: #<NoMethodError: undefined method typename' for nil:NilClass> C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:164:in find_bounds'
                                      C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:71:in activate' C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:912:in select_tool'
                                      C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:912

                                      Etaoin Shrdlu

                                      %

                                      (THERE'S NO PLACE LIKE)

                                      G28 X0.0 Y0.0 Z0.0

                                      M30

                                      %

                                      1 Reply Last reply Reply Quote 0
                                      • J Offline
                                        jgro11
                                        last edited by 2 Dec 2012, 22:13

                                        OK, I added "require 'offset.rb' to the plugin and uploaded as V.04. (Thanks for the catch TIG!). I also renamed the plugin back to CNC-profile.rb so you can just load it over the top of what you have in your plugins folder. The version number will still exist in the plugins menu.

                                        Quote "I would like to also suggest that when the path layer is created it is not made as the active layer. Layer 0 should remain active." The path layer is set active during the geometry creation and at the end of the plugin the active layer gets changed back to the default layer. You never got to the end of the plugin, so it never got the chance to change it back to the default layer.

                                        Quote "C:/Program Files/Google/Google SketchUp 8/Plugins/CNC_Files/CNC_Profile_Defaults.txt
                                        Error: #<NoMethodError: undefined method typename' for nil:NilClass> C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:164:in find_bounds'
                                        C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:71:in activate' C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:912:in select_tool'
                                        C:/Program Files/Google/Google SketchUp 8/Plugins/CNC-profile_v03.rb:912"

                                        Try deleting the CNC_Profile_Defaults.txt from the CNC_files folder in your plugins folder. It should create a new one when you run the plugin. See if that helps.

                                        jgro

                                        1 Reply Last reply Reply Quote 0
                                        • TIGT Offline
                                          TIG Moderator
                                          last edited by 2 Dec 2012, 22:15

                                          @Dave...
                                          That part of the code is checking that the first item in the current selection is a group.
                                          Unfortunately if there's no selection that 'nil' and that has no .typename...
                                          There are better ways yo check what's selected, if anything is...

                                          To get it to work as it is... make sure you have something selected before using the tool, and ensure that it's a group... 😒

                                          TIG

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 3
                                          • 4
                                          • 1 / 4
                                          • First post
                                            Last post
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement