![]() 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. Redirect internal Python errors to report view.Redirect internal Python output to report view.If you are totally new to Python and want to understand how it works, we also have a basic introduction to Python.īefore proceeding with Python scripting, go to Edit → Preferences → General → Output window and check two boxes: In this tutorial, we'll work on a couple of basic examples to get you started, but there is much more documentation about Python scripting available on this wiki. From external scripts, which can used to create quite complex solutions, even entire Workbenches.From macros, which are a convenient way to quickly add a missing tool to the FreeCAD interface.From the FreeCAD Python interpreter, where you can issue commands in a "command line"-style interface.There are several ways to use Python in FreeCAD: ![]() Modify the 3D representation of those objects. ![]() From the Python console, or from custom scripts, you can control FreeCAD and make it perform very complex operations.įor example, from a Python script, you can: But its most widespread use is as a scripting language embedded in other applications. It is open-source and multi-platform, and can be used for many purposes: from simple shell scripts to very complex programs. That means, if you want a subpackage to be skipped, rename itįrom %package foo to %package -n %-foo.lang in the %files section header.Python is a programming language that it relatively easy to learn and understand. %package -n something is at this point -n something, and denotes that this subpackage should Pkgname of the package itself is an empty string. Pkgname, or subpackage name, is internal to a spec file, and is that thing you put after In some cases, it is only modname though. Packages adhering to the SUSE Python module naming policy are usually called -modname. Modname is the PyPI name, or, if the package in question is not on PyPI, the moniker that we īetween the major and minor version number, in case the latter is part of the flavor name: The name of the binary in %_bindir ( /usr/bin) is the name of the flavor with an addtional. Conditionals are in place to switch python to mean python3 in the future. Using python is either a redefinition of python2, or an alternative for All of them have a "long" form too.įor compatibility reasons you see sometimes python. Some macros are redefined with "short" flavor for compatibility The flavor is used as a prefix for all flavor-specific macros. Specified not by python-rpm-macros but by the obs project definition in %primary_python. python3 points to the default ofĬoinstallable flavors python3 where is the minor version number. Python2, python3, python38, python39, python310, python311 and pyp圓. At this point, we recognize the following flavors: The purpose of the singlespec system is to take a package for a particular flavor, andĪutogenerate subpackages for all the other flavors. The macro system can be used in spec files for building RPM packages. This repository contains a work-in-progress macro system generator for the singlespec Python initiative.
0 Comments
Leave a Reply. |