OpenSCAD教程之"创建基本2D物体" | OpenSCAD tutorial -- Create 2D primitives

in #utopian-io7 years ago (edited)

Summary: OpenSCAD (version 2015.03-2) is the open source software for creating solid 3D CAD models. It is available for Linux/UNIX, Windows and Mac OS X, and it is a programming Solid CAD Modeller. In this tutorial I will show you how to create 2D Primitives.
The 2D Primitives include circle, square, polygon and text, let's start...

1)circle(圆形):

语法如下,以指定半径或者直径的方式创建:

circle(r=radius | d=diameter);

指定半径创建:

图片.png

指定直径创建:

图片.png

配合内置参数$fn,可以创建正多边形:

等边三角形:

图片.png

正方形:

图片.png

正六边形:

图片.png

配合函数resize和scale可以创建椭圆:

图片.png

图片.png

2)square(矩形)

语法如下:

square(size = [x, y], center = true/false);
square(size = x , center = true/false);

创建中心在原点的长方形:

图片.png

创建中心不在原点的长方形:

图片.png

创建中心在原点的正方形:

图片.png

创建中心不在原点的正方形:

图片.png

3)polygon(多边形):

语法如下,points指定顶点,paths指定顶点的索引顺序

polygon(points = [ [x, y], ... ], paths = [ [p1, p2, p3..], ...], convexity = N);

创建平行四边形:

图片.png

创建一个内部有空洞的三角形:

图片.png

创建内部有许多空洞的平行四边形:

图片.png

4)text(文字):

语法如下:

text("text", parameters=...);

Parameters:
text ,要创建的文字
size ,文字的大小,缺省是10
font ,字体
halign ,水平对齐方式, 缺省是 "left",可取值"left", "center" 和"right".
valign ,垂直对齐方式,缺省是“baseline”,可取值"top", "center", "baseline" and "bottom".
spacing ,文字间距,缺省是1
direction,文字方向,缺省是“ltr”,可取值"ltr" (left-to-right), "rtl" (right-to-left), "ttb" (top-to-bottom) and "btt" (bottom-to-top).
language,文字语言,缺省是“en”
script,解析文字的脚本,缺省是"latin"

例如:

图片.png

配合linear_extrude可以创建3D文字:

图片.png



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved because it does not follow the Utopian Rules.

Your tutorial is far too trivial for us to accept.

You can contact us on Discord.
[utopian-moderator]