Document structure/zh: Difference between revisions

From FreeCAD Documentation
(Created page with "视图文档中包含的另一个内容是三维视图。一个文档可以打开多个视图,因此您可以同时从多个视图检查文档。也许你想同时看到你...")
(Created page with "==编程==")
Line 18: Line 18:
视图文档中包含的另一个内容是三维视图。一个文档可以打开多个视图,因此您可以同时从多个视图检查文档。也许你想同时看到你工作的俯视图和俯视图。然后,您将拥有同一文档的两个视图,它们都存储在视图文档中。可以从“视图”菜单或右键单击“视图”选项卡来创建新视图或关闭视图。
视图文档中包含的另一个内容是三维视图。一个文档可以打开多个视图,因此您可以同时从多个视图检查文档。也许你想同时看到你工作的俯视图和俯视图。然后,您将拥有同一文档的两个视图,它们都存储在视图文档中。可以从“视图”菜单或右键单击“视图”选项卡来创建新视图或关闭视图。


==Scripting==
==编程==


Documents can be easily created, accessed and modified from the [[Python]] interpreter. For example:
Documents can be easily created, accessed and modified from the [[Python]] interpreter. For example:

Revision as of 03:56, 23 February 2019


FreeCad文档包含场景的所有对象。它可以包含组和使用任何工作台生成的对象。您可以在工作台之间切换但仍然编辑同一文档。文档是进行保存操作时存储到磁盘上的内容。您还可以在FreeCad中同时打开多个文档,并打开同一文档的多个视图。

在文档中,可以将对象移动到组中,并赋予唯一的名称。管理组、对象和对象名主要是从树视图中完成的。当然,就像freecad中的所有操作一样,它也可以通过Python解释器完成。在树视图中,可以创建组、将对象移动到组、删除对象或组、在树视图中或对象上单击鼠标右键、通过双击对象的名称重命名对象或其他的操作(取决于当前工作台)。

FreeCad文档中的对象可以是不同类型的。每个工作台都可以创建自己的对象类型,例如网格工作台用来创建网格对象,零件工作台用来创建零件对象,草稿工作台也可以用来创建零件对象等。

如果在FreeCad中至少有一个打开的文档,则始终只有一个活动文档。这是显示在当前三维视图中的文档,即当前正在处理的文档。

Application and User Interface

Like almost everything else in FreeCAD, the graphical user interface part (GUI) is separated from the base application part (App). This is also valid for documents. The documents are also made of two parts: the Application document, which contains our objects, and the View document, which contains the representation on screen of our objects.

Think of it as two spaces, where the objects are defined. Their constructive parameters (is it a cube? a cone? which size?) are stored in the Application document, while their graphical representation (is it drawn with black lines? with blue faces?) are stored in the View document. Why is that? Because FreeCAD can also be used without graphical interface, for example, inside other programs, and we must still be able to manipulate our objects, even if nothing is drawn on the screen.

视图文档中包含的另一个内容是三维视图。一个文档可以打开多个视图,因此您可以同时从多个视图检查文档。也许你想同时看到你工作的俯视图和俯视图。然后,您将拥有同一文档的两个视图,它们都存储在视图文档中。可以从“视图”菜单或右键单击“视图”选项卡来创建新视图或关闭视图。

编程

Documents can be easily created, accessed and modified from the Python interpreter. For example:

FreeCAD.ActiveDocument

Will return the current (active) document

FreeCAD.ActiveDocument.Blob

Would access an object called "Blob" inside your document

FreeCADGui.ActiveDocument

Will return the view document associated to the current document

FreeCADGui.ActiveDocument.Blob

Would access the graphical representation (view) part of our Blob object

FreeCADGui.ActiveDocument.ActiveView

Will return the current view

Mouse Model
Preferences Editor