Property editor/zh-cn

概述
属性编辑器是FreeCAD最重要的工具之一，也是FreeCAD使用的主要元素. 属性编辑器允许管理文档中对象的属性.

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

通常，属性编辑器一次只处理一个对象. 属性编辑器中显示的值属于活动文档的活动对象（如果您处理多个文档，请注意哪个文档是真正活动文档）. 如果您没有选择任何元素（或没有元素），则属性编辑器将为空.

并不是所有的属性都可以随时修改. 根据具体状态，某些属性将显示为只读.



属性定义
一个属性是一条信息，如一个数字或文本字符串，附加到一个FreeCAD文档或文档中的一个对象. 可以使用属性编辑器修改属性，如果允许的话.

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.

FreeCAD中的自定义脚本对象可以具有以下类型的属性：

Some of the most commonly used property types are:

不同的对象可能有不同的属性. 然而，一些属性在所有对象中是常见的，例如对象的位置和旋转是可以被操纵的数据属性.

View and Data properties
有两种功能属性类型，可通过属性编辑器下方的选项卡来访问：
 * : 关于对象“视觉”显示方面上的各种属性.
 * : 关于对象“物理”参数的各种属性.

For this reason, properties are considered to be more "real", as they truly define the geometry of a shape. On the other hand, 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
The most basic scripted object won't show any property in the property editor, except for its  attribute. The is a user editable string that identifies the object in the tree view. On the other hand, the 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



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

For 2D geometry, most objects are derived from (itself derived from ) 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:
 * : 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 option is active, and one property is selected, more actions are available with a second right click:
 * : deactivates the command, hiding the additional Data and View properties.
 * : adds a dynamic property to the object; this works with both C++ defined objects, and Python scripted objects.
 * : brings up the formula editor, which allows using expressions in the property value.
 * : if active, sets the property as hidden, meaning that it will only be displayed if is active.
 * : if active, sets the property as output.
 * : 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.
 * : if active, sets the property to be read-only; it won't be editable any more until this switch is turned off.
 * : if active, sets the property as transient.
 * : if active, it becomes touched, and ready for recompute.
 * : if active, it is evaluated when the document is restored.

属性
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.

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




 * : 指示是否显示对象的最小外接立方体值可为False, 或True (默认值为False).
 * : 指示是否显示特征控制点. 值可为False, 或True (默认值为False).
 * : 设置3D视图中模型多边形表示法（polygonal representation）的精准度（曲面细分）. 较小的数值 = 更高的渲染质量. 此值按对象大小的百分比来计算(以mm表示的偏差 = (w+h+d)/3*valueInPercent/100, 其中w,h,d分别为包围盒的维度).
 * :对象的显示模式，平直线（Flat lines）, 着色（Shaded）, 线框（Wireframe）, 点（Points） [[IMAGE:Vue_DisplayModePartDesign_fr_00.png|96px]]. （默认值, 平直线）.
 * : 光照单侧（One side）, 两侧（Two side） [[IMAGE:Vue_Lighting_fr_00.png|96px]]. (默认值，两侧).
 * : 指定线段（边）的颜色（默认值, 25, 25, 25）.
 * : 指定线段（边）的粗细（默认值, 2）.
 * : 指定点（端点）的颜色（默认值, 25, 25, 25）.
 * : 指定点的大小（默认值, 2）.
 * : 对象是否可以被选中. 值为False或True （默认值, True）.
 * : 指定带有颜色的几何形状（默认值, 204, 204, 204）.
 * : 设置对象的透明度，取值范围为0 to 100 （默认值, 0）.
 * : 确定对象的可见性(如同键的效果). 取值为False或True （默认值, True）.

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






 * : whether to refine the fusion done with other objects.


 * : the point in space that specifies where the revolution takes place. It cannot be modified directly, only when editing the feature.


 * : the axis around which the revolution will be performed. It cannot be modified directly, only when editing the feature.


 * : the angle that specifies how much of the base element is rotated. By default it is, but it can be any fraction of that.

此属性取3个参数，通过工具中的x、y、z输入框来传递对应数值. 为一个以上的输入框设置同一值，将导致零件在对应坐标轴上按设置的数值移动相应数量的单位.

Scripting
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 property, this means that the object has the  attribute.

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

Properties follow the or  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.



In similar way the properties are added, not to the base object, but to its. Then, it follows that properties like, , , , , and others, can be examined and changed from the Python console.