文檔結構

From FreeCAD Documentation
Revision as of 03:45, 23 February 2019 by Renoxray (talk | contribs) (Created page with "如果在FreeCad中至少有一个打开的文档,则始终只有一个活动文档。这是显示在当前三维视图中的文档,即当前正在处理的文档。")


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.

Another thing that is contained inside the View document are 3D views. One document can have several views opened, so you can inspect your document from several points of view at the same time. Maybe you would want to see a top view and a front view of your work at the same time? Then, you will have two views of the same document, both stored in the View document. Creating new views or closing views can be done from the View menu or by right-clicking on a view tab.

Scripting

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