文檔結構

From FreeCAD Documentation
Revision as of 03:56, 23 February 2019 by Renoxray (talk | contribs) (Created page with "==编程==")


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