Loading

MakerBot Print is our newest print-prepration software, which supports native CAD files and STL assemblies,
allows you to interact with all your printers via the Cloud, and many other exciting new features.

Download Now

Pinned

Customizer Update

by tbuser

Customizer now runs the new version of OpenSCAD 2015.03

Also, all the google fonts from http://www.google.com/fonts have been added to the servers and can be used in text() :)

View Comment

Welcome!

by atartanian

OpenSCAD is an open source programming language and IDE (Integrated Development Environment) for parametric 3D design. It is used to create precise, customizable and easily modifiable designs ready for 3D printing. It has a growing developer community and is the tool used to create designs compatible with the MakerBot Customizer app: http://www.thingiverse.com/apps/customizer

You can download OpenSCAD from www.openscad.org/downloads.html

This group is a place to discuss all things OpenSCAD including (but not limited to) new features, techniques, questions, libraries, works in progress, etc. So post a new Topic or contribute on an existing one!

Share knowledge, get constructive feedback, and ask questions!

Join to add your OpenSCAD designs or libraries to this group's Things. Non-OpenSCAD designs will be removed.

Have fun!

View Comment

OpenSCAD 2015.03 is out!

by atartanian

WOOT! now we can put comic sans on everything ;D

get it here: http://www.openscad.org/downloads.html

If you make any scripts that use features from the new version, add links to them in this post!

Summary of changes

Language Features

  • Added text() module for 2D text
  • Added offset() module for 2D offsets
  • Added list comprehensions and let()
  • Added concat() function
  • Added chr() function
  • surface() can now take PNG images as input
  • min() and max() can now take a vector argument
  • 2D minkowski can now handle polygons with holes
  • Variables can now be assigned in local blocks without using assign()

Program Features

  • Added Toolbar icons
  • New code editor based on QScintilla
  • Added Splash screen
  • Added SVG export
  • Added AMF export
  • Added --viewall and --autocenter cmd-line parameters
  • GUI is now translated into German, Czech, Spanish, French and Russian
  • MDI (Multiple Document Interface) is now available on all platforms
  • Color schemes for viewer and editor can be user-edited using JSON files
  • GUI components are now dockable
  • Added Tickmarks on axes

Bugfixes/improvements

  • Performance improvement: 2D (clipper), preview, hull, minkowski, surface
  • Performance improvement: Reduce duplicate evaluation of identical expressions
  • Better recursion behavior
  • STL export and import is now more robust
  • Internal cavities are better supported
  • New examples
  • Windows cmd-line behaves better
  • Better mirror() and scale() behavior when using negative factors

Deprecations

  • polyhedron() now takes a faces= argument rather than triangles=
  • assign() is no longer needed. Local variables can be created in any scope
View Comment

warning: too many unnamed arguments supplied

by rshambaugh

I'm trying to customize this speaker spacer: https://www.thingiverse.com/thing:2924217

but I'm getting a warning preventing the outer ring from rendering:

WARNING: Too many unnamed arguments supplied, in file speakerrings.scad, line 77

Specifically, this line:

    spacerTrim(0, spacerTrimThickness, spacerTrimHeight);

Here's the entire code:

// Speaker ring generator
// Code remix from https://www.thingiverse.com/thing:451253
//
// Use to make speaker rings for 5, 5.25, 6, 6.5, 6.75, 8, 10, 12, 15, 18, 21 inch speakers (sizes dependent on 3D printer capabilities, maybe use CNC for larger speaker spacers)
//
// preview[view:south, tilt:top]
//
/* [Unit adjustment] */
// Choose from mm, cm, or inch 
units_entered = 25.4;//[1:mm, 10:cm, 25.4:inch]

/* [Spacer Ring Sizing] */
// inner diameter (e.g. Speaker cutout diameter), set to just a little larger than the speaker cutout.  Default is for 6.5 inch ring.
d_inner= 5.5;

// outer diameter, (Speaker ring outer diameter)
d_outer= 7.61;

// height of adapter, (Common heights are .25, .5, .75, 1 inch)
h = 1.81;

/* [Hidden] */
// inner tolerance substract from wall)
i_inner = 0;
// outer tolerance in mm (substract from wall)
i_outer = 0;

//
// This code from https://www.thingiverse.com/apps/customizer/run?thing_id=1483876
/* [Flush Mounting Trim Ring] */

// Width of flush-mount trim, Set to .01 for no flush-mount ring (if height is less than .6 inches try using the opposite of the height, (i.e. height is 0.44 than make this -0.44) 
spacerTrimThickness = 0.25; 

// Height of flush-mount trim, Set to .01 for no flush-mount ring (if height is less than .6 inches try using the opposite of the height, (i.e. height is 0.44 than make this -0.44)
spacerTrimHeight = 0.15; 

/* [Speaker Screw Holes] */
//Speaker mount hole diameter, (same size as inner d_inner), (should be slightly larger than needed to ensure fit)
speakerHoleDiameter = d_inner;

//diagonally opposing holes this distance apart
speakerScrewHoleSpacing = 6.0;

numberOfSpeakerScrewHoles = 4; 

//.128 inch (3.25mm) seems good for #6 wood screw (screw in slowly / don't overtighten to avoid cracking) - chase with drill bit if needed
speakerScrewHoleDiameter = 0.128;

// Sets the angle from 0 to position holes, 45 is default
speakerScrewHoleAngle = 45;

/* [Spacer Ring Mounting Holes] */

//diagonally opposing holes this distance apart
mountScrewHoleSpacing = 6.5; 

numberOfMountScrewHoles = 4; 

//.2 inch (5.05mm) seems good for mount screws.  (use oem if possible), (screw in slowly / don't overtighten to avoid cracking) - chase with drill bit if needed
mountScrewHoleDiameter = 0.2;

/* [Spacer Ring Template] */
// Print 2D template to check fit

difference() {
    cylinder(d=d_outer+spacerTrimThickness-i_outer, h=h, $fn=256);

    translate([0,0,-1]) {
        cylinder(d=d_inner+i_inner, h=h+2, $fn=256);

    screwCutOuts(0, speakerScrewHoleSpacing, numberOfSpeakerScrewHoles, speakerScrewHoleDiameter, speakerScrewHoleAngle);

    mountscrewCutOuts(0, mountScrewHoleSpacing, numberOfMountScrewHoles, mountScrewHoleDiameter);

    spacerTrim(0, spacerTrimThickness, spacerTrimHeight);

    }
}

echo ((d_outer-d_inner-i_outer-i_inner)/2, units_entered);

module screwCutOuts(rotation, distance, numberOfHoles, holeDiameter, holeAngle)

{
    rotate ([rotation,0,0]) translate([0, 0, 1]) 
    {
        for (i = [0 : 360 / numberOfHoles : 360])
        {
            rotate([0,0,i + holeAngle])
                translate([0, distance / 2, h*.25])
                    cylinder(r = holeDiameter / 2, h = h * 2, $fn=50);
        }
    }
}

module mountscrewCutOuts(rotation, distance, numberOfHoles, holeDiameter)

{
    rotate ([rotation,0,0]) translate([0, 0, -1.5]) 
    {
        for (i = [0 : 360 / numberOfHoles : 360])
        {
            rotate([0,0,i + 0])
                translate([0, distance / 2, 2])
                    union () {
                        cylinder(r = holeDiameter / 2, h = h * 2, $fn=50);
                translate([0,0,1])cylinder(h=h*.26, r=holeDiameter / 2 + .1, $fn=50);
            }
        }
    }
}

// Trim for ring flush-mounting.  Code from https://www.thingiverse.com/apps/customizer/run?thing_id=1483876
module spacerTrim(spacerTrimThickness, spacerTrimHeight) 

{
    difference() {

        translate([0, 0, h+h-spacerTrimHeight])
        cylinder(h=h + spacerTrimHeight, d=d_outer, $fn=256);
        cylinder(h=h * 4, d=d_inner, center=true);

        }
}

Any ideas about what's wrong?

Speaker Spacer Ring Generator
SpeakerGen
View Comment

OpenSCAD 2019.05 has just been released

by Torsten

Hi!

As Marius already wrote a nice summary for the mailing list, I'm just shamelessly reposting that... so here we go...

OpenSCAD 2019.05 has just been released: http://www.openscad.org/news.html#20190518

This release adds a number of features which have been in development for the last 4 years. Some of the larger program features are Customizer, which was first started as a Google Summer of Code project, and 3D input device support. The OpenSCAD language itself and standard library has seen a number of iterative improvements

The source code, as well as binaries for Mac OS X, Windows and Linux are ready for download.

As usual, thanks go to everyone who has contributed to this release through development and community management, bug reports and fixes, documentation, translation, discussions, as well as testing the development snapshots!

A summary of changes since last release follows.

Take care,

-Marius

Language Features:

  • New modules
    • assert() - stop script evaluation on failed constraints
    • let() - scoped assignment
  • New functions
    • ord() - convert from character to Unicode code point
    • echo()
    • assert() - stop script evaluation on failed constraints
    • Type testing functions: is_undef(), is_list(), is_num(), is_bool(), is_string()
  • New special variable: $preview variable which is set to true in preview mode
  • List comprehension updates
    • Added if/else condition
    • Added each keyword
    • Added C-style for loop
    • Now allows looping over characters of a string
  • rotate_extrude(): Added angle parameter to
  • import() now supports SVG, 3MF and AMF
  • color() now supports hex color codes
  • Removed glide() and subdiv() which were never implemented

Program Features:

  • Customizer: Allow parametrizing design parameters with GUI customization
  • Support for using 3D-Mouse / Joystick / Gamepad input devices for controlling the 3D view
  • 3D Printing support: Purchase from a print service partner or print to Octoprint
  • New export file formats: SVG, 3MF, AMF
  • Quick-edit and preview of values using Alt-Arrows (Shift-Alt-Arrows on macOS)
  • Added --view cmd-line parameter
  • Play sound notification on render complete
  • Line numbers and filenames are now shown for many errors and warnings
  • Hardwarning preference: Stop on first warning
  • Hardwarning and assert now shows a stack trace
  • New warnings
    • Module call parameterns don't match module declaration
    • Argument value of of range
    • Duplicate passed argument
    • Children passed to module not accepting children
    • Reference to inknown $special_variables
    • Duplicate assigment
  • New translations: Ukrainian, Polish
View Comment

Try open this file, preview or render failed, what's wrong??

by jumboj

projection() {rotate([0,90,0])
linear_extrude(center = true, convexity = 10, height = 2, slices = 500, twist = -720.0000000000) {
polygon(paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]], points = [[5.0000000000, 0.0000000000], [-4.1720501029, -2.7049938569], [2.0177390834, 4.5140070730], [0.7584029619, -4.8578221518], [-3.2605860792, 3.6427754512], [4.6908070829, -1.2754333166], [-4.6033294053, -1.4732513353], [3.0434506148, 3.7189746642], [-0.5274057206, -4.7485791243], [-2.1283496766, 4.2464841521], [4.0720613414, -2.3911710830], [-4.6898477069, -0.2076947943], [3.7995111958, 2.7095188597], [-1.7038236718, -4.3146581578], [-0.9121403690, 4.5199939852], [3.2048995297, -3.2765169691], [-4.4445335361, 0.9996039548], [4.2470317943, 1.5695517013], [-2.6930703108, -3.6051868608], [-4.1720501029, -2.7049938569], [2.0177390834, 4.5140070730], [0.7584029619, -4.8578221518], [-3.2605860792, 3.6427754512], [4.6908070829, -1.2754333166], [-4.6033294053, -1.4732513353], [3.0434506148, 3.7189746642], [-0.5274057206, -4.7485791243], [-2.1283496766, 4.2464841521], [4.0720613414, -2.3911710830], [-4.6898477069, -0.2076947943], [3.7995111958, 2.7095188597], [-1.7038236718, -4.3146581578], [-0.9121403690, 4.5199939852], [3.2048995297, -3.2765169691], [-4.4445335361, 0.9996039548], [4.2470317943, 1.5695517013]]);
}
}

View Comment

Box with slanted front and back.

by AeroMaxx

I'm wanting to create a box that has an slope front at approx 130 degrees, and a sloped rear at 40 degrees. The box is to have walls that are 2mm thick.

The box currently is in two parts that form a union, the first part is a slim box that has a hollow middle, the walls are 2mm thick, and the x, y, z is [60, 40, 6]

I think there is two ways I can do the front and rear slopes, I'd like the total height of the box to be 20.

The first way could be to make an additonal box with the same dimensions as the lower box but with a height of 14 such as x, y, z of [60, 40, 14], translate would need to be used with this. Make additional cubes and rotate and translate them then use difference to remove the parts from the cube. The problem I am having with this method is lining everything up accurately it seems near impossible to line everything up pixel perfect, it also is very difficult to get the slopes to start at the same height on the front and rear.

So I thought of a different way I could make thin cubes of 2mm thick as I wanted walls that thick anyway, such as using x, y, z of [56, 2, 22] and then rotate and translate them, this has the added benefit of not needing to have anything cut out from the inside of the cube to make the walls 2mm thick. It however doesn't solve the problem of lining everything up accurately it still seems near impossible to line everything up pixel perfect.

Once I have been able to resolve the above issues I was wanting to cut a rectangle hole in the front slope, the rear slope won't have a hole cut into it.

If someone could potentially share their thoughts and ideas, or perhaps even give some recommendations as to what you think I should do to get the results I am after it would be very much appreciated, I wouldn't necessarily need the code writing for me as I do have a programming/scripting background, but that being said if you would like to share some rough examples to explain what your suggesting that would be very much appreciated.

Thank you in advanced.

View Comment

Data Structures - Defining and Accessing

by txoof

I'm looking for a method for defining and accessing data structures. I frequently need to have a pre-defined data set to make calls easier. I've used the following two methods below in the past, but I'm looking for a better method that makes it easy to add future data and is reasonably easy to read and maintain.

If you have a suggestion, it would be really helpful if you could offer a little sample code to go along with it.

Thanks!

Lookup method
As can be seen in this (failed) project: http://www.thingiverse.com/thing:668210

type1 = [[len, 10], [dia, 5], [bolt, 4]];
type2 = [[len, 20], [dia, 7], [bolt, 3]];

types = [type1, type2];

i = 0;

//variables need to be defined before using a lookup
len = 0;
dia = 0; 
bolt = 0;

len = lookup(len, type[i]);
dia = lookup(dia, type[i]);
bolt = lookup(dia, type[i]);

module doStuff() {
*/ Do stuff here /*
}

doStuff()

Pros:

  • Allows for each element to be discretely defined
  • Allows for descriptive variable names to be used in the definitions
  • Elements can be in any order

Cons:

  • Abuse of the lookup() function
  • Non-straitght-forward way to use as a library - You must know the contents of the types array as well as the index number you want to call

Indexed Array Method
As can be seen in this project: http://www.thingiverse.com/thing:1259672

types = [["Human Readable Type Name", "total length", "diameter at mid-point", "bolt length"], ["Type 1", 10, 5, 4], ["Type 2", 20, 7, 3]];

module doStuff(type=1]) {
   len = types[type][1];
   dia = types[type][2];
   bolt = types[type][3];

   /* do stuff here /* 
}
doStuff(2);

Pros:

  • Allows for adding a 0th element with human readable descriptions that can be referenced later
  • Allows for embedding human readable names for each group
  • Easy to call if types are common sizes (such as M series metric bolts)

Cons:

  • Elements must be in a particular order
  • Must remember order of datum in array when programming
  • Not easy to reference elements if you don't happen to know what order they are in
  • Crap to maintain, if element order changes everything goes to hell
Customizable Parametric Battery Holder (AAA, AA, C, D)
by txoof
nuts_and_bolts - MCAD replacement (nuts, bolts, washers, T-Slots)
by txoof
View Comment

Dynamically demonstrate the openscad modeling process with py

by jumboj
Dynamically demonstrate the openscad modeling process with python step by step
by jumboj
View Comment

is it possible to have an if() inside a function() ?

by SavageRodent

The code below does not work, but i don't know if i am simply phrasing it incorrectly.

a=10;
b=6;

echo(com(0));

function com(i)=[
if(i==0)
a+b
else
a-b
];

View Comment

can no longer use imported stl files - sort of.

by curiousaardvark

I can import an stl file, render it and export it.
Which, by itself, is completely useless.

As soon as i apply a difference operation to the imported stl, it refuses to render.
I can get an f5 preview but as soon as i try and get an f6 render, the stl vanishes and I get this message:

ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: pe_prev->is_border() || !internal::Plane_constructor::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).is_degenerate() File: /opt/mxe/usr/i686-w64-mingw32.static/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h Line: 251

I used to be able difference imported stls.
I usually run the latest development version of openscad.
Thought that might be it, but having downgraded to the 2015 current recommended version. I get exactly the same thing.,

The complexity of the imported stl doesn't seem to make any difference.

Anybody got any ideas ? It's really bloody annoying.
The idea of learning a wysiwig cad program fills me with dread, but this is bloody ridiculous.

View Comment