OpenSCAD教程之"创建基本3D物体" | OpenSCAD tutorial -- Create Primitive Solids

in #utopian-io6 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 3D CAD Modeller. In this tutorial I will show you how to create Primitive Solids.
The Primitive Solids include cube, sphere, cylinder and polyhedron, let's start...

1)方块(cube)

创建方块有2中语法,如下:
cube(size = [x,y,z], center = true/false);
cube(size = x , center = true/false);

size指定方块的边长,center指定正方体的中心是否位于座标原点。如下图:

1.1)创建正方体:cube(size = x , center = true/false);

图片.png

图片.png

1.2)创建边长不一样的长方体:cube(size = [x,y,z], center = true/false);

图片.png

图片.png

2)球体(sphere)

创建球体可以指定半径或者直径,语法如下:
sphere(r = x);
sphere(d = x);

指定半径创建:
图片.png

指定直径创建:
图片.png

3)圆柱(锥,台)体(cylinder)

语法如下,当r1=r2的时候,是圆柱体;r1或者r2一个为0的时候是圆锥体;r1和r2都不为0,并且不相等的时候为圆台体;center指定物体的中心是否位于座标原点。

cylinder(h = height, r1 = BottomRadius, r2 = TopRadius, center = true/false);

圆柱体:

图片.png

图片.png

圆锥体:

图片.png

图片.png

图片.png

图片.png

圆台体:

图片.png

图片.png

图片.png

图片.png

通过指定内置参数$fn的数值,可以创建棱柱,棱锥和棱台体:

图片.png

图片.png

图片.png

4)多面体(polyhedron)

语法如下,points指定多面体的顶点座标集,faces指定多面体每个面上顶点的索引,convexity指定在预览模式下与射线相交的最大面数。

polyhedron( points = [ [X0, Y0, Z0], [X1, Y1, Z1], ... ], faces = [ [P0, P1, P2, P3, ...], ... ], convexity = N);

比如下面用多面体的方法创建长方体:

图片.png

图片.png



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Hey @azcax I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • This is your first accepted contribution here in Utopian. Welcome!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Thank you for the contribution. It has been approved.

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