FeaturePython Custom Properties/ru

Введение
See also: Autogenerated API documentation (C++ documentation).

Properties are the true building blocks of FeaturePython objects. Through them, the user will be able to interact and modify your object. After creating a new FeaturePython object in your document:

You can get a list of the available properties by issuing:

Creating a FeaturePython object and adding a property to it
This code will create an object with internal name (automatically renamed to  and so on, if an object named  already exists) and give it the user-friendly label. This label will be displayed in the Tree view. Expressions can refer to this object by its label using.

To add a property to this object, use the long form of as shown below. FreeCAD will automatically split and display it with spaces  in the Data tab of the Property editor.

is the type of the property. The different types are described in more detail below.

You can also use the short form which omits the last two arguments. The subsection defaults to, and the tooltip is not displayed with this form.

To get or set the property, use :

If the type of the property is App::PropertyEnumeration, the setter has a special behavior: setting a list of strings defines the cases allowed by the enumeration, setting a string selects one of these cases. To set the list of possible cases and set the current one, use:

App::PropertyAcceleration
A acceleration property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyAngle
An angle property. It can contain an value. You can use "Value" variable to get float variable. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyArea
A area property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyBool
A boolean property. It can contain and. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyBoolList
A property containing a list of booleans. It can contain a Python list of booleans, e.g. . For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyColor
A color property. It can contain tuple of four values. Each item can take values between 0.0 and 1.0. You can set red, green and blue values. Also you can set step transparency too. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyColorList
A colorList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyDirection
A direction property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyDistance
A distance property. It can contain a value. You can use "Value" variable to get float variable. Values always must be in millimeters unit. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyEnumeration
An enumeration property. The allowed items are defined by setting the property to a list. After that, it can contain items of the given list. The list of allowed items can be changed by setting the property to a list again. For more details, see the section about Creating a FeaturePython object and adding a property to it.

As of FreeCAD 0.20, you can also group enumerations, which are displayed in the GUI using a submenu interface. To group, use the character (vertical pipe) as a separator, e.g.:

Item A",   "Group 1

The GUI will display this as a menu structure:
 * Group 1
 * Item A
 * Item B
 * Group 2
 * Another item
 * Last item

App::PropertyExpressionEngine
A expressionEngine property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyFile
A filename property. It can contain a string indicating the path to a filename :(Does it allow relative paths or absolute paths or both?). For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyFileIncluded
A filename property that also includes the file itself into the document. The file doesn't get loaded into memory, it gets copied from the document archive into the document transient directory. There it is accessible for reading. You can get the transient path through. As input, the property accepts a string containing the path to the original file. The property returns the path to the temporary file in the transient directory. For more details, see this example from the Arch Workbench.

App::PropertyFloat
A float property. It can contain a value. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyFloatConstraint
A float constraint property. It can contain a value. By using this property you can set start and finish values. Also you can set step interval too. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyFloatList
A float list property. It can contain list of values. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyFont
A font property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyForce
A force property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyFrequency
A frequency property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyInteger
An integer property. It can contain an integer value. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyIntegerConstraint
An integer constraint property. It can contain an value. By using this property you can set start and finish values. Also you can set step interval too. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyIntegerList
An integer list property. It can contain list of values. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyIntegerSet
A integerSet property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLength
A length property. It can contain a value. You can use "Value" variable to get float variable. Values always must be in millimeters unit. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLink
A link property. It can contain link to an object. When you call this property, it will return the linked object. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkChild
A linkChild property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkGlobal
A linkGlobal property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkHidden
A linkHidden property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkList
A link list property. It can contain list of linked objects. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkListChild
A linkListChild property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkListGlobal
A linkListGlobal property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkListHidden
A linkListHidden property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkSub
A linkSub property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkSubChild
A linkSubChild property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkSubGlobal
A linkSubGlobal property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkSubHidden
A linkSubHidden property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkSubList
A linkSubList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkSubListChild
A linkSubListChild property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkSubListGlobal
A linkSubListGlobal property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyLinkSubListHidden
A linkSubListHidden property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyMap
A map property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyMaterial
A material property. It can contain a FreeCAD material object. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyMaterialList
A material list property. It can contain list of materials. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyMatrix
A matrix property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyPath
A path property. It can contain a string representing a path to a folder :(does it also allow paths to files? does it allow relative or absolute paths or both?). For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyPercent
A percent property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyPersistentObject
A persistentObject property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyPlacement
A placement property. It can contain object. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyPlacementLink
A placementLink property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyPlacementList
A placement list property. It can contain list of. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyPosition
A position property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyPrecision
A precision property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyPressure
A pressure property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyPythonObject
A pythonObject property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyQuantity
A quantity property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyQuantityConstraint
A quantityConstraint property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertySpeed
A speed property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyString
A string property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyStringList
A stringList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyUUID
A uUID property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyVacuumPermittivity
A vacuumPermittivity property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyVector
A vector property. It can contain a FreeCAD object. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyVectorDistance
A vectorDistance property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyVectorList
A vector list property. It can contain list of. For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyVolume
A volume property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyXLink
A xLink property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyXLinkList
A xLinkList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyXLinkSub
A xLinkSub property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

App::PropertyXLinkSubList
A xLinkSubList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Mesh::PropertyCurvatureList
A curvatureList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Mesh::PropertyMeshKernel
A mesh kernel property. It can contain a object. For more details, see the section about Creating a FeaturePython object and adding a property to it.

Mesh::PropertyNormalList
A normalList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Part::PropertyFilletEdges
A filletEdges property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Part::PropertyGeometryList
A geometryList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Part::PropertyPartShape
A part shape property. It can contain object. For more details, see the section about Creating a FeaturePython object and adding a property to it.

Part::PropertyShapeHistory
A shapeHistory property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Path::PropertyPath
A path property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Path::PropertyTool
A tool property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Path::PropertyTooltable
A tooltable property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Sketcher::PropertyConstraintList
A constraintList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Spreadsheet::PropertyColumnWidths
A columnWidths property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Spreadsheet::PropertyRowHeights
A rowHeights property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Spreadsheet::PropertySheet
A sheet property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

Spreadsheet::PropertySpreadsheetQuantity
A spreadsheetQuantity property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

TechDraw::PropertyCenterLineList
A centerLineList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

TechDraw::PropertyCosmeticEdgeList
A cosmeticEdgeList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

TechDraw::PropertyCosmeticVertexList
A cosmeticVertexList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.

TechDraw::PropertyGeomFormatList
A geomFormatList property. It can contain "allowed type and/or values". For more details, see the section about Creating a FeaturePython object and adding a property to it.