OpenSCAD - The Programmers Solid 3D CAD Modeller

alpha
Posts: 174
Joined: Thu Apr 12, 2012 2:49 pm

OpenSCAD - The Programmers Solid 3D CAD Modeller

Post by alpha » Tue May 08, 2012 3:00 pm

Here is the download link: http://www.openscad.org/

Code: Select all

module plate()
{
	x = 50;
	y = 80;
	z = 10;
	r = 5;
	h = z+1;
	xt = x -35;
	yt = y -5;

	difference() {
		cube([x, y, z], center = true);
		translate(v = [xt, yt, 0])
		cylinder(h, r, r, center = true);
		translate(v = [-xt, yt, 0])
		cylinder(h, r, r, center = true);
		translate(v = [xt, -yt, 0])
		cylinder(h, r, r, center = true);
		translate(v = [-xt, -yt, 0])
		cylinder(h, r, r, center = true);
	}
}

plate();
This code creates a little plate with 4 holes, by just changing the parameters r and xt or yt the hole size and location can easily manipulated. I guess this looks like a fast way of modeling all kinds of objects you know the exact size and dimensions...

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: OpenSCAD - The Programmers Solid 3D CAD Modeller

Post by WillAdams » Fri Apr 12, 2013 11:53 pm

I tried this, and was quickly able to make a circle-diamond-square file, but had the following issues:

- export didn't work on my machine running Windows XP SP3 w/ version 2013.01.08 ---nothing no error message or dialog
- exports to STL so needs a resolution option
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: OpenSCAD - The Programmers Solid 3D CAD Modeller

Post by cvoinescu » Sat Apr 13, 2013 12:22 am

WillAdams wrote:- exports to STL so needs a resolution option
No it doesn't, and/or the setting exists.

OpenSCAD exports an exact STL representation of its model. No approximations are made during export. However, the internal model is created as an approximation of what's described in the source code. When you say "cylinder", for instance, OpenSCAD actually creates a prism. You can control how many faces the prism has with the $fa, $fs and $fn variables and arguments. In many 3D prints, you can see the default $fa=12 having generated a 30-sided prism, which I find annoying.

Because OpenSCAD works only with polyhedra internally (or polygons, when using it for 2D stuff), it does not need to approximate anything when exporting STL. This is also why its DXF export is rubbish, with everything made out of segments (well, technically, the export is perfect, it's the internal model that's not appropriate for creating DXFs).
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: OpenSCAD - The Programmers Solid 3D CAD Modeller

Post by WillAdams » Sat Apr 13, 2013 2:22 am

Okay, thanks for the correction. Obviously, I mis-remembered the resolution thing (now I'll have to figure out which program had that setting) --- but the faceting thing, while optimally implemented still strikes me as wrong --- if I spec a circle, I want it rendered using only arcs / curves.
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: OpenSCAD - The Programmers Solid 3D CAD Modeller

Post by cvoinescu » Sat Apr 13, 2013 12:49 pm

WillAdams wrote:if I spec a circle, I want it rendered using only arcs / curves.
Me too! That's why I gave up using OpenSCAD to create DXFs for the laser-cut parts. It would have been nearly ideal, workflow-wise, except the end product was, well... ugh.

It's perfectly understandable why they chose that method, though. It makes it possible for them to combine shapes the way they do without the math becoming incredibly hairy. And it's perfectly acceptable when the main goal is to create a STL file for 3-D printing.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: OpenSCAD - The Programmers Solid 3D CAD Modeller

Post by WillAdams » Sat Apr 13, 2013 1:06 pm

Okay, that leaves two questions:

- are there any plans / would it be possible to provide OpenSCAD w/ a better export?
- what drawing workflows preserve arcs and circles?
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: OpenSCAD - The Programmers Solid 3D CAD Modeller

Post by WillAdams » Tue Apr 16, 2013 2:58 pm

Putting this to the OpenSCAD mailing list generated some interesting discussion, and an interesting possible solution:

- import the OpenSCAD file into FreeCAD

Anyone have any experience w/ that? If it maintains the geometry nicely, could be perfect.
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: OpenSCAD - The Programmers Solid 3D CAD Modeller

Post by WillAdams » Sat Apr 20, 2013 8:47 pm

Unfortunately, I couldn't get FreeCAD 0.13 to install on my machine, but this may be moot, since a second option was suggested:

http://www.implicitcad.org/

a Haskell program which is OpenSCAD compatible, uses geometry internally and has a G-code export.

Unfortunately, no WebGL and I'm using an old Tablet PC so haven't been able to try it yet.
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: OpenSCAD - The Programmers Solid 3D CAD Modeller

Post by cvoinescu » Sat Apr 20, 2013 10:08 pm

Wow, ImplicitCAD is exactly what I've been looking for to replace OpenSCAD. It's a bit of a process to get it to work on Windows, but if it does what it says it does, totally worth it. Good find!

Edit: I have played with ImplicitCAD online, and I read the article about how it works, internally. Dead simple, and the internal model is perfect. However, the model is implicit (for non-mathematicians, that means the modeled object emerges as the solution of an equation, rather than from an explicit description of its parts and features), which means it's still a difficult problem to export exact DXFs with arcs and circles. I don't see any reference to that being possible, so I guess I'll have to install it and see. Even if it doesn't export good DXFs, it's still a step forward from OpenSCAD, so I'm going to try to use it in my 3D printing workflow.
Last edited by cvoinescu on Sun Apr 21, 2013 3:36 am, edited 1 time in total.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

rmellin
Posts: 6
Joined: Mon Apr 15, 2013 2:13 am

Re: OpenSCAD - The Programmers Solid 3D CAD Modeller

Post by rmellin » Sun Apr 21, 2013 12:25 am

indeed, ImplicitCAD seems a grest bit technology. OPenScad suffers from the lack of real variables among other things.

Post Reply