
Introduction
The stroke width connection lets you change line thickness of SVG elements at runtime through a WinCC Unified property. For example, you might want pipe outlines to grow thicker as pressure increases, or make a border more prominent when an alarm is active.
The SVGHMI Converter also supports a FixedOnScale mode — a common need when you resize widgets but want the lines to stay the same visual thickness.

Configuration Fields
Upload your SVG to the SVGHMI Converter and add a Stroke Width connection. The form has five fields:
Fixed on Scaling
The Fixed on scaling checkbox controls how stroke width behaves when the widget is resized in WinCC:
- Checked (default) — the widget gets a
FixedOnScaleproperty. While it istrueat runtime, the stroke width is recalculated from the widget's actual width versus the viewBox width, so lines keep the same on-screen thickness regardless of widget size. - Unchecked — the value is used as-is, in the SVG's own (viewBox) units. Lines become thicker or thinner as the widget scales.
Element's ID
Select the target element from the dropdown or type its ID manually.
If the list is empty, open the SVG in a vector editor and assign an
idto the element. You can targetrect,circle,path, or groups (g). Selecting a group applies stroke width control to all children, including nested groups.
Strict search (checkbox):
- Checked — matches one exact ID
- Unchecked — partial matching: selects all elements whose ID starts with the entered text
WinCC Property
The property name that appears in WinCC Unified when the widget is placed on a screen. The converter suggests StrokeWidth. Rules:
- Must not be empty
- Letters and digits only — no spaces, underscores or special characters
- Must start with a letter
Examples: BorderWidth, LineThickness, PipeStroke
Default Value
Initial stroke width, 1 by default. The form accepts numbers from 0 to 100.
Text Field's ID
Optional. Select a <text> or <textPath> element to display the current stroke width value at runtime. The converter replaces the element's content with <hmi:text hmi-bind:value="{{ ParamProps.BorderWidth }}"/>.
Generated SVGHMI Code
Long expressions below are wrapped for readability; the converter writes each binding on one line.
Simple Binding (no fixed scaling)
When scaleFixed is disabled, the converter produces a direct binding:
<rect id="myRect" hmi-bind:stroke-width="{{ParamProps.BorderWidth}}" .../>
FixedOnScale Binding
When scaleFixed is enabled (default), the converter generates a conditional binding:
<rect id="myRect" hmi-bind:stroke-width="{{ ParamProps.FixedOnScale ? ParamProps.BorderWidth * 210 / HmiProps.Width : ParamProps.BorderWidth }}" .../>
Where 210 is the viewBox width of the converted SVG and HmiProps.Width is the widget's actual width on the WinCC screen. The formula:
ParamProps.FixedOnScale = true→value * viewBoxWidth / actualWidgetWidth. A widget stretched to 420px gets half the stroke width in SVG units — after the 2× stretch that is exactlyBorderWidthpixels on screen, the same visual thickness as before.ParamProps.FixedOnScale = false→ the value is used directly, so the line scales together with the widget.
Only the widget's width enters the formula. Converted widgets use preserveAspectRatio="none", so if you stretch a widget mostly in height, horizontal lines will still get thicker — resize proportionally for the best result.
In both cases the static stroke-width attribute is removed from the element — the binding takes over.
Auto-Generated Parameters
Each stroke width connection creates a hmi:paramDef entry (the default comes from the Default Value field):
<hmi:paramDef name="BorderWidth" type="number" default="1"/>
When scaleFixed: true, an additional parameter is generated:
<hmi:paramDef name="FixedOnScale" type="boolean" default="true"/>
FixedOnScale is a single widget-wide switch: if you add several stroke width connections with fixed scaling, they all share it.

Troubleshooting
Stroke width not changing in WinCC:
- Check the element's
stroke. If the element has nostrokeattribute at all, the converter addsstroke="#000000"so the width is visible. Butstroke="none"is kept as is — the width changes, yet there is nothing to see. Set a stroke color in your editor (or add a Stroke color connection). - Check that the property name matches exactly in the WinCC properties panel.
Unexpected black outlines after conversion:
- When you target a group, every child without its own
strokegetsstroke="#000000". If the group contains filled shapes that should stay without an outline, target the outlined elements individually (or by a shared ID prefix with Strict search off) instead of the whole group.
Lines too thick or too thin after resizing:
- Enable the
FixedOnScaleoption. Without it, stroke width scales with the widget dimensions and may appear disproportionate.
Connection Config Reference
| Field | Type | Default | Description |
|---|---|---|---|
type | string | — | "stroke-width" |
prop | string | StrokeWidth | Property name for the generated hmi:paramDef |
elemId | string | — | Target SVG element ID |
elemIdAll | boolean | true | true = exact match; false = prefix match |
value | number | 1 | Default stroke width |
scaleFixed | boolean | true | Add FixedOnScale runtime toggle for viewBox-relative scaling |
bindText | boolean | false | Display value in a text element |
textField | string | — | ID of a <text> element for value display |
Additional Resources
- SVGHMI Converter
- SVG to SVGHMI converter guide — overview of the available connections
- Fill & Stroke Opacity — dynamic transparency
- Height and Width Configuration — dynamic sizing
- HMI Widget Library
FAQ
What is FixedOnScale in SVGHMI?
A boolean widget property the converter adds when Fixed on scaling is checked. While it is true, the stroke width is recalculated as value × viewBox width / actual widget width, so lines keep the same thickness on screen at any widget size.
Why do lines look thicker after I resize the widget?
Without FixedOnScale the stroke width is in SVG units and scales with the widget. Only the widget width enters the FixedOnScale formula, so stretching a widget mostly in height still makes horizontal lines thicker: resize proportionally.
Why does the stroke width not change at runtime?
Check the stroke color. An element with stroke="none" keeps it, so the width changes but nothing is visible. Set a stroke color in your editor or add a Stroke color connection.
Why did black outlines appear after conversion?
Elements without their own stroke get stroke="#000000" so the width is visible. If you target a group, its filled shapes get outlines too: target the outlined elements by ID or ID prefix instead.

