参考链接

官方文档

官方文档之——代码

如何快速上手

打开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用法

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 笔记的更多相关文章

  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. vi编辑器查找

    当你用vi打开一个文件后,因为文件太长,如何才能找到你所要查找的关键字呢? 你在命令模式下敲斜杆( / )这时在状态栏(也就是屏幕左下脚)就出现了 “/” 然后输入你要查找的关键字敲回车就可以了. 如 ...

  2. Codeigniter CI 框架的一些优化思考

    前段时间使用CI做了两个小项目,对CI的流程和设计理念也有了一些新的认识.CI架构的一些基本优化这里就不做介绍了,如搬离system 文件夹等. 最近有一个稍微大一点的系统,也准备拿CI来做.设计时遇 ...

  3. 实战:mysql写存储过程并定时调用

    有表:cap_meter_detail 字段:recordtime 情景:recordtime每半个小时记录一次,故一天会产生很很多数据,我们要做的是,每天00:00:00对cap_meter_det ...

  4. ubuntu 文件解压命令

    [解压.zip文件] unzip ./FileName.zip //前提是安装了unzip 安装unzip命令:sudo apt-get install unzip 卸载unzip软件 命令:sudo ...

  5. lnmp.org + phpstorm + xdebug

    lnmp.org下载安装包安装之: lnmp是个集成安装包,就不用自己在配置lnmp环境 安装phpstorm,破解方法:注册服务器为http://idea.lanyus.com 就可以了 xdebu ...

  6. JSP界面设置提示浮动框

    1.公共js <script type="text/javascript"> var tip={ $:function(ele){ if(typeof(ele)==&q ...

  7. Caused by: javax.el.PropertyNotFoundException: Property 'title' not found on type java.lang.String

    问题:在JSP页面显示从后台传过来的list集合数据报错. 错误信息: Caused by: javax.el.PropertyNotFoundException: Property 'title' ...

  8. ssh复制remote

    rsync rsync localdirectory username@10.211.55.4:/home/username/Downloads/localdirectory -r

  9. Codeforces Round #318 (Div. 2) B Bear and Three Musketeers (暴力)

    算一下复杂度.发现可以直接暴.对于u枚举a和b,判断一下是否连边,更新答案. #include<bits/stdc++.h> using namespace std; int n,m; ; ...

  10. DP一直是自己的弱势 开始练滚动数组——HDOJ4502

    http://acm.hdu.edu.cn/showproblem.php?pid=4502//题目链接 思路 : dp[i]表示 到第i天能获得的最大工资  依次更新 #include<cst ...