App DocumentObject: Difference between revisions

From LabRPS Documentation
Jump to navigation Jump to search
(Created page with "{{TOCright}} == Introduction == An App DocumentObject object, or formally an {{incode|App::DocumentObject}}, is the base class of all object classes handled in the document. In general terms, a "DocumentObject" is any "thing" that can appear in the Tree view, and which is saved and restored when opening a document. 800px {{Caption|Simplified diagram of the relationships between the core objects i...")
 
No edit summary
Line 18: Line 18:
* The [[App_FeaturePython|App FeaturePython]] class, an empty object that can be used for different purposes, depending on the added properties.
* The [[App_FeaturePython|App FeaturePython]] class, an empty object that can be used for different purposes, depending on the added properties.
* The [[App_RPSFeature|App RPSFeature]] class, the base object of all random phenomenon simulation objects.
* The [[App_RPSFeature|App RPSFeature]] class, the base object of all random phenomenon simulation objects.
* The [[WindLab_Feature|WindLab Feature]] class, derived from App RPSFeature.
* The [[SeismicLab_Feature|SeismicLab Feature]] class, derived from App RPSFeature.
* The [[SeaLab_Feature|SeaLab Feature]] class, derived from App RPSFeature.


== Properties ==  
== Properties ==  
Line 39: Line 36:
{{Emphasis|See also:}} [[LabRPS_Scripting_Basics|LabRPS Scripting Basics]] and [[Scripted_objects|scripted objects]].
{{Emphasis|See also:}} [[LabRPS_Scripting_Basics|LabRPS Scripting Basics]] and [[Scripted_objects|scripted objects]].


See [[WindLab_Feature|WindLab Feature]] for the general information on adding objects to the document.
A DocumentObject is created with the {{incode|addObject()}} method of the document. However, in general, there is no need to create this object manually. It is usually better to subclass one of the more complex classes, for example, [[App_FeaturePython|App FeaturePython]], etc.
 
A DocumentObject is created with the {{incode|addObject()}} method of the document. However, in general, there is no need to create this object manually. It is usually better to subclass one of the more complex classes, for example, [[App_FeaturePython|App FeaturePython]], [[App_RPSFeature|App RPSFeature]], [[WindLab_Feature|WindLab Feature]], etc.


{{Code|code=
{{Code|code=

Revision as of 08:12, 28 October 2024

Introduction

An App DocumentObject object, or formally an App::DocumentObject, is the base class of all object classes handled in the document.

In general terms, a "DocumentObject" is any "thing" that can appear in the Tree view, and which is saved and restored when opening a document.

LabRPS core objects.svg

Simplified diagram of the relationships between the core objects in LabRPS

Usage

The App DocumentObject is an internal class, so it cannot be created from the graphical interface, nor is it meant to be used by itself. It just defines the basic behavior and properties of objects in the program.

Some of the most important DocumentObjects are the following:

  • The App FeaturePython class, an empty object that can be used for different purposes, depending on the added properties.
  • The App RPSFeature class, the base object of all random phenomenon simulation objects.

Properties

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

These are the basic properties that essentially all objects have. These properties can be accessed from the Python console.

  • DataLabel (String): the user editable name of this object, it is an arbitrary UTF8 string. By default, it is the same as the Name.
  • DataLabel2 (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 "".
  • DataExpression Engine (ExpressionEngine): a list of expressions.
  • DataVisibility (Bool): whether to display the object or not.

For derived objects, only DataLabel will be listed in the property editor by default. The other properties will be hidden.

Scripting

See also: LabRPS Scripting Basics and scripted objects.

A DocumentObject is created with the addObject() method of the document. However, in general, there is no need to create this object manually. It is usually better to subclass one of the more complex classes, for example, App FeaturePython, etc.

import LabRPS as App

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


Template:Document objects navi