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 ...
随机推荐
- 用户会话跟踪机制(session+cookie)
最近在优化之前给学校写的一个项目,发现了同一个浏览器(IE,Firefox)开多个选项卡的时候不能登录多个用户,后一个登录用户会把前一个用户给覆盖了,我的登录逻辑是把user对象存放到session中 ...
- HDU4035 Maze(期望DP)
题意 抄袭自https://www.cnblogs.com/Paul-Guderian/p/7624039.html 有n个房间,由n-1条隧道连通起来,形成一棵树,从结点1出发,开始走,在每个结点i ...
- mysql查询问题
需求:根据选择不同的分类id,查找到同时属于选中的分类的文章id sql语句: select result,GROUP_CONCAT(category_id) from (select categor ...
- IE和火狐下的iframe刷新
前面使用了前端上传插件plupload,在谷歌浏览器中运行完全没问题,但是在IE和火狐下就出现当文档加载完成之后,该文件上传的iframe插件的上传按钮点击无效,当对上传的文件进行一次删除之后,按钮就 ...
- arcgis jsapi接口入门系列(8):鼠标在地图画面
初始化,每个map执行一次 PS:画点也差不多,都是用SketchViewModel,因此本demo没有专门写画点的 drawPolygonInit: function () { //画几何对象初始化 ...
- Android 实现九宫格、点击图片放大全屏浏览等
项目GitHub地址https://github.com/tikeyc/TNinePlaceGridView_Android https://github.com/tikeyc/TikeycAndro ...
- viewpager的使用-新方法 5.1
效果图: 添加依赖包: compile ‘com.android.support:design:22.2.0‘ 布局文件: <?xml version="1.0" encod ...
- ios has denied the launch request.
ios has denied the launch request. You can choose either of the two ways. Solution 1: Open System Pr ...
- [转+补]Android打包so后魅族5中安装运行崩溃问题的解决方法
上周在做噪音检测so集成中,遇到不同的so库打包到 APK 时,安装在某些机器上,出现 java.lang.UnsatisfiedLinkError 加载失败. 为此,深究了一下原理,和给出了解决方案 ...
- LeetCode Add and Search Word - Data structure design (trie树)
题意:实现添加单词和查找单词的作用,即实现字典功能. 思路:'.' 可以代表一个任何小写字母,可能是".abc"或者"a.bc"或者"abc.&quo ...