参考链接

官方文档

官方文档之——代码

如何快速上手

打开openSCAD后界面如下:

选择其中的examples,从basic看起。配合官方文档中的first step部分,和官方文档——代码写法即可很快上手。

概述

  • 默认界面左边是代码,右边是预览图
  • Ctrl + D 可注释选中行(从edit菜单栏中得知)
  • 以下按钮预览(鼠标停留可显示文字preview)

命令

几何体

  1. cube(10); //边长为10的正方体,锚点在其一角
  2. cube([2,3,4]); //长宽高分别为2,3,4的长方体,锚点在其一角
  3. cube(15, center=true); //边长为15的正方体,锚点在其中心
  4. sphere(10); //半径为10的球体
  5. polygon( points=[[0,0],[8,4],[4,8],[4,12],[12,16],[0,20]] ); //这几个点顺次连接构成的几何体

几何变换

  1. translate([-24,0,0]) //平移
  2. union() //并
  3. intersection //交
  4. difference() // 差
  5. hull() //凸包,详情请百度

例子:

linear Extrude

  1. linear_extrude(
  2. height = fanwidth,
  3. center = true,
  4. convexity = 10,
  5. twist = -fanrot,
  6. slices = 20,
  7. scale = 1.0,
  8. $fn = 16) {...}

minkowski() (倒角,圆角,bevel)

例一:minkowski()直接用于三维物体

  1. height = 10;
  2. length = 10;
  3. width = 20;
  4. bevelRadius = 2;
  5. $fn=50;
  6. cube([length-2*bevelRadius, width-2*bevelRadius,height]);
  7. cylinder(r=bevelRadius,h=height);
  8. translate([20,0,0])
  9. minkowski()
  10. {
  11. cube([length-2*bevelRadius, width-2*bevelRadius,height/2]);
  12. cylinder(r=bevelRadius,h=height/2);
  13. }

例二:minkowski()用于二维物体(之后可以叠加linear Extrude)

  1. height = 10;
  2. length = 10;
  3. width = 20;
  4. bevelRadius = 2;
  5. linear_extrude(height = height)
  6. square([length-2*bevelRadius, width-2*bevelRadius]);
  7. linear_extrude(height = height)
  8. circle(r=bevelRadius);
  9. $fn=50;
  10. translate([20,0,0])
  11. linear_extrude(height = height)
  12. minkowski()
  13. {
  14. square([length-2*bevelRadius, width-2*bevelRadius]);
  15. circle(r=bevelRadius);
  16. }

效果和例一相同

projection()

  1. projection(cut = true)
  2. import("projection.stl");

rotate_extrude()

绕z轴旋转360°

文字

官方文档——text用法

  1. text(letter,
  2. size=size*22/30,
  3. font="Bitstream Vera Sans",
  4. halign="center",
  5. valign="center");

echo(字符串变量);

会在右边控制台console中第三行左右显示

导入其他文件

import("xxx.stl");

  1. import("projection.stl"); //

use <xxx.scad>

  1. use <logo.scad> //Imports the Logo() module from logo.scad into this namespace
  2. Logo();

特殊显示(透明与高亮)

  1. cube(15,center = true);
  2. translate([0, 0, 20]){
  3. %cube(15,center = true); //% 是透明
  4. }
  5. translate([0, 0, -20]){
  6. #cube(15,center = true); //#是高亮
  7. }

效果如图:

特殊变量

分辨率:$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.

初始视角 $vpr, $vpt and $vpd

  • $vpr shows rotation
  • $vpt shows translation (i.e. won't be affected by rotate and zoom)
  • $vpd shows the camera distance [Note: Requires version 2015.03]

openscad 3Dmodels 笔记的更多相关文章

  1. git-简单流程(学习笔记)

    这是阅读廖雪峰的官方网站的笔记,用于自己以后回看 1.进入项目文件夹 初始化一个Git仓库,使用git init命令. 添加文件到Git仓库,分两步: 第一步,使用命令git add <file ...

  2. js学习笔记:webpack基础入门(一)

    之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...

  3. SQL Server技术内幕笔记合集

    SQL Server技术内幕笔记合集 发这一篇文章主要是方便大家找到我的笔记入口,方便大家o(∩_∩)o Microsoft SQL Server 6.5 技术内幕 笔记http://www.cnbl ...

  4. PHP-自定义模板-学习笔记

    1.  开始 这几天,看了李炎恢老师的<PHP第二季度视频>中的“章节7:创建TPL自定义模板”,做一个学习笔记,通过绘制架构图.UML类图和思维导图,来对加深理解. 2.  整体架构图 ...

  5. PHP-会员登录与注册例子解析-学习笔记

    1.开始 最近开始学习李炎恢老师的<PHP第二季度视频>中的“章节5:使用OOP注册会员”,做一个学习笔记,通过绘制基本页面流程和UML类图,来对加深理解. 2.基本页面流程 3.通过UM ...

  6. NET Core-学习笔记(三)

    这里将要和大家分享的是学习总结第三篇:首先感慨一下这周跟随netcore官网学习是遇到的一些问题: a.官网的英文版教程使用的部分nuget包和我当时安装的最新包版本不一致,所以没法按照教材上给出的列 ...

  7. springMVC学习笔记--知识点总结1

    以下是学习springmvc框架时的笔记整理: 结果跳转方式 1.设置ModelAndView,根据view的名称,和视图渲染器跳转到指定的页面. 比如jsp的视图渲染器是如下配置的: <!-- ...

  8. 读书笔记汇总 - SQL必知必会(第4版)

    本系列记录并分享学习SQL的过程,主要内容为SQL的基础概念及练习过程. 书目信息 中文名:<SQL必知必会(第4版)> 英文名:<Sams Teach Yourself SQL i ...

  9. 2014年暑假c#学习笔记目录

    2014年暑假c#学习笔记 一.C#编程基础 1. c#编程基础之枚举 2. c#编程基础之函数可变参数 3. c#编程基础之字符串基础 4. c#编程基础之字符串函数 5.c#编程基础之ref.ou ...

随机推荐

  1. aspectj xml

    1.接口和类 1.1 ISomeService 接口 public interface ISomeService { public void doSome(); public void dade(); ...

  2. react-native入门学习( 一 )

    开发环境配置 因为个人电脑是windows7环境,所以在选择安装react-native 环境的时候是用的 windows+androidreact-native中文网文档地址  https://re ...

  3. Hibernate框架关系映射一对多双向关联

    直入主题,首先大配置常规配置, 这里住要说关联关系,大配置不多少,而且jar包默认添加好,笔者用的是idea2016. 然后我们知道关联关系主要是在小配置添加节点来配置属性.个人认为关联映射,就是对应 ...

  4. Objective-C Protocols

    Objective-C allows you to define protocols, which declare the methods expected to be used for a part ...

  5. 关于Retrofit + RxJava 的使用

    年前一个月到现在,一直都在忙一个项目.项目使用的三方框架还是蛮多的. 下面来总结一下自己使用Retrofit + RxJava的知识点吧. (以下讲述从一个请求的最初开始) 1.首先定义一个RxMan ...

  6. LR常用函数汇总

    lr_start_transaction为性能分析标记事务的开始 lr_end_transaction为性能分析标记事务的结束 lr_rendezvous在 Vuser 脚本中设置集合点 lr_thi ...

  7. OPENFIRE 启动流程

    在java>org>jivesoftware>openfire>starter,该类中的main方法启动,有图为证: 在start中方法分别调用unpackArchives和f ...

  8. 在ABAP里模拟实现Java Spring的依赖注入

    Dependency Injection- 依赖注入,在Java Spring框架中有着广泛地应用.通过依赖注入,我们不必在应用代码里繁琐地初始化依赖的资源,非常方便. 那么ABAP能否从语言层面上也 ...

  9. App Store上的开源应用汇总

    以下是互联网上主要的开源iOS应用的列表,在学习的时候,多看看完成的功能代码可以给我们带来很多经验,但是除了Apple官方提供的Sample Code之外,我们很难找到优质的开源项目代码,所以我搜集了 ...

  10. kmp 模板

    #include<stdio.h> #include<stdlib.h> #include<string.h> #include<algorithm> ...