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. ttraband

    ttraband Member

    Offline
    Messages:
    44
    Trophy Points:
    8
    Tim,

    You've probably thought of this already, but if you are hard-coding the location of C:Windows that may lead to problems when that's not where Windows is installed. You might try use a system environment variable (%Systemdrive% for the drive letter, or %SystemRoot% or %WinDir% for the folder in which Windows is installed) in your code to automatically adjust for different people's system setups. The beauty of these is that each time Windows starts up, it puts the real right values in, so there's no work for the programmer or the user.

    I'm sure that there are comprehensive lists of variables available from Microsoft, but a quick Google search found http://www.wilsonmar.com/1envvars.htm with a nice clean table.
     
  2. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    I appreciate the thought, but this was only a problem with the first release since it was something I just threw together and had been using for a few days and didn't look it back over for problems. The code that had a problem with the path is in GPlot.rb and that was to load GPlot.dll (now GPlot.exe). If you take a look at it now you will notice that it actually asks SU to use its own path to find GPlot.exe.

    Using the environment variables would have been ineffective in this case since SU is not necessarily installed on %SystemDrive%. One possible solution would have been to look up the installation location in the registry under HKLMSOFTWAREGoogleGoogle SketchUP 7InstallLocation.

    There is only one thing in GPlot that even needs to know any paths and that is to store the new color settings in the users app data folder. That is retrieved through a Windows API call to SHGetFolderPath with a csidl of CSIDL_LOCAL_APPDATA.

    The problem that Yoram is having is a buggy implementation of OpenGL in the video driver. One of the API calls I am making fails in that driver for some reason and I just need to put together a list of all the GL calls that are different between the versions and see what I can eliminate.
     
  3. ttraband

    ttraband Member

    Offline
    Messages:
    44
    Trophy Points:
    8
    Like I said, I figured you had it covered. Just thought I'd mention it, since hard-coding assumed default paths is an error I see some of my college students make.
     
  4. 7up

    7up Moderator Staff Member

    Offline
    Messages:
    1,090
    Trophy Points:
    38
    Location:
    Kentucky
    Thanks Tim, I normally have hidden files turned on but recently done a fresh install and guess I forgot it. DUH
     
  5. kram242

    kram242 Administrator Staff Member

    Offline
    Messages:
    6,311
    Trophy Points:
    13
    Location:
    NJ
  6. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    I uploaded version 1.3 of GPlot to the first post. This one has some cool features and it fixes a few bugs in the file parser.

    - Syntax highlighting with configurable colors
    - Refreshing of plot based on changes in editor (click the refresh button in toolbar)
    - Monitors the gcode file for any changes and prompts for reload. This way gplot can stay open and as you regenerate the code in SU gplot will display a dialog asking if you want to reload.
    - Huge improvement in parsing speed. Previous versions required up to a minute for large files to load. Now a 20,000 line file takes about 4 or 5 seconds.

    The syntax highlighter doesn't enforce proper gcode yet, it just adds color so it is easier to see keywords.
     
  7. 3DMON

    3DMON Moderator Staff Member

    Offline
    Messages:
    2,380
    Trophy Points:
    38
    Location:
    Sebastian, Florida
    Nice work Tim.
    It sure does load a lot faster.
    Thanks!
     
  8. meistertek

    meistertek Member

    Offline
    Messages:
    318
    Trophy Points:
    16
    Location:
    Chicago, IL
    Gplot 1.3 is great Tim! I was considering using a separate computer for my phlatprinter and now I can since I can check all the code visually with g-plot and even edit code! This is awesome! Gplot would be a very useful to anyone having to program any type of CNC machine, not just PhlatPrinter owners.

    The only thing I can think of that would be nice would be adding a search and replace function.
     
  9. 7up

    7up Moderator Staff Member

    Offline
    Messages:
    1,090
    Trophy Points:
    38
    Location:
    Kentucky
    Nice work Tim, great upgrades.
     
  10. FozzyTheBear

    FozzyTheBear Member

    Offline
    Messages:
    261
    Trophy Points:
    16
    Couldn't agree more!! Nicely done Tim!! Many Thanks!!.......

    Best Reagrds,
    Julian (Fozzy The Bear)
     
  11. kram242

    kram242 Administrator Staff Member

    Offline
    Messages:
    6,311
    Trophy Points:
    13
    Location:
    NJ
    Tim I just tried to edit the extensions of the board, you should now be able to upload the msi or exe extensions.
    I wanted to try an older more complex model so I grabbed the rig file and it worked perfect!
    I really need to re-work this one to take advantage of the new Phlatscript as well.
    Mark

    p.s. Tim I love the icon too looks cool! :D What is the design from?

    Attached files [​IMG] [​IMG]
     
  12. FozzyTheBear

    FozzyTheBear Member

    Offline
    Messages:
    261
    Trophy Points:
    16
    Excellent!! You just solved my distribution problem as well then! :D

    Best Regards,
    Julian (Fozzy The Bear)
     
  13. xtremeRCpilot

    xtremeRCpilot Member

    Offline
    Messages:
    736
    Trophy Points:
    16
    Location:
    Cleveland, Ohio
    Thank you again Tim!!! I love the editor, now I just need to learn how to use it!!! :D

    John
     
  14. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    Glad you guys are liking it. I have some more things in the works that should make it a much more capable gcode editor.

    Mark, thanks for changing the extension settings on the board to allow MSIs. I didn't want to bother you with it over Thanksgiving. I'll upload the installer package later this evening.

    The icon set I am using is part of an open source project to standardize toolbar and menu icons between applications. The one I used for the application was intended as a replacement for a drawing program running under KDE.
     
  15. kram242

    kram242 Administrator Staff Member

    Offline
    Messages:
    6,311
    Trophy Points:
    13
    Location:
    NJ
    Tim I hope this works, I am still working on figuring this PHP stuff out :D

    The idea of standardizing toolbar and menu icons between applications is a neat idea indeed. It would make learning new software a breeze.
    Mark
     
  16. filthybeast

    filthybeast New Member

    Offline
    Messages:
    67
    Trophy Points:
    0
    Location:
    Upper Lake Ca
    It may be simple but works very well, what a time saver this is for me, Thanks!

    I have sketchup and emc2 on separate puters not on a lan, so Id have to burn the gcode to cd, then take it to the router puter. If i screwed it up somehow, (which I do a lot for some reason :oops: ) then Id have to go back and fix/burn again, what a pain.
    Now I can make sure all is good with the gcode before burning :D

    Fred
     
  17. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    filthybeast, I don't know why you have to burn a CD. Can you not use a USB flash drive? That's what I did.
     
  18. filthybeast

    filthybeast New Member

    Offline
    Messages:
    67
    Trophy Points:
    0
    Location:
    Upper Lake Ca
    I plan to get a flash drive, very soon, But the cdrw works pretty well also, I just keep rewriting the same cd, plus it gives me a backup of my files in case the puter dies suddenly, which it has before :oops:
     
  19. crash5050

    crash5050 Member

    Offline
    Messages:
    190
    Trophy Points:
    16
    Location:
    Greenwood/ Fort Smith, Arkansas
    I guess I am a bit slow. I tried this G-Code in Mach 3 and it works perfectly, but if I paste it into G-Plot it gives me an errot that says : NUmber Expected on line 1. here is the 1st few lines of the G-code.


    ( Made using CamBam - http://www.cambam.co.uk )
    ( Unititled 1/24/2009 5:06:31 PM )
    ( T0 : 0.24 )
    G20 G90 G64 G40
    G0 Z0.25
    ( T0 : 0.24 )
    T0 M6
    ( MOPDrill_1 )
    G17
    M3 S0
    G81 X2.625 Y13.375 Z-0.2 R0.25 F50.0
    G81 Y12.75 Z-0.2
    G81 X3.625 Z-0.2
     
  20. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    You didn't do anything wrong. That is a bug and it is related to the I, J and K axis fix in 1.3. The ".0" in the feed rate (F50.0) is a float but the parser is trying to verify it is a whole number. I'll fix it in the next version but for now remove the .0 on the feed rates so the line looks like this:

    G81 X2.625 Y13.375 Z-0.2 R0.25 F50

    Thanks for pointing it out. I'll also fix that error dialog to actually report the correct line number and character position as it would have been easier to find the problem ;)
     
  21. MartinT

    MartinT Member

    Offline
    Messages:
    109
    Trophy Points:
    18
    When I try to load a (any) Gcode, I get the warning "0.050 is not a floating point value"
    I can see the code in the lefthand screen, but no drawing on the right hand side.
    This happens with all the codes I try to load, and sometimes the value in the warning is 0.070.
    I have v1.3 running on Vista.

    Also, it does not "autoload" a gcode when i press the button under the plugins. (Get a warning "could not locate a gcode file to plot. Try using the generate gcode button) (however there is a .cnc file in the same foldere as the .skp file of the model selected, I first have to make another gcodefile before it can load) (My sketchup is under D:program filesSketchup7, (windows is on the C: drive))
     
  22. 3DMON

    3DMON Moderator Staff Member

    Offline
    Messages:
    2,380
    Trophy Points:
    38
    Location:
    Sebastian, Florida
    I don't know about the first part of your problems but for the second part, you can run the gplot by itself. I copied a shortcut of the app from the plugins folder and have it on my desktop. This way you don't have to be running Sketchup for it to work. The only way it will work under Sketchup is after you generated gcode from the Phlatscript..
     
  23. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    Could you post one of you gcode files that is having the problem? It will be much easier to find the problem with an example. You can PM it to me if you want to keep it private.

    Gplot loads the file from the SU menu by looking in the current open SU file for a gcode output file. That value only exists after gcode has been generated. If you don't save your model after generating gcode that file entry will not be available next time it is opened in SU. Maybe I will look at adding the ability to check the same directory for a file with the same name but one of the rs274 file extensions if the model doesn't have the output name stored.

    Can you make sure you have the 1.3 version? I probably messed up by putting the new downloads at the bottom of my first post since I notice that people are still downloading the original one. If you don't have a menu with a File | Open command then it is the old version.
     
  24. MartinT

    MartinT Member

    Offline
    Messages:
    109
    Trophy Points:
    18
    Hi Tim,
    I do have the version with the file>open possibility,
    and the files that do not "work" are all the example files that are on the Phlatprinter DVD#3... :eek:
     
  25. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    I just tried about 10 of the sample files and they all appeared to work OK here. Some of the ones I tried are directly in the Example Files folder: Ear.cnc, EagleVbridge.cnc. Can you point out a specific one that gplot is having a problem with in case I am overlooking something obvious?

    Does it happen with the following code?[pre]%
    G90
    G20
    G49
    M3 S15000
    G0 X1.0 Y1.0 Z0.050
    G1 Z-0.350 F250
    G1 X2 F500
    Y2
    X1
    Y1
    G0 Z0.050
    G0 X0.000 Y0.000
    G0Z0.050
    X0.000Y0.000
    M05
    M02
    %
    [/pre]
     

Share This Page