OpenSCAD

Post tags: | openscad |

OpenSCAD User Manual

OpenSCAD User Manual

Current OpenSCAD version

OpenSCAD version 2014.03 on Thu Jun 30 11:26:51 MDT 2016

2015.03-3 available on Sat Aug 20 11:45:54 MDT 2016

For Ubuntu users:

To update to the latest release add the following PPA before installing OpenSCAD:

        sudo add-apt-repository ppa:openscad/releases
        

User library location

OpenSCAD default user library folder

        ~/.local/share/OpenSCAD/libraries/
        

My user library local git repo

        ~/dev/CootSCAD/
        

Use enironment variable so OpenSCAD uses the library directory.

        export OPENSCADPATH=$HOME/dev/CootSCAD
        alias scad='OPENSCADPATH=~/dev/CootSCAD; openscad&'
        

Github Repo.

github.com/CootCraig/CootSCAD

MCAD files


        OpenSCAD  dpkg-query -L openscad-mcad     
         ...
        /usr/share/openscad/libraries/MCAD/trochoids.scad
         ...
        

openscad.vim

openscad.vim : Simple syntax highlighting for the OpenSCAD language

vim.org/scripts

sirtaj/vim-openscad at github

Forums

Mailing list forum interface

RepRap OpenSCAD forum

Tasks

Stepped Sine Wave Scarf model in OpenScad

Generate 2D polygon DXF for one sine wave step`

From the User Manual we learn:

OpenSCAD provides two types of 3D modelling:

  • Constructive Solid Geometry (CSG)
  • extrusion of 2D primitives into 3D space.

Autocad DXF files are used as the data exchange format for 2D outlines. In addition to 2D paths for extrusion it is also possible to read design parameters from DXF files. Besides DXF files OpenSCAD can read and create 3D models in the STL and OFF file formats.

Research

Cheat Sheet

Using OpenSCAD in a command line environment

Intro. Slide Show

CubeHero Blog

OpenSCAD github

OpenSCAD github

OpenSCAD mailing list

OpenSCAD mailing list

OpenSCAD, The Instructable

statusorel.ru article OpenSCAD, The Instructable

I am going to be writing more OpenSCAD Instructables. I want an Instructable that I can refer to that explains the OpenSCAD concepts you won’t find in the user manual. This is that Instructable.

I teach a class at Tampa Hackerspace called “OpenSCAD Introduction”, this is based on that class.

Misc.

Trace2SCAD: Converting Images Into OpenSCAD Models

How to use Openscad (1), tricks and tips to design a parametric 3D object

Shapeoko

Shapeoko wiki page on OpenSCAD

Tutorials

Jérémie FRANCOIS

tridimake.com article How to use Openscad, tricks and tips to design a parametric 3D object

David Dobervich

Open SCAD Tutorial #1

Laura Taalman

PolyBowls - A simple OpenSCAD code walkthrough

David Taylor

3D Modelling for 3D printing #1

Les Hall

Openscad Lecture 1 - basic shapes and CSG

List MCAD files


        OpenSCAD  dpkg-query -L openscad-mcad     
         ...
        /usr/share/openscad/libraries/MCAD/trochoids.scad
         ...
        

Organze Files

blog.cubehero.com Organizing your OpenSCAD code: Part I

Use / Include Thread

Giles Bathgate-2 post Use / Include

As far as I understand “include”, basically includes the text from one file in another, as if you had just cut the contents from one file and paste it in the other (or just concatenated the two files together)

“use” is much smarter only modules in the file are pulled into the other, this doesn’t include top level objects. also global variables within the lib seem to get thier own namespace, and for good reason

Bas PijlsBas post

Bas Pijls:

I know that MATLAB has a funky way of dealing with global variables. I circumvented the this once by implementing constants as functions. In openscad you could put the following in an include file:

         function height() =  1*cm;
         function length() = height()/2;
        

Functions, as opposed to global variables, are included using the “use” statement.

OpenSCAD tips for creating reusable modules

mytechexperiments.com article

mathgrrl - OpenSCAD Resources

mathgrrl - OpenSCAD Resources

Special Variables

OpenSCAD_User_Manual Special Variables

$fa, $fs and $fn

The $fa, $fs and $fn special variables control the number of facets used to generate an arc:

$fa is the minimum angle for a fragment. Even a huge circle does not have more fragments than 360 divided by this number. The default value is 12 (i.e. 30 fragments for a full circle). The minimum allowed value is 0.01. Any attempt to set a lower value will cause a warning.

$fs is the minimum size of a fragment. Because of this variable very small circles have a smaller number of fragments than specified using $fa. The default value is 2. The minimum allowed value is 0.01. Any attempt to set a lower value will cause a warning.

$fn is usually 0. When this variable has a value greater than zero, the other two variables are ignored and full circle is rendered using this number of fragments. The default value is 0.

TIP: If you want to create a circle/cylinder/sphere which has a axis aligned integer bounding box (i.e. a bounding box that has integral dimensions, and an integral position) use a value of $fn that is divisible by 4.

Variable Scope

OpenSCAD_User_Manual Variables

SolidPython

github A python frontend for solid modelling that compiles to OpenSCAD

Thingiverse

thingiverse.com/groups/

thingiverse.com/groups/openscad

thingiverse tagged with openscad

Obijuan/obiscad

github.com/Obijuan/obiscad

github.com/Obijuan/obiscad

  • attach.scad
  • bcube.scad
  • bevel.scad
  • utils.scad
  • vector.scad

attach.scad

Attach library for Openscad by obijuan

thingiverse.com/thing:30136 Attach library for Openscad by obijuan

Openscad library for easily attaching parts. This is an experimental work on enhancing the openscad tool. Usually the code written by users is difficult to read and understand. If we want to share the code and to reuse parts made by others, it is very important to write clean code.

The attach operator is a experimental way of joining together parts. It just hides all the translate/rotate operators to the user, making the code easier to read, maitain and reuse.

I have written about it (and given an example of use) in this post:

iearobotics.com/blog/ Enhancing Openscad with the attach library

The attach operator is part of the obiscad tools I am developing:

github.com/Obijuan/obiscad

vector.scad

Vector library for OpenScad by obijuan

thingiverse.com/thing:30014 Vector library for OpenScad by obijuan

This is a Vector library for drawing vectors in Openscad. It is extremely useful for designing robots and viewing their kinematics. In addition, it gives a lot of help when designing parts by means of displaying auxiliary vectors and frames of reference.

Another very useful operator is “orientate()” which make the child to point in the direction given by a vector.

The vector library is part of the tools I am developing for making it easier the use of Openscad. These tools are called obiscad. They are located in this repo:

https://github.com/Obijuan/obiscad/

Iearobotics Blog

Enhancing Openscad with the attach library

iearobotics.com/blog Enhancing Openscad with the attach library

OpenSCAD from source

wikibooks.org/wiki/ page

This site and it’s subpages can also be helpful: OpenSCAD User Manual/Building OpenSCAD from Sources

        ~dev/openscad/README.md:
        
        git clone git@github.com:openscad/openscad.git
        git checkout openscad-2015.03-3
        git checkout -b my-openscad-2015.03-3
        
        sudo ./scripts/uni-get-dependencies.sh
        ./scripts/check-dependencies.sh
        qmake openscad.pro
        make
          got a compile error, fixed with:
        sudo apt-get install libqscintilla2-dev
        make
          built
        

uninstall current and install just built.

        dpkg --get-selections |grep -i opensca
        
        
        openscad					install
        openscad-mcad					install
        openscad-testing				install
        openscad-testing-data				install
        
        Remove a package (but not its configuration files): 
        sudo dpkg --remove --force-all openscad
        
          Removing openscad (2014.03+dfsg-1) ...
        
        checkinstall
        
        

openscad-mcad

openscad/MCAD

reprap.org/wiki/MCAD

github.com/SolidCode

  • SolidPython A python frontend for solid modelling that compiles to OpenSCAD Python 107 157
  • MCAD forked from elmom/MCAD OpenSCAD Parametric CAD Library (LGPL 2.1)
  • pyscad forked from kevinmehall/pyscad Python bindings for OpenSCAD
  • ThingDoc forked from josefprusa/ThingDoc

Variable scope

compile-time, not run-time

User Manual page Variables are set at compile-time, not run-time

Because OpenSCAD calculates its variable values at compile-time, not run-time, the last variable assignment, within a scope will apply everywhere in that scope, or inner scopes thereof. It may be helpful to think of them as override-able constants rather than as variables.

        // The value of 'a' reflects only the last set value
           a = 0;
           echo(a);  // 5
           a = 3;
           echo(a);  // 5
           a = 5;
        

While this appears to be counter-intuitive, it allows you to do some interesting things: For instance, if you set up your shared library files to have default values defined as variables at their root level, when you include that file in your own code, you can ‘re-define’ or override those constants by simply assigning a new value to them.