openscad 3Dmodels 笔记
参考链接
如何快速上手
打开openSCAD后界面如下:

选择其中的examples,从basic看起。配合官方文档中的first step部分,和官方文档——代码写法即可很快上手。
概述
- 默认界面左边是代码,右边是预览图
- Ctrl + D 可注释选中行(从edit菜单栏中得知)
- 以下按钮预览(鼠标停留可显示文字preview)

命令
几何体
cube(10); //边长为10的正方体,锚点在其一角
cube([2,3,4]); //长宽高分别为2,3,4的长方体,锚点在其一角
cube(15, center=true); //边长为15的正方体,锚点在其中心
sphere(10); //半径为10的球体
polygon( points=[[0,0],[8,4],[4,8],[4,12],[12,16],[0,20]] ); //这几个点顺次连接构成的几何体
几何变换
translate([-24,0,0]) //平移
union() //并
intersection //交
difference() // 差
hull() //凸包,详情请百度
例子:

linear Extrude
linear_extrude(
height = fanwidth,
center = true,
convexity = 10,
twist = -fanrot,
slices = 20,
scale = 1.0,
$fn = 16) {...}
minkowski() (倒角,圆角,bevel)
例一:minkowski()直接用于三维物体
height = 10;
length = 10;
width = 20;
bevelRadius = 2;
$fn=50;
cube([length-2*bevelRadius, width-2*bevelRadius,height]);
cylinder(r=bevelRadius,h=height);
translate([20,0,0])
minkowski()
{
cube([length-2*bevelRadius, width-2*bevelRadius,height/2]);
cylinder(r=bevelRadius,h=height/2);
}



例二:minkowski()用于二维物体(之后可以叠加linear Extrude)
height = 10;
length = 10;
width = 20;
bevelRadius = 2;
linear_extrude(height = height)
square([length-2*bevelRadius, width-2*bevelRadius]);
linear_extrude(height = height)
circle(r=bevelRadius);
$fn=50;
translate([20,0,0])
linear_extrude(height = height)
minkowski()
{
square([length-2*bevelRadius, width-2*bevelRadius]);
circle(r=bevelRadius);
}
效果和例一相同
projection()
projection(cut = true)
import("projection.stl");
rotate_extrude()
绕z轴旋转360°
文字
text(letter,
size=size*22/30,
font="Bitstream Vera Sans",
halign="center",
valign="center");
echo(字符串变量);
会在右边控制台console中第三行左右显示

导入其他文件
import("xxx.stl");
import("projection.stl"); //
use <xxx.scad>
use <logo.scad> //Imports the Logo() module from logo.scad into this namespace
Logo();
特殊显示(透明与高亮)
cube(15,center = true);
translate([0, 0, 20]){
%cube(15,center = true); //% 是透明
}
translate([0, 0, -20]){
#cube(15,center = true); //#是高亮
}
效果如图:

特殊变量
分辨率:$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 笔记的更多相关文章
- git-简单流程(学习笔记)
这是阅读廖雪峰的官方网站的笔记,用于自己以后回看 1.进入项目文件夹 初始化一个Git仓库,使用git init命令. 添加文件到Git仓库,分两步: 第一步,使用命令git add <file ...
- js学习笔记:webpack基础入门(一)
之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...
- SQL Server技术内幕笔记合集
SQL Server技术内幕笔记合集 发这一篇文章主要是方便大家找到我的笔记入口,方便大家o(∩_∩)o Microsoft SQL Server 6.5 技术内幕 笔记http://www.cnbl ...
- PHP-自定义模板-学习笔记
1. 开始 这几天,看了李炎恢老师的<PHP第二季度视频>中的“章节7:创建TPL自定义模板”,做一个学习笔记,通过绘制架构图.UML类图和思维导图,来对加深理解. 2. 整体架构图 ...
- PHP-会员登录与注册例子解析-学习笔记
1.开始 最近开始学习李炎恢老师的<PHP第二季度视频>中的“章节5:使用OOP注册会员”,做一个学习笔记,通过绘制基本页面流程和UML类图,来对加深理解. 2.基本页面流程 3.通过UM ...
- NET Core-学习笔记(三)
这里将要和大家分享的是学习总结第三篇:首先感慨一下这周跟随netcore官网学习是遇到的一些问题: a.官网的英文版教程使用的部分nuget包和我当时安装的最新包版本不一致,所以没法按照教材上给出的列 ...
- springMVC学习笔记--知识点总结1
以下是学习springmvc框架时的笔记整理: 结果跳转方式 1.设置ModelAndView,根据view的名称,和视图渲染器跳转到指定的页面. 比如jsp的视图渲染器是如下配置的: <!-- ...
- 读书笔记汇总 - SQL必知必会(第4版)
本系列记录并分享学习SQL的过程,主要内容为SQL的基础概念及练习过程. 书目信息 中文名:<SQL必知必会(第4版)> 英文名:<Sams Teach Yourself SQL i ...
- 2014年暑假c#学习笔记目录
2014年暑假c#学习笔记 一.C#编程基础 1. c#编程基础之枚举 2. c#编程基础之函数可变参数 3. c#编程基础之字符串基础 4. c#编程基础之字符串函数 5.c#编程基础之ref.ou ...
随机推荐
- toLua学习
toLua学习通用的过程//开始LuaState lua = new LuaState();lua.Start();--在这个位置插入lua的具体操作--//结束lua.CheckTop();lua. ...
- php pack、unpack、ord 函数使用方法(二进制流接口应用实例)
在工作中,我也逐渐了解到pack,unpack,ord对于二进制字节处理的强大. 下面我逐一介绍它们.在我们工作中,用到它们的估计不多. 我在最近一个工作中,因为通讯需要用到二进制流,然后接口用php ...
- node项目 Error: Cannot find module 'mongoose'
这是因为你部署的项目没有添加mongoose,使用 在自己项目的根目录下:npm install mongoose --save
- systemback-----做你折腾的后盾
http://imcn.me/html/y2015/24421.html ubuntu的系统还原工具,最近在学习grunt,要安装nodejs 等一些依赖,对于有轻微系统洁癖的我来说是个好的解决方案, ...
- JAVA设计模式之观察者模式 - Observer
有趣的事情发生时,可千万别错过了!有一个模式可以帮你的对象知悉现况,不会错过该对象感兴趣的事.对象甚至在运行时可决定是否要继续被通知.有了观察者,你将会消息灵通. 介绍 观察者模式的定义: 在对象之间 ...
- poj2823滑动窗口
这个是单调队列的入门题目.值得注意的一点是队列中的数的index是单调递增的,所以从队首删除的时候从前向后循环找到第一个index满足>= i - k + 1条件的元素作为队首元素就可以了,这也 ...
- 图片压缩(pc端和移动端都适用)
最近在做移动端遇到了一个问题就是: 手机拍照后,图片过大如果上传到服务器务必会浪费带宽,最重要的是流量啊 别慌,好事儿来了,务必就会有人去研究研究图片的压缩: 鄙人结合前人的经验,结合自己实战,总结出 ...
- win7下如何解决协议适配器错误问题
数据库为oracle 11g,在cmd中使用sqlplus命令出现了“协议适配器错误”. 原因分析:oracle相关服务没有启动. 解决办法如下: step1:进入服务页面. 方法一:cmd → se ...
- vba 时间
Sub tt1() Dim d1, d2 As Date d1 = #//# d2 = #//# Debug.Print "相隔" & (d2 - d1) & &q ...
- 二、pandas入门
import numpy as np import pandas as pd Series: #创建Series方法1 s1=pd.Series([1,2,3,4]) s1 # 0 1 # 1 2 # ...