![]() As a result several different, and even totally incompatible, object types can coexist in the same document. Each module not only adds new workbenches to the interface, but also new Python commands and new object types. Without its modules it can do little more than create new, empty documents. The FreeCAD base application is more or less an empty container. The true power of FreeCAD lies in its faithful modules, with their respective workbenches. For example, FreeCADGui.ActiveDocument contains ActiveView, which is the currently opened 3D view. They are the two components of a FreeCAD document, and they contain different attributes and methods. FreeCAD.ActiveDocument and FreeCADGui.ActiveDocument are not the same object however. To illustrate our concept, see that both FreeCAD and FreeCADGui contain an ActiveDocument attribute, which is the currently opened document. ![]() They contain all kinds of generic functionality to work with documents and their objects. When you start FreeCAD, the Python console already loads two base modules: FreeCAD and FreeCADGui (which can also be accessed by their shortcuts App and Gui). Let's start by creating a new empty document: You can copy-paste each line in the Python console and then press Enter, or copy-paste the entire code in a new Macro window. In this tutorial you can use both methods. In the console you write Python commands one by one, executing them by pressing Enter, while macros can contain more complex code made up of several lines, executed only when the macro is executed. In the Python console (select View → Panels → Python console from the menu) or in the Macro editor (select Macro → Macros. There are two ways to write Python code in FreeCAD.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |