App FeaturePython/it: Difference between revisions

From FreeCAD Documentation
(Created page with "== Proprietà ==")
(Created page with "=== Dati ===")
Line 27: Line 27:
These are the properties available in the [[property editor|property editor]].
These are the properties available in the [[property editor|property editor]].


=== Data ===
=== Dati ===


{{TitleProperty|Base}}
{{TitleProperty|Base}}

Revision as of 21:51, 16 December 2019

Other languages:

Introduzione

Un oggetto App FeaturePython, o formalmente un App::FeaturePython, è una semplice istanza di App DocumentObject in Python. Questo è un oggetto semplice che per impostazione predefinita non ha molte proprietà, ad esempio nessun posizionamentoforma topologica. Questo oggetto è per uso generale e, fornendolo di proprietà, può essere utilizzato per gestire diversi tipi di dati.

Diagramma semplificato delle relazioni tra gli oggetti principali del programma. La classe App::FeaturePython è una semplice implementazione di App::DocumentObject che può essere utilizzata per qualsiasi scopo, poiché per impostazione predefinita non ha una forma.

Utilizzo

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.

Proprietà

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.

Dati

Base

  • DatiLabel: the user editable name of this object, it is an arbitrary UTF8 string.

Hidden properties Data

  • DatiExpression Engine: a list of expressions.
  • DatiLabel2: a longer, user editable description of this object, it is an arbitrary UTF8 string.
  • VistaProxy: a class associated with this object.
  • DatiVisibility: whether to display the object or not.

View

Base

  • VistaDisplay Mode: it is empty by default.
  • VistaOn Top When Selected: Disabled, Enabled, Object, Element.
  • VistaSelection Style: Shape, BoundBox.
  • VistaShow In Tree: if it is true, the object appears in the tree view. Otherwise, it is set as invisible.
  • VistaVisibility: if it is true, the object appears in the 3D view; otherwise it is invisible. By default this property can be toggled on and off by pressing the Space bar in the keyboard.

Hidden properties View

  • VistaProxy: a class associated with this view provider.

Scripting

See also: FreeCAD Scripting Basics, and scripted objects.

See Part Feature for the general information on adding objects to the program.

A 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"