Dynamic Calculation of Dimensions

Do any software products support run-time specification of the dimensions of the workpiece and then scale the design to fit?

If I design a 4x5x1 piece in CC, wouldn’t it be great to be able to load it into CM, specify the piece as 8x10x3/4 or 16x20x2 or 2x2.5x.25 and have it automatically adjust the vectors to scale the design to fit the piece? This as opposed to having to go back to CC, enter a new set of dimensions and regenerating GCode, and having to name or file that GCode according to size.

The w and h dimension would need to remain proportional…so maybe the interface would “insist” on it by automatically adjusting the “other” dimension, but depth could easily be specified at the time the program is launched.

I would imagine it would be question of mathematical recalculation of vector starting points and distances, but would be relatively easy to code.

If no one is doing this, I’m imagining there is some obstacle I’m not seeing — but if it’s possible, would that be a feature for CM: To prompt the user at runtime for the dimensions of the piece to be cut and do the adjustments on the spot? You could provide a “Frame” option, similar to LightBurn, which jogs the spindle over the cutting area to visually confirm the areat that’s going to be cut.

This is known as parametric design (but c.f., conversational CAM below).

I’ve been exploring it using OpenSCAD and pairing that w/ METAPOST to make projects:

and also doing designs using BlockSCAD:

and it’s more-or-less the subject of my Kickstarter (which I’m running behind on, but hope to finish up this year):

https://www.kickstarter.com/projects/designinto3d/design-into-3d-a-book-of-customizable-project-desi

Other tools which offer this sort of parametric design include:

  • Autodesk Fusion360
  • Rhino3D w/ Grasshopper
  • CADquery — stand-alone tool or an (outdated?) workbench in FreeCAD

I tried doing it in Alibre Atom3D, but found not being able to center things problematic:

https://community.carbide3d.com/t/parametric-design-using-alibre-atom3d/17409

List at: https://wiki.shapeoko.com/index.php/Programming

If there were a scripting language which could directly make .c2d files (which are JSON format) I’d be in business.

As an alternative, for simpler projects there’s also conversational CAM:

https://wiki.shapeoko.com/index.php/Interactive_G-Code_Generators

which is more in-line w/ what you’re asking after.

2 Likes

I knew I couldn’t have been the first to think of it :slight_smile: So, it seems to be a little burning passion for you. I do hope you could make it work in your products. I’ll look into the links you’re suggesting…I didn’t expect as much research as you gave me here!

It does seem strange that vectors can’t just be scaled. Starting value direction and distance? Seems that should be very doable…but if you haven’t found a reasonable solution in as long as you’ve been looking at it, I’m certain it’s harder than it seems!

Thanks for the homework…I’ll have some fun!

My twisted mind would have taken a shortcut and dynamically tweaked the steps per mm GRBL params to achieve that, since (almost) everything is relative to the zero point. Send a command to adjust $100 and $101 by the chosen scaling factor, and GRBL will scale distances for you. Maybe. I did not think this through.

1 Like

Yes, one can just scale vectors — I did that for a wrench — drew up the 10mm size, then scaled up/down to get other sizes. The problem is that’s rarely a useful thing to do — one wants the dimensions to interact with each other (e.g., the stock thickness with the length of a board).

There are a couple of tools already in existence which I’ve worked up 3D front-ends for:

https://wiki.shapeoko.com/index.php/Design_into_3D#Current_Status

I’d say it’s not as bad as I describe — my problem is I want a perfect solution centered around Carbide Create — there are competing programs which have solved this — Vectric for example has variables in the Pro version (but I only have Desktop and can’t justify spending more), Autodesk Fusion 360 works well for this sort of thing (but you’d have to get me real drunk for me to share the story of why I’m never doing business w/ Autodesk), FreeCAD will allow one to input numbers from a spreadsheet, &c.

Hopefully at some point @robgrz will add scripting or variables into Carbide Create — until then, I’m trying to balance things.

1 Like

you can scale gcode in theory. but only a little bit in practice. Scale it up too much (say more than 2x) without also scaling the size of the bit, and you create gaps between the cutout lines.

scaling down has similar issues, scale down too much and the bit that just fit in some tight corner now no longer fits

1 Like

I’m sure you have enough on your plate! I’m also partial to a CC-centric solution. There’s something very nice about the simplicity of CC for the 80/20 rule of complexity vs. volume of things I do. But even a basic/simple solution that’s not perfect (Voltaire: “Perfection is the enemy of good”), that would allow us to scale within the proportions of the WxH of the original and then some % of the depth, would be awesome.

For example, suppose I had a design I originally planned to make on 3/4" stock, but now I have a need to do it on 1/2" stock…or the stock I have is just SLIGHTLY less than 3/4…now I have to generate new GCode in CC…meh…I’d rather just say, “oh…by the way, this stock is 1/2”, so scale all of my Z depths by a factor of 33.3333%.

1 Like

Oh…and if I ever get the chance to have a drink with you, I’ll get that Autodesk story out of you! :slight_smile:

1 Like

That definitely makes sense. Bit geometry is something I didn’t consider.

OK…I’ll settle for variable depth to compensate for different stock thicknesses!

1 Like

Yeah, some sort of scripting or support for variables in Carbide Create would allow that to “just work” — but first someone has to add that as a feature in Carbide Create, or work up a tool for generating .c2d (JSON) files programmatically — I’ve had some discussions w/ folks on this, and as noted, there are some tools for this already, just none which quite suit me.

Two different approaches I’d like to look into:

  • exporting .c2d from Inkscape or some other design tool ---- RapCAD seemed promising for this, but the developer wasn’t directly interested
  • working up a tool to convert from MakerCAM SVG (w/ embedded CAM instructions) to .c2d — probably that would best be done in Inkscape

Alternately, @fenrus has done a nifty tool which creates G-Code based on darkness values in SVG files which seems promising, but it then requires that one work up a tool to create such files — the METAPOST system noted above should be workable for that — but then one bypasses Carbide Create which I’d like to include for reason of reviewing a design and adding features which aren’t suited to being done programmatically.

Even just variable depth isn’t enough, see the interactions in:

https://willadams.gitbook.io/design-into-3d/3d-project

variable depth also needs dynamic F&S adjustments but … that’s doable :wink:

1 Like

Really interesting stuff there :slight_smile:

Yes…this is kind of what I was thinking a well, @Julien, but as @fenrus pointed out, bit geometry will end up causing grief. I don’t know how valuable just depth would be…but it’s something.

Quite honestly, beyond the pitfalls mentioned above, changing a parameter in Fusion (and one day in CC) and regenerating the G-code is so quick that I don’t think I would ever bother going down that route anyway. Not for workflow streamlining reasons, I mean. I could definitely go down that route for other bad reasons that frequently lead me down multiple rabbit holes :slight_smile:

This is probably more complicated than what the original poster wanted, but I’m currently working on a parametric design to engrave a Gunter’s quadrant (simplified planispheric astrolabe) that is more than just scaling; the curves also vary with latitude and the obliquity of the ecliptic. After a few false starts, I decided on a spreadsheet (google sheets) that generates SVG that I then run through Inkscape since CC only accepts limited SVG. The Inkscape output, paper model, is good and I’m almost ready to machine the first prototype. I’ll eventually port the spreadsheet to code.

3 Likes

How is the spreadsheet generating SVG? Are you interspersing calculations and SVG boilerplate?

1 Like

Yes, more or less. Concatenating ‘boilerplate’ text with ‘fixed’ calculations. Copy & paste to a text file is also required to get something Inkscape can read. It’s a quick and dirty way to verify SVG as well as the equations.

1 Like

Have you considered using a 2D drawing program such as METAPOST or Asymptote? Nodebox or Processing might work as well though I had precision issues with them.

I’m not really familiar with available alternatives. I’ll look into those; thanks!

1 Like