App GeoFeature
Introduction
An App GeoFeature object, or formally an App::GeoFeature
, is the base class of most objects that will display geometrical elements in the 3D view.
Simplified diagram of the relationships between the core objects in the program. The App::GeoFeature
class is the base class of essentially all objects in the software that will display a shape in the 3D view.
How to use
The App GeoFeature is an internal object, so it cannot be created from the graphical interface. It is generally not meant to be used directly, rather it defines a bare-bones object that only has a basic Placement property to define its position in the 3D view.
One of the most important GeoFeatures is the Part Feature class, which is the parent of most objects with 2D and 3D topological shapes.
Properties
An App GeoFeature (App::GeoFeature
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 GeoFeature has the DataPlacement property, which controls its position in the 3D view.
See Property for all property types that scripted objects can have.
These are the properties available in the property editor.
Data
Base
- DataPlacement: the position of the object in the 3D view. The placement is defined by a
Base
point (vector), and aRotation
(axis and angle). See Placement.- DataAngle: the angle of rotation around the DataAxis.
- DataAxis: the unit vector that defines the axis of rotation for the placement. Each value is between 0 and 1. If any value is above 1, the vector is normalized so that the magnitude of the vector is 1.
- DataPosition: the 3D coordinates of the base point of the placement.
- DataLabel: the user editable name of this object, it is an arbitrary UTF8 string.
View
Base
- ViewBounding Box: if it is
true
, the object will show the bounding box in the 3D view. - ViewDisplay Mode: it is empty by default.
- ViewOn Top When Selected:
Disabled
,Enabled
,Object
,Element
. - ViewSelectable: if it is
true
, the object can be picked with the pointer in the 3D view. Otherwise, the object cannot be selected until this option is set totrue
. - ViewSelection Style:
Shape
,BoundBox
. - ViewShape Color: a tuple of three values
(r,g,b)
to define the color of the faces in the 3D view; by default it is(0.8, 0.8, 0.8)
, which is displayed as[204,204,204]
on base 255, a light gray . - ViewShow In Tree: if it is
true
, the object appears in the tree view. Otherwise, it is set as invisible. - ViewTransparency: a float from 0 to 100 that determines the level of transparency of the faces in the 3D view. A value of 100 indicates completely invisible faces; the faces are invisible but they can still be picked as long as ViewSelectable is
true
. - ViewVisibility: 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
- ViewProxy: a class associated with this view provider.
- ViewShape Material: a material associated with this object.
Scripting
See also: FreeCAD Scripting Basics, and scripted objects.
See Part Feature for the general information on adding objects to the program
A GeoFeature is created with the addObject()
method of the document. If you would like to create an object with 2D or 3D geometry, it may be better to create one of the sub-classes specialized for those shapes, for example, Part Feature or Part Part2DObject.
import FreeCAD as App
doc = App.newDocument()
obj = App.ActiveDocument.addObject("App::GeoFeature", "Name")
obj.Label = "Custom label"
This basic App::GeoFeature
doesn't have a default view provider, so no icon will be displayed on the tree view, and no View properties will be available.
Therefore, for Python scripting, the recommendation is to add the App::GeometryPython
object.
import FreeCAD as App
doc = App.newDocument()
obj = App.ActiveDocument.addObject("App::GeometryPython", "Name")
obj.Label = "Custom label"
For example, the Arch BuildingPart element is an App::GeometryPython
object with a custom icon.
- Getting started
- Installation: Download, Windows, Linux, Mac, Additional components, Docker, AppImage, Ubuntu Snap
- Basics: About FreeCAD, Interface, Mouse navigation, Selection methods, Object name, Preferences, Workbenches, Document structure, Properties, Help FreeCAD, Donate
- Help: Tutorials, Video tutorials
- Workbenches: Std Base, Assembly, BIM, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test Framework
- Hubs: User hub, Power users hub, Developer hub