Модуль OpenSCAD

From FreeCAD Documentation
Jump to navigation Jump to search
This page is a translated version of the page OpenSCAD Module and the translation is 25% complete.
Outdated translations are marked like this.
Other languages:
Bahasa Indonesia • ‎Deutsch • ‎English • ‎Türkçe • ‎español • ‎français • ‎hrvatski • ‎italiano • ‎polski • ‎português • ‎português do Brasil • ‎română • ‎svenska • ‎čeština • ‎русский • ‎中文 • ‎中文(中国大陆)‎ • ‎中文(台灣)‎
Arrow-left.svg Workbench Mesh.svg Mesh Module Назад:
Далее: Part Module Workbench Part.svg Arrow-right.svg
OpenSCAD workbench icon


The Workbench OpenSCAD.svg OpenSCAD Workbench is intended to offer interoperability with the open source software OpenSCAD. This program is not distributed as part of FreeCAD, but should be installed to make full use of this workbench. OpenSCAD should not be confused with OpenCASCADE, which is the geometrical kernel that FreeCAD uses to build geometry on screen. The OpenCASCADE libraries are always needed to use FreeCAD, while the OpenSCAD executable is entirely optional.

It contains a CSG importer to open the CSG files from OpenSCAD, and an exporter to output a CSG based tree. Geometry which is not based on CSG operations will be exported as a mesh.

This workbench contains functions to modify the CSG feature tree and repair models. It also contains general purpose tools that do not require installation of OpenSCAD; they can be used in conjunction with other workbenches. For example, the Mesh Workbench internally uses the OpenSCAD functions to perform operations with meshes, as they are quite robust.



In FreeCAD 0.19, the Ply (Python-Lex-Yacc) module, which is used to import CSG files, was removed from the FreeCAD source code, as it is a third party library not developed by FreeCAD. As a result, you now need to install Ply before using the OpenSCAD Workbench. When using a pre-packaged, stable version of FreeCAD this dependency should be installed automatically in all platforms; in other cases, for example, when compiling from source, you may have to install it from an online repository.

In Debian/Ubuntu based systems this is done like this.

sudo apt install python3-ply

The general installation in all platforms can be done from the Python package index.

pip3 install --user ply

OpenSCAD language and file format

The OpenSCAD language allows the use of variables and loops. It allows you to specify sub-modules to reuse geometry and code. This high degree of flexibility makes parsing very complex. Currently the OpenSCAD Workbench cannot handle the OpenSCAD language natively. Instead, if OpenSCAD is installed, it can be used to convert the input to the CSG format, which is a subset of the OpenSCAD language, and can be used as the input to OpenSCAD for further processing. During conversion all parametric behavior is lost, meaning that all variable names are discarded, loops expanded, and mathematical expressions evaluated.


  • OpenSCAD ColorCodeShape.svg Color Code Shape: Изменить цвет всех или выбранных поверхностей относительно их годности.
  • OpenSCAD ReplaceObject.svg Заменить объект: Заменить объект в древе компонентов.
  • OpenSCAD RemoveSubtree.svg Удалить объекты вместе с их потомками: Удаляет выбранные объекты и их потомки, на которые не ссылаются друге объекты.
  • OpenSCAD RefineShapeFeature.svg Улучшить свойство фигуры: Создаёт объект, очищенный от лишних линий.
  • OpenSCAD IncreaseToleranceFeature.svg Increase Tolerance Feature: Увеличивает допуски для ребер/граней/вершины выбранного объекта (ов).
  • OpenSCAD Edgestofaces.png Преобразовать грани в поверхности: Преобразование краёв в грани. Полезно при подготовке к выдавливанию геометрии, импортированной из DXF.
  • OpenSCAD ExpandPlacements.png Развернуть: Раскрывает все расположения вниз по древу.
  • OpenSCAD ExplodeGroup.png Расчленить Группу: Разрывает объединённые примитивы на составляющие.
  • OpenSCAD AddOpenSCADElement.png Add OpenSCAD Element: Добавляет элемент OpenSCAD внедрением кода OpenSCAD в панель задач (требует установленного OpenSCAD).
  • OpenSCAD MeshBoolean.png Mesh Boolean: Создаёт новый полигональный объект бинарными операциями из форм.
  • OpenSCAD Hull.svg Hull: Применяет операцию Convex Hull (создание выпуклой оболочки) к выбранным формам.
  • OpenSCAD Minkowski.svg Minkowski: Применяет суммы Минковского к выбранным формам.


  • Std DlgParameter.svg Preferences: настройки, доступные для инструментов OpenSCAD.


OpenSCAD creates constructive solid geometry, as well as imports mesh files and extrudes 2D geometry from DXF files. FreeCAD allows you to create CSG with primitives as well. The FreeCAD geometry kernel (OCCT) works using a boundary representation. Therefore conversion from CSG to BREP should, in theory, be possible whereas conversion from BREP to CSG is, in general, not.

OpenSCAD works internally on meshes. Some operations which are useful on meshes are not meaningful on a BREP model and can not be fully supported. Among these are convex hull, minkowski sum, glide and subdiv. Currently we run the OpenSCAD binary in order to perform hull and minkwoski operations and import the result. This means that the involved geometry will be triangulated. In OpenSCAD non-uniform scaling is often used, which does not impose any problems when using meshes. In our geometry kernel geometric primitives (lines, circular sections, etc) are converted to BSpline prior to performing such deformations. Those BSplines are known to cause trouble in later boolean operations. An automatic solution is not available at the moment. Please feel free to post to the forum if you encounter such problems. Often such problems can be solved be remodeling small parts. A deformation of a cylinder can substituted by an extrusion of an ellipses.


When importing DXF set the Draft precision to a sensible amount as this will affect the detection of connected edges.

If FreeCAD crashes when importing CSG, it is strongly recommended that you enable "automatically check model after boolean operation" in Menu → Edit → Preferences → Part Design → Model setting.



Arrow-left.svg Workbench Mesh.svg Mesh Module Назад:
Далее: Part Module Workbench Part.svg Arrow-right.svg