App FeaturePython

From LabRPS Documentation
Revision as of 07:49, 28 October 2024 by LabRPS (talk | contribs) (Created page with "{{TOCright}} == Introduction == An 32px App FeaturePython object, or formally an {{incode|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, Depending on the properties that are assigned to it, it can be used to manage different types of data. 800px {{Captio...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

An Feature.svg 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, Depending on the properties that are assigned to it, it can be used to manage different types of data.

LabRPS core objects.svg

Simplified diagram of the relationships between the core objects in LabRPS

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.

Properties

See Property for all property types that scripted objects can have.

The App FeaturePython (App::FeaturePython class) is derived from the basic App DocumentObject (App::DocumentObject class) and inherits all its properties. It also has several additional properties.

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

  • Data (Hidden)Proxy (PythonObject): a custom class associated with this object.
  • DataLabel (String): the user editable name of this object, it is an arbitrary UTF8 string.
  • Data (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 "".
  • Data (Hidden)Expression Engine (ExpressionEngine): a list of expressions. By default, it is empty [].
  • Data (Hidden)Visibility (Bool): whether to display the object or not.

View

Base

  • View (Hidden)Proxy (PythonObject): a custom viewprovider class associated with this object.

Display Options

  • ViewDisplay Mode (Enumeration): it is empty by default.
  • ViewShow In Tree (Bool): it defaults to true, 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 CheckBoxTrue.svg Show hidden items. Then the hidden item can be chosen and ViewShow In Tree can be switched back to true.
  • ViewVisibility (Bool): it defaults to true, in which case the object will be visible in the tree view. By default this property can be toggled on and off by selecting the object, and pressing the Space bar.

Scripting

See also: LabRPS Scripting Basics and scripted objects.

An App FeaturePython is created with the addObject() method of the document.

import LabRPS as App

doc = App.newDocument()
obj = App.ActiveDocument.addObject("App::FeaturePython", "Name")
obj.Label = "Custom label"


Template:Document objects navi