OpenSCAD用户手册/OpenSCAD用户界面

维基教科书,自由的教学读本
跳到导航 跳到搜索

用户界面[编辑]

OpenSCAD的主视窗界面中显示一段小程序生成OpenSCAD的Logo。

用户界面分为三部分内容:

  • 可视区域
  • 命令行窗口
  • 文本编辑器

显示区域[编辑]

预览和渲染效果输出到视图显示区。通过使用 Show Axes 菜单进入相应选项,来设定坐标轴是否启用。

控制台窗口[编辑]

在控制台窗口中显示状态信息、警告和错误。

文本编辑器[编辑]

内置的文本编辑器提供了基本的编辑功能,如文本搜索和替换,也支持语法高亮。在首选项对话框中可以选择预定义的颜色方案。

OpenSCAD Find Dialog
OpenSCAD Replace Dialog
OpenSCAD Editor with Find / Replace functionality.


视图导航[编辑]

视图区导航主要使用鼠标操作:

动作 图示 说明
旋转视图 Farm-Fresh mouse select left.png 以鼠标左键拖动,可使视图绕窗口的两条中轴(译者注:即视图窗口的横竖两条中线)旋转。其中,竖轴(译者注:即视图窗口的竖中线)保持方向不变(译者注:因为没有绕垂直于屏幕的那条轴旋转)。
⇧ Shift + Farm-Fresh mouse select left.png 按下 shift 键的同时以鼠标左键拖动,可使视图绕竖轴与垂直屏幕的轴旋转。
移动视图区域 Farm-Fresh mouse select right.png 以鼠标右键拖动可移动视图区域。
缩放 Mouse wheel up.svgMouse wheel down.svg 拨动滚轮即可缩放
Farm-Fresh mouse select scroll.png 以鼠标中键拖动(译者注:可改变旋转中点的距离,即旋转中心点深入屏幕还是突出屏幕更靠近用户)
⇧ Shift + Farm-Fresh mouse select right.png 按下 shift 键的同时以鼠标左键或鼠标中键拖动
⇧ Shift + Farm-Fresh mouse select scroll.png
+ and - 按键 +-
旋转复位 Ctrl+0 旋转可用快捷键 Ctrl+0 复位
移动复位 Ctrl+P 移动可用快捷键 Ctrl+P 复位

视图设置[编辑]

使用View菜单可配置显示区域不同的渲染方法及以及其他的配置。这里所描述的大多数选项都可以使用快捷方式。

渲染模式[编辑]

OpenCSG (F9)[编辑]

这种方法能够快速产生结果,但应用于高度非凸对象时帧速率较低。

需要注意的是,选择OpenCSG模式使用F9切换到最后生成的OpenCSG视图,但不会重新处理源代码。你以使用 '“Compile”‘ 功能(F5,在“Design”菜单中)重新处理源代码,建立OpenCSG对象并切换OpenCSG视图。

实现细节[编辑]

在OpenCSG模式下,使用OpenCSG 库产生可见的模型。该库采用先进的OpenGL的功能特性(2.0)例如Z缓冲,不需要确定的网格计算结果 —— 他跟踪对象如何被组合。例如,当渲染立方体中的一个凹陷,它会在图形卡中先绘制立方体,然后再渲染凹面,他并非使用Z缓冲区的 hide 功能处理立方体覆盖的部分球体,而是将呈现 only 的那部分球体,从而在视觉上产生一个球形凹陷的立方体。

CGAL (表面/栅格, F10/F11)[编辑]

这种方法第一次渲染时需要一些时间,但是首次渲染完成后(移动或旋转等操作时)帧率更高。

正如前面运用 OpenCSG 一样,F10 和 F11 快捷键只是准许 CGAL 显示模式但并未更新当前的对象。要真正用 CGAL 渲染,请用Compile and Render(编译并渲染)功能(快捷键 F6,在Design(设计)菜单项下)。

To combine the benefits of those two display methods, you can selectively wrap parts of your program in a render function and force them to be baken into a mesh even with OpenCSG mode enabled.

实现细节[编辑]

The acronym CGAL refers to The Open Source Computational Geometry Algorithms Library.

In CGAL mode, the CGAL library is used to compute the mesh of the root object, which is then displayed using simple OpenGL.

视图选项[编辑]

显示边缘 (Ctrl+1)[编辑]

The difference between the CGAL and OpenCSG approaches can be seen at edges created by boolean operations.

If Show Edges is enabled, both OpenCSG and CGAL mode will render edges as well as faces, CGAL will even show vertices. In CGAL grid mode, this option has no effect.

Enabling this option shows the difference between OpenCSG and CGAL quite clearly: While in CGAL mode you see an edge drawn everywhere it "belongs", OpenCSG will not show edges resulting from boolean operations – this is because they were never explicitly calculated but are just where one object's Z clipping begins or ends.

显示坐标轴 (Ctrl+2)[编辑]

If Show Axes is enabled, the origin of the global coordinate system will be indicated by an orthogonal axes indicator. Additionally, a smaller axes indicator with axes names will be shown in the lower left corner of the viewing area. The smaller axes indicator is marked x, y, z and coloured red, green, blue respectively.

显示十字标线 (Ctrl+3)[编辑]

If Show Crosshairs is enabled, the center of the viewport will be indicated by four lines pointing in the room diagonal directions of the global coordinate system. This is useful when aligning the viewing area to a particular point in the model to keep it centered on screen during rotation.

动态显示[编辑]

The Animate option adds an animation bar to the lower edge of the screen. As soon as FPS and Steps are set (reasonable values to begin with are 10 and 100, respectively), the current Time is incremented by 1/Steps, FPS times per second, until it reaches 1, when it wraps back to 0.

Every time Time is changed, the program is re-evaluated with the variable $t set to the current time. Read more about how $t is used in section Other_Language_Features

显示对齐[编辑]

The menu items Top, Bottom, …, Diagonal and Center (Ctrl+4, Ctrl+5, …, Ctrl+0, Ctrl+P) align the view to the global coordinate system.

Top, Bottom, Left, Right, Front and Back align it in parallel to the axes, the Diagonal option aligns it diagonally as it is aligned when OpenSCAD starts.

The Center option will put the coordinate center in the middle of the screen (but not rotate the view).

By default, the view is in Perspective mode, meaning that distances far away from the viewer will look shorter, as it is common with eyes or cameras. When the view mode is changed to Orthogonal, visible distances will not depend on the camera distance (the view will simulate a camera in infinite distance with infinite focal length). This is especially useful in combination with the Top etc. options described above, as this will result in a 2D image similar to what one would see in an engineering drawing.