SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
OpenSCAD Tutorial
John Oliva - 2/22/17
Intro
What is OpenSCAD?
● 3D modeling program based on constructive solid
geometry
● Dynamically typed language
● Open Source: https://github.com/openscad/openscad
● Windows, Mac OS X, Linux (14 - 23 MB), web app
(openscad.net)
● GUI or CLI usage
Intro
Why OpenSCAD?
● Free to obtain and for commercial use
● Parametric - easy to adjust object to customize use
● Simple language
● Large amount of existing code freely available (Github,
Thingiverse, etc.)
● Large user community
● Well established - been around since 2010
● Produces solid, watertight 3D objects
● Good online documentation
Intro
Differentiators from other 3D CAD?
● Declarative, procedure oriented programming
● Interactive design - but not by interacting directly with
rendered model on screen
● Customizers
○ Thingiverse
○ Built into development version of OpenSCAD
● Computational generation of shapes (e.g. fractal shaped
object)
Resources
● www.openscad.org
● cheatsheet: www.openscad.org/cheatsheet
● manual: en.wikibooks.org/wiki/OpenSCAD_User_Manual
● Libraries
○ OpenSCAD general library of relativity
■ github.com/davidson16807/relativity.scad/wiki
■ www.thingiverse.com/thing:349943
○ MCAD library
■ github.com/openscad/MCAD
■ Lots of resources for mechanical design
● Alternative language interfaces
○ SolidPython: github.com/SolidCode/SolidPython
○ OpenJSCAD: openjscad.org
● Web based OpenSCAD: openscad.net
Installation
● www.openscad.org/downloads.html
● Latest stable releases
○ Mac OS X: 2015.03-3
○ Windows: 2015.03-2
○ Linux: 2015.03-2
● Much more recent development snapshots
Quick GUI Overview
● Preview/Render pane
● Code pane
○ detachable
○ supports external editor (Design->Automatic Reload and Preview)
● Console pane
○ detachable
● Customizer pane
○ detachable
○ not currently available in stables releases
Workflow
● Iterate (until happy with design)
○ Write OpenSCAD code
○ Preview using F5 (generates CSG representation for OpenGL
rendering)
● Render to full geometry using F6 (generates CGAL
representation, surfaces, edges, vertices)
● Export to a format for import into subsequent tool
○ e.g. STL for import into siicer
○ export formats: STL, OFF, AMF, DXF, SVG, CSG, PNG
Concepts - 2D Shapes
● Circle
● Square (actually rectangle)
● Polygon
● Text
Concepts - 3D Shapes
● Cube (actually rectangular prism)
● Sphere
● Cylinder (or cone)
Concepts - Transforms
● Translate
● Scale
● Rotate
● Mirror
● Color
● Others: resize, multmatrix, offset, hull, minkowski
Concepts - Boolean Operations
● Union
○ combines multiple shapes into a single object
● Difference
○ removes/subtracts second and remaining shapes from the first
shape
● Intersection
○ leaves the parts that are common to all of the shapes included
Concepts - Extrusions
● Linear
○ extends a 2D object in the X/Y plane in the Z direction
● Rotational
○ rotates a 2D object defined in the X/Y plane around the Z axis
Concepts - Surface
● Creates a 3D object from:
○ height map data file
○ PNG image where grayscale indicates height
○ Can be used to create a lithophane
Examples
● Cup
● Customizer: Lego block
Language - Comments
● line: //
● block: /* */
Language - Console logging
● echo (aa,bb,cc,dd);
● echo (var=var);
Language - Types
● No declaration required
● Numbers (integer, floating point)
● Boolean (true/false)
● String
● Vector
● Undefined (undef)
Language - Variables
● variable_name = expression
● Variable values at calculated at compile-time, not run-time
● Special variables - start with $
○ $fa minimum angle
○ $fs minimum size
○ $fn minimum # of fragments
○ $t animation step
○ Others: $vpr, $vpt, $vpd
Language - Operators
● arithmetic: *, /, +, -, %
● relational: <, >, <=, >=, ==, !=
● logical: &&, ||, !
● conditional: exp ? val1 : val2
● vector: +, -
Language - List Comprehensions
● Used to generate a list
● Examples
○ Squares: squares = [ for(i=[0:10]) i*i ]; echo (squares);
○ Divisible by 3: div3 = [ for(i=[0:20]) if (i%3 == 0) i ]; echo (div3);
Language - Modules
● Operates like a subroutine in other languages and does
not return a value
● Most often used for constructing higher order 2D or 3D
objects from simpler ones
● Format: module name (comma_sep_param_list) { … }
Language - Functions
● Operates like a function in other languages although
defined as a single expression returning a value
● Most often used for constructing higher order 2D or 3D
objects from simpler ones
● Format: function name (params) = expression yielding a
value
● Example - Factorial
function factorial(n) = ( n==1 ? 1 : n * factorial(n-1) );
fact=factorial(10);
echo(fact=fact);
Language - Looping
● Often used to create multiple instances of objects
parameterized by the loop variable
● Format
○ for (var = [start:end]) { actions }
○ for (var = [start:step:end]) { actions }
Language - Conditional
● if (logical expression) { actions } else { actions }
Language - Math Functions
● abs, sign, sin, cos, tan, acos, asin, atan, atan2, floor, round,
ceil, ln, len, let, log, pow, sqrt, exp, rands, min, max
Language - Libraries
● include <filename>
○ inserts contents of file at that point in the including file
○ included file is OpenSCAD formatted
○ modules and functions are defined
○ commands are executed
● use <filename>
○ modules and functions are defined
○ included file is OpenSCAD formatted
○ NO commands are executed
● import <STL/OFF/DXF file>
○ imports and renders file

Mais conteúdo relacionado

Semelhante a OpenSCAD Tutorial

High Performance Rust UI.pdf
High Performance Rust UI.pdfHigh Performance Rust UI.pdf
High Performance Rust UI.pdf
mraaaaa
 

Semelhante a OpenSCAD Tutorial (20)

Blockchain Coding Dojo - BlockchainHub Graz
Blockchain Coding Dojo - BlockchainHub GrazBlockchain Coding Dojo - BlockchainHub Graz
Blockchain Coding Dojo - BlockchainHub Graz
 
Feel++ webinar 9 27 2012
Feel++ webinar 9 27 2012Feel++ webinar 9 27 2012
Feel++ webinar 9 27 2012
 
AutoCAD Architecture
AutoCAD ArchitectureAutoCAD Architecture
AutoCAD Architecture
 
Python for PHP developers
Python for PHP developersPython for PHP developers
Python for PHP developers
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
 
Ruby meets Go
Ruby meets GoRuby meets Go
Ruby meets Go
 
Substrait Overview.pdf
Substrait Overview.pdfSubstrait Overview.pdf
Substrait Overview.pdf
 
Baby steps to Domain-Driven Design
Baby steps to Domain-Driven DesignBaby steps to Domain-Driven Design
Baby steps to Domain-Driven Design
 
Blueprints: Introduction to Python programming
Blueprints: Introduction to Python programmingBlueprints: Introduction to Python programming
Blueprints: Introduction to Python programming
 
Go_ Get iT! .pdf
Go_ Get iT! .pdfGo_ Get iT! .pdf
Go_ Get iT! .pdf
 
High Performance Rust UI.pdf
High Performance Rust UI.pdfHigh Performance Rust UI.pdf
High Performance Rust UI.pdf
 
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and Golang
 
Build your Own Customizable 3D Objects with Sculpteo
Build your Own Customizable 3D Objects with SculpteoBuild your Own Customizable 3D Objects with Sculpteo
Build your Own Customizable 3D Objects with Sculpteo
 
Blender presentation at SIGGRAPH 2013
Blender presentation at SIGGRAPH 2013Blender presentation at SIGGRAPH 2013
Blender presentation at SIGGRAPH 2013
 
openGL basics for sample program (1).ppt
openGL basics for sample program (1).pptopenGL basics for sample program (1).ppt
openGL basics for sample program (1).ppt
 
openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.ppt
 
Domain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroDomain Driven Design: Zero to Hero
Domain Driven Design: Zero to Hero
 
Interprocess communication with C++.pdf
Interprocess communication with C++.pdfInterprocess communication with C++.pdf
Interprocess communication with C++.pdf
 
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
 Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ... Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
 
Civil project .ppt
Civil project .pptCivil project .ppt
Civil project .ppt
 

Mais de John Oliva

NYC Titanium User's Group - Accelerated Development with TiShadow
NYC Titanium User's Group - Accelerated Development with TiShadowNYC Titanium User's Group - Accelerated Development with TiShadow
NYC Titanium User's Group - Accelerated Development with TiShadow
John Oliva
 
NYC Titanium User's Group - Tools and Techniques for Mobile UI/UX
NYC Titanium User's Group - Tools and Techniques for Mobile UI/UXNYC Titanium User's Group - Tools and Techniques for Mobile UI/UX
NYC Titanium User's Group - Tools and Techniques for Mobile UI/UX
John Oliva
 

Mais de John Oliva (10)

Sensor enclosure presentation
Sensor enclosure presentationSensor enclosure presentation
Sensor enclosure presentation
 
Printing with PETG
Printing with PETGPrinting with PETG
Printing with PETG
 
NYC Titanium User's Group - 2/18 Organizer Topics
NYC Titanium User's Group - 2/18 Organizer TopicsNYC Titanium User's Group - 2/18 Organizer Topics
NYC Titanium User's Group - 2/18 Organizer Topics
 
NYC Titanium User's Group - 12/13 Organizer Topics + Presentation Video
NYC Titanium User's Group - 12/13 Organizer Topics + Presentation VideoNYC Titanium User's Group - 12/13 Organizer Topics + Presentation Video
NYC Titanium User's Group - 12/13 Organizer Topics + Presentation Video
 
NYC Titanium User's Group - Accelerated Development with TiShadow
NYC Titanium User's Group - Accelerated Development with TiShadowNYC Titanium User's Group - Accelerated Development with TiShadow
NYC Titanium User's Group - Accelerated Development with TiShadow
 
NYC Titanium User's Group - tiConf US Revisited
NYC Titanium User's Group - tiConf US RevisitedNYC Titanium User's Group - tiConf US Revisited
NYC Titanium User's Group - tiConf US Revisited
 
NYC Titanium User's Group - Tools and Techniques for Mobile UI/UX
NYC Titanium User's Group - Tools and Techniques for Mobile UI/UXNYC Titanium User's Group - Tools and Techniques for Mobile UI/UX
NYC Titanium User's Group - Tools and Techniques for Mobile UI/UX
 
NYC Titanium User's Group - Mobile Analytics
NYC Titanium User's Group - Mobile AnalyticsNYC Titanium User's Group - Mobile Analytics
NYC Titanium User's Group - Mobile Analytics
 
CTO School - Titanium Overview
CTO School - Titanium OverviewCTO School - Titanium Overview
CTO School - Titanium Overview
 
NYC Titanium User's Group - Kickoff Meeting
NYC Titanium User's Group - Kickoff MeetingNYC Titanium User's Group - Kickoff Meeting
NYC Titanium User's Group - Kickoff Meeting
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

OpenSCAD Tutorial

  • 2. Intro What is OpenSCAD? ● 3D modeling program based on constructive solid geometry ● Dynamically typed language ● Open Source: https://github.com/openscad/openscad ● Windows, Mac OS X, Linux (14 - 23 MB), web app (openscad.net) ● GUI or CLI usage
  • 3. Intro Why OpenSCAD? ● Free to obtain and for commercial use ● Parametric - easy to adjust object to customize use ● Simple language ● Large amount of existing code freely available (Github, Thingiverse, etc.) ● Large user community ● Well established - been around since 2010 ● Produces solid, watertight 3D objects ● Good online documentation
  • 4. Intro Differentiators from other 3D CAD? ● Declarative, procedure oriented programming ● Interactive design - but not by interacting directly with rendered model on screen ● Customizers ○ Thingiverse ○ Built into development version of OpenSCAD ● Computational generation of shapes (e.g. fractal shaped object)
  • 5. Resources ● www.openscad.org ● cheatsheet: www.openscad.org/cheatsheet ● manual: en.wikibooks.org/wiki/OpenSCAD_User_Manual ● Libraries ○ OpenSCAD general library of relativity ■ github.com/davidson16807/relativity.scad/wiki ■ www.thingiverse.com/thing:349943 ○ MCAD library ■ github.com/openscad/MCAD ■ Lots of resources for mechanical design ● Alternative language interfaces ○ SolidPython: github.com/SolidCode/SolidPython ○ OpenJSCAD: openjscad.org ● Web based OpenSCAD: openscad.net
  • 6. Installation ● www.openscad.org/downloads.html ● Latest stable releases ○ Mac OS X: 2015.03-3 ○ Windows: 2015.03-2 ○ Linux: 2015.03-2 ● Much more recent development snapshots
  • 7. Quick GUI Overview ● Preview/Render pane ● Code pane ○ detachable ○ supports external editor (Design->Automatic Reload and Preview) ● Console pane ○ detachable ● Customizer pane ○ detachable ○ not currently available in stables releases
  • 8. Workflow ● Iterate (until happy with design) ○ Write OpenSCAD code ○ Preview using F5 (generates CSG representation for OpenGL rendering) ● Render to full geometry using F6 (generates CGAL representation, surfaces, edges, vertices) ● Export to a format for import into subsequent tool ○ e.g. STL for import into siicer ○ export formats: STL, OFF, AMF, DXF, SVG, CSG, PNG
  • 9. Concepts - 2D Shapes ● Circle ● Square (actually rectangle) ● Polygon ● Text
  • 10. Concepts - 3D Shapes ● Cube (actually rectangular prism) ● Sphere ● Cylinder (or cone)
  • 11. Concepts - Transforms ● Translate ● Scale ● Rotate ● Mirror ● Color ● Others: resize, multmatrix, offset, hull, minkowski
  • 12. Concepts - Boolean Operations ● Union ○ combines multiple shapes into a single object ● Difference ○ removes/subtracts second and remaining shapes from the first shape ● Intersection ○ leaves the parts that are common to all of the shapes included
  • 13. Concepts - Extrusions ● Linear ○ extends a 2D object in the X/Y plane in the Z direction ● Rotational ○ rotates a 2D object defined in the X/Y plane around the Z axis
  • 14. Concepts - Surface ● Creates a 3D object from: ○ height map data file ○ PNG image where grayscale indicates height ○ Can be used to create a lithophane
  • 16. Language - Comments ● line: // ● block: /* */
  • 17. Language - Console logging ● echo (aa,bb,cc,dd); ● echo (var=var);
  • 18. Language - Types ● No declaration required ● Numbers (integer, floating point) ● Boolean (true/false) ● String ● Vector ● Undefined (undef)
  • 19. Language - Variables ● variable_name = expression ● Variable values at calculated at compile-time, not run-time ● Special variables - start with $ ○ $fa minimum angle ○ $fs minimum size ○ $fn minimum # of fragments ○ $t animation step ○ Others: $vpr, $vpt, $vpd
  • 20. Language - Operators ● arithmetic: *, /, +, -, % ● relational: <, >, <=, >=, ==, != ● logical: &&, ||, ! ● conditional: exp ? val1 : val2 ● vector: +, -
  • 21. Language - List Comprehensions ● Used to generate a list ● Examples ○ Squares: squares = [ for(i=[0:10]) i*i ]; echo (squares); ○ Divisible by 3: div3 = [ for(i=[0:20]) if (i%3 == 0) i ]; echo (div3);
  • 22. Language - Modules ● Operates like a subroutine in other languages and does not return a value ● Most often used for constructing higher order 2D or 3D objects from simpler ones ● Format: module name (comma_sep_param_list) { … }
  • 23. Language - Functions ● Operates like a function in other languages although defined as a single expression returning a value ● Most often used for constructing higher order 2D or 3D objects from simpler ones ● Format: function name (params) = expression yielding a value ● Example - Factorial function factorial(n) = ( n==1 ? 1 : n * factorial(n-1) ); fact=factorial(10); echo(fact=fact);
  • 24. Language - Looping ● Often used to create multiple instances of objects parameterized by the loop variable ● Format ○ for (var = [start:end]) { actions } ○ for (var = [start:step:end]) { actions }
  • 25. Language - Conditional ● if (logical expression) { actions } else { actions }
  • 26. Language - Math Functions ● abs, sign, sin, cos, tan, acos, asin, atan, atan2, floor, round, ceil, ln, len, let, log, pow, sqrt, exp, rands, min, max
  • 27. Language - Libraries ● include <filename> ○ inserts contents of file at that point in the including file ○ included file is OpenSCAD formatted ○ modules and functions are defined ○ commands are executed ● use <filename> ○ modules and functions are defined ○ included file is OpenSCAD formatted ○ NO commands are executed ● import <STL/OFF/DXF file> ○ imports and renders file