Property/de: Difference between revisions

From FreeCAD Documentation
No edit summary
(Updating to match new version of source page)
(14 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<languages/>
Eine '''Objekteigenschaft''' ist eine Information, wie eine Ziffer oder ein Text, angehängt an ein FreeCAD-Dokument oder an ein Objekt in einem Dokument. Objekteigenschaft können betrachtet werden und - falls Berechtigung vorhanden - auch geändert werden, im [[Eigenschaften-editor]].


== Introduction ==
Eigenschaften spielen eine ausgesprochen wichtige Rolle in FreeCAD, da diese von Anfang an nötig sind, um mit parametrischen Objekten zu arbeiten, da solche Objekte '''nur''' durch ihre Eigenschaften definiert werden.


<div class="mw-translate-fuzzy">
Selbsterstellte Objekte [[scripted objects]] in FreeCAD können Objekteigenschaften der folgenden Typen besitzen:
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">
Boolean
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.
Float
</div>
FloatList
FloatConstraint
Angle
Distance
Integer
IntegerConstraint
Percent
Enumeration
IntegerList
String
StringList
Link
LinkList
Matrix
Vector
VectorList
Placement
PlacementLink
Color
ColorList
Material
Path
File
FileIncluded
PartShape
FilletContour
Circle


== All property types ==
{{docnav/de|Benutzeroberfläche anpassen|Arbeiten mit Arbeitsbereichen}}


<div class="mw-translate-fuzzy">
{{languages |{{en|Property}} {{es|Property/es}} {{fr|Property/fr}} {{pl|Property/pl}} {{se|Property/se}} {{ru|Property/ru}} }}
Benutzerdefinierte [[scripted objects/de|geskriptete Objekte]] in FreeCAD können Eigenschaften der folgenden Typen besitzen:
</div>
{{Code|code=
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 {{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]]}}

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

[[Category:Base/de]]

{{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")