Difference between revisions of "Property editor"

From FreeCAD Documentation
Jump to navigation Jump to search
(New image "File:FreeCAD Properties Data.png" from the 0.19 version.)
(Marked this version for translation)
 
(61 intermediate revisions by 5 users not shown)
Line 2: Line 2:
 
<translate>
 
<translate>
 
<!--T:27-->
 
<!--T:27-->
{{docnav|Interface Customization|Workbenches}}
+
{{Docnav
 +
|[[Interface Customization|Interface Customization]]
 +
|[[Workbenches|Workbenches]]
 +
}}
 +
 
 +
== Introduction == <!--T:1-->
  
==Overview== <!--T:1-->
+
<!--T:29-->
The Property Editor is one of the most important tools of FreeCAD and a main element while working with FreeCAD.
+
The [[property editor|property editor]] appears when the {{MenuCommand|Model}} tab of the [[combo_view|combo view]] is active in the [[interface|interface]]; it allows managing the publicly exposed properties of the objects in the document.
The Property Editor allows managing the properties of the objects in your document.
 
  
 
<!--T:2-->
 
<!--T:2-->
Generally the Property Editor is intended to deal with just one object at one time. The values shown in the Property Editor belong to the active object of your active document (be careful of which document is really active if you work on multiple documents). If you did not select any element (or there are no elements), the Property Editor will be blank.
+
Generally, the property editor is intended to deal with just one object at one time. The values shown in the property editor belong to the selected object of the active document. Despite this, some properties like colors, can be set for multiple selected objects. If there are no elements selected, the property editor will be empty.
  
 
<!--T:3-->
 
<!--T:3-->
Not all the properties can be modified in any moment. Depending on the specific status, some properties will be shown as read-only.
+
Not all properties can be modified always; depending on the specific status of the property, some of them will be invisible (not listed), or be read-only (not editable).
 +
</translate>
 +
{{TOCright}}
 +
<translate>
  
<!--T:4-->
+
<!--T:30-->
The properties of an object are grouped in View properties and Data properties, and shown under different tabs.
+
[[File:FreeCAD_Property_editor_empty.png]]
  
<!--T:5-->
+
<!--T:31-->
Different objects may have different properties. However, some properties are common among all objects, for instance the position and the rotation of an object are Data properties that can be manipulated.
+
{{Caption|Empty property editor, when no object is selected.}}
  
==Property definition== <!--T:6-->
+
==Property types== <!--T:6-->
A '''property''' is a piece of information like a number or a text string that is attached to a FreeCAD document or an object in a document. Properties can be viewed and modified with the [[Property editor]].
 
  
<!--T:11-->
+
<!--T:32-->
Properties play a very important part in FreeCAD, since it has been designed to work with parametric objects, which are objects defined only by their properties.
+
A property is a piece of information like a number or a text string that is attached to a FreeCAD document or an object in the document.
  
 
<!--T:12-->
 
<!--T:12-->
Custom [[scripted objects]] in FreeCAD can have properties of the following types:
+
Custom [[scripted objects|scripted objects]] can use any of the property types defined in the base system. See the full list in [[Property|Property]].
  
<!--T:13-->
+
<!--T:33-->
 +
Some of the most commonly used property types are:
 +
</translate>
 
{{Code|code=
 
{{Code|code=
Boolean
+
App::PropertyBool
Float
+
App::PropertyFloat
FloatList
+
App::PropertyAngle
FloatConstraint
+
App::PropertyDistance
Angle
+
App::PropertyInteger
Distance
+
App::PropertyString
Integer
+
App::PropertyMatrix
IntegerConstraint
+
App::PropertyVector
Percent
+
App::PropertyPlacement
Enumeration
 
IntegerList
 
String
 
StringList
 
Link
 
LinkList
 
Matrix
 
Vector
 
VectorList
 
Placement
 
PlacementLink
 
Color
 
ColorList
 
Material
 
Path
 
File
 
FileIncluded
 
PartShape
 
FilletContour
 
Circle
 
 
}}
 
}}
 +
<translate>
 +
 +
<!--T:5-->
 +
Different objects may have different types of properties. However, many objects have the same types because they are derived from the same internal class. For example, most objects that describe geometrical shapes (lines, circles, rectangles, solid bodies, imported parts, etc.), have the "Placement" property that defines their position in the [[3D view|3D view]].
 +
 +
== View and Data properties == <!--T:34-->
 +
 +
<!--T:15-->
 +
There are two classes of feature properties accessible through tabs in the property editor:
 +
* {{MenuCommand|View}} properties, related to the "visual" appearance of the object. The {{MenuCommand|View}} properties are tied to the {{Emphasis|ViewProvider}} ({{incode|ViewObject}} attribute) of the object, and are only accessible when the graphical user interface (GUI) is loaded. They are not accessible when using FreeCAD in console mode, or as a headless library.
 +
* {{MenuCommand|Data}} properties, related to the "physical" parameters of the object. The {{MenuCommand|Data}} properties define the essential characteristics of the object; they exist at all times, even when FreeCAD is used in console mode, or as a library. This means that if you load a document in console mode, you can edit the radius of a circle or the length of a line, even if you cannot see the result on the screen.
 +
 +
<!--T:35-->
 +
For this reason, {{MenuCommand|Data}} properties are considered to be more "real", as they truly define the geometry of a shape. On the other hand, {{MenuCommand|View}} properties are less important because they only affect the superficial appearance of the geometry. For example, a circle of 10 mm radius is different from a circle of 5 mm radius; the color of the circle (view property) doesn't affect its shape, but the radius does (data property). In many instances in this documentation, the word "property" is understood to refer to a "Data property" and not to a "View property".
 +
 +
=== Basic properties === <!--T:36-->
 +
 +
<!--T:64-->
 +
{{Emphasis|See also: [[Object_name|Object name]]}}
 +
 +
<!--T:37-->
 +
The most basic [[scripted objects|scripted object]] won't show any {{MenuCommand|Data}} property in the property editor, except for its {{incode|Label}} attribute. The {{incode|Label}} is a user editable string that identifies the object in the [[tree view|tree view]]. On the other hand, the {{incode|Name}} attribute of an object is assigned at the moment of its creation and cannot be changed; this attribute is read-only, and is not displayed in the property editor either.
 +
 +
<!--T:38-->
 +
A basic parametric object is created as follow
  
Internally, the property name is prefixed with {{incode|App::Property}}:
+
</translate>
 
{{Code|code=
 
{{Code|code=
App::PropertyBoolean
+
obj = App.ActiveDocument.addObject("App::FeaturePython", "App__FeaturePython")
App::PropertyFloat
+
obj.Label = "Plain_object"
App::PropertyFloatList
+
print(obj.Name)
...
+
print(obj.Label)
 
}}
 
}}
 +
<translate>
 +
 +
<!--T:39-->
 +
[[File:FreeCAD_Property_editor_View_basic.png|x264px]] [[File:FreeCAD_Property_editor_Data_basic.png|x264px]]
 +
 +
<!--T:40-->
 +
{{Caption|View and Data tabs of the property editor, for a basic "App::FeaturePython" scripted object.}}
 +
 +
<!--T:45-->
 +
Most geometrical objects that can be created and displayed in the [[3D view|3D view]] are derived from a {{incode|Part::Feature}}. See [[Part Feature|Part Feature]] for the most basic properties that these objects have.
 +
 +
<!--T:46-->
 +
For 2D geometry, most objects are derived from {{incode|Part::Part2DObject}} (itself derived from {{incode|Part::Feature}}) which is the base of [[Sketch|Sketches]], and most [[Draft Workbench|Draft elements]]. See [[Part Part2DObject|Part Part2DObject]] for the most basic properties that these objects have.
  
==Example of Part object properties== <!--T:14-->
+
==Actions == <!--T:41-->
===Properties===
 
  
 +
<!--T:42-->
 +
Actions in the property view were implemented in 0.19.
  
<!--T:15-->
+
<!--T:43-->
There are two types of feature properties accessible through tabs at the bottom of the property editor:
+
Right clicking in an empty space of the view, or with a property selected, shows only one command:
: {{PropertyView|View}} : properties related to the "visual" display of an object.
+
* {{MenuCommand|Show all}}: if active, in addition to the standard properties that appear already, it shows all the hidden Data and View properties in their respective tabs.
: {{PropertyData|Data}} : properties related to the "physical" parameters of an object.
+
** Data: "Proxy", "Label2", "Expression Engine", and "Visibility".
 +
** View: "Proxy".
 +
 
 +
<!--T:44-->
 +
When the {{MenuCommand|Show all}} option is active, and one property is selected, more actions are available with a second right click:
 +
* {{MenuCommand|Show all}}: deactivates the {{MenuCommand|Show all}} command, hiding the additional Data and View properties.
 +
* {{MenuCommand|Add Property}}: adds a dynamic property to the object; this works with both C++ defined objects, and Python [[scripted objects|scripted objects]].
 +
* {{MenuCommand|Expression}}: brings up the formula editor, which allows using [[Expressions|expressions]] in the property value.
 +
* {{MenuCommand|Hidden}}: if active, sets the property as hidden, meaning that it will only be displayed if {{MenuCommand|Show all}} is active.
 +
* {{MenuCommand|Output}}: if active, sets the property as output.
 +
* {{MenuCommand|NoRecompute}}: if active, sets the property as not recomputed when the document is recomputed; this is useful when a property should be kept unaffected by other updates.
 +
* {{MenuCommand|ReadOnly}}: if active, sets the property to be read-only; it won't be editable any more until this switch is turned off.
 +
* {{MenuCommand|Transient}}: if active, sets the property as transient.
 +
* {{MenuCommand|Touched}}: if active, it becomes touched, and ready for recompute.
 +
* {{MenuCommand|EvalOnRestore}}: if active, it is evaluated when the document is restored.
 +
 
 +
==Example of the properties of a PartDesign object== <!--T:14-->
 +
 
 +
<!--T:56-->
 +
In this section we show some common properties that are visible for a [[PartDesign Body|PartDesign Body]], and one [[PartDesign Feature|PartDesign Feature]]. The specific properties of an object can found in the specific documentation page of that object.
  
 
===View=== <!--T:16-->
 
===View=== <!--T:16-->
  
 +
<!--T:57-->
 +
Most of these properties are inherited from the [[Part_Feature|Part Feature]] basic object.
  
 
<!--T:17-->
 
<!--T:17-->
[[File:FreeCAD_Properties_View.png|490px|left]]
+
[[File:FreeCAD_Property_editor_View.png|490px|left]]
 
{{TitleProperty|Base}}
 
{{TitleProperty|Base}}
  
 
<!--T:18-->
 
<!--T:18-->
* {{PropertyView|Bounding Box}} : Indicates if a box showing the overall extent of the object is to be displayed. Value False, or True (Default, False).
+
* {{PropertyView|Angular Deflection}}: it is another way to specify how finely to generate the mesh for rendering on screen or when exporting. The default value is 28.5 degrees, or 0.5 radians. The smaller the value the smoother the appearance will be in the [[3D view|3D view]], and the finer the mesh that will be exported.
* {{PropertyView|Control Point}} : Indicates if the feature control points are to be displayed.  Value False, or True (Default, False).
+
* {{PropertyView|Bounding Box}}: indicates if a box showing the overall extent of the object is displayed.
* {{PropertyView|Deviation}} : Sets the accuracy of the polygonal representation of the model in the 3d view (tessellation). Lower values = better quality. The value is in percent of object's size (deviation in mm = (w+h+d)/3*valueInPercent/100, where w,h,d are the bounding box dimensions).
+
* {{PropertyView|Deviation}}: sets the accuracy of the polygonal representation of the model in the [[3D view|3D view]] (tessellation). Lower values indicate better quality. The value is in percent of object's size.
* {{PropertyView|Display Mode}} :Display mode of the feature, '''Flat lines, Shaded, Wireframe, Points''' [[IMAGE:Vue_DisplayModePartDesign_fr_00.png|96px]]. (Default, '''Flat lines''').
+
* {{PropertyView|Display Mode}}: display mode of the entire Body, {{Value|Flat lines}} (default), {{Value|Shaded}}, {{Value|Wireframe}}, {{Value|Points}}.
* {{PropertyView|Lighting}} : Lighting '''One side, Two side''' [[IMAGE:Vue_Lighting_fr_00.png|96px]]. (Default, '''Two side''').
+
* {{PropertyView|Display Mode Body}}: display mode of the Tip of the Body, {{Value|Through}} (default), {{Value|Tip}}.
* {{PropertyView|Line Color}} : Gives the color of the line (edges) (Default, '''25, 25, 25''').
+
* {{PropertyView|Draw Style}}: {{Value|Solid}}, {{Value|Dashed}}, {{Value|Dotted}}, {{Value|Dashdot}}; defines the style of the edges in the [[3D view|3D view]].
* {{PropertyView|Line Width}} : Gives the thickness of the line (edges) (Default, '''2''').
+
* {{PropertyView|Lighting}}: {{Value|One side}}, {{Value|Two side}} (default).
* {{PropertyView|Point Color}} : Gives the color of the points (ends of the feature) (Default, '''25, 25, 25''').
+
* {{PropertyView|Line Color}}: the RGB color of the edges, it defaults to {{value|(25, 25, 25)}}.
* {{PropertyView|Point Size}} : Gives the size of the points (Default, '''2''').
+
* {{PropertyView|Line Width}}: the thickness of the edges, it defaults to {{value|2}} pixels.
* {{PropertyView|Selectable}} : Allows selection of the feature. Value False, ou True (Default, True).
+
* {{PropertyView|On Top When Selected}}: {{value|Disabled}}, {{value|Enabled}}, {{value|Object}}, {{value|Element}}.
* {{PropertyView|Shape Color}} : Give the color shape (default, '''204, 204, 204''').
+
* {{PropertyView|Point Color}}: the RGB color of the vertices, it defaults to {{value|(25, 25, 25)}}.
* {{PropertyView|Transparency}} : Sets the degree of transparency in the feature of '''0''' to '''100''' (Default, '''0''').
+
* {{PropertyView|Point Size}}: the size of the vertices, it defaults to {{value|2}} pixels.
* {{PropertyView|Visibility}} : Determines the visibility of the feature (like the bar {{KEY|SPACE}}). Value False, or True (Default, True).
+
* {{PropertyView|Selectable}}: whether the object is selectable or not.
 +
* {{PropertyView|Selection Style}}: {{value|Shape}}, {{value|BoundBox}}.
 +
* {{PropertyView|Shape Color}}: the RGB color of the shape, it defaults to {{value|(204, 204, 204)}}.
 +
* {{PropertyView|Show In Tree}}: if it is {{TRUE}}, the object appears in the tree view. Otherwise, it is set as invisible.
 +
* {{PropertyView|Transparency}}: the degree of transparency from {{value|0}} (default) to {{value|100}}.
 +
* {{PropertyView|Visibility}}: whether the object is visible in the [[3D view|3D view]] or not. Toggle with the {{KEY|Space}} bar in the keyboard.
 
{{clear}}
 
{{clear}}
  
 
===Data=== <!--T:19-->
 
===Data=== <!--T:19-->
  
 +
<!--T:58-->
 +
In this case we observe the properties of the [[PartDesign Revolution|PartDesign Revolution]] feature.
  
 
<!--T:20-->
 
<!--T:20-->
[[File:FreeCAD_Properties_Data.png|490px|left]]
+
[[File:FreeCAD_Property_editor_Data.png|490px|left]]
 
{{TitleProperty|Base}}
 
{{TitleProperty|Base}}
  
 +
<!--T:25-->
 +
* {{PropertyData|Label}}: the user defined name given to the object, this can be changed as desired.
 +
 +
<!--T:59-->
 +
{{TitleProperty|Part Design}}
 +
* {{PropertyData|Refine}}: whether to refine the fusion done with other objects.
  
 
<!--T:21-->
 
<!--T:21-->
{{PropertyData|Placement}} :
+
{{TitleProperty|Revolution}}
Summary of the data below.
+
* {{PropertyData|Base}}: the point in space that specifies where the revolution takes place. It cannot be modified directly, only when editing the feature.
Every feature has a placement that can be controlled through the Data Properties table. It controls the placement of the part with respect to the coordinate system. NOTE: The placement properties do not affect the physical dimensions of the feature, but merely its position in space!<br>If you select the title '''Placement''' [[Image:Tache_Placement_01_fr_00.png|256px|Options Placement]], a button with {{KEY|three small points}} appears to the right. Clicking this button {{KEY| '''...'''}}, opens the '''[[Tasks_Placement|Tasks_Placement]]''' options window.
 
  
 +
<!--T:23-->
 +
* {{PropertyData|Axis}}: the axis around which the revolution will be performed. It cannot be modified directly, only when editing the feature.
  
 
<!--T:22-->
 
<!--T:22-->
{{PropertyData|Angle}} :
+
* {{PropertyData|Angle}}: the angle that specifies how much of the base element is rotated. By default it is {{value|360 deg}}, but it can be any fraction of that.
Specifies the angle to be used with the [[#Axis|axis]] property (below). An angle is set here, and the axis that the angle acts upon is set with the axis property.
 
The feature is rotated by the specified angle, about the specified axis.
 
A usage example might be if you created a revolution feature as required, but then needed to rotate the whole feature by some amount, in order to allow it to line-up with another pre-existing feature.
 
  
 +
<!--T:60-->
 +
{{TitleProperty|Sketch Based}}
  
<!--T:23-->
+
<!--T:24-->
{{PropertyData|Axis}} :
+
* {{PropertyData|Midplane}}: if the base object is a [[Sketch|Sketch]], when this property is {{TRUE}}, it will perform the revolution with the sketch serving as a plane of symmetry. This is noticeable if the {{PropertyData|Angle}} is different from {{value|360 deg}}.
This property specifies the axis/axes about which the feature is to be rotated. The exact value of rotation comes from the angle property (above).
+
* {{PropertyData|Reversed}}: by default it is {{TRUE}}. Whether to perform the revolution in one direction or the other.
This property takes three arguments, which are passed as numbers in the x, y, and z boxes in the tool. Setting a value for more than one of the axes will cause the part to be rotated in each axis, by the angle value multiplied by the value for the axis.
+
 
For example, with an angle of 15° set, specifying a value of 1.0 for x, and 2.0 for y will cause the finished part to be rotated 15° in the x-axis AND 30° in the y-axis.
+
</translate>
 +
{{clear}}
 +
<translate>
 +
 
 +
== Scripting == <!--T:48-->
 +
 
 +
<!--T:51-->
 +
{{Emphasis|See also:}} [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].
 +
 
 +
<!--T:52-->
 +
See [[scripted objects|scripted objects]] for the full information on adding properties to objects defined through [[Python|Python]].
 +
 
 +
<!--T:49-->
 +
Most properties that are visible in the property editor can be accessed from the [[Python console|Python console]]. These properties are just attributes of the class that defines the selected object. For example, if the property editor shows the {{PropertyData|Group}} property, this means that the object has the {{incode|Group}} attribute.
 +
</translate>
 +
{{Code|code=
 +
print(obj.Group)
 +
}}
 +
<translate>
 +
 
 +
<!--T:53-->
 +
These attributes (properties) are added with the {{incode|addProperty}} method of the base object. At least it is necessary to specify the type of [[property|property]], and its name.
 +
</translate>
 +
{{Code|code=
 +
obj.addProperty("App::PropertyFloat", "Custom")
 +
print(obj.Custom)
 +
}}
 +
<translate>
  
 +
<!--T:50-->
 +
Properties follow the {{incode|CapitalCamelCase}} or {{incode|PascalCase}} convention, meaning that each word starts with a capital letter, and there are no underscores. When the property editor displays such names, it leaves a space between each capital letter, making it easier to read.
  
<!--T:24-->
+
</translate>
{{PropertyData|Position}} :
+
{{Code|code=
This property specifies the base point to which all dimensions refer. This takes three arguments, which are passed as numbers to the x, y, and z boxes in the tool. Setting a value for more than one of the boxes will cause the part to be translated by the number of units along the corresponding axis.
+
obj.addProperty("App::PropertyDistance", "CustomCamelProperty")
 +
obj.CustomCamelProperty = 1000
 +
print(obj.CustomCamelProperty)
 +
}}
 +
<translate>
  
 +
<!--T:54-->
 +
[[File:FreeCAD_Property_editor_Custom.png]]
 +
{{Caption|Property editor showing the Data properties of a [[PartDesign Body|PartDesign Body]], with two additional properties, "Custom" and "Custom Camel Property".}}
  
<!--T:25-->
+
<!--T:55-->
{{PropertyData|Label}} :
+
In similar way the {{MenuCommand|View}} properties are added, not to the base object, but to its {{incode|ViewObject}}. Then, it follows that properties like {{PropertyView|Angular Deflection}}, {{PropertyView|Bounding Box}}, {{PropertyView|Display Mode}}, {{PropertyView|Display Mode Body}}, {{PropertyView|Line Color}}, and others, can be examined and changed from the [[Python console|Python console]].
The Label is the name given to the object (feature), this name can be changed as desired.
 
  
 +
</translate>
 +
{{Code|code=
 +
print(obj.ViewObject.AngularDeflection)
 +
print(obj.ViewObject.BoundingBox)
 +
print(obj.ViewObject.DisplayMode)
 +
print(obj.ViewObject.DisplayModeBody)
 +
print(obj.ViewObject.LineColor)
 +
}}
 +
<translate>
  
<!--T:26-->
+
<!--T:61-->
{{clear}}
+
All public properties of the object, and of its view provider, are contained in the corresponding {{incode|PropertiesList}} attribute.
'''PS: The displayed properties can vary, depending on the tool used.'''
+
</translate>
 +
{{Code|code=
 +
print(obj.PropertiesList)
 +
print(obj.ViewObject.PropertiesList)
 +
}}
 +
<translate>
  
 
<!--T:9-->
 
<!--T:9-->
{{docnav|Interface Customization|Workbenches}}
+
{{Docnav
 
+
|[[Interface Customization|Interface Customization]]
<!--T:10-->
+
|[[Workbenches|Workbenches]]
[[Category:User Documentation]]
+
}}
  
<!--T:28-->
 
[[Category:Base]]
 
 
</translate>
 
</translate>
 +
{{Interface navi{{#translation:}}}}
 +
{{Std Base navi{{#translation:}}}}
 +
{{Userdocnavi{{#translation:}}}}

Latest revision as of 22:06, 5 June 2020

Other languages:
Bahasa Indonesia • ‎Deutsch • ‎English • ‎Türkçe • ‎español • ‎français • ‎hrvatski • ‎italiano • ‎polski • ‎português • ‎português do Brasil • ‎română • ‎svenska • ‎čeština • ‎български • ‎русский • ‎українська • ‎中文(中国大陆)‎

Introduction

The property editor appears when the Model tab of the combo view is active in the interface; it allows managing the publicly exposed properties of the objects in the document.

Generally, the property editor is intended to deal with just one object at one time. The values shown in the property editor belong to the selected object of the active document. Despite this, some properties like colors, can be set for multiple selected objects. If there are no elements selected, the property editor will be empty.

Not all properties can be modified always; depending on the specific status of the property, some of them will be invisible (not listed), or be read-only (not editable).

FreeCAD Property editor empty.png

Empty property editor, when no object is selected.


Property types

A property is a piece of information like a number or a text string that is attached to a FreeCAD document or an object in the document.

Custom scripted objects can use any of the property types defined in the base system. See the full list in Property.

Some of the most commonly used property types are:

App::PropertyBool
App::PropertyFloat
App::PropertyAngle
App::PropertyDistance
App::PropertyInteger
App::PropertyString
App::PropertyMatrix
App::PropertyVector
App::PropertyPlacement

Different objects may have different types of properties. However, many objects have the same types because they are derived from the same internal class. For example, most objects that describe geometrical shapes (lines, circles, rectangles, solid bodies, imported parts, etc.), have the "Placement" property that defines their position in the 3D view.

View and Data properties

There are two classes of feature properties accessible through tabs in the property editor:

  • View properties, related to the "visual" appearance of the object. The View properties are tied to the ViewProvider (ViewObject attribute) of the object, and are only accessible when the graphical user interface (GUI) is loaded. They are not accessible when using FreeCAD in console mode, or as a headless library.
  • Data properties, related to the "physical" parameters of the object. The Data properties define the essential characteristics of the object; they exist at all times, even when FreeCAD is used in console mode, or as a library. This means that if you load a document in console mode, you can edit the radius of a circle or the length of a line, even if you cannot see the result on the screen.

For this reason, Data properties are considered to be more "real", as they truly define the geometry of a shape. On the other hand, View properties are less important because they only affect the superficial appearance of the geometry. For example, a circle of 10 mm radius is different from a circle of 5 mm radius; the color of the circle (view property) doesn't affect its shape, but the radius does (data property). In many instances in this documentation, the word "property" is understood to refer to a "Data property" and not to a "View property".

Basic properties

See also: Object name

The most basic scripted object won't show any Data property in the property editor, except for its Label attribute. The Label is a user editable string that identifies the object in the tree view. On the other hand, the Name attribute of an object is assigned at the moment of its creation and cannot be changed; this attribute is read-only, and is not displayed in the property editor either.

A basic parametric object is created as follow

obj = App.ActiveDocument.addObject("App::FeaturePython", "App__FeaturePython")
obj.Label = "Plain_object"
print(obj.Name)
print(obj.Label)

FreeCAD Property editor View basic.png FreeCAD Property editor Data basic.png

View and Data tabs of the property editor, for a basic "App::FeaturePython" scripted object.


Most geometrical objects that can be created and displayed in the 3D view are derived from a Part::Feature. See Part Feature for the most basic properties that these objects have.

For 2D geometry, most objects are derived from Part::Part2DObject (itself derived from Part::Feature) which is the base of Sketches, and most Draft elements. See Part Part2DObject for the most basic properties that these objects have.

Actions

Actions in the property view were implemented in 0.19.

Right clicking in an empty space of the view, or with a property selected, shows only one command:

  • Show all: if active, in addition to the standard properties that appear already, it shows all the hidden Data and View properties in their respective tabs.
    • Data: "Proxy", "Label2", "Expression Engine", and "Visibility".
    • View: "Proxy".

When the Show all option is active, and one property is selected, more actions are available with a second right click:

  • Show all: deactivates the Show all command, hiding the additional Data and View properties.
  • Add Property: adds a dynamic property to the object; this works with both C++ defined objects, and Python scripted objects.
  • Expression: brings up the formula editor, which allows using expressions in the property value.
  • Hidden: if active, sets the property as hidden, meaning that it will only be displayed if Show all is active.
  • Output: if active, sets the property as output.
  • NoRecompute: if active, sets the property as not recomputed when the document is recomputed; this is useful when a property should be kept unaffected by other updates.
  • ReadOnly: if active, sets the property to be read-only; it won't be editable any more until this switch is turned off.
  • Transient: if active, sets the property as transient.
  • Touched: if active, it becomes touched, and ready for recompute.
  • EvalOnRestore: if active, it is evaluated when the document is restored.

Example of the properties of a PartDesign object

In this section we show some common properties that are visible for a PartDesign Body, and one PartDesign Feature. The specific properties of an object can found in the specific documentation page of that object.

View

Most of these properties are inherited from the Part Feature basic object.

FreeCAD Property editor View.png

Base

  • ViewAngular Deflection: it is another way to specify how finely to generate the mesh for rendering on screen or when exporting. The default value is 28.5 degrees, or 0.5 radians. The smaller the value the smoother the appearance will be in the 3D view, and the finer the mesh that will be exported.
  • ViewBounding Box: indicates if a box showing the overall extent of the object is displayed.
  • ViewDeviation: sets the accuracy of the polygonal representation of the model in the 3D view (tessellation). Lower values indicate better quality. The value is in percent of object's size.
  • ViewDisplay Mode: display mode of the entire Body, Flat lines (default), Shaded, Wireframe, Points.
  • ViewDisplay Mode Body: display mode of the Tip of the Body, Through (default), Tip.
  • ViewDraw Style: Solid, Dashed, Dotted, Dashdot; defines the style of the edges in the 3D view.
  • ViewLighting: One side, Two side (default).
  • ViewLine Color: the RGB color of the edges, it defaults to (25, 25, 25).
  • ViewLine Width: the thickness of the edges, it defaults to 2 pixels.
  • ViewOn Top When Selected: Disabled, Enabled, Object, Element.
  • ViewPoint Color: the RGB color of the vertices, it defaults to (25, 25, 25).
  • ViewPoint Size: the size of the vertices, it defaults to 2 pixels.
  • ViewSelectable: whether the object is selectable or not.
  • ViewSelection Style: Shape, BoundBox.
  • ViewShape Color: the RGB color of the shape, it defaults to (204, 204, 204).
  • ViewShow In Tree: if it is True, the object appears in the tree view. Otherwise, it is set as invisible.
  • ViewTransparency: the degree of transparency from 0 (default) to 100.
  • ViewVisibility: whether the object is visible in the 3D view or not. Toggle with the Space bar in the keyboard.


Data

In this case we observe the properties of the PartDesign Revolution feature.

FreeCAD Property editor Data.png

Base

  • DataLabel: the user defined name given to the object, this can be changed as desired.

Part Design

  • DataRefine: whether to refine the fusion done with other objects.

Revolution

  • DataBase: the point in space that specifies where the revolution takes place. It cannot be modified directly, only when editing the feature.
  • DataAxis: the axis around which the revolution will be performed. It cannot be modified directly, only when editing the feature.
  • DataAngle: the angle that specifies how much of the base element is rotated. By default it is 360 deg, but it can be any fraction of that.

Sketch Based

  • DataMidplane: if the base object is a Sketch, when this property is True, it will perform the revolution with the sketch serving as a plane of symmetry. This is noticeable if the DataAngle is different from 360 deg.
  • DataReversed: by default it is True. Whether to perform the revolution in one direction or the other.


Scripting

See also: FreeCAD Scripting Basics.

See scripted objects for the full information on adding properties to objects defined through Python.

Most properties that are visible in the property editor can be accessed from the Python console. These properties are just attributes of the class that defines the selected object. For example, if the property editor shows the DataGroup property, this means that the object has the Group attribute.

print(obj.Group)

These attributes (properties) are added with the addProperty method of the base object. At least it is necessary to specify the type of property, and its name.

obj.addProperty("App::PropertyFloat", "Custom")
print(obj.Custom)

Properties follow the CapitalCamelCase or PascalCase convention, meaning that each word starts with a capital letter, and there are no underscores. When the property editor displays such names, it leaves a space between each capital letter, making it easier to read.

obj.addProperty("App::PropertyDistance", "CustomCamelProperty")
obj.CustomCamelProperty = 1000
print(obj.CustomCamelProperty)

FreeCAD Property editor Custom.png

Property editor showing the Data properties of a PartDesign Body, with two additional properties, "Custom" and "Custom Camel Property".


In similar way the View properties are added, not to the base object, but to its ViewObject. Then, it follows that properties like ViewAngular Deflection, ViewBounding Box, ViewDisplay Mode, ViewDisplay Mode Body, ViewLine Color, and others, can be examined and changed from the Python console.

print(obj.ViewObject.AngularDeflection)
print(obj.ViewObject.BoundingBox)
print(obj.ViewObject.DisplayMode)
print(obj.ViewObject.DisplayModeBody)
print(obj.ViewObject.LineColor)

All public properties of the object, and of its view provider, are contained in the corresponding PropertiesList attribute.

print(obj.PropertiesList)
print(obj.ViewObject.PropertiesList)