Skip to content

Property Calculation

Asketyll edited this page Aug 12, 2026 · 4 revisions

Property Calculation

Automatically calculates a custom property's value and writes it onto the elements that carry that property — for example, the full text of a group's label cell, the element's coordinates, or a fixed value. Property Calculation is a value engine: it only fills values in, it never attaches properties itself (attaching is Custom Properties' job — it writes only where the property is already attached). It reuses the shared ARES DGNLib custom properties (Item Types).

How it works — calculation rules

Each property's value comes from a calculation rule in ARES_Calc_Rules. A rule is:

Prop[name] [& condition]* = Source
  • Prop[name] — the target property (one name, no wildcards). ARES writes this property's value wherever it is attached.
  • & condition (optional) — the same conditions as the attach rules: Lvl[level], Cell[name], Type[type], combined with & (AND), negated with !, with * / ? wildcards (see Custom Properties). The rule applies only to elements matching every condition.
  • = Source — where the value comes from. One of:

There are two families of source: a group source (Cell* and GroupLength) scans the element's graphic group — including the element itself — for a matching member and reads the value off that member; a self source reads the element's own attribute.

Source Value
CellText[pattern] The full text of a cell of the element's graphic group whose name matches pattern (wildcards allowed; pattern may list several |-separated alternatives, e.g. ASUF*|SP0*). Includes the element itself — a label cell that carries the property gets its own text; an ungrouped matching cell also gets its own text.
CellCoord[pattern] The "X;Y" coordinates of that same matching cell — the TAGGING cell's own position, not the element's.
CellId[pattern] The ID of that same matching cell.
CellLvl[pattern] The level name of that same matching cell.
CellColor[pattern] The color index of that same matching cell.
CellStyle[pattern] The line-style name of that same matching cell.
CellWeight[pattern] The line-weight of that same matching cell.
Value[text] A fixed literal value (e.g. Value[Type-A]).
Coord or Coord[n] The element's OWN "X;Y" coordinates (n = number of decimals; default is ARES_Round). Recomputed when the element moves.
Id The element's OWN ID.
Lvl The element's OWN level name.
Color The element's OWN color index.
Style The element's OWN line-style name.
Weight The element's OWN line-weight.
Length or Length[n] The element's OWN geometry length (n = decimals; default is ARES_Length_Round) — only when the element itself is a Line/Arc/Shape/ComplexShape/ComplexString; empty otherwise.
GroupLength or GroupLength[n] The length of the first line/arc/shape found in the element's graphic group (including itself) — the usual case: the property sits on a text/cell, and the length comes from the linked geometry, just like Auto Lengths.

Every Cell* source uses the same pattern grammar as CellText; use the Cell* family when a property must carry an attribute of the cell that grouped the element, not its own.

Several rules for the same property: the first that matches wins. Rules are tried in order, so put the specific rules before the general ones. Example:

Prop[Repere]&Cell[ETIREF]=Value[REF] ; Prop[Repere]=CellText[ETI*] ; Prop[XY]=Coord ; Prop[Coordonnee]=CellCoord[ASUF*|SP0*] ; Prop[Longueur]=GroupLength[1]

Here Repere is REF on the ETIREF cell (first rule wins), and the group's ETI* cell text elsewhere; XY is each element's own coordinates; Coordonnee is the position of whichever ASUF*/SP0* cell tagged the group; Longueur is the length of the group's linked geometry, rounded to 1 decimal.

The engine reacts live: filling a property when it is attached, recomputing a self source (Coord, Length, …) when the relevant element itself changes, following a matching cell's attribute (text, coordinates, level, color, style, weight) when it is edited, following the linked geometry's length for GroupLength, and clearing a value when its source disappears (or, with ARES_Calc_Detach_Empty on, detaching the property). CellId never needs to recompute after the initial fill — an element's ID cannot change.

Editing the rules

The options dialog edits the calc rules one at a time, exactly like the Custom Properties attach-rule editor: an editable drop-down (pick a rule → edit → commit replaces it; free-type + commit appends; empty + commit removes it), with a coloured syntax preview below it (keywords in bold, & blue, ! orange, * / ? green, an impossible-condition combination shown in red). A malformed rule is refused (a status-bar message, nothing saved). Bulk edits still travel via .cfg import/export.

Commands

EditPropertyCalculationOptions

macro vba run [ARES]EditPropertyCalculationOptions

Opens the Property Calculation options (the master switch, the detach-empty option, and the calc-rules editor). Editing is write-through — the config stays in sync, no restart.

Configuration variables

Variable Default Purpose
ARES_Property_Calc False Master switch for the feature (off by default).
ARES_Calc_Rules (empty) The calculation rules: Prop[name][&conditions]=Source ; … (Source = CellText|CellCoord|CellId|CellLvl|CellColor|CellStyle|CellWeight[pattern] / Value[text] / Coord|Length|GroupLength[n] / Id|Lvl|Color|Style|Weight; a pattern may be several |-separated alternatives). First matching rule per property wins.
ARES_Calc_Detach_Empty False When on, a property whose calculated value ends up empty is detached (the tagger removes it) instead of being kept empty; a rule that still mandates the property re-attaches it (empty).

Clone this wiki locally