The FreeCAD source code/it: Difference between revisions

From FreeCAD Documentation
No edit summary
No edit summary
Line 1: Line 1:
Il [https://github.com/FreeCAD/FreeCAD codice sorgente di FreeCAD] è gestito con git, ed è pubblico, aperto e disponibile sotto la [https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License licenza LGPL]. Esso può essere copiato, scaricato, letto, analizzato, ridistribuito e modificato da chiunque. Se avete intenzione di apportare delle modifiche che desiderate vedere incluse nel codice ufficiale, ricordate che le modifiche devono essere approvate dagli sviluppatori di FreeCAD, quindi è saggio discutere prima le vostre intenzioni e idee nel [http://forum.freecadweb.org forum], per non rischiare che le modifiche siano respinte a causa di qualche motivo imprevisto.
Il [https://github.com/FreeCAD/FreeCAD codice sorgente di FreeCAD] è gestito con git, ed è pubblico, aperto e disponibile sotto la [https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License licenza LGPL]. Esso può essere copiato, scaricato, letto, analizzato, ridistribuito e modificato da chiunque. Se avete intenzione di apportare delle modifiche che desiderate vedere incluse nel codice ufficiale, ricordate che le modifiche devono essere approvate dagli sviluppatori di FreeCAD, quindi è saggio discutere prima le proprie intenzioni e idee nel [http://forum.freecadweb.org forum], per non rischiare che le modifiche vengano poi respinte a causa di qualche motivo imprevisto.


Qui di seguito ci sono alcuni suggerimenti e informazioni utili per fornire una traccia, se siete interessati a esplorare il codice FreeCAD.
Qui di seguito ci sono alcuni suggerimenti e informazioni utili per fornire una traccia, se siete interessati a esplorare il codice FreeCAD.

Revision as of 08:43, 1 November 2016

Il codice sorgente di FreeCAD è gestito con git, ed è pubblico, aperto e disponibile sotto la licenza LGPL. Esso può essere copiato, scaricato, letto, analizzato, ridistribuito e modificato da chiunque. Se avete intenzione di apportare delle modifiche che desiderate vedere incluse nel codice ufficiale, ricordate che le modifiche devono essere approvate dagli sviluppatori di FreeCAD, quindi è saggio discutere prima le proprie intenzioni e idee nel forum, per non rischiare che le modifiche vengano poi respinte a causa di qualche motivo imprevisto.

Qui di seguito ci sono alcuni suggerimenti e informazioni utili per fornire una traccia, se siete interessati a esplorare il codice FreeCAD.

  • Il codice di FreeCAD è programmato principalmente in C++, ma si basa pesantemente su Python. Una grande parte delle sue funzionalità fornisce un legame di associazione a Python, ed offrire sempre un accesso con python per qualsiasi nuova caratteristica implementata in C++ è parte della filosofia di base dello sviluppo di FreeCAD. Per ottenere questo, in tutto FreeCAD sono abbondantemente utilizzati CPython (gli strumenti di interfacciamento con C forniti da Python stesso) e specialmente PyCXX. Nel stesso codice di FreeCAD sono forniti anche molti modelli e strumenti personalizzati per rendere molto facile la costruzione dei legami di associazione a python. Alcune parti di alto livello del codice di FreeCAD sono codificati completamente in Python.
  • Il codice sorgente FreeCAD è completamente multi-piattaforma, ed è stata messa molta attenzione per consentire che l'applicazione sia utilizzabile sul maggior numero possibile di piattaforme e configurazioni, e per non mettere gli attuali utenti in situazioni difficili. Pertanto le nuove versioni dei componenti necessari sono rinviate, quanto più possibile, finchè non sono completamente e facilmente disponibili per tutte le piattaforme, e anche la compatibilità (la possibilità di aprire su una nuova versione di FreeCAD un file prodotto con una versione precedente) è considerata un importante priorità.
  • Quasi tutte le funzionalità di FreeCAD sono divise in due parti distinte, chiamate App e Gui. Questa separazione si riflette ovunque nella struttura dei file del codice sorgente. La parte App contiene tutte le funzionalità che devono essere eseguite in pura modalità console (senza interfaccia grafica). Dato che FreeCAD può essere compilato ed eseguito senza la sua interfaccia grafica, il codice in App è indipendente da qualsiasi libreria correlata alla GUI. La parte Gui contiene tutto il codice necessario per l'esecuzione in modalità GUI, ed è costruita attorno alle funzionalità App.
  • Most of FreeCAD's functionality is implemented in Modules. FreeCAD without its module is a simple container window that can just open and save a file. All the geometry tools and workbenches are implemented in Modules. Modules can be written in C++, in Python, or combining the best of the two worlds, can be hybrid C++/Python modules, where solid, core functionality is programmed in C++ while end-user tools are made in Python and are therefore much easier to extend and adapt by FreeCAD users. Each module usually defines and creates a Workbench in the FreeCAD interface, when used in GUI mode, usually with the same name, but it is not mandatory for modules to contain a workbench.
  • FreeCAD modules often depend on other modules. Most modules that use solid geometry depend on the Part module, which is the most fundamental module of FreeCAD, and implements most of the interfacing with OpenCasCade. Although other module can use OpenCasCade functionality directly, they often rely on higher-level functions provided by Part.
  • Modules are always initialized from Python. Even if they are written fully in C++, they always contain a minimal Python/CPython structure.
  • FreeCAD is an avid user of other open-source libraries. Besides Python and Qt, used by the core and almost all of the modules, the two heavyweight libraries used throughout most modules are OpenCasCade Technology and Coin3D. OpenCasCade is used to create and manage all the solid geometry of FreeCAD, while coin3D is used to manage the 3D view. OpenCascade is used mainly in the App world, and coin3D exclusively in the Gui world. A basic understanding of OpenCasCade is fundamental to do any geometry-related work with FreeCAD. More specific modules make use of more specific libraries, and since there are usually no restrictions on that point apart from these libraries to be easily available on all platforms, the list of dependencies of a full FreeCAD installation with all its modules can be quite large.
  • FreeCAD's document objects, which are all the objects contained in a FreeCAD document, are what appear in the Tree View in the GUI and in FreeCAD.ActiveDocument.Objects() in Python. They may or may not have any geometrical data, and may or may not show anything in the 3D view. They are always separated in App and Gui parts. The Gui part is not loaded when running in console mode. Standard geometrical objects, such as those found in Part or PartDesign, have their OpenCasCade-based geometry defined in their App counterpart, while the Gui counterpart (also usually called "View Provider") is responsible for creating a coin3D representation of that geometry, which will be inserted into the main coin3D scene graph of the 3D view.
  • The basic directory structure of the source code is organized like this:
    • App: contains the FreeCAD console-mode application, defines basic structures and base classes for document objects, that are used by modules to build their own.
    • Base: contains core functionality commonly used everywhere in FreeCAD: 3D vectors, units, matrixes, placements, etc.
    • Gui: contains the FreeCAD GUI-mode application, defines the 3D view, contains many tools and functions to be used by workbenches to interact with the interface and with the 3D view, defines base classes for view providers.
    • Doc: contains mainly a all-in-one Qt help file generated from this wiki.
    • Mod: contains all the modules, themselves further separated into App and Gui (except for python modules, which don't always follow that rule so clearly).