1. Hey guyz. Welcome to the All New Phlatforum!



    Sign Up and take a look around. There are so many awesome new features.

    The Phlatforum is a place we can all hang out and

    have fun sharing our RC adventures!

  2. Dismiss Notice

Simple GCode plotter plugin

Discussion in 'SketchUcam Related Software' started by gasmasher, Sep 9, 2009.

  1. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    I wrote a very simple gcode plotter last weekend that is triggered through the Plugin menu in SU. It is Windows only for now but is using OpenGL so it might work under Wine. There is currently no error checking and I am just using it to get a quick visualization of the gcode put out by the PhlatscripT. This shouldn't be considered part of the PhlatscripT but it does rely on version 0.918 or greater.

    Place GPlot.rb and GPlot.dll and Win32API.so (this comes from a standard Ruby 1.8 install) in your SU Plugin folder. After generating the gcode for a model select the Plugins | Plot GCode menu item.

    Edit
    The bugsplat was from me linking against a development library. The zip file has been replaced.


    Edit 9/19/2009
    v1.2
    - Added ability to pan and rotate about the origin with the mouse.
    - Added Menu items for opening gcode files
    - Added Menu item to change the drawing colors based on motion code (G0, G1, G2, G3)
    - Added right click menu to copy and paste sections of gcode
    - Copy GPlot.exe and GPlot.rb to your sketchup plugins folder. The old GPlot.dll and Win32API.so can be removed


    Edit 11/26/2009

    v1.3
    - Fixed error when I,J or K arc offsets are followed by a float.
    - Added syntax highlighting to the gcode editor
    - Vastly improved the speed of the parser (20,000 line file now takes about 5 seconds)
    - Allow refreshing of plot from changes in editor
    - Created optional installer package

    There are two options for installation.
    1. Download the zip file and unzip it anywhere you want. Copy the gplot.exe and gplot.rb files to your GoogleGoogle SketchUp 7Plugins folder.
    2. Download the MSI installer and run it. Locate the gplot folder in the program files folder. Copy the gplot.exe and gplot.rb files to your GoogleGoogle SketchUp 7Plugins folder if you want to enable the Sketchup plugin.


    Attached files GPlot.zip (469.4 KB)Â GPlot1.2.zip (498.7 KB)Â GPlot1.3.msi (1.4 MB)Â GPlot1.3.zip (1.4 MB)Â
     
  2. rayclark

    rayclark Member

    Offline
    Messages:
    134
    Trophy Points:
    18
    Location:
    Center of Michigan
    Just tried it but it keeps crashing SU
     
  3. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    Thanks for the feedback. Guess I'll have to try it on another machine that doesn't have my development environment installed.
     
  4. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    rayclark, what version of Windows are you using? I am developing on XP Pro.
     
  5. rayclark

    rayclark Member

    Offline
    Messages:
    134
    Trophy Points:
    18
    Location:
    Center of Michigan
    I'm using Windows 7
     
  6. tvcasualty

    tvcasualty New Member

    Offline
    Messages:
    637
    Trophy Points:
    0
    Same deal in Wine.... Bugsplat report...
     
  7. 3DMON

    3DMON Moderator Staff Member

    Offline
    Messages:
    2,380
    Trophy Points:
    38
    Location:
    Sebastian, Florida
    I am running XP and I also got the bug splat.
     
  8. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    Must have something to do with my development environment on this machine. I'll get it on another one and figure out the problem.
     
  9. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    It was a problem on my end. I was linking against a development library I can't distribute. The updated zip has been tested on Windows 2K in VMWare and XP Pro.
     
  10. Evil-Tunes

    Evil-Tunes Moderator Staff Member

    Offline
    Messages:
    659
    Trophy Points:
    16
    Location:
    Southern N.J.
    Thanks Gasmasher
    That is just too cool :mrgreen:
    I love it :ugeek:
    E-T
     
  11. Flashsolutions

    Flashsolutions Active Member

    Offline
    Messages:
    1,123
    Trophy Points:
    38
    Location:
    Leesburg, Florida
    Works here.... Windows XP Pro
     
  12. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    Good job, Gasmasher! It does work with Winxp Pro, but I do get an error message.



    Attached files [​IMG] [​IMG]
     
  13. kram242

    kram242 Administrator Staff Member

    Offline
    Messages:
    6,311
    Trophy Points:
    13
    Location:
    NJ
    I think that is due to the fact that it is open in Sketchup or Mach3
    I get that error when I output to Mach3 and forget and leave it open in Mach3 and try to regenerate the code in Sketchup.
    Mark
    p.s. I have not had the chance to try this program out yet but I plan on giving it a go today :)
    Looks cool!
     
  14. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    Mark, you are right! :oops: I just tried it again and no error message, this time.
     
  15. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    Can some help the village idiot, please? I didn't get it to work. I had put all three files in the plugin folder. I generated the g-code with the PS and then clicked on the 'Plot Gcode' in the plugin menu and nothing happens. What did I do wrong? I'm too in XP Pro and SU7.
     
  16. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    What is the full path to the gcode file you generated? I will try to recreate the same path and name and see if it has something to do with it. Could you also try opening the ruby console in SU under the Windows menu and then run the plugin? If you get anything printed in the console copy and paste it here.
     
  17. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    I had put the gcode in a file of my choosing. The windows system on my computer is on drive 'd' as is SU. The code is on drive 'c'.

    Edit: Just to make sure, I tried saving the gcode on both drives. In both cases the folder name is 'Zip'. The name of the file is 'Superfly 38 inch.cnc' which is the file name in SU. I'm using PS v0.920
     
  18. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    That is the problem. I have the path hardcoded as C. You can open GPlot.rb in a simple text editor like Notepad (don't use Word or it will insert the wrong line breaks) and change the path to the dll. Just change the drive letter and path to point at you plugins directory.

    From GPlot.rb:
    [pre]
    def initialize
    @PlotGCode = Win32API.new("C:/Program Files/Google/Google SketchUp 7/Plugins/GPlot.dll", "PlotGCode", ['P'], 'V')
    end
    [/pre]
     
  19. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    You've answered before I finished my editing. I'll try it now with the above change. Thanks, gasmasher.
     
  20. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    Nope, didn't work either. I tried saving the on either dive as stated above and didn't work in either case. I just get nothing at all. No error, no nothing. As if I didn't press the link at all.
     
  21. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    Would you mind trying the ruby console in SU? Before running the plugin select the menu Window | Ruby Console. When you run the plugin any fatal errors should print to the console. Sorry you are having problems.
     
  22. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    Duh, he said while hitting himself on the forehead. I didn't restart SU after making the change to the ruby file. It works now, thanks.
     
  23. rayclark

    rayclark Member

    Offline
    Messages:
    134
    Trophy Points:
    18
    Location:
    Center of Michigan
    Works great in Windows 7 now. Thanks gasmasher. Very nice plugin.

    RC
     
  24. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    That's great, I'm glad it's working for you guys now. Thanks for all the feedback.
     
  25. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    Hey gasmasher, he said in cute singsong voice, can we have the pluging also doing editing and then refreshing too? ;)
     

Share This Page