sketchucation logo sketchucation
    • Login
    1. Home
    2. noelwarr
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
    N
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 6
    • Posts 63
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Sketchup CNC

      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
      3. Interpolation in 4 axis routers
      4. 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?

      posted in Woodworking
      N
      noelwarr
    • RE: Sketchup CNC

      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

      posted in Woodworking
      N
      noelwarr
    • RE: Sketchup CNC

      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! 😳

      posted in Woodworking
      N
      noelwarr
    • RE: Sketchup CNC

      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

      posted in Woodworking
      N
      noelwarr
    • RE: Sketchup CNC

      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.

      posted in Woodworking
      N
      noelwarr
    • RE: Sketchup CNC

      😎 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

      posted in Woodworking
      N
      noelwarr
    • RE: Sketchup CNC

      Hi there voljanko.
      I'm really pleased you're giving it a go. πŸ˜„ 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

      posted in Woodworking
      N
      noelwarr
    • RE: Sketchup CNC

      Thanks for the encouragement Mike. It's already useful to me πŸ˜„. 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.

      posted in Woodworking
      N
      noelwarr
    • RE: Sketchup CNC

      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.

      posted in Woodworking
      N
      noelwarr
    • RE: Sketchup CNC

      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.

      
      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
      
      posted in Woodworking
      N
      noelwarr
    • RE: Sketchup CNC

      Hmm... Interest seems to have died down a bit. πŸ˜•

      posted in Woodworking
      N
      noelwarr
    • RE: Best practices for working with cummulative transformations

      @Thomthom: Great thread! All this OOP and geometry, I can't help but feel it verges on mental masturbation πŸ˜† . It's almost metaphysical. I'll be using a bit of code from that thread. Thanks

      @TIG: The short answer is I'm trying to find the transformation of a lot of things. I'll give you some background. I'm trying to create a kind of project space for CNC manufacturing. The hiearchy looks something like this.

      ->MODEL
      --->ASSEMLY (Group/Component)
      ----->WORKPIECE (Component)
      ------->DESIGN (Group)
      --------->TOOLPATH (Group/Component)
      ----------->HOLE (Group/Component)

      Some things are forbidden. A toolpath can't contain any other groups or instances, a workpiece can't contain another workpiece. But I want to allow the user to further nest whatever they want. This means a workpiece can have a group of toolpaths or an assembly can have workpieces that are nested in other groups.

      At the risk of rambling on, I'll leave it at that. Let me know if I'm not clear (which is often the case when I try to explain anything related to OOP πŸ˜• )

      posted in Developers' Forum
      N
      noelwarr
    • RE: Best practices for working with cummulative transformations

      @Thomthom. Fantastic little writeup. Had no idea about that. Performance isn't really an issue at the moment but I'll change my code anyway. I'll sleep better knowing its faster.

      @TIG. I don't see that working. Indeed, you do get to the model but not through all the nested objects. I get the following with both nested instances and groups...

      entity.parent
      => Sketchup::ComponentDefinition
      entity.parent.parent
      => Sketchup::DefinitionList
      entity.parent.parent.parent
      => Sketchup::Model

      I think the only way is to go "inwards". You can't go "backwards" because entities only exist in definitions and definitions only exist in definition lists (If that makes any sense).

      posted in Developers' Forum
      N
      noelwarr
    • Best practices for working with cummulative transformations

      My model has a bunch of nested groups and instances. That's all fine. I also understand that I can't really say "where is entity X" in my model because it might be present in various instances.

      For my purposes I need to have a kind of flattened tree of my model so I can effectively ask "Give me a list of all groups and instances(nested and not nested) in groupX with their corresponding cummulative transformations". I have a vague idea of how to do this but I just want to make sure I am taking the right approach. Something like

      
      def gather(entity,transformation)
        result = {;entities => [], ;transformations => []}
        if entity.typename == "Group" || entity.typename == "Model"
          entities = entity.entities
        elsif entity.typename == "ComponentInstance"
          entities = entity.definition.entities
        else
          return []
        end
        result[;entities].push entity
        result[;transformations].push transformation
        entities.each{|ent|
          gathered = gather(entity, (entity.transformation * transformation)) 
          result[;entities] += gathered[;entities]
          result[;transformations] += gathered[;transformations]
        }
        return result
      end
      
      gather(Sketchup;;active_model, Geom;;Transformation.new)
      
      

      I haven't tested it out but you get the idea. It's an itterative function that collects a couple of arrays, one with the groups and intsnces, the other has the transformations. So, any views?

      posted in Developers' Forum
      N
      noelwarr
    • RE: Sketchup CNC

      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 😳 (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 πŸ˜„ 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.

      posted in Woodworking
      N
      noelwarr
    • RE: Groups, Instances and Entities...

      Sorry for rehashing old problems. I did look around the forums. Guess I just wasn't looking properly. Your reply was clear and concise TIG. I tried your code out and it worked a charm. Cheers!

      posted in Developers' Forum
      N
      noelwarr
    • RE: Sketchup is Inacurrate???

      Wow! Lots of posts. Think I've read through them all but I don't think the following has been pointed out... Sketchup is based on floating point data structure. These are inherently inaccurate. Try the following out in the ruby console

      (Math::PI).to_l
      => 3.14159265358979
      (Math::PI * 10**13).to_l
      => 31415926535897.9

      This means that the further away from the origin your entities are, the more inaccurate they are.

      Floats are a lightweight data structure ideal for a program like Sketchup. There are others that are actually capable of manipulating irrational numbers (pi, square root of two...check out GMP) without ever loosing accuracy but they are very heavy weight and only really necessary if you're, I don't know, sending a rocket to the moon or something.

      Sketchup overcomes this floating point inaccuracy by allowing for a little tollerance but as you can see the difference is still there

      point1.to_s + point2.to_s
      => (258,878708mm, 172,933835mm, 0mm)(0mm, 0mm, 0mm)
      point1.z == point2.z
      => true
      point1.to_a
      => [10.1920751212053, 6.80841870273468, 1.77635683940025e-015]
      point2.to_a
      => [0.0, 0.0, 0.0]

      Nonetheless Sketchup is a great tool and its inaccuracy (that is also present in those other "more professional" packages!) can be overlooked 99% of the time. Hope this was of use to anyone.

      posted in SketchUp Discussions
      N
      noelwarr
    • Groups, Instances and Entities...

      I know this subject seems to go on for ever but I've come across a particularly interesting bug and wanted to share it. We have an instance with a bunch of entities that we can capture in an array. That should look something like

      a = instance.definition.entities.to_a

      Theoretically I should now be able to group the entities like this (I am using Sketchup 😎

      instance.definition.entities.add_group a

      What is particularly interesting about this is that if I am in an edit session within the instance all works fine. If I am outside the instance strange things start happening. The group appears outside but is not clickable and disappears when I enter the edit session. If I delete the instance and click on the group I get a bug splat. Wierd

      Anyone care to shed some light as to what is going on?

      posted in Developers' Forum
      N
      noelwarr
    • Sketchup CNC

      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?

      posted in Woodworking
      N
      noelwarr
    • RE: CSG in Sketchup

      Do with the information? The only thing I will do as a direct result of getting an answer is having the wikipedia page changed. After all, we want wikipedia to be as accurate as possible now, don't we?

      I should mention that I am developping a SU plugin that involves using the CGAL library (Minkowski sums, boolean operations, envelopes...) and though knowing weather SU uses CSG is not imperative for my project it certainly helps me have a better understanding of how SU works under the hood.

      posted in Newbie Forum
      N
      noelwarr
    • 1 / 1