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 class, so it cannot be created from the graphical interface. It is not meant to be used directly. It is sub-classed by other classes that are intended to handle shapes in the 3D view.
One of the most important GeoFeatures is the Part Feature class, which is the parent object of most 2D and 3D geometrical objects that can be displayed in the 3D view.
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 allows it to control the position of the shape it contains in the 3D view.
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.
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 a 2D or 3D object, it is usually better to create one of the sub-classes, for example, Part::Feature
, Part::Part2DObject
, or Sketcher::SketchObject
.
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. For this, the recommendation is to use the Template:App::GeometryPython class.
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, Arch, Assembly, 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