SketchUcation Premium Membership

 

 

Sketchup CNC

To access this forum when logged in, please, sign up to the Woodworking User Group in your User Control Panel.

Sketchup CNC

Postby noelwarr » Thu Mar 29, 2012 12:13 pm

I've almost finished developing a plugin that extends sketchups capabilities into a rudementary CAM application.
It consists of four magic buttons

1) Decalare a component instance as a "workpiece"
2) Convert a set of edges into a toolpath
3) Create a cylinder representing a hole
4) Generate the Gcode.

I know sketchup isn't really meant for CAM but it's free and easy to use. I've geared it towards a 3 axis woodworking cnc machine with multiple tools but I'm sure it could be adapted to other manufacturing processes. The really fantastic thing is that with dynamic components you can have a whole wardrobe's gcode generated automatically. It's a bit fidgity but I'm getting there

I was planning to make it opensource but I'm not really sure if there is any demand out there. If it's just a couple of people I'll be more than glad to just email the files. So, anyone?
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

Re: Sketchup CNC

Postby Dave R » Thu Mar 29, 2012 1:03 pm

Noel, I haven't got a CNC router but I have a friend who does and he's been talking with me about a collaboration where I do the drawings and he uses them for his woodworking projects. I'd be interested to see how your plugin works and if it could work with his Shopbot. I think I know of some others who might find it useful, too.
Inspecting mirrors is a job I could easily see myself doing.
User avatar
Dave R
Global Moderator
 
Posts: 8970
Joined: Tue Nov 13, 2007 11:52 pm
Location: SE Minnesota
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: woodworking
Level of SketchUp: Advanced

Re: Sketchup CNC

Postby d12dozr » Thu Mar 29, 2012 3:16 pm

That plugin sounds like the cat's meow for makerspaces. I recently got access to a Shopbot via a local makerspace, so I'd be interested. I bet many makerspaces/hackerspaces would be interested in it. Here's a list of them throughout the world: http://hackerspaces.org/wiki/List_of_Hacker_Spaces
"There is a man in the world who will never be turned down... he is the man who delivers the goods."
d12dozr
Top SketchUcator
 
Posts: 1915
Joined: Mon Feb 09, 2009 8:43 am
Location: Minnesota
Name: Marcus
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: product design
Level of SketchUp: Advanced

Re: Sketchup CNC

Postby EscapeArtist » Fri Mar 30, 2012 5:04 am

+ 1 on the Makerspaces. If I ever get some extra $$, my number one purchases are a DIY CNC router kit and/or a Makerbot.
User avatar
EscapeArtist
Top SketchUcator
 
Posts: 1302
Joined: Sun Aug 03, 2008 7:36 pm
Location: Northeast US
Name: Jeff
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: hobby
Level of SketchUp: Intermediate

Re: Sketchup CNC

Postby noelwarr » Tue Apr 03, 2012 4:46 pm

Brilliant!

I've had a look at these shopbots and they are quite simple machines compared to the ones we have at my workplace. This means the postprocessor (This is the part that converts the toolpaths into the text file the CNC machine uses) I have made is a little overkill. On the positive side, it's always easier to downscale that upscale.

SOME GOOD POINTS:

Because the plugin uses attributes to tell the parser "Hey, I'm a toolpath" or "Hey, I'm a hole", it is also posible to have other plugins run ontop of it. You could have one that automatically generates the toolpaths for complex mesh surfaces. Wouldn't that be nice!

The plugin is divided into a few seperate ruby files. One is "postprocessor.rb". I hope this makes it easier for people to edit, modify and make their own.

SOME BAD POINTS:

I am not a professional programmer. The code has no documentation or comments at present. It is not an extension (yet). I'm sure it is full of unorthodox practices. I haven't even designed icons for the buttons :oops: (I know which one is which off by heart.)

But then that's why I'm making it open source. So YOU do the work for me :D How cheeky can you get? The point is it works. Still in beta but check out the stool and chair I made, all from within Sketchup.
https://plus.google.com/u/0/106243199685455140135/posts/X95aEM2G3b1
https://plus.google.com/u/0/106243199685455140135/posts/94dAHb1utfW


OK, please bear in mind I am new to this so I need some help from you guys. I'm usually quite chaotic but I would like to do this right. First off, liscense and sharing.

1) GPL, BSD...
2) GIT, google projects, just email...

Any preferences or recomendation? My defaults would be GPL and goole projects.
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

Re: Sketchup CNC

Postby noelwarr » Thu Apr 05, 2012 4:03 pm

Hmm... Interest seems to have died down a bit. :?
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

Re: Sketchup CNC

Postby Dave R » Thu Apr 05, 2012 4:46 pm

noelwarr wrote:Hmm... Interest seems to have died down a bit. :?


Not on my part. I've been on the road for a week with very limited access to the Internet. (Chills, shakes, dry heaves. Maybe I'm addicted.) I came back to a huge pile of work, too. Still, I'd like to see what can be done with this.
Inspecting mirrors is a job I could easily see myself doing.
User avatar
Dave R
Global Moderator
 
Posts: 8970
Joined: Tue Nov 13, 2007 11:52 pm
Location: SE Minnesota
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: woodworking
Level of SketchUp: Advanced

Re: Sketchup CNC

Postby voljanko » Sat Apr 07, 2012 8:13 am

noelwarr wrote:Hmm... Interest seems to have died down a bit. :?

Just throw us a bone and the interest will be much bigger :)
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
voljanko
 
Posts: 131
Joined: Mon Sep 14, 2009 11:06 pm
Location: Slovenia
Name: David Malnar

Re: Sketchup CNC

Postby Jim » Sat Apr 07, 2012 11:43 am

Noel,

You may also want to check out www.phlatforum.com - the owners designed and sell a 3-axis machine and software specifically made for SketchUp. (It looks like they are now designing a 3d printer since the last time I visited.)
Jim
Global Moderator
 
Posts: 4126
Joined: Mon Nov 12, 2007 10:13 pm
Location: NEOH
Name: Jim
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: other
Level of SketchUp: Intermediate

Re: Sketchup CNC

Postby prismcnd » Sat Apr 07, 2012 1:36 pm

I am also keeping a keen eye on this thread
“Whatever the mind of man can conceive and believe, it can achieve.” -W.Clement Stone (American best selling Author and Founder of Combined Insurance Co (now a part of Aon Corp.), 1902-2002)
prismcnd
 
Posts: 56
Joined: Thu Apr 09, 2009 11:00 pm
Location: Toronto,Canada
Name: Prismcnd

Re: Sketchup CNC

Postby noelwarr » Mon Apr 09, 2012 11:14 am

Drum roll please.

I'll be uploading my code this comming weekend (In whatever state its in).

@voljanko: A bone you say. How about a little reflective code. I started out as a kid with pascal and Qbasic. I still find it mind boggling to call functions from themselves. You've just gotta love that OOP style. What a break through.

Code: Select all
def gather(target, bundle = self, transformation = Geom::Transformation.new)
  result = []
  entity = bundle.entity
  if (entity.is_a? Sketchup::Group) ||
    (entity.is_a? Sketchup::ComponentInstance) ||
    (entity.is_a? Sketchup::Model)
    transformation = (bundle.entity.transformation * transformation) if bundle != self
    if target == bundle["type"].to_s + bundle["execution"].to_s
      result.push [bundle, transformation]
    end
    bundle.entities.to_a.each{|ent|
      gathered = gather(target, Bundle.open(ent), transformation)
      if gathered != nil
   result += gathered
      end
    }
  end
  return result
end
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

Re: Sketchup CNC

Postby voljanko » Tue Apr 10, 2012 4:47 pm

noelwarr wrote:I started out as a kid with pascal and Qbasic.

I started with the Basic commands written on the rubber buttons of ZX Spectrum :)

Anyway,we have a Roland cnc router in the office so I can make some tests of your plugin.
Hope it will not cut itself :)
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
voljanko
 
Posts: 131
Joined: Mon Sep 14, 2009 11:06 pm
Location: Slovenia
Name: David Malnar

Re: Sketchup CNC

Postby noelwarr » Fri Apr 13, 2012 3:47 pm

DISCLAIMER> The following code will not work for you "out of the box". First, you need to edit minivistii.rb to refference the other files correctly. Then you need to know how the four buttons work (see the readme file). Then edit the postprocessor.rb to suit your machine.

If you want to contribute, let me know. There are a few things I should explain about the approach I've taken. The Bundle class also needs to be explained.

If you don't know Ruby I sugest you wait a couple of months for me to improve the script.

Well, as promissed http://code.google.com/p/minivistii/source/browse/#git%2FMiniVistii

Use at your peril.
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

Re: Sketchup CNC

Postby Mike Lucey » Fri Apr 13, 2012 4:24 pm

Thanks Noel for putting up your efforts so far. I hope that other programmers will be able to row in and help to get this open source ruby developed to a level that will render it useful.

Mike
User avatar
Mike Lucey
Mayor
 
Posts: 7237
Joined: Mon Oct 22, 2007 1:22 pm
Location: Co. Clare, Ireland
Name: Mike Lucey
Operating system: Mac
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: Sketchup CNC

Postby noelwarr » Sat Apr 14, 2012 12:16 am

Thanks for the encouragement Mike. It's already useful to me :D. As I mentioned before, Sketchup isn't really meant for CAM. Precisely because of this you can do things with it I have never seen a CAM application do...

With the plugin I can draw a few connected edges, declare it as a toolpath and then copy and paste this operation around my workpiece, stretching, scaling and rotating it as I wish. Very flexible.
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

Re: Sketchup CNC

Postby Mike Lucey » Sat Apr 14, 2012 12:51 am

Yep, I've been using SU since v1 and hardly a week goes by that I don't see some new use it has been adapted for. Maybe not ideally doing the job but still doing the job in some manner.

I wish I could offer actual productive help on this project but my programming skills are 0! Hopefully others will row in and get involved :D
User avatar
Mike Lucey
Mayor
 
Posts: 7237
Joined: Mon Oct 22, 2007 1:22 pm
Location: Co. Clare, Ireland
Name: Mike Lucey
Operating system: Mac
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: Sketchup CNC

Postby voljanko » Sun Apr 15, 2012 8:17 am

Hello Noel,
I tried to have some g-code from your plugin.
After selecting the 2 vertexes with the 2nd button (the model must be edited to select vertex),all the edges has been colored black.
Then with the 4th button (for generating code) I get this error in the console:
Error: #<NoMethodError: undefined method `each' for nil:NilClass>
C:/Program Files/Sketchup8/Plugins/minivistii/concepts.rb:191:in `initialize'
What goes wrong?
I would like to test the g-code on the simple xyz router to engrave something.What tool and procedure should I select?
Congratulations for the plugin,the code seems to be very well structured.
Hope your plugin will be useful also for others.
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
voljanko
 
Posts: 131
Joined: Mon Sep 14, 2009 11:06 pm
Location: Slovenia
Name: David Malnar

Re: Sketchup CNC

Postby noelwarr » Sun Apr 15, 2012 9:16 pm

Hi there voljanko.
I'm really pleased you're giving it a go. :D Don't worry, we'll get it up and running in no time. I've had a look at where the error is coming from and I think there is something strange about the way you have declared your toolpath. Hardly surprising considering the fact there are no instructions, no icons and no nothing. I have written a little article in the wiki of the project. Try following those instructions. If you think you've done it right and it's still giving the same error send me your skp file and I'll take a look.

From your error I guess the following is the case. You have a group with a bunch of edges that represent your toolpath. The toolpath however is actually defined by the vertices. If there is a vertex in the group that isn't part of the toolpath the method fails. There are a number of reasons this might happen.

Engraving should be easy enough. Check out this 6 month old post. I think it was about 50 lines of ruby code. It was just an experiment but ever since this project has been bubbling away in my mind. In the photos you can see a sketchup model, the gcode generated from a small script and the finished product.

https://plus.google.com/u/0/106243199685455140135/posts/3rq4Zep9V5b

Thanks again for giving it some time voljanko
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

Re: Sketchup CNC

Postby voljanko » Mon Apr 16, 2012 7:15 pm

Jeee,it's working now,I have some g-code!
First I have misunderstood the concept of the toolpath.Your plugin is only accepting lines for toolpath.If I want to declare anything else (shape or body) is giving me that error.
It's a good start.Now I have to check if the commands and coordinates in the code are compatible with the router.
Thank you again for your plugin.
I think it is a good start platform for a standard Sketchup to CNC plugin.
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
voljanko
 
Posts: 131
Joined: Mon Sep 14, 2009 11:06 pm
Location: Slovenia
Name: David Malnar

Re: Sketchup CNC

Postby noelwarr » Mon Apr 16, 2012 8:16 pm

:fro: Brilliant!

There is a good chance it won't be compatible with your CNC router. But don't worry, if it isn't, I'll write a simple postprocessor for your machine. A simple postprocessor is what this plugin needs to get others to start tinkering around with it. Let me know how you get on
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

Re: Sketchup CNC

Postby errror404 » Mon Apr 16, 2012 9:19 pm

I made my own CNC machine using a x2 mini mill... unfortunately, I moved and the machine is still siting at my parent's basement.

I'll keep an eye, but can't contribute testing right now
errror404
 
Posts: 50
Joined: Tue Sep 09, 2008 1:38 pm

Re: Sketchup CNC

Postby noelwarr » Tue Apr 17, 2012 9:55 pm

Oops... :?

Just realised a problem with the plugin. Workpieces seem to be taking their origin from the model's origin. Should be an easy fix. Don't know why that's happening. Probably a last minute change before I committed and pushed my code. I'll look into it this weekend. Meanwhile, for testing purposes please position your workpiece origins on the model origin. Thanks.
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

Re: Sketchup CNC

Postby Dropout » Wed Apr 18, 2012 1:48 am

Ok please tell me how to install this and make it run.
Dropout
 
Posts: 57
Joined: Tue Jan 26, 2010 7:57 pm

Re: Sketchup CNC

Postby noelwarr » Wed Apr 18, 2012 7:49 am

Hi there dropout.

It's a plugin like any other so you just stick the relevant files in your Sketchup plugin directory. The next time you start sketchup they will be read and executed automatically.

That said, if you don't feel confident toying around with the code, it's probably best you stay away from this code for the time being. It's all quite exerimental at the moment and the user interface is unfriendly to say the least.

Also, you're probably wondering how to download the program. Well, you can't the way you would other programs. What I have uploaded is the repository which allows others to contribute to the source code. If you're still eager but don't want to install GIT you could just copy each file individually creating necessary folders, etc. Good luck
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

Re: Sketchup CNC

Postby tim » Sat Apr 21, 2012 6:49 pm

Noel, excellent start on a really interesting project.
I grabbed the code and notice a couple of things immediately:
a) you've used some words that would need translating before I had a clue what was going on ('cuchilla', 'graus', etc)
b) you've done something I've seen done many, many, times in Smalltalk and Ruby etc - made filenames by concatenating literal strings including the directory separators. Bad move, it makes for OS specific code when you don't want it. There should be useful methods to build a suitable path that avoids that issue. A quick google suggests using things like File.join instead of pwd + '\\' + foo
tim
 
Posts: 420
Joined: Wed Nov 14, 2007 6:50 pm
Location: Qualicum Beach, Vancouver Island, Canada

Re: Sketchup CNC

Postby noelwarr » Sat Apr 21, 2012 7:47 pm

Thanks for the feedback Tim. Really encouraging and straight to the point.

a) These are Catalan words and they describe the tools that are available to my machine. Every machine is different so the UI needs to be different for every machine. At the moment this means you would need to edit "ui.rb" as well as "postprocessor.rb". It is poorly thought out I agree, but my efforts were concentrated in the "concepts.rb" and "parser.rb" files and getting them right. I belive that the best solution would be to have the "ui.rb", "concepts.rb" and "parser.rb" files stay untouched.
It seems obvious to me that a class called something like "CNC" or "Machine" should be declared somewhere in "postprocessor.rb". It should have a method tools() that retrieves the tools available to that machine. This can be piped to the UI and should be easy enough for hobbyists to edit for their machine. This class should also contain other methods to aid the postprocessing. Things like number_of_axes(), pods?(), max_spindle_speed()...

b) I thought there was a good chance it would fail on macs but decided to make a concious effort to not loose sleep over it. Something told me that the answer would come to me in the form of a wise man called Tim :) I'll fix it soon.

Thanks again and I'm sorry there are no comments! :oops:
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

Re: Sketchup CNC

Postby tim » Sun Apr 22, 2012 6:54 am

noelwarr wrote:a) These are Catalan words and they describe the tools that are available to my machine.

Really? It probably won't surprise you to hear that I know no Catalan at all. I suspect my mother learned a little many, many years ago because she and her red-headed friend Nancy hitch-hiked across Andorra (amongst other parts of Europe) around 1957 or so. I understand they got into quite a few adventures such as sleeping under hedges in snowdrifts….


noelwarr wrote: Every machine is different so the UI needs to be different for every machine. At the moment this means you would need to edit "ui.rb" as well as "postprocessor.rb". It is poorly thought out I agree, but my efforts were concentrated in the "concepts.rb" and "parser.rb" files and getting them right. I belive that the best solution would be to have the "ui.rb", "concepts.rb" and "parser.rb" files stay untouched.
It seems obvious to me that a class called something like "CNC" or "Machine" should be declared somewhere in "postprocessor.rb". It should have a method tools() that retrieves the tools available to that machine. This can be piped to the UI and should be easy enough for hobbyists to edit for their machine. This class should also contain other methods to aid the postprocessing. Things like number_of_axes(), pods?(), max_spindle_speed()...

Sounds a good idea. I'd hazard a guess that somewhere in Ruby-land there is a standard way to provide lists of UI related words and phrases that you can choose from at runtime, depending upon a chosen language setting. It's a fairly standard technique that works tolerably well most of the time.
noelwarr wrote:b) I thought there was a good chance it would fail on macs but decided to make a concious effort to not loose sleep over it. Something told me that the answer would come to me in the form of a wise man called Tim :) I'll fix it soon.

One lives to serve. ;)

As for comments - I always advise against living up to the old joke that goes "Comments? Why do you think it's called code?". A friend put it even better; "Don't document the code, code the document"
tim
 
Posts: 420
Joined: Wed Nov 14, 2007 6:50 pm
Location: Qualicum Beach, Vancouver Island, Canada

Re: Sketchup CNC

Postby noelwarr » Sun Apr 29, 2012 11:38 am

Looking forward to making this code a bit more user-friendly over the next couple of weeks. Anyone willing to design some icons for the UI? They have to come in png file format and come in two different sizes (24px x 24px and 16px x 16px). There are 5 in total and should represent the following.
1) Declare an assembly
2) Declare a workpiece
3) Declare a toolpath
4) Declare a hole
5) Generate the gcode (or whatever files are necessary for the CNC machine)
It would be nice if they blended into the Sketchu UI but you can hand sketch them for all I care. The problem is I'm used to having blank buttons. I just know which one is which and I'll probably never get round to designing them. Since you're all Sketchup users I sugest designing them in the Sketchup model and then just capturing the screen.

If you're up for it, send me an IM or email or something. Cheers
Last edited by noelwarr on Sun Apr 29, 2012 7:14 pm, edited 1 time in total.
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

Re: Sketchup CNC

Postby Scott M » Sun Apr 29, 2012 2:55 pm

I am also very interested in this plugin one question I have is. Will it be able to generate code for v carvings also 3d carvings etc. I have toyed around with other trial versions of v carve and 3d programs and they have separate post for a multitude of machines of witch even the ones that are set up for ours still have to be edited for our particular machine. I don't know if I have ever seen a single post that was user friendly enough for a person that knows nothing about programing to edit properly. Looking forward to using this in the future
Scott M
 
Posts: 51
Joined: Sat Oct 16, 2010 1:43 pm

Re: Sketchup CNC

Postby noelwarr » Mon Apr 30, 2012 8:25 am

Hi Scott
I see no reason why you shouldn't be able to perform V carvings and 3D toolpaths. As long as your CNC machine is a 3 axis router you can pretty much do anything with this plugin. There are a few things you can't do at the moment but they have a relatively simple fix. These are
1) Pure curves
2) Assemblies
There are some it will probably never do
1) Interpolation in 4 axis routers
2) Helicoidal curves (Spirals)

As far as the post processors go. There is no getting around the fact that you need one for every machine just like you need a driver for every printer. I have thought of a way to simplify the whole process and to make it as user friendly as possible. I think that you'll probabbly be able to edit it with relative ease. It is however likely that if this project continues to grow, the postprocessor will become a much more complex document with time.
Can you tell me a little about your CNC machine?
noelwarr
 
Posts: 64
Joined: Mon Jun 20, 2011 5:07 pm
Name: noelwarr

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Need Authorised SketchUp Training by experts in various disciplines? Check out our Training details.

Ad Machine
Robot
 
Posts: 2012

Next

Return to Woodworking

Who is online

Users browsing this forum: No registered users and 0 guests