App: Właściwości Python
Introduction
An App FeaturePython object, or formally an App::FeaturePython
, is a simple instance of the App DocumentObject in Python.
This is a simple object that by default doesn't have many properties, for example, no placement nor topological shape. This object is for general purpose use; depending on the properties that are assigned to it, it can be used to manage different types of data.
Simplified diagram of the relationships between the core objects in the program. The App::FeaturePython
class is a simple implementation of the App::DocumentObject
that can be used for any purpose, as it doesn't have a TopoShape by default.
Usage
The App FeaturePython is an internal object, so it cannot be created from the graphical interface. It is meant to be sub-classed by classes that will handle different types of data.
See Scripting for more information.
Properties
An App FeaturePython (App::FeaturePython
class) is derived from the basic App DocumentObject (App::DocumentObject
class), therefore it shares all the latter's properties.
In addition to the properties described in App DocumentObject, the FeaturePython has a basic view provider, so it does appear in the tree view.
See Property for all property types that scripted objects can have.
These are the properties available in the property editor. Hidden properties can be shown by using the Show all command in the context menu of the property editor.
Data
Base
- DANE (Hidden)Proxy (
PythonObject
): a custom class associated with this object. - DANELabel (
String
): the user editable name of this object, it is an arbitrary UTF8 string. - DANE (Hidden)Label2 (
String
): a longer, user editable description of this object, it is an arbitrary UTF8 string that may include newlines. By default, it is an empty string""
. - DANE (Hidden)Expression Engine (
ExpressionEngine
): a list of expressions. By default, it is empty[]
. - DANE (Hidden)Visibility (
Bool
): whether to display the object or not.
View
These properties correspond to the basic properties of the base viewprovider, Gui::ViewProviderDocumentObject
, that is inherited by all viewproviders in the software.
Base
- WIDOK (Hidden)Proxy (
PythonObject
): a custom view provider class associated with this object. This property only exist for those classes that are able to assign a custom class.
Display Options
- WIDOKDisplay Mode (
Enumeration
): it is empty by default. - WIDOKShow In Tree (
Bool
): it defaults totrue
, in which case the object will appear in the tree view; otherwise, the object will be hidden in the tree view. Once an object in the tree is invisible, you can see it again by opening the context menu over the name of the document (right-click), and selecting Show hidden items. Then the hidden item can be chosen and WIDOKShow In Tree can be switched back totrue
. - WIDOKVisibility (
Bool
): it defaults totrue
, in which case the object will be visible in the 3D view if it has a Shape, otherwise it will be invisible. By default this property can be toggled on and off by selecting the object, and pressing the Space bar in the keyboard.
Selection
- WIDOKOn Top When Selected (
Enumeration
): it controls the way in which the selection occurs in the 3D view if the object has a Shape, and there are many objects partially covered by others. It defaults toDisabled
, meaning that no special highlighting will occur;Enabled
means that the object will appear on top of any other object when selected;Object
means that the object will appear on top only if the entire object is selected in the tree view;Element
means that the object will appear on top only if a subelement (vertex, edge, face) is selected in the 3D view. - WIDOKSelection Style (
Enumeration
): it controls the way the object is highlighted if it has a Shape. If it isShape
, the entire shape (vertices, edges, and faces) will be highlighted in the 3D view; if it isBoundBox
a bounding box will appear surrounding the object and will be highlighted.
Scripting
See also: FreeCAD Scripting Basics, and scripted objects.
See Part Feature for the general information on adding objects to the program.
An App FeaturePython is created with the addObject()
method of the document.
import FreeCAD as App
doc = App.newDocument()
obj = App.ActiveDocument.addObject("App::FeaturePython", "Name")
obj.Label = "Custom label"
For example, the Draft Text, Draft Dimension, and Working plane proxy elements of the Draft Workbench are App::FeaturePython
objects with a custom icon and additional properties. They hold data but not an actual Part TopoShape.
If the desired object should have a placement, a shape, an attachment, or other complex properties, it is better to create one of the more complex classes, for example, App GeoFeature, Part Feature, or Part Part2DObject.
- Rdzenne: App: Obiekt dokumentu
- Podstawowe: : Właściwości Python, App: Cechy geometrii, Część: Cecha, Siatka: Cecha, MES: Siatka
- Kształty wewnętrzne: Część: Kształt topologiczny, Siatka: Obiekt siatki, MES: Siatka
- Struktura: App: Obiekt grupy dokumentu (Std: Grupa), App: Część (Std: Część), App: Link
- Pochodne: Część: Part2DObject, Szkicownik: Obiekt szkicu, Projekt części: Zawartość, Projekt części: Cecha
- Jak zacząć
- Instalacja: Pobieranie programu, Windows, Linux, Mac, Dodatkowych komponentów, Docker, AppImage, Ubuntu Snap
- Podstawy: Informacje na temat FreeCAD, Interfejs użytkownika, Profil nawigacji myszką, Metody wyboru, Nazwa obiektu, Edytor ustawień, Środowiska pracy, Struktura dokumentu, Właściwości, Pomóż w rozwoju FreeCAD, Dotacje
- Pomoc: Poradniki, Wideo poradniki
- Środowiska pracy: Strona Startowa, Architektura, Assembly, CAM, Rysunek Roboczy, MES, Inspekcja, Siatka, OpenSCAD, Część, Projekt Części, Punkty, Inżynieria Wsteczna, Robot, Szkicownik, Arkusz Kalkulacyjny, Start, Powierzchnia 3D, Rysunek Techniczny, Test Framework, Web