sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Plugin publishing questions.

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 3 Posters 298 Views 3 Watching
    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.
    • G Offline
      Grays42
      last edited by

      Hi Sketchucation,

      You guys helped me quite a bit last year, and after several revisions my CNC code is more or less fully functional. I never really had an interest in publishing it as it was for my own use, but if other people could benefit from it, it wouldn't be a bad idea. (It's months of work on my part and around 3,000 lines of code, including extensive unit testing.) I don't use GitHub and have just been using my Google Drive as basic version control.

      The basic function of the plugin is to convert a Sketchup Group or ComponentInstance into "gcode" necessary to cut out the piece with a CNC machine. It will work with any Group or ComponentInstance that has a single flat base and I have covered all types of intersections I can think of.

      Here's a gallery of the plugin in action (note that the lines are drawing the produced gcode after it has already been exported):

      Link Preview Image
      GPath plugin

      Discover the magic of the internet at Imgur, a community powered entertainment destination. Lift your spirits with funny jokes, trending memes, entertaining gifs, inspiring stories, viral videos, and so much more from users.

      favicon

      Imgur (imgur.com)

      Here's a zip to the current version:
      https://drive.google.com/file/d/0B22HAM7WzR-RWHluTTF5ekozdFk/edit?usp=sharing

      Here's a sample of the exported gcode:

      (Generated with Grays42_GPath)
      
      (---------- HEADER ----------)
      G90 (Absolute distance)
      G40 (Tool Radius Compensation Off)
      G20 (Inches)
      G17 (All curves are in X-Y plane)
      G94 (Inches per minute feed mode)
      M03 (Motor on)
      
      
      
      
         (---------- WORKPIECE 1 ----------)
         (---------- WORKPIECE NAME; G1 ----------)
         (Group x-y bounds; [6.000",4.000"],[8.000",6.000"])
         (Group height; 1.000")
         (Group base z; 0.000")
      
            (--- WORKPIECE 1, PATH STACK 0 ---)
            G00 X8.0940 Y6.0000 Z2.0000 F50.0000
            G00 X8.0940 Y6.0000 Z0.5000
      
            (--- WP 1, STACK 0,  z0.350" -> z0.350" ---)
               G01 X8.0940 Y6.0000 Z0.3500 F6.0000
               G01 X8.0940 Y4.0000 Z0.3500 F30.0000
               G02 X8.0000 Y3.9060 Z0.3500 I-0.0940 J-0.0000
               G01 X6.0000 Y3.9060 Z0.3500
               G02 X5.9060 Y4.0000 Z0.3500 I0.0000 J0.0940
               G01 X5.9060 Y6.0000 Z0.3500
               G02 X6.0000 Y6.0940 Z0.3500 I0.0940 J-0.0000
               G01 X8.0000 Y6.0940 Z0.3500
               G02 X8.0940 Y6.0000 Z0.3500 I0.0000 J-0.0940
      
            (--- WP 1, STACK 0,  z0.350" -> z0.200" ---)
               G01 X8.0940 Y6.0000 Z0.3500 F6.0000
               G01 X8.0940 Y4.0000 Z0.3151 F30.0000
               G02 X8.0000 Y3.9060 Z0.3125 I-0.0940 J-0.0000
               G01 X6.0000 Y3.9060 Z0.2776
               G02 X5.9060 Y4.0000 Z0.2750 I0.0000 J0.0940
               G01 X5.9060 Y6.0000 Z0.2401
               G02 X6.0000 Y6.0940 Z0.2375 I0.0940 J-0.0000
               G01 X8.0000 Y6.0940 Z0.2026
               G02 X8.0940 Y6.0000 Z0.2000 I0.0000 J-0.0940
      
            (--- WP 1, STACK 0,  z0.200" -> z0.050" ---)
               G01 X8.0940 Y6.0000 Z0.2000 F6.0000
               G01 X8.0940 Y4.0000 Z0.1651 F30.0000
               G02 X8.0000 Y3.9060 Z0.1625 I-0.0940 J-0.0000
               G01 X6.0000 Y3.9060 Z0.1276
               G02 X5.9060 Y4.0000 Z0.1250 I0.0000 J0.0940
               G01 X5.9060 Y6.0000 Z0.0901
               G02 X6.0000 Y6.0940 Z0.0875 I0.0940 J-0.0000
               G01 X8.0000 Y6.0940 Z0.0526
               G02 X8.0940 Y6.0000 Z0.0500 I0.0000 J-0.0940
      
            (--- WP 1, STACK 0,  z0.050" -> z0.050" ---)
               G01 X8.0940 Y6.0000 Z0.0500 F6.0000
               G01 X8.0940 Y4.0000 Z0.0500 F30.0000
               G02 X8.0000 Y3.9060 Z0.0500 I-0.0940 J-0.0000
               G01 X6.0000 Y3.9060 Z0.0500
               G02 X5.9060 Y4.0000 Z0.0500 I0.0000 J0.0940
               G01 X5.9060 Y6.0000 Z0.0500
               G02 X6.0000 Y6.0940 Z0.0500 I0.0940 J-0.0000
               G01 X8.0000 Y6.0940 Z0.0500
               G02 X8.0940 Y6.0000 Z0.0500 I0.0000 J-0.0940
            G00 X8.0940 Y6.0000 Z2.0000 F50.0000
      
      (WORKPIECE 1 REPORT;)
      (Workpiece feed distance; 38.3273 inches.)
      (Workpiece seek distance; 13.5754 inches.)
      
      
      (FINAL CLEANUP)
      
      (FINAL WORK RUN REPORT;)
      (Total feed distance; 38.3273 inches.)
      (Total seek distance; 13.5754 inches.)
      

      I'm posting while on lunch, so I'll follow up a bit later this evening. My question is, if I did want to go about publishing it, is there anything I need to alter in the code? Could someone who is experienced with writing and publishing plugins please take a look and offer me advice or recommendations?

      As I said, I'm fine with how it works for now--it does exactly what I want it to do for my own use. This is just for anyone else who would find benefit from my work.

      Thanks,
      Brandon

      1 Reply Last reply Reply Quote 0
      • D Offline
        driven
        last edited by

        hi the images look good,

        why don't you just attach the zip here so it's easier to download [ i.e. I couldn't ]

        then some of the 'ruby masters' may be inclined to take a look...

        john

        learn from the mistakes of others, you may not live long enough to make them all yourself...

        1 Reply Last reply Reply Quote 0
        • G Offline
          Grays42
          last edited by

          Ah, sorry. I forgot that you can attach zips to posts here.


          GPath Plugin.zip

          1 Reply Last reply Reply Quote 0
          • tt_suT Offline
            tt_su
            last edited by

            I had a quick scan of the code, looks fine for the most of it. Two things I'd address though:

            gpath.rb

            
            load 'gpath/main.rb'
            
            def grel
            	load 'gpath/main.rb'
            end
            
            

            That's a global method that adds itself to every object in the environment. I recommend wrap that in your Grays42_GPath like you did with everything else. For Extension Warehouse we'd reject an extensions for adding to the global scope.

            In ui_handler.rb there is a bunch of globals. I'd recommend you convert these to instance variables in your top level module.

            For double loading protection where you used this if not $gpath_ui_console_loaded then there is two functions file_loaded(__FILE__) and file_loaded?(__FILE__) defined in sketchup.rb that you can use.

            1 Reply Last reply Reply Quote 0
            • G Offline
              Grays42
              last edited by

              I made the edits you advised. Still toying with the code; after I've done some more testing I'll submit to extension warehouse.

              1 Reply Last reply Reply Quote 0
              • tt_suT Offline
                tt_su
                last edited by

                Another thing worth testing is the Undo operation. We find that many extensions submitted doesn't produce a clean undo history. Some times an action require multiple undo steps. In particular setting attributes cause this as many are not aware that setting attributes are undoable operations.

                So take your plugin for a spin, try out the various functions and check if you can undo each operation with one undo step.

                1 Reply Last reply Reply Quote 0
                • G Offline
                  Grays42
                  last edited by

                  Sounds good.

                  The draw step can be reversed or stopped by deleting the group the draw is writing to, but I don't have it enclosed in an operation. I can add that in. That's the only thing that really needs to be undone; I'm not really crazy about a single undo step rewriting the CNC environment variables and outputting the gcode to a file is a single step anyway that can't be reversed short of deleting the files from the filesystem.

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

                  Advertisement