Power users hub/zh-cn: Difference between revisions
Johnquicker (talk | contribs) (Created page with "== 定制FreeCAD ==") |
(Updating to match new version of source page) |
||
(42 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> |
<languages/> |
||
{{TOCright}} |
|||
[[Image:Power_user_hub.png|64px]] |
|||
---- |
|||
<div class="mw-translate-fuzzy"> |
|||
[[Image:Crystal_Clear_app_terminal.png|right|150]] |
|||
如果你想深入理解FreeCAD,这里就是你该来的地方。你能学到如何为你的需求定制FreeCAD。 |
|||
</div> |
|||
如果你想深入理解FreeCAD,这里就是你该来的地方。你能学到如何为你的需求定制FreeCAD。 |
|||
这些页面还远没有成熟。如果你没找到你要找的信息,或者你在别的地方发现了有用的信息,而我们没有链接在这里,那为什么不[[Help_FreeCAD|自己添加进来]]?同时,请在[http://forum.freecadweb.org/ 论坛]留下你的意见。 |
|||
<div class="mw-translate-fuzzy"> |
|||
FreeCAD最秒的好处之一,就是它给你的灵活性。你不需要作任何编译,不需要接触源代码,就可以写脚本,就可以作扩展,可触范围极广。所有的脚本都用[http://en.wikipedia.org/wiki/Python_(programming_language) Python]完成。它是一门强大而简洁的编程语言。有了简洁的Python脚本,你有权触及FreeCAD的任何部分。比如说,你可以: |
FreeCAD最秒的好处之一,就是它给你的灵活性。你不需要作任何编译,不需要接触源代码,就可以写脚本,就可以作扩展,可触范围极广。所有的脚本都用[http://en.wikipedia.org/wiki/Python_(programming_language) Python]完成。它是一门强大而简洁的编程语言。有了简洁的Python脚本,你有权触及FreeCAD的任何部分。比如说,你可以: |
||
* '''创建和修改几何体''':有没有这种情况?你需要的特殊对象,没有出现在FreeCAD的默认安装包里?你可以轻松创建一个新对象类型,既可以写脚本,也可以调配一个已有的类型。 |
* '''创建和修改几何体''':有没有这种情况?你需要的特殊对象,没有出现在FreeCAD的默认安装包里?你可以轻松创建一个新对象类型,既可以写脚本,也可以调配一个已有的类型。 |
||
Line 12: | Line 14: | ||
* '''修改界面''':FreeCAD的用户界面还处于十分基础的阶段。但是如果你要有所扩展,工具都给你准备好了。比如说,你可以创建一个工具条,把你的工具都放进去;你也可以创建一个特殊面板,用来与你的工具互动,诸如此类。 |
* '''修改界面''':FreeCAD的用户界面还处于十分基础的阶段。但是如果你要有所扩展,工具都给你准备好了。比如说,你可以创建一个工具条,把你的工具都放进去;你也可以创建一个特殊面板,用来与你的工具互动,诸如此类。 |
||
* '''修改场景表现''':建立和计算几何体,在屏幕上显示那个几何体,这件事在FreeCAD里有不同的流程来处理。场景元素显示在屏幕上的方式,你对此有完全控制权。所以,你可以修改那个表现,与它交互,或者加入各种各样的定制行为和屏幕组件。举几个例子,信息、拖拽、锚定或者暂时实体。 |
* '''修改场景表现''':建立和计算几何体,在屏幕上显示那个几何体,这件事在FreeCAD里有不同的流程来处理。场景元素显示在屏幕上的方式,你对此有完全控制权。所以,你可以修改那个表现,与它交互,或者加入各种各样的定制行为和屏幕组件。举几个例子,信息、拖拽、锚定或者暂时实体。 |
||
</div> |
|||
<div class="mw-translate-fuzzy"> |
|||
这些页面还远没有成熟。如果你没找到你要找的信息,或者你在别的地方发现了有用的信息,而我们没有链接在这里,那为什么不[[Help_FreeCAD|自己添加进来]]?同时,请在[http://forum.freecadweb.org/ 论坛]留下你的意见。 |
|||
</div> |
|||
<span id="Customizing_FreeCAD"></span> |
|||
== 定制FreeCAD == |
== 定制FreeCAD == |
||
<div class="mw-translate-fuzzy"> |
|||
* [[Interface Customization]]: Starting with the beginning: Toolbars and shortcuts |
|||
* [[Interface Customization|界面定制]]: 从头开始:工具栏和快捷方式 |
|||
* [[Macros|Working with Macros]]: Easily record often repeated tasks or Python code |
|||
* [[Macros|用宏工作]]: 轻松录制多遍任务或Python代码 |
|||
* [[Macros_recipes|Macros recipes]] |
|||
* [[Macros_recipes|宏菜单]] |
|||
* [[Customize_Toolbars|Customize Toolbars]] |
|||
* [[Customize_Toolbars|定制工具栏]] |
|||
* [[Installing_more_workbenches|Installing more workbenches]] |
|||
* [[Installing_more_workbenches|安装更多工作台]] |
|||
* [http://forum.freecadweb.org/viewtopic.php?t=10556 Plugin Loader] |
|||
* [http://forum.freecadweb.org/viewtopic.php?t=10556 插件装载器] |
|||
* [https://github.com/FreeCAD/FreeCAD-addons Addons installer.FCMacro] |
* [https://github.com/FreeCAD/FreeCAD-addons Addons installer.FCMacro] |
||
</div> |
|||
<span id="Scripting_in_FreeCAD"></span> |
|||
== Scripting in FreeCAD == |
|||
== 在FreeCAD里写脚本 == |
|||
===General=== |
===General=== |
||
* [[Introduction to Python]] - See also other Python tutorials at the bottom of this page |
|||
* [[Python scripting tutorial|FreeCAD scripting tutorial]] - A general look at python scripting in FreeCAD |
|||
* [[FreeCAD Scripting Basics]]: Well, the basics... |
|||
* [[Gui Command]] : Adding custom commands to the GUI |
|||
* Using mixed [[Units]] in FreeCAD |
|||
<div class="mw-translate-fuzzy"> |
|||
=== Modules === |
|||
===通则=== |
|||
* [[Introduction to Python | 介绍Python]] - 在页面底端还有其他Python教程。 |
|||
* [[Python scripting tutorial|FreeCAD脚本教程]] - 概略看一下在FreeCAD中用Python写脚本。 |
|||
* [[FreeCAD Scripting Basics|FreeCAD脚本基础]] - 好吧,基本的东西…… |
|||
* [[Gui Command|Gui命令]] - 向GUI添加定制的命令。 |
|||
* 在FreeCAD里使用混合[[Units|单位]]。 |
|||
</div> |
|||
<span id="Modules"></span> |
|||
As the functionality of FreeCAD is separated in Modules which deal with special data types and applications. FreeCAD has built-in modules and Extension Modules (plug-ins). Once plugin modules are installed, they become availible to you as easily as the built-in modules. The modules described below are the default modules, includeed in every FreeCAD installation. |
|||
=== 模块 === |
|||
<div class="mw-translate-fuzzy"> |
|||
* The [[Builtin modules]] are the principal FreeCAD modules. They contain tools for manipulating general FreeCAD configurations, documents and their contents. |
|||
在FreeCAD中,功能性的东西被划分到各个模块,处理特定的数据类型和应用。FreeCAD有内建模块和扩展模块(插件)。插件模块一旦安装,它们就和内建模块一样方便触达。下面讲的是默认模块,FreeCAD的每一个安装包都包含了。 |
|||
* [[Workbench creation]] shows you how to create your own workbench |
|||
</div> |
|||
<div class="mw-translate-fuzzy"> |
|||
===Working with Meshes=== |
|||
* [[Builtin modules|内建模块]]是FreeCAD的主体模块。里面的工具,可以调整FreeCAD的一般配置、文档和内容。 |
|||
* [[Mesh Scripting]]: How to interact with the [[Mesh Module]] |
|||
* [[Workbench creation|创建工作台]]展示给你如何创建自己的工作台。 |
|||
</div> |
|||
===Working with |
====Working with Meshes==== |
||
* [[Part Module|The Part Module]]: How [http://en.wikipedia.org/wiki/Open_CASCADE Open CASCADE Technology] tools and structure is used in FreeCAD |
|||
* [[Topological data scripting]]: How to interact with the Part Module |
|||
* [[PythonOCC]]: How to unleash the whole Open CASCADE power |
|||
* [[Mesh to Part]]: Converting between object types |
|||
<div class="mw-translate-fuzzy"> |
|||
===Accessing the Coin scenegraph=== |
|||
=== 网格类工作 === |
|||
* [[Scenegraph|The Coin/Inventor scenegraph]]: How the FreeCAD scene representation works |
|||
* [[Mesh Scripting|网格脚本]]:怎样与[[Mesh Workbench|网格模块]]交互。 |
|||
* [[Pivy]]: How to access and modify the scenegraph |
|||
</div> |
|||
====Working with Parts==== |
|||
<div class="mw-translate-fuzzy"> |
|||
=== 零件类工作 === |
|||
* [[Part_Workbench|零件模块]]:[http://en.wikipedia.org/wiki/Open_CASCADE 开源CASCADE技术]的工具和体系如何用在FreeCAD中。 |
|||
* [[Topological data scripting|拓扑数据脚本]]:怎样与零件模块交互。 |
|||
* [[PythonOCC]]:怎样释放开源CASCADE的全部能量。 |
|||
* [[Mesh to Part|网格到零件]]:转换对象类型。 |
|||
</div> |
|||
====Accessing the Coin scenegraph==== |
|||
<div class="mw-translate-fuzzy"> |
|||
===触达Coin的场景图=== |
|||
* [[Scenegraph|Coin/Inventor的场景图]]:FreeCAD的场景表现如何运作。 |
|||
* [[Pivy]]:如何触达和变更场景图。 |
|||
</div> |
|||
===Controlling the Qt interface=== |
===Controlling the Qt interface=== |
||
* [[PySide]]: How to access the interface, and modify its contents |
|||
* [[Embedding FreeCADGui|Using the FreeCAD GUI]] in another Qt application with PyQt |
|||
<div class="mw-translate-fuzzy"> |
|||
===Working with parametric objects=== |
|||
===控制Qt接口=== |
|||
* [[Scripted objects]]: How to make 100% Python-scripted objects in FreeCAD |
|||
* [[PySide]]:如何触达接口,并修改它的内容。 |
|||
* [[Drawing Module]]: Automating the 3D-to-2D process |
|||
* 在另一个Qt应用里,通过PyQt,来[[Embedding FreeCADGui|使用FreeCAD的GUI]]。 |
|||
</div> |
|||
<span id="Working_with_parametric_objects"></span> |
|||
<div class="mw-translate-fuzzy"> |
|||
===参数对象类工作=== |
|||
* [[Scripted objects|脚本化的对象]]:在FreeCAD里如何制作100%的Python脚本化的对象。 |
|||
* [[Drawing Workbench|制图模块]]:让3D到2D的过程实现自动化。 |
|||
</div> |
|||
* [[Scripted_objects|Scripted objects]]: how to make 100% Python-scripted objects. |
|||
** [[Scripted_objects_with_attachment|Scripted objects with attachment]]: how to make scripted objects attachable to other objects. |
|||
** [[Scripted_objects_saving_attributes|Scripted objects saving attributes]]: how to save and restore attributes of the proxy class with {{incode|dumps}} and {{incode|loads}}. |
|||
** [[Scripted_objects_migration|Scripted objects migration]]: how to migrate old scripted objects to a new class. |
|||
===Examples=== |
===Examples=== |
||
* [[Code snippets]] : A collection of pieces of FreeCAD Python code, to serve as ingredients in your scripts... |
|||
* [[Line drawing function]]: How to build a simple tool to draw lines |
|||
* [[Dialog creation]]: How to construct dialogs with Qt designer, and use them in FreeCAD |
|||
* [[Embedding FreeCAD]]: How to import FreeCAD as a Python module in other applications |
|||
* The [[Draft Module]] adds basic 2d drawing functions to freecad. It is written entirely in Python, so it can be a good example if you want to write your own modules. |
|||
* [[FreeCAD vector math library]] : A couple of handy functions to manipulate FreeCAD vectors. This library is also included in the Draft module. |
|||
<div class="mw-translate-fuzzy"> |
|||
== API Functions == |
|||
=== 例子 === |
|||
* [[Code snippets|代码片段]]:搜集了一些FreeCAD的Python代码段,作为你的脚本的配料…… |
|||
* [[Line drawing function|画线函数]]:如何建造一个简单工具,来画线。 |
|||
* [[Dialog creation|创建对话]]:如何用Qt设计器来建造对话框,把它们用在FreeCAD里。 |
|||
* [[Embedding FreeCAD|嵌入式FreeCAD]]:在其他应用里,如何载入FreeCAD,作为一个Python模块。 |
|||
* [[Draft Workbench|绘图模块]]为FreeCAD加入了2D绘图函数。它整个都是用Python写的,所以如果你想写自己的模块,它就是个好例子。 |
|||
* [[FreeCAD vector math library|FreeCAD向量数学程序库]]:几个很顺手的函数,来操控FreeCAD的向量。这个函数库也包含在绘图模块里面了。 |
|||
</div> |
|||
<span id="API_Functions"></span> |
|||
The complete API documentation of FreeCAD is located at http://www.freecadweb.org/api/ . It contains both C++ and Python APIs, and is not totally well formatted yet, which can be confusing when looking for python-only code. An easier to browse version can be found [[:Category:API|here]]. Note that it can be incomplete, since it is updated manually. For more accurate information, browse the modules directly from FreeCAD's Python console. |
|||
== API函数 == |
|||
FreeCAD完整的API文档放在http://www.freecadweb.org/api/中。它既有C++也有Python的API,还没有完全格式化好。当你想找只含Python的代码,就会发现那里有点乱。更便于浏览的版本在[[:Category:API|这里]]。注意,它可能并不完整,因为它得用人工更新。要找更精确信息的话,直接在FreeCAD的Python控制台里浏览相应模块吧。 |
|||
== Advanced modification == |
|||
Related: [[Exposing_C%2B%2B_to_Python|Exposing C++ to Python]] |
|||
* [[Start up and Configuration]]: Startup and command line options |
|||
* [[Install on Windows]]: Using the windows installer |
|||
* [[CompileOnWindows|Compiling FreeCAD on Windows]] and [[CompileOnUnix|Compiling FreeCAD on Unix]] |
|||
* [[Branding]]: Simple modifications you can do to the source code to change some aspects of FreeCAD |
|||
* [[Extra python modules]] : Extend the FreeCAD python interpreter with these powerful modules! |
|||
<span id="Advanced_modification"></span> |
|||
== Python tutorials == |
|||
== 高级修改 == |
|||
<div class="mw-translate-fuzzy"> |
|||
These are good generic tutorials, not specific to FreeCAD, that might interest you if you are totally new to python. |
|||
* [[Start up and Configuration|启动和配置]]:启动和命令行选项。 |
|||
* [[Installing_on_Windows|在Windows上安装]]:使用Windows安装器。 |
|||
* [[Compile_on_Windows|在Windows上编译FreeCAD]],[[Compile_on_Linux|在Unix上编译FreeCAD]] |
|||
* [[Branding|品牌化]]:简单变更FreeCAD的源代码,改变FreeCAD的一些方面。 |
|||
* [[Extra python modules|额外的Python模块]]:用这些强大的模块,来扩展FreeCAD的Python解释器。 |
|||
</div> |
|||
<span id="Python_tutorials"></span> |
|||
== Python教程 == |
|||
这些是通用教程,都很棒。它们不是特殊为FreeCAD制作的,如果你完全没接触过Python,它们可能对你有益处。 |
|||
<div class="mw-translate-fuzzy"> |
|||
'''Python''' |
'''Python''' |
||
* [https://docs.python.org/2.7/tutorial/index.html |
* [https://docs.python.org/2.7/tutorial/index.html 官方Python2.7教程] - 发现Python之旅的完全指南。 |
||
* [http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python |
* [http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python 非程序员的Python教程] - 超赞的维基书。 |
||
* [http://npt.cc.rsu.ru/user/wanderer/ODP/Python_for_Newbies.htm Python |
* [http://npt.cc.rsu.ru/user/wanderer/ODP/Python_for_Newbies.htm 为新手写的Python] - 一本大型指南,涵盖了方方面面的基础内容。 |
||
</div> |
|||
'''PySide''' - 怎样通过Python创建和管理FreeCAD的Qt用户交互界面。 |
|||
* [http://zetcode.com/gui/pysidetutorial/ PySide教程]:一个平台不可知论者的教程,通过很多例子,展示PySide的用法。 |
|||
* [http://www.pythoncentral.io/series/python-pyside-pyqt-tutorial/ PySide/PyQt教程]:一个PySide和PyQt教程,很容易读,有例子。 |
|||
* [http://qt-project.org/wiki/PySideDocumentation PySide文档]:来自于Qt项目(全部都是那些人写的)。 |
|||
* [http://qt-project.org/wiki/QtCreator_and_PySide 在PySide里使用QtCreator]:也是来自于Qt项目。 |
|||
* [http://srinikom.github.io/pyside-docs/index.html PySide参考]:无微不至地详解PySide和Qt的各种小细节,一个可靠的参考源。 |
|||
* [http://nullege.com/codes/search?cq=PySide PySide代码片段]:一个可以搜索的PySide代码片段数据库。 |
|||
<div class="mw-translate-fuzzy"> |
|||
下面两个参考源,是PyQt特定的(不是PySide),但它们可能给了一些有用的信息: |
|||
* [http://www.cs.usfca.edu/~afedosov/qttut/ 基础PyQt教程]:一个基于Linux的简短教程,解释了怎样使用PyQt和Qt Designer。 |
|||
* [http://vizzzion.org/?id=pyqt 用Python编程Qt应用]:一个更深入的教程,涵盖了用Qt和Python工作的所有方面。 |
|||
</div> |
|||
<div class="mw-translate-fuzzy"> |
|||
'''PySide''' - How to create and manage FreeCAD's Qt UI interface from python |
|||
'''Pivy''' - 怎样与FreeCAD的3D场景交互 |
|||
* [http://zetcode.com/gui/pysidetutorial/ PySide tutorial] : A platform-agnostic tutorial showing the usage of PySide with examples |
|||
* [http://pivy.coin3d.org/documentation/pycon 基础Pivy教程]:来自官方Pivy站点,非常简单的教程。 |
|||
* [http://www.pythoncentral.io/series/python-pyside-pyqt-tutorial/ PySide/PyQt tutorial] : A easy to read tutorial that covers PySide and PyQt with examples |
|||
* [http://www.google.com.br/url?sa=U&start=3&q=http://studierstube.icg.tu-graz.ac.at/doc/pdf/PivyStudierstubeTutorial.pdf&ei=XyC1Sc2wOeCKmQem_eHnBQ&usg=AFQjCNEYhb-0DcUc6OxFVijAe1epBb-4aA 介绍Pivy给studierstube]:这份文档算不上是教程,但是它很好地展示了Pivy是怎样工作的。 |
|||
* [http://qt-project.org/wiki/PySideDocumentation PySide documentation] : from the Qt Project (the people who wrote it all) |
|||
</div> |
|||
* [http://qt-project.org/wiki/QtCreator_and_PySide Using QtCreator in PySide] : also from the Qt Project |
|||
* [http://srinikom.github.io/pyside-docs/index.html PySide reference] : endless detail on the minutiae of PySide and Qt, a reliable reference source |
|||
* [http://nullege.com/codes/search?cq=PySide PySide code snippets] : a searchable database of PySide code snippets |
|||
<span id="Community_projects"></span> |
|||
The following two references are PyQt specific (not PySide) but may offer some information of use: |
|||
== 社区项目 == |
|||
* [http://www.cs.usfca.edu/~afedosov/qttut/ Basic PyQt tutorial] : A simple and short linux-based tutorial that will explain how to work with PyQt and Qt Designer |
|||
* [http://vizzzion.org/?id=pyqt Programming Qt applications in python] : A more in-depth tutorial covering all the process of working with qt and python. |
|||
<div class="mw-translate-fuzzy"> |
|||
'''Pivy''' - How to interact with FreeCAD's 3D scenes |
|||
在[[FreeCAD Community Portal|社区入口]],你会找到其它基于FreeCAD的项目,它们由FreeCAD用户社区运行。如果你正开始一个新的FreeCAD项目,一定要登记上去。如果你愿意[[Help FreeCAD|帮助FreeCAD]],我们也准备了那个页面,列出了你可以做的事情。 |
|||
* [http://pivy.coin3d.org/documentation/pycon Basic Pivy tutorial] : A very simple tutorial from the official Pivy site |
|||
</div> |
|||
* [http://www.google.com.br/url?sa=U&start=3&q=http://studierstube.icg.tu-graz.ac.at/doc/pdf/PivyStudierstubeTutorial.pdf&ei=XyC1Sc2wOeCKmQem_eHnBQ&usg=AFQjCNEYhb-0DcUc6OxFVijAe1epBb-4aA Introducing Pivy into studierstube] : A document that is not really a tutorial, but that illustrates well how Pivy works |
|||
* [[Scientific_literature|Scientific literature]]: articles that reference or use the FreeCAD system in different ways. |
|||
== Community projects == |
|||
On the [[FreeCAD Community Portal|Community portal]], you can find other FreeCAD-based projects run by the FreeCAD users community. If you are starting a new FreeCAD project, be sure to list it there! We also have a page with things you can do if you would like to [[Help FreeCAD]]. |
|||
{{Powerdocnavi{{#translation:}}}} |
|||
[[Category:Hubs/zh-cn]] |
|||
[[Category: |
[[Category:Hubs{{#translation:}}]] |
Latest revision as of 09:01, 27 January 2024
如果你想深入理解FreeCAD,这里就是你该来的地方。你能学到如何为你的需求定制FreeCAD。
FreeCAD最秒的好处之一,就是它给你的灵活性。你不需要作任何编译,不需要接触源代码,就可以写脚本,就可以作扩展,可触范围极广。所有的脚本都用Python完成。它是一门强大而简洁的编程语言。有了简洁的Python脚本,你有权触及FreeCAD的任何部分。比如说,你可以:
- 创建和修改几何体:有没有这种情况?你需要的特殊对象,没有出现在FreeCAD的默认安装包里?你可以轻松创建一个新对象类型,既可以写脚本,也可以调配一个已有的类型。
- 创建定制的工具和命令:目前,FreeCAD已经有了很广泛的功能,但是给终端用户的工具和命令还不是很多。不过,你已经可以很容易地创建自己的工具包了。
- 修改界面:FreeCAD的用户界面还处于十分基础的阶段。但是如果你要有所扩展,工具都给你准备好了。比如说,你可以创建一个工具条,把你的工具都放进去;你也可以创建一个特殊面板,用来与你的工具互动,诸如此类。
- 修改场景表现:建立和计算几何体,在屏幕上显示那个几何体,这件事在FreeCAD里有不同的流程来处理。场景元素显示在屏幕上的方式,你对此有完全控制权。所以,你可以修改那个表现,与它交互,或者加入各种各样的定制行为和屏幕组件。举几个例子,信息、拖拽、锚定或者暂时实体。
定制FreeCAD
在FreeCAD里写脚本
General
通则
- 介绍Python - 在页面底端还有其他Python教程。
- FreeCAD脚本教程 - 概略看一下在FreeCAD中用Python写脚本。
- FreeCAD脚本基础 - 好吧,基本的东西……
- Gui命令 - 向GUI添加定制的命令。
- 在FreeCAD里使用混合单位。
模块
在FreeCAD中,功能性的东西被划分到各个模块,处理特定的数据类型和应用。FreeCAD有内建模块和扩展模块(插件)。插件模块一旦安装,它们就和内建模块一样方便触达。下面讲的是默认模块,FreeCAD的每一个安装包都包含了。
Working with Meshes
Working with Parts
零件类工作
- 零件模块:开源CASCADE技术的工具和体系如何用在FreeCAD中。
- 拓扑数据脚本:怎样与零件模块交互。
- PythonOCC:怎样释放开源CASCADE的全部能量。
- 网格到零件:转换对象类型。
Accessing the Coin scenegraph
触达Coin的场景图
- Coin/Inventor的场景图:FreeCAD的场景表现如何运作。
- Pivy:如何触达和变更场景图。
Controlling the Qt interface
控制Qt接口
- PySide:如何触达接口,并修改它的内容。
- 在另一个Qt应用里,通过PyQt,来使用FreeCAD的GUI。
- Scripted objects: how to make 100% Python-scripted objects.
- Scripted objects with attachment: how to make scripted objects attachable to other objects.
- Scripted objects saving attributes: how to save and restore attributes of the proxy class with
dumps
andloads
. - Scripted objects migration: how to migrate old scripted objects to a new class.
Examples
例子
- 代码片段:搜集了一些FreeCAD的Python代码段,作为你的脚本的配料……
- 画线函数:如何建造一个简单工具,来画线。
- 创建对话:如何用Qt设计器来建造对话框,把它们用在FreeCAD里。
- 嵌入式FreeCAD:在其他应用里,如何载入FreeCAD,作为一个Python模块。
- 绘图模块为FreeCAD加入了2D绘图函数。它整个都是用Python写的,所以如果你想写自己的模块,它就是个好例子。
- FreeCAD向量数学程序库:几个很顺手的函数,来操控FreeCAD的向量。这个函数库也包含在绘图模块里面了。
API函数
FreeCAD完整的API文档放在http://www.freecadweb.org/api/中。它既有C++也有Python的API,还没有完全格式化好。当你想找只含Python的代码,就会发现那里有点乱。更便于浏览的版本在这里。注意,它可能并不完整,因为它得用人工更新。要找更精确信息的话,直接在FreeCAD的Python控制台里浏览相应模块吧。
Related: Exposing C++ to Python
高级修改
- 启动和配置:启动和命令行选项。
- 在Windows上安装:使用Windows安装器。
- 在Windows上编译FreeCAD,在Unix上编译FreeCAD
- 品牌化:简单变更FreeCAD的源代码,改变FreeCAD的一些方面。
- 额外的Python模块:用这些强大的模块,来扩展FreeCAD的Python解释器。
Python教程
这些是通用教程,都很棒。它们不是特殊为FreeCAD制作的,如果你完全没接触过Python,它们可能对你有益处。
Python
- 官方Python2.7教程 - 发现Python之旅的完全指南。
- 非程序员的Python教程 - 超赞的维基书。
- 为新手写的Python - 一本大型指南,涵盖了方方面面的基础内容。
PySide - 怎样通过Python创建和管理FreeCAD的Qt用户交互界面。
- PySide教程:一个平台不可知论者的教程,通过很多例子,展示PySide的用法。
- PySide/PyQt教程:一个PySide和PyQt教程,很容易读,有例子。
- PySide文档:来自于Qt项目(全部都是那些人写的)。
- 在PySide里使用QtCreator:也是来自于Qt项目。
- PySide参考:无微不至地详解PySide和Qt的各种小细节,一个可靠的参考源。
- PySide代码片段:一个可以搜索的PySide代码片段数据库。
下面两个参考源,是PyQt特定的(不是PySide),但它们可能给了一些有用的信息:
- 基础PyQt教程:一个基于Linux的简短教程,解释了怎样使用PyQt和Qt Designer。
- 用Python编程Qt应用:一个更深入的教程,涵盖了用Qt和Python工作的所有方面。
Pivy - 怎样与FreeCAD的3D场景交互
- 基础Pivy教程:来自官方Pivy站点,非常简单的教程。
- 介绍Pivy给studierstube:这份文档算不上是教程,但是它很好地展示了Pivy是怎样工作的。
社区项目
在社区入口,你会找到其它基于FreeCAD的项目,它们由FreeCAD用户社区运行。如果你正开始一个新的FreeCAD项目,一定要登记上去。如果你愿意帮助FreeCAD,我们也准备了那个页面,列出了你可以做的事情。
- Scientific literature: articles that reference or use the FreeCAD system in different ways.
- FreeCAD scripting: Python, Introduction to Python, Python scripting tutorial, FreeCAD Scripting Basics
- Modules: Builtin modules, Units, Quantity
- Workbenches: Workbench creation, Gui Commands, Commands, Installing more workbenches
- Meshes and Parts: Mesh Scripting, Topological data scripting, Mesh to Part, PythonOCC
- Parametric objects: Scripted objects, Viewproviders (Custom icon in tree view)
- Scenegraph: Coin (Inventor) scenegraph, Pivy
- Graphical interface: Interface creation, Interface creation completely in Python (1, 2, 3, 4, 5), PySide, PySide examples beginner, intermediate, advanced
- Macros: Macros, How to install macros
- Embedding: Embedding FreeCAD, Embedding FreeCADGui
- Other: Expressions, Code snippets, Line drawing function, FreeCAD vector math library (deprecated)
- Hubs: User hub, Power users hub, Developer hub