FreeCAD Logo FreeCAD 1.0
  • English Afrikaans Arabic Belarusian Catalan Czech German Greek Spanish Spanish Basque Finnish Filipino French Galician Croatian Hungarian Indonesian Italian Japanese Kabyle Korean Lithuanian Dutch Norwegian Bokmal Polish Portuguese Portuguese Romanian Russian Slovak Slovenian Serbian Swedish Turkish Ukrainian Valencian Vietnamese Chinese Chinese
  • Features
  • Download
  • Blog
  • Documentation
    Documentation index Getting started Users documentation The FreeCAD manual Workbenches documentation Python coding documentation C++ coding documentation Tutorials Frequently asked questions Privacy policy About FreeCAD
  • Contribute
    How to help Sponsor Report a bug Make a pull request Jobs and funding Contribution guidelines Developers handbook Translations
  • Community
    Code of conduct Forum The FPA GitHub GitLab Codeberg Mastodon Matrix IRC IRC via Webchat Gitter Discord Reddit Twitter Facebook LinkedIn Calendar
  • ♥ Donate

Donate

$
SEPA Information
Please set up your SEPA bank transfer to:
Beneficiary: The FreeCAD project association
IBAN: BE04 0019 2896 4531
BIC/SWIFT: GEBABEBBXXX
Bank agency: BNP Paribas Fortis
Address: Rue de la Station 64, 1360 Perwez, Belgium

While Stripe doesn't support monthly donations, you can still become a sponsor! Simply make a one-time donation equivalent to 12 months of support, and you'll gain access to the corresponding sponsoring tier. It's an easy and flexible way to contribute.

If you are not sure or not able to commit to a regular donation, but still want to help the project, you can do a one-time donation, of any amount.

Choose freely the amount you wish to donate one time only.

You can support FreeCAD by sponsoring it as an individual or organization through various platforms. Sponsorship provides a steady income for developers, allowing the FPA to plan ahead and enabling greater investment in FreeCAD. To encourage sponsorship, we offer different tiers, and unless you choose to remain anonymous, your name or company logo will be featured on our website accordingly.

from 1 USD / 1 EUR per month. You will not have your name displayed here, but you will have helped the project a lot anyway. Together, normal sponsors maintain the project on its feet as much as the bigger sponsors.

from 25 USD / 25 EUR per month. Your name or company name is displayed on this page.

from 100 USD / 100 EUR per month. Your name or company name is displayed on this page, with a link to your website, and a one-line description text.

from 200 USD / 200 EUR per month. Your name or company name and logo displayed on this page, with a link to your website and a custom description text. Companies that have helped FreeCAD early on also appear under Gold sponsors.

Instead of donating each month, you might find it more comfortable to make a one-time donation that, when divided by twelve, would give you right to enter a sponsoring tier. Don't hesitate to do so!

Choose freely the amount you wish to donate each month.

Please inform your forum name or twitter handle as a notein your transfer, or reach to us, so we can give you proper credits!

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 it doesn't have a placement or a topological shape. 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 FreeCAD

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.

For example, the Draft Text, Draft Dimension, and Draft WorkingPlaneProxy objects 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.

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 View. Hidden properties can be shown by using the Show hidden command in the context menu of the Property View.

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 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 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.

Selection

  • ViewOn 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 to Disabled, 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.
  • ViewSelection Style (Enumeration): it controls the way the object is highlighted if it has a Shape. If it is Shape, the entire shape (vertices, edges, and faces) will be highlighted in the 3D View; if it is BoundBox 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 document.

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"


This page is retrieved from https://wiki.freecad.org/App_FeaturePython

Get in touch!
Forum GitHub Mastodon Matrix IRC Gitter.im Discord Reddit Twitter Facebook LinkedIn

© The FreeCAD Team. Homepage image credits (top to bottom): ppemawm, r-frank, epileftric, regis, rider_mortagnais, bejant.

This project is supported by: , KiCad Services Corp. and other sponsors

GitHubImprove this page on GitHub