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.

视图



 * : 指示是否显示对象的最小外接立方体值可为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）.

数据


Summary of the data below. 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! If you select the title Placement, a button with appears to the right. Clicking this button, opens the Tasks_Placement options window.

Specifies the angle to be used with the 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.

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). 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.

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