14.1 Introduction
In this chapter, we will get through Python scripting preparation, based on horn4 project and its horn4.py base script, located in .../QW-Modeller/v2023x64/macros/Feeds.
The project that we will create using the Python scripting language is an axisymmetrical corrugated horn antenna.
A fully parametrized sketch will be drawn and revolved into an axisymmetrical solid; however, QuickWave objects such as media, ports, ntf boxes, absorbing boxes, etc., will not be defined. This approach might be more efficient when creating geometrically complex objects that can be easily applied to several projects. To accomplish this goal, we will work with an existing QuickWave project instead of creating a new document. A macro created this way can be executed in any QW-Modeller project.
The usage of such a macro-based object imported into an example project will be presented in the last section of this tutorial. New script can be edited in either the FCMacro format within FreeCAD or in any Python editor using the .py format.
Figure 1: 3D View of the obtained horn
In the realm of Python scripting, code can be methodically categorized into three essential segments: the import section, function definition section, and the main code section.