Power users hub/zh-cn: Difference between revisions

From FreeCAD Documentation
(Created page with "在FreeCAD中,功能性的东西被划分到各个模块,处理特定的数据类型和应用。FreeCAD有内建模块和扩展模块(插件)。插件模块一旦安...")
(Updating to match new version of source page)
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
[[Image:Power_user_hub.png|64px]]
----
__NOTOC__


<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>


== 定制FreeCAD ==
== 定制FreeCAD ==


<div class="mw-translate-fuzzy">
* [[Interface Customization|界面定制]]: 从头开始:工具栏和快捷方式
* [[Interface Customization|界面定制]]: 从头开始:工具栏和快捷方式
* [[Macros|用宏工作]]: 轻松录制多遍任务或Python代码
* [[Macros|用宏工作]]: 轻松录制多遍任务或Python代码
Line 22: Line 30:
* [http://forum.freecadweb.org/viewtopic.php?t=10556 插件装载器]
* [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>


== 在FreeCAD里写脚本 ==
== 在FreeCAD里写脚本 ==


<div class="mw-translate-fuzzy">
===通则===
===通则===
* [[Introduction to Python | 介绍Python]] - 在页面底端还有其他Python教程。
* [[Introduction to Python | 介绍Python]] - 在页面底端还有其他Python教程。
Line 31: Line 41:
* [[Gui Command|Gui命令]] - 向GUI添加定制的命令。
* [[Gui Command|Gui命令]] - 向GUI添加定制的命令。
* 在FreeCAD里使用混合[[Units|单位]]。
* 在FreeCAD里使用混合[[Units|单位]]。
</div>


=== 模块 ===
=== 模块 ===


<div class="mw-translate-fuzzy">
在FreeCAD中,功能性的东西被划分到各个模块,处理特定的数据类型和应用。FreeCAD有内建模块和扩展模块(插件)。插件模块一旦安装,它们就和内建模块一样方便触达。下面讲的是默认模块,FreeCAD的每一个安装包都包含了。
在FreeCAD中,功能性的东西被划分到各个模块,处理特定的数据类型和应用。FreeCAD有内建模块和扩展模块(插件)。插件模块一旦安装,它们就和内建模块一样方便触达。下面讲的是默认模块,FreeCAD的每一个安装包都包含了。
</div>


<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.
* [[Builtin modules|内建模块]]是FreeCAD的主体模块。里面的工具,可以调整FreeCAD的一般配置、文档和内容。
* [[Workbench creation]] shows you how to create your own workbench
* [[Workbench creation|创建工作台]]展示给你如何创建自己的工作台。
</div>


<div class="mw-translate-fuzzy">
===Working with Meshes===
=== 网格类工作 ===
* [[Mesh Scripting]]: How to interact with the [[Mesh Module]]
* [[Mesh Scripting|网格脚本]]:怎样与[[Mesh Module|网格模块]]交互。
</div>


<div class="mw-translate-fuzzy">
===Working with Parts===
=== 零件类工作 ===
* [[Part Module|The Part Module]]: How [http://en.wikipedia.org/wiki/Open_CASCADE Open CASCADE Technology] tools and structure is used in FreeCAD
* [[Part Module|零件模块]]:[http://en.wikipedia.org/wiki/Open_CASCADE 开源CASCADE技术]的工具和体系如何用在FreeCAD中。
* [[Topological data scripting]]: How to interact with the Part Module
* [[Topological data scripting|拓扑数据脚本]]:怎样与零件模块交互。
* [[PythonOCC]]: How to unleash the whole Open CASCADE power
* [[PythonOCC]]:怎样释放开源CASCADE的全部能量。
* [[Mesh to Part]]: Converting between object types
* [[Mesh to Part|网格到零件]]:转换对象类型。
</div>


<div class="mw-translate-fuzzy">
===Accessing the Coin scenegraph===
===触达Coin的场景图===
* [[Scenegraph|The Coin/Inventor scenegraph]]: How the FreeCAD scene representation works
* [[Scenegraph|Coin/Inventor的场景图]]:FreeCAD的场景表现如何运作。
* [[Pivy]]: How to access and modify the scenegraph
* [[Pivy]]:如何触达和变更场景图。
</div>


<div class="mw-translate-fuzzy">
===Controlling the Qt interface===
===控制Qt接口===
* [[PySide]]: How to access the interface, and modify its contents
* [[PySide]]:如何触达接口,并修改它的内容。
* [[Embedding FreeCADGui|Using the FreeCAD GUI]] in another Qt application with PyQt
* 在另一个Qt应用里,通过PyQt,来[[Embedding FreeCADGui|使用FreeCAD的GUI]]。
</div>


<div class="mw-translate-fuzzy">
===Working with parametric objects===
===参数对象类工作===
* [[Scripted objects]]: How to make 100% Python-scripted objects in FreeCAD
* [[Scripted objects|脚本化的对象]]:在FreeCAD里如何制作100%的Python脚本化的对象。
* [[Drawing Module]]: Automating the 3D-to-2D process
* [[Drawing Module|制图模块]]:让3D到2D的过程实现自动化。
</div>


* [[Scripted_objects|Scripted objects]]: how to make 100% Python-scripted objects.
===Examples===
** [[Scripted_objects_with_attachment|Scripted objects with attachment]]: how to make scripted objects attachable to other objects.
* [[Code snippets]] : A collection of pieces of FreeCAD Python code, to serve as ingredients in your scripts...
** [[Scripted_objects_saving_attributes|Scripted objects saving attributes]]: how to save and restore attributes of the proxy class with {{incode|__getstate__}} and {{incode|__setstate__}}.
* [[Line drawing function]]: How to build a simple tool to draw lines
** [[Scripted_objects_migration|Scripted objects migration]]: how to migrate old scripted objects to a new class.
* [[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 Module|绘图模块]]为FreeCAD加入了2D绘图函数。它整个都是用Python写的,所以如果你想写自己的模块,它就是个好例子。
* [[FreeCAD vector math library|FreeCAD向量数学程序库]]:几个很顺手的函数,来操控FreeCAD的向量。这个函数库也包含在绘图模块里面了。
</div>


== API函数 ==
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.


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!


== 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|启动和配置]]:启动和命令行选项。
* [[Install on Windows|在Windows上安装]]:使用Windows安装器。
* [[CompileOnWindows|在Windows上编译FreeCAD]],[[CompileOnUnix|在Unix上编译FreeCAD]]
* [[Branding|品牌化]]:简单变更FreeCAD的源代码,改变FreeCAD的一些方面。
* [[Extra python modules|额外的Python模块]]:用这些强大的模块,来扩展FreeCAD的Python解释器。
</div>

== Python教程 ==

这些是通用教程,都很棒。它们不是特殊为FreeCAD制作的,如果你完全没接触过Python,它们可能对你有益处。


'''Python'''
'''Python'''
* [https://docs.python.org/2.7/tutorial/index.html Official python tutorial] - A very complete tutorial for discovering python
* [https://docs.python.org/2.7/tutorial/index.html 官方Python2.7教程] - 发现Python之旅的完全指南。
* [http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python Non-programmer tutorial for python] - an excellent wikibook
* [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 for newbies] - one big tutorial covering all the basics
* [http://npt.cc.rsu.ru/user/wanderer/ODP/Python_for_Newbies.htm 为新手写的Python] - 一本大型指南,涵盖了方方面面的基础内容。

'''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">
'''PySide''' - How to create and manage FreeCAD's Qt UI interface from python
下面两个参考源,是PyQt特定的(不是PySide),但它们可能给了一些有用的信息:
* [http://zetcode.com/gui/pysidetutorial/ PySide tutorial] : A platform-agnostic tutorial showing the usage of PySide with examples
* [http://www.cs.usfca.edu/~afedosov/qttut/ 基础PyQt教程]:一个基于Linux的简短教程,解释了怎样使用PyQt和Qt Designer。
* [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://vizzzion.org/?id=pyqt 用Python编程Qt应用]:一个更深入的教程,涵盖了用Qt和Python工作的所有方面。
* [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


<div class="mw-translate-fuzzy">
The following two references are PyQt specific (not PySide) but may offer some information of use:
'''Pivy''' - 怎样与FreeCAD的3D场景交互
* [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://pivy.coin3d.org/documentation/pycon 基础Pivy教程]:来自官方Pivy站点,非常简单的教程。
* [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.
* [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是怎样工作的。
</div>


== 社区项目 ==
'''Pivy''' - How to interact with FreeCAD's 3D scenes
* [http://pivy.coin3d.org/documentation/pycon Basic Pivy tutorial] : A very simple tutorial from the official Pivy site
* [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


<div class="mw-translate-fuzzy">
== Community projects ==
在[[FreeCAD Community Portal|社区入口]],你会找到其它基于FreeCAD的项目,它们由FreeCAD用户社区运行。如果你正开始一个新的FreeCAD项目,一定要登记上去。如果你愿意[[Help FreeCAD|帮助FreeCAD]],我们也准备了那个页面,列出了你可以做的事情。
</div>


* [[Scientific_literature|Scientific literature]]: articles that reference or use the FreeCAD system in different ways.
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:User Documentation/zh-cn]]
[[Category:Hubs{{#translation:}}]]

Revision as of 17:06, 11 October 2020



如果你想深入理解FreeCAD,这里就是你该来的地方。你能学到如何为你的需求定制FreeCAD。

FreeCAD最秒的好处之一,就是它给你的灵活性。你不需要作任何编译,不需要接触源代码,就可以写脚本,就可以作扩展,可触范围极广。所有的脚本都用Python完成。它是一门强大而简洁的编程语言。有了简洁的Python脚本,你有权触及FreeCAD的任何部分。比如说,你可以:

  • 创建和修改几何体:有没有这种情况?你需要的特殊对象,没有出现在FreeCAD的默认安装包里?你可以轻松创建一个新对象类型,既可以写脚本,也可以调配一个已有的类型。
  • 创建定制的工具和命令:目前,FreeCAD已经有了很广泛的功能,但是给终端用户的工具和命令还不是很多。不过,你已经可以很容易地创建自己的工具包了。
  • 修改界面:FreeCAD的用户界面还处于十分基础的阶段。但是如果你要有所扩展,工具都给你准备好了。比如说,你可以创建一个工具条,把你的工具都放进去;你也可以创建一个特殊面板,用来与你的工具互动,诸如此类。
  • 修改场景表现:建立和计算几何体,在屏幕上显示那个几何体,这件事在FreeCAD里有不同的流程来处理。场景元素显示在屏幕上的方式,你对此有完全控制权。所以,你可以修改那个表现,与它交互,或者加入各种各样的定制行为和屏幕组件。举几个例子,信息、拖拽、锚定或者暂时实体。

这些页面还远没有成熟。如果你没找到你要找的信息,或者你在别的地方发现了有用的信息,而我们没有链接在这里,那为什么不自己添加进来?同时,请在论坛留下你的意见。

定制FreeCAD

在FreeCAD里写脚本

通则

模块

在FreeCAD中,功能性的东西被划分到各个模块,处理特定的数据类型和应用。FreeCAD有内建模块和扩展模块(插件)。插件模块一旦安装,它们就和内建模块一样方便触达。下面讲的是默认模块,FreeCAD的每一个安装包都包含了。

  • 内建模块是FreeCAD的主体模块。里面的工具,可以调整FreeCAD的一般配置、文档和内容。
  • 创建工作台展示给你如何创建自己的工作台。

网格类工作

零件类工作

触达Coin的场景图

控制Qt接口

参数对象类工作

例子

  • 代码片段:搜集了一些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

高级修改

Python教程

这些是通用教程,都很棒。它们不是特殊为FreeCAD制作的,如果你完全没接触过Python,它们可能对你有益处。

Python

PySide - 怎样通过Python创建和管理FreeCAD的Qt用户交互界面。

下面两个参考源,是PyQt特定的(不是PySide),但它们可能给了一些有用的信息:

  • 基础PyQt教程:一个基于Linux的简短教程,解释了怎样使用PyQt和Qt Designer。
  • 用Python编程Qt应用:一个更深入的教程,涵盖了用Qt和Python工作的所有方面。

Pivy - 怎样与FreeCAD的3D场景交互

社区项目

社区入口,你会找到其它基于FreeCAD的项目,它们由FreeCAD用户社区运行。如果你正开始一个新的FreeCAD项目,一定要登记上去。如果你愿意帮助FreeCAD,我们也准备了那个页面,列出了你可以做的事情。