Std VarSet/bg

Std VarSet

Menu location
None
Workbenches
All
Default shortcut
None
Introduced in version
1.0
See also
Spreadsheet Workbench, DynamicData Workbench

Описание

Командата "Std VarSet създава VarSet. VarSet е набор от свойства, които могат да се използват като променливи в expressions.

Диалоговият прозорец Добавяне на свойство

Употреба

  1. Направете едно от следните неща:
    • За да създадете нов VarSet: натиснете бутона Variable Set.
    • За да редактирате съществуващ VarSet: щракнете двукратно върху задания в Tree View.
  2. Отваря се диалоговият прозорец "Добавяне на свойство".
  3. Въведете Име' за свойството.
    • Името трябва да е уникално за VarSet.
    • Само буквено-цифрови знаци и долни черти (A към Z, a към z, 0 към 9 и ) са разрешени.
    • Първият символ може да не е цифра.
    • FreeCAD използва конвенцията UpperCamelCase за своите имена на свойства, което означава, че всяка дума започва с главна буква и няма интервали или долни черти. Когато Property View показва такова име, между думите се вмъкват интервали, което прави името по-лесно за четене. Препоръчително е да се следва тази конвенция.
  4. Въведете име "Група за свойството или изберете група от списъка. Имената на групи имат същите ограничения като имената на свойствата.
  5. Изберете свойството Тип от списъка. Вижте по-долу за най common types.
  6. Въведете Стойност за свойството. Това поле приема единици за свойства, които имат единици. Можете също да зададете expression.
  7. 1.0 and below: По желание поставете отметка в квадратчето Добавяне на друг, ако искате да добавите още свойства.
  8. По избор въведете Tooltip' за свойството.
  9. Натиснете бутона OK.
  10. Диалоговият прозорец се отваря отново (1.0 and below: само ако е отметнато квадр 'Добавяне на друг) и може да се добави ново свойство.
  11. Натиснете бутона Cancel, когато сте готови.

Common property types

FreeCAD supports many property types. The table below lists some of the most common types. See FeaturePython Custom Properties for more information.

Property type Default unit (if any) Remark
App::PropertyLength mm Similar to App::PropertyDistance but cannot be negative
App::PropertyAngle ° (or deg)
App::PropertyFloat Decimal number
App::PropertyInteger Whole number
App::PropertyBool true or false, can be used in conditional expressions
App::PropertyString Text string
App::PropertyEnumeration Text-based option list

Notes

  • Properties can also be added to existing VarSets in the Expression editor by checking the Store in Variable Set… checkbox.
  • A property can be removed from a VarSet via the context menu of the Property View.
  • A group name can be changed via the same menu.
  • 1.0 and below: The command cannot set the list of allowed items of an App::PropertyEnumeration property. This can be done via Python code or in the Property View. The steps for the latter option are:
    1. Select Show hidden in the context menu of the Property View.
    2. Expand the node of the property.
    3. Click in the Enum field.
    4. Press the button that appears.
    5. Enter values in the List dialog box that opens.
    6. Press the OK button.
  • VarSets can also be edited with the commands from the DynamicData Workbench. Properties can be renamed, regrouped, retyped, and their tooltip updated. This external workbench can be installed from the Addon Manager.

Scripting

import FreeCAD as App

doc = App.ActiveDocument

var_set = doc.addObject("App::VarSet", "VarSetName")
var_set.addProperty("App::PropertyInteger", "MyNumber")  # Property is added to the Base group.
var_set.MyNumber = 123
var_set.addProperty("App::PropertyString", "MyText", group="SomeGroup", doc="Some tooltip information")
var_set.MyText = "Abc"

doc.recompute()