14.2 Importing libraries
In the first section of a Python script (import section), we include statements to import external libraries or modules that provide additional functionality beyond the core Python language. These libraries contain pre-defined functions, classes, and objects that you can use in your script to perform various tasks or access specific features.
import math
import FreeCAD
import QW_Modeller
import Sketcher
import Part
• import math: The math library is a fundamental Python library that provides a wide range of mathematical functions and constants.
• import FreeCAD: The FreeCAD library is the core library of the FreeCAD software. It provides access to the entire FreeCAD application, allowing users to create, modify, and analyze 3D models. It’s a versatile tool for interacting with the FreeCAD environment, making and manipulating objects, and performing various CAD operations.
• import QW_Modeller: QW-Modeller module is essential to maintain QW-Parameters. Also, after the final solid is obtained, it is used to recalculate the mesh.
• import Sketcher: The Sketcher library is crucial when working with 2D sketches in FreeCAD. It provides tools and functions to create and edit 2D sketches that can later be used as a basis for creating 3D objects. Users use it extensively to define and manipulate sketch elements like lines, arcs, and constraints.
• import Part: The Part library is a key component for working with 3D geometry in FreeCAD. In this particular tutorial, the Part library is used to create axisymmetrical solids by revolving sketches. In general, it offers various classes and functions to create, modify, and analyze 3D shapes and solids. Users employ it extensively to craft a variety of 3D solids, from simple forms like cubes and cylinders to more intricate and customized structures, as showcased in this tutorial.