Property/de: Difference between revisions

From FreeCAD Documentation
No edit summary
(Updating to match new version of source page)
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<languages/>

== Introduction ==

<div class="mw-translate-fuzzy">
Eine '''Eigenschaft''' ist ein Stück Information wie eine Zahl oder eine Zeichenkette, das mit einem FreeCAD-Dokument oder einem Objekt eines Dokuments verbunden ist. Eigenschaften können mit dem [[Property editor/de|Eigenschaftseditor]] angezeigt und geändert werden.
Eine '''Eigenschaft''' ist ein Stück Information wie eine Zahl oder eine Zeichenkette, das mit einem FreeCAD-Dokument oder einem Objekt eines Dokuments verbunden ist. Eigenschaften können mit dem [[Property editor/de|Eigenschaftseditor]] angezeigt und geändert werden.
</div>


<div class="mw-translate-fuzzy">
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.
Eigenschaften spielen in FreeCAD eine sehr wichtige Rolle, da es konstruiert wurde, um mit parametrischen Objekten zu arbeiten, die nur durch ihre Eigenschaften definiert werden.
</div>


== All property types ==
Custom [[scripted objects]] in FreeCAD can have properties of the following types:


<div class="mw-translate-fuzzy">
Benutzerdefinierte [[scripted objects/de|geskriptete Objekte]] in FreeCAD können Eigenschaften der folgenden Typen besitzen:
</div>
{{Code|code=
{{Code|code=
Bool
Boolean
Float
Float
FloatList
FloatList
FloatConstraint
FloatConstraint
Angle
Angle
Distance
Distance
ExpressionEngine
Integer
Integer
IntegerConstraint
IntegerConstraint
Percent
Percent
Enumeration
Enumeration
IntegerList
IntegerList
String
String
StringList
StringList
Link
Length
LinkList
Link
Matrix
LinkList
Vector
LinkSubList
VectorList
Matrix
Placement
Vector
PlacementLink
VectorList
Color
VectorDistance
ColorList
Placement
Material
PlacementLink
Path
PythonObject
File
Color
FileIncluded
ColorList
PartShape
Material
FilletContour
Path
Circle
File
FileIncluded
PartShape
FilletContour
Circle
}}
}}


Internally, the property name is prefixed with {{incode|App::Property}}:
{{Code|code=
App::PropertyBool
App::PropertyFloat
App::PropertyFloatList
...
}}

Remember that these are property {{Emphasis|types}}. A single object may have many properties of the same type, but with different names.

For example:

{{Code|code=
obj.addProperty("App::PropertyFloat", "Length")
obj.addProperty("App::PropertyFloat", "Width")
obj.addProperty("App::PropertyFloat", "Height")
}}

This indicates an object with three properties of type "Float", named "Length", "Width", and "Height", respectively.

== Scripting ==

{{Emphasis|See also:}} [[FreeCAD Scripting Basics|FreeCAD scripting basics]]

A [[scripted objects|scripted object]] is created first, and then properties are assigned.
{{Code|code=
obj = App.ActiveDocument.addObject("Part::Feature", "CustomObject")

obj.addProperty("App::PropertyFloat", "Velocity", "Parameter", "Body speed")
obj.addProperty("App::PropertyBool", "VelocityEnabled", "Parameter", "Enable body speed")
}}

In general, {{Emphasis|Data}} properties are assigned by using the object's {{incode|addProperty()}} method. On the other hand, {{Emphasis|View}} properties are normally provided automatically by the parent object from which the scripted object is derived.

For example:
* Deriving from {{incode|App::FeaturePython}} provides only 4 {{Emphasis|View}} properties: "Display Mode", "On Top When Selected", "Show In Tree", and "Visibility".
* Deriving from {{incode|Part::Feature}} provides 17 {{Emphasis|View}} properties: the previous four, plus "Angular Deflection", "Bounding Box", "Deviation", "Draw Style", "Lighting", "Line Color", "Line Width", "Point Color", "Point Size", "Selectable", "Selection Style", "Shape Color", and "Transparency".

Nevertheless, {{Emphasis|View}} properties can also be assigned using the view provider object's {{incode|addProperty()}} method.
{{Code|code=
obj.ViewObject.addProperty("App::PropertyBool", "SuperVisibility", "Base", "Make the object glow")
}}
{{docnav/de|[[Interface Customization/de|Benutzeroberfläche anpassen]]|[[Workbenches/de|Arbeiten mit Arbeitsbereichen]]}}
{{docnav/de|[[Interface Customization/de|Benutzeroberfläche anpassen]]|[[Workbenches/de|Arbeiten mit Arbeitsbereichen]]}}


<div class="mw-translate-fuzzy">
[[Category:User Documentation/de]]
[[Category:User Documentation/de]]
</div>


[[Category:Base]]
[[Category:Base/de]]


{{clear}}
{{clear}}

Revision as of 16:23, 12 December 2019

Introduction

Eine Eigenschaft ist ein Stück Information wie eine Zahl oder eine Zeichenkette, das mit einem FreeCAD-Dokument oder einem Objekt eines Dokuments verbunden ist. Eigenschaften können mit dem Eigenschaftseditor angezeigt und geändert werden.

Eigenschaften spielen in FreeCAD eine sehr wichtige Rolle, da es konstruiert wurde, um mit parametrischen Objekten zu arbeiten, die nur durch ihre Eigenschaften definiert werden.

All property types

Benutzerdefinierte geskriptete Objekte in FreeCAD können Eigenschaften der folgenden Typen besitzen:

Bool
Float
FloatList
FloatConstraint
Angle
Distance
ExpressionEngine
Integer
IntegerConstraint
Percent
Enumeration
IntegerList
String
StringList
Length
Link
LinkList
LinkSubList
Matrix
Vector
VectorList
VectorDistance
Placement
PlacementLink
PythonObject
Color
ColorList
Material
Path
File
FileIncluded
PartShape
FilletContour
Circle

Internally, the property name is prefixed with App::Property:

App::PropertyBool
App::PropertyFloat
App::PropertyFloatList
...

Remember that these are property types. A single object may have many properties of the same type, but with different names.

For example:

obj.addProperty("App::PropertyFloat", "Length")
obj.addProperty("App::PropertyFloat", "Width")
obj.addProperty("App::PropertyFloat", "Height")

This indicates an object with three properties of type "Float", named "Length", "Width", and "Height", respectively.

Scripting

See also: FreeCAD scripting basics

A scripted object is created first, and then properties are assigned.

obj = App.ActiveDocument.addObject("Part::Feature", "CustomObject")

obj.addProperty("App::PropertyFloat", "Velocity", "Parameter", "Body speed")
obj.addProperty("App::PropertyBool", "VelocityEnabled", "Parameter", "Enable body speed")

In general, Data properties are assigned by using the object's addProperty() method. On the other hand, View properties are normally provided automatically by the parent object from which the scripted object is derived.

For example:

  • Deriving from App::FeaturePython provides only 4 View properties: "Display Mode", "On Top When Selected", "Show In Tree", and "Visibility".
  • Deriving from Part::Feature provides 17 View properties: the previous four, plus "Angular Deflection", "Bounding Box", "Deviation", "Draw Style", "Lighting", "Line Color", "Line Width", "Point Color", "Point Size", "Selectable", "Selection Style", "Shape Color", and "Transparency".

Nevertheless, View properties can also be assigned using the view provider object's addProperty() method.

obj.ViewObject.addProperty("App::PropertyBool", "SuperVisibility", "Base", "Make the object glow")