Overview: Custom Block Faceplate Integration in PCS 7 APL V8.0
SIMATIC PCS 7 V8.0 with the Advanced Process Library (APL) V8.0 exposes a standardized faceplate for every channel, motor, valve, and analog block type shipped with the library. When you build a custom calculation block — for example, a power-consumption aggregator that derives kW and integrates kWh from one or more ch_ai inputs — you must reproduce the same picture-set conventions used by the standard APL blocks if you want the operator to open that faceplate from the same SelFaceplate1 input wired through a mot_l motor block or any other APL icon family that carries a faceplate button.
This reference documents the picture naming, block-icon registration, WinCC compile sequence, and verification steps required to make a custom block's faceplate open when the operator presses the faceplate button on a mot_l instance, or on any APL block icon derived from @@PCS7Typicals.PDL. It also covers the most common failure modes observed during commissioning of PCS 7 V8.0 SP1 with APL V8.0 SP1 (build 8.0.2.10) and notes the migration impact for PCS 7 V9.0/V9.1 and TIA-Portal-based PCS 7 V10.
.pdl with .svg plus a JSON manifest; see the migration section.Prerequisites and Software Stack
| Component | Required Version | Purpose |
|---|---|---|
| SIMATIC PCS 7 Engineering Station | V8.0 SP1 (V8.0.2.x) or later | CFC/SFC, SCL compilation, WinCC Explorer |
| PCS 7 APL (Advanced Process Library) | V8.0 SP1, build ≥ 8.0.2.10 | Block types mot_l, ch_ai, PWR_CAL
|
| SIMATIC WinCC Explorer | V7.3 SP2 (matches ES) | Picture tree, faceplate compile, runtime |
| APL Style Guide | Edition 2013-08 (V8.0) | Authoring rules for custom blocks |
| STEP 7 / S7-PCT | V5.5 + SP4 or V13 TIA | Hardware configuration of ET200 / S7-400 stations |
| SIMATIC PDM | V8.0 SP1 | Optional: device integration for PROFIBUS / HART |
| Graphics Designer | V7.3 SP2 | Picture authoring (PDL files) |
| OS Project Editor | V8.0 SP1 | Picture tree synchronization |
Reference documentation (download from the Siemens Industry Online Support portal):
- Manual SIMATIC PCS 7 V8.0 - Documentation Bundle: PCS 7 V8.0 documentation
- Manual PCS 7 - Operator Station - Configuring Faceplates: WinCC faceplate configuration
- APL block-icon source archive: PCS 7 APL V8.0 block icons (PCS7Typicals.PDL)
- WinCC Openness reference for faceplate importing: TIA Portal Openness: Importing a screen with a faceplate instance
- APL Style Guide Edition 2013: PCS 7 APL Style Guide V8.0
PCS 7 APL Block Architecture and Faceplate Naming
Each APL block type is associated with a fixed picture set in the WinCC picture tree. The canonical naming convention is:
| Picture File | Purpose | Visible On |
|---|---|---|
@PG_<blockname>.pdl |
Main process picture (legacy) | Process screen area (backwards-compat) |
@PG_<blockname>_Standard.pdl |
Standard faceplate with views + buttons | Operator opens by faceplate button |
@PG_<blockname>_Message.pdl |
Message-class faceplate | Opened from alarm line / message row |
@PG_<blockname>_Add_1.pdl … _Add_5.pdl
|
Optional add-on views | Selectable from standard view |
@PG_<blockname>_Trend.pdl |
Online trend view | Optional |
The WinCC runtime resolves @PG_<blockname>_Standard.pdl at the moment the operator clicks the faceplate button. The block icon carries the dynamic property PictureName, normally populated by the CFC OS compiler from the block type's HMI attributes. For a custom block the engineer must populate this property at compile time, which is why the picture file must exist in the active WinCC project before the OS compile step. The runtime then maps the dynamic property to the PictureName attribute of the picture-window object embedded in the faceplate trigger button.
The block icons for the standard library live in @@PCS7Typicals.PDL. The C-action attached to the faceplate button in those icons is conceptually:
OpenFaceplate("BlockType", GetPropChar(lpszPictureName, "BlockType"));
When the operator clicks the button, WinCC reads the BlockType property of the icon and calls OpenFaceplate(). The runtime substitutes BlockType with the actual type name and looks for @PG_<BlockType>_Standard.pdl. If that PDL does not exist, the click event is silently discarded (with a debug log entry), which is the most common symptom reported when a custom faceplate does not open from the mot_l button.
Understanding the SelFaceplate1 Input Structure
The SelFaceplate1 input of an APL block is a structured UDT (User Defined Type) with the following members:
| Subfield | Data Type | Direction | Meaning |
|---|---|---|---|
Visible |
BOOL | Input | Show faceplate button on the block icon |
PictureName |
STRING[32] | Input | Optional override; defaults to @PG_<BlockType>_Standard.pdl
|
InputValue |
REAL | Input | Value displayed in the faceplate header (analog only) |
AuthorisationLevel |
BYTE | Input | Operator level required to open |
When you connect an output of a custom block to the SelFaceplate1 input of a mot_l instance, the CFC compiler populates the UDT from the connected block's HMI attributes. Only the value subfield is wired by an actual data connection; the PictureName subfield is filled at compile time from the BlockType attribute of the custom block.
The SelFaceplate2 input (where present) follows the same structure and is used for a secondary faceplate (for example, an additional detail view of a complex block). For a power-consumption block, only SelFaceplate1 is normally used.
Custom Block APL Style Guide Compliance
Before authoring the faceplate, the custom block itself must satisfy the APL Style Guide. The non-negotiable attributes are:
| Attribute | Required Setting | Why |
|---|---|---|
S7_m_c |
true |
Marks block as "with message class" — required for Alarm Line entry and for BlockType export |
S7_alarm_8 |
Entered | Allows MS/NS event triggering from faceplate |
BlockType |
Exactly matches PDL basename (case sensitive) | Used by OpenFaceplate() to resolve PDL |
Version |
≥ V1.0.0 | OS compile rejects pre-V1 blocks |
| HMI tag export | All inputs/outputs with S7_visible = true
|
WinCC dataset generation |
| Operator permissions | Every input written from faceplate requires S7_edit
|
Prevents accidental write from unauthorized operator |
S7_shortcut |
Entered for every operator input | V9.0+ enforcement |
Add the attributes via the block's Object Properties → Attributes tab in the CFC editor or directly in the SCL source. Sample SCL attribute declaration:
{S7_m_c := 'true'; S7_alarm_8 := 'true'; BlockType := 'PowerCalc'; Version := '1.0.0'; S7_shortcut := 'PWR'}
S7_m_c = false on a custom calculation block. Even though a power-consumption aggregator does not generate process messages, the BlockType attribute is exported only when S7_m_c is true, and the faceplate button in mot_l routes through the block-icon property sheet of the custom block, not the motor block. Setting S7_m_c = true on a calculation block adds a single "Acknowledged" state to the Alarm Line but does not generate nuisance messages.Step-by-Step: Build the Custom Block in the CFC/SFC Editor
- Open the master data library in the CFC editor (View → Library).
- Insert a new SCL source
FB_PowerCalcin the Blocks container, family PowerCalc. - Declare inputs
PT_Primary(REAL, kW),PF_Factor(REAL, default 1.0), and outputsPWR_kW(REAL),PWR_kWh(REAL, integrating),PWR_Status(WORD). - In the FB body, add the calculation logic:
wherePWR_kW := PT_Primary * PF_Factor; IF PWR_kWh_running THEN PWR_kWh := PWR_kWh + (PWR_kW * CYCLE_TIME / 3600.0); END_IF; PWR_Status.0 := (PWR_kW > PWR_Max); PWR_Status.1 := (PT_Primary < 0.0);CYCLE_TIMEis the OB35 cycle (default 1000 ms = 1 s on PCS 7). For longer OB35 cycles, scale accordingly. - Apply the HMI attributes from the table above. Confirm with right-click → Special Object Properties → HMI that every variable intended for operator display shows up under "Operator Control and Monitoring".
- Compile
FB_PowerCalcto a CFC block type and place it on the chartPWR_AGGREGATE_01. - Wire the motor's
PWR_kWfrom this instance toSelFaceplate1input of the samemot_linstance if you want the operator to open the power faceplate from the motor block icon. The motor block'sSelFaceplate1input is of typeSTRUCTwith subfieldsVisibleandPictureName; the CFC compiler populatesPictureNamefrom the connected block'sBlockTypeattribute automatically. - Save and close the chart.
Step-by-Step: Author the Faceplate Picture Set
The picture set must be created in the WinCC Graphics Designer before the OS compile step, otherwise the icon cannot resolve @PG_PowerCalc_Standard.pdl.
- In WinCC Explorer, navigate to Graphics Designer → Project Pictures.
- Right-click and select New Picture; name it
@PG_PowerCalc.pdl. Set Start Picture = false and Apply Project Color Scheme = true. - Open the new picture and lay out the standard faceplate template:
- Header bar with block tag name (dynamize via tag prefix property
PictureWindow.TagPrefix). - Process value fields for
PWR_kW,PWR_kWh(I/O field with output-only viaOutputValueproperty). - Limits area with bar graph from 0 to
PWR_Max(configure in Tag dialog as Bar representation, fill direction bottom-to-top). - Eight function buttons (Standard, Message, Limits, Trend, Parameter, Batch, Faceplate-1, Faceplate-2). For a calculation block, only Standard + Trend + Faceplate-1 are normally wired.
- Header bar with block tag name (dynamize via tag prefix property
- Save the picture as
@PG_PowerCalc_Standard.pdl. The picture file must exist in the active project before the next OS compile; do not save it under a different name or with leading spaces. - Duplicate the picture for each additional view (
@PG_PowerCalc_Trend.pdl,@PG_PowerCalc_Limits.pdl, etc.). - Verify in WinCC Explorer that all six files are listed under Project Pictures. Reopen each, check Properties → Window Attributes: Start Picture must be false; Adapt Picture = no; Border = dialog with caption.
Resizing = KeepRatio. See the TIA Portal Openness documentation on importing a screen with a faceplate instance for the canonical sizing rules.Step-by-Step: Wire SelFaceplate1 and Register the Block Icon
Two artefacts must be in place for the faceplate to open:
-
Picture file exists:
@PG_PowerCalc_Standard.pdl(case sensitive) must reside in the WinCC project. -
Block icon calls
OpenFaceplate(): The block icon on the process picture must invoke the WinCC internal function with the correctBlockTypestring.
The APL block-icon family in @@PCS7Typicals.PDL already implements the call. To reuse the icon for a custom block:
- Open
@@PCS7Typicals.PDLfrom the project library (read-only copy). Identify the icon closest to your block — for a power aggregator pick the analog-input block iconAPL_AI_Icon. - Duplicate the icon into the project-specific picture set (drag-and-drop while holding
Ctrl). - Open the duplicate, change the dynamic property
PictureNamefrom the default to@PG_PowerCalc_Standard.pdl. - Confirm the C-action on the faceplate button reads:
OpenFaceplate("PowerCalc", GetPropChar(lpszPictureName, "BlockType"));Replace the literal"PowerCalc"with the exactBlockTypeattribute from your custom FB; the string is case-sensitive and must match the basename of the PDL (without the leading@PG_prefix and trailing_Standard.pdlsuffix). - On the
mot_linstance that you want to drive, navigate to Object Properties → I/Os. Set the inputSelFaceplate1to point to the output of thePowerCalcinstance via CFC interconnection; do not write the picture name manually in WinCC, because the OS compile regenerates the value fromBlockType. - Save the picture and the CFC chart.
Step-by-Step: Compile OS and Load Runtime
- Open the OS project in WinCC Explorer and run OS Compile from the SIMATIC Manager toolbar. Confirm the OS server selection and check the box Generate block icons from CFC.
- Open the OS log after compile. Look for lines such as:
A NOT FOUND warning indicates the picture file is in the wrong directory or has a typo in its name.INFO Block icon: PowerCalc → @PG_PowerCalc_Standard.pdl (resolved) WARN Block icon: PowerCalc → @PG_PowerCalc_Standard.pdl (NOT FOUND) - Run OS Project Editor and OS Download to push the project to the OS server.
- Activate runtime, open the picture containing the
mot_licon, and click the faceplate button.
Verification Procedure
Use this checklist to confirm the custom faceplate opens as expected from both the motor block icon and the custom block icon.
- In the process picture, click the faceplate button on the
mot_lblock icon. The@PG_PowerCalc_Standard.pdlfaceplate opens. If a generic APL faceplate opens, theSelFaceplate1interconnection is not yet propagated; rebuild the CFC. - Click the faceplate button on the
PowerCalcblock icon directly. The same faceplate opens. - Verify the tag prefix in the faceplate header matches the actual instance tag, e.g.
PWR_AGGREGATE_01/PowerCalc. A wrong prefix indicates the block's I/O names were renamed after compile. - Generate an acknowledgment by clicking the standard faceplate's Acknowledge button; a confirmation event should appear in the Alarm Line.
- Press
Ctrl+F5in WinCC Explorer to inspect Diagnostics → PDL Cache and confirm the file@PG_PowerCalc_Standard.PDLwas loaded into the runtime cache. - Toggle the operator user to a higher authorization level (level 5 or above) and confirm that write operations on the faceplate are accepted.
- Switch the operator language to a non-default (e.g. German) and verify all text fields render correctly. Re-run Text Library → Compile if any text shows the source identifier instead of the translated string.
Troubleshooting Matrix
| Symptom | Likely Cause | Diagnostic | Remedy |
|---|---|---|---|
| Faceplate button does nothing | Picture file name typo | List @PG_* in WinCC Explorer; verify basename |
Rename file to @PG_PowerCalc_Standard.pdl exactly |
| Generic APL faceplate opens instead of custom |
SelFaceplate1 input not wired in CFC |
Inspect CFC chart in graphic editor | Wire PowerCalc output to SelFaceplate1 of mot_l instance; recompile OS |
| Compile warns "block has no BlockType" | HMI attribute missing on FB | Open FB, check Object Properties → Attributes | Add attribute BlockType = PowerCalc; ensure S7_m_c = true
|
| Picture opens with placeholder fields | HMI tag export skipped | Run Block Type Export; check generated XML | Mark every operator-visible variable with S7_visible
|
| Click triggers but picture is blank | Picture saved with start-picture flag | Open PDL; check Properties → Window Attributes | Set Start Picture = false |
| Picture opens on second click only |
OpenFaceplace() not set to "replace" mode |
Inspect C-action | Use SetPropChar(lpszPictureName, "Visible", 1); before OpenFaceplate()
|
| Only the first 8 buttons show | Add-on pictures (_Add_1 … _Add_5) not created | List @PG_PowerCalc* files |
Duplicate PDL and rename each add-on |
| Runtime license error 1024 | Faceplate count exceeds licensed faceplates | Open SIMATIC License Manager | Upgrade RT license or reduce active faceplates |
| Faces only on WinCC client, not OS server | Server picture not synchronized | Compare *.pdl_ files server vs client |
Re-download project on OS server |
| Block icon visible but unclickable | Operator authorization too low | Open User Administrator | Grant operator role "Process controlling — level 5" |
| PDL cache shows file present but click fails | Case mismatch on filename | Compare exact spelling of PDL on disk vs BlockType
|
Re-save PDL with exact basename; recompile OS |
| OS compile error 0xE0150018 |
S7_shortcut attribute missing (V9.0+) |
Open compile log; locate attribute name | Add S7_shortcut attribute to every operator input |
| Faceplate opens behind main window |
AdaptSize not set on picture window |
Inspect picture-window properties | Set AdaptSize = 1 and IndependentWindow = false
|
| Text fields show identifier "@...%..." | Text library not compiled | Open Text Library | Right-click → Compile All |
| Trend view shows zero data points | Tag not logged in archive | Open Tag Logging editor | Enable archiving on PWR_kW with 1 s cycle |
Naming Convention Reference
The WinCC runtime resolves faceplate names through a series of substitution rules. Memorize the canonical pattern:
| Pattern | Literal Example | Resolution Order |
|---|---|---|
@PG_<BlockType>_Standard.pdl |
@PG_PowerCalc_Standard.pdl |
1st choice — must exist |
@PG_<BlockType>.pdl |
@PG_PowerCalc.pdl |
Used as main picture if no _Standard |
@PG_<BlockType>_Message.pdl |
@PG_PowerCalc_Message.pdl |
For alarm-line events |
@PG_<BlockType>_Add_<n>.pdl |
@PG_PowerCalc_Add_3.pdl |
Optional add-on 1–5 |
@pg_powercalc_Standard.pdl but the BlockType is PowerCalc, the runtime reports a NOT FOUND warning even though the file is "visible" in Explorer.Block Icon Script Reference
The WinCC C-action attached to the faceplate button of every standard APL block icon is functionally equivalent to the following VBScript snippet, which can be embedded in custom icons via the Event → Mouse → Click tab:
Sub OnLButtonDown(ByVal Item, ByVal nFlags, ByVal x, ByVal y)
Dim sBlockType
sBlockType = GetPropChar(Item.LpszPictureName, "BlockType")
If Len(sBlockType) > 0 Then
OpenFaceplate(sBlockType, Item.LpszPictureName)
End If
End Sub
You can also invoke the faceplate from a button in C-script directly:
{
char szType[64];
strcpy(szType, GetPropChar(lpszPictureName, "BlockType"));
OpenFaceplate(szType, lpszPictureName);
}
If you want to open a faceplate from a non-APL icon (a regular WinCC picture window), populate the picture window's PictureName property with the full PDL string, e.g. @PG_PowerCalc_Standard.pdl, and set AdaptSize = 1 so the picture window snaps to the 100 × 50 (or 100 × 100) standard size.
Sample Complete Power-Consumption Block (SCL)
The following SCL source illustrates a fully APL-compliant power-consumption block. It demonstrates the HMI attributes, the integrating logic, and the alarm-class binding needed for the faceplate to integrate correctly with mot_l.
FUNCTION_BLOCK FB_PowerCalc
TITLE = 'Power Consumption Calculator'
VERSION : '1.0.0'
AUTHOR : eng
FAMILY : PowerCalc
{ S7_m_c := 'true'; S7_alarm_8 := 'true'; BlockType := 'PowerCalc'; S7_shortcut := 'PWR' }
VAR_INPUT
PT_Primary : REAL := 0.0; // Primary power (kW)
PF_Factor : REAL := 1.0; // Power factor multiplier
PWR_Max : REAL := 1000.0; // Maximum expected (kW)
CYCLE_TIME : REAL := 1.0; // OB35 cycle time (s)
Reset_kWh : BOOL := FALSE; // Operator reset
END_VAR
VAR_OUTPUT
PWR_kW : REAL; // Instantaneous power (kW)
PWR_kWh : REAL; // Integrated energy (kWh)
PWR_Status : WORD; // Bit 0: overload, bit 1: under-range
END_VAR
VAR
fbIntegrate : INTEGRATE; // PCS 7 standard integrator FB
END_VAR
BEGIN
PWR_kW := PT_Primary * PF_Factor;
IF Reset_kWh THEN
PWR_kWh := 0.0;
ELSE
PWR_kWh := PWR_kWh + (PWR_kW * CYCLE_TIME / 3600.0);
END_IF;
PWR_Status.0 := (PWR_kW > PWR_Max);
PWR_Status.1 := (PT_Primary < 0.0);
// Alarm-class binding — required for S7_m_c = true
IF PWR_Status.0 THEN
// Raise MSG_CLASS = "PWR_HIGH"
END_IF;
END_FUNCTION_BLOCK
After compiling this block, verify that the HMI export contains entries for PWR_kW, PWR_kWh, PWR_Max, Reset_kWh, and PWR_Status. The exported XML file resides in the CFC project under Generated\HMI\BlockTypes\PowerCalc.xml.
Multilingual Faceplate Considerations
PCS 7 faceplates support up to 32 operator languages through the WinCC Text Library. When you author a custom faceplate:
- Every visible string must be wrapped in a text-library entry. Do not embed raw text in the PDL.
- Create one text-library entry per language per string. The default language is the one shipped with the project template.
- After modifying text, run Text Library → Compile All and download to the OS server. Without a recompile, text fields display the source identifier such as
@PWR_AGGREGATE_01.PWR_kW. - Verify on the runtime by switching the operator language in User Administrator → Operator → Language.
Performance and License Considerations
Each unique faceplate type loaded in runtime consumes one faceplate license count, regardless of how many instances are open simultaneously. The standard PCS 7 V8.0 SP1 RT license grants 256 faceplate instances per OS server; PCS 7 V8.0 SP2 raises this to 512. Each add-on picture (_Add_1 … _Add_5) is a separate faceplate type and counts independently.
For plants with hundreds of custom blocks, batch the custom-block compilation and audit the OS server's faceplate count with the WinCC Performance Monitor to avoid reaching the licensed ceiling during a major process upset when every operator may open multiple faceplates at once.
Diagnostic Tools and Log Files
| Tool / File | Location | Purpose |
|---|---|---|
| OS compile log | Project folder OS_Compile.log
|
Lists block-icon resolution success/failure |
| WinCC Syslog | %ProgramData%\Siemens\Automation\WinCC\SysLog\ |
Runtime events, faceplate open/close |
| PDL Cache viewer | WinCC Explorer → Diagnostics → PDL Cache | Lists loaded picture files at runtime |
| Block type XML | Generated\HMI\BlockTypes\<BlockType>.xml |
Verifies exported HMI attributes |
| CFC consistency check | SIMATIC Manager → Options → Chart Consistency | Validates SelFaceplate1 interconnections |
| APLOG viewer | OS Server → APLOG directory | Chronological alarm and event log |
Migration Notes and Compatibility
When migrating from PCS 7 V8.x to V9.0 / V9.1 the picture naming is unchanged, but two settings are now strictly enforced:
- The HMI attribute
S7_shortcutis required for every operator input. Without it, the OS compile issues error0xE0150018("attribute missing") and aborts the icon generation. - The new "APL+" type system in V9.0 expects the picture file to declare a
Versionproperty in the PDL header. V8.0 PDLs continue to work, but V9.0 will log a deprecation warning toWinCC_Sys.loguntil you re-save the PDL.
When migrating custom blocks created for the classic APL (PCS 7 V7.1 and earlier), the picture files used the older @PG_*.pdl pattern with no _Standard suffix. The V8.0 runtime still supports these, but the faceplate button on mot_l in modern libraries always routes to the _Standard variant, so any pre-V8.0 faceplate must be renamed to keep the click working.
For customers moving to TIA Portal-based PCS 7 (V18 / V19 with PCS 7 V10), the same OpenFaceplate() API is preserved in WinCC Unified but the syntax changes to UI.OpenFaceplateInWindow(...). Existing custom PDLs need to be re-authored in the Unified graphics designer because the .pdl file format is replaced by .svg plus a JSON manifest.
Security and Audit Trail
Every faceplate open is logged in the WinCC Audit trail when the project has the optional PCS 7 Audit component installed. The audit entry includes the operator's user ID, timestamp, block tag name, and faceplate name. Operator authorization level 6 ("Process controlling — level 6") is required to modify PWR_kWh reset values; configure this in User Administrator → Authorization Levels.
FAQ
Why does my custom faceplate never open from the mot_l SelFaceplate1 input?
Three causes in 90% of cases: the picture file @PG_<BlockType>_Standard.pdl is missing from the WinCC project, the FB's BlockType HMI attribute is empty, or the CFC interconnection from the custom block output to SelFaceplate1 was not propagated through a fresh OS compile. Verify by inspecting the OS compile log for the warning block icon → @PG_xxx_Standard.pdl (NOT FOUND).
Do I need to create a separate block icon for my custom block?
No. You can duplicate an existing APL icon from @@PCS7Typicals.PDL (e.g. APL_AI_Icon) into your project picture, change its dynamic PictureName property to @PG_<BlockType>_Standard.pdl, and place it on the process screen. The C-action on the faceplate button will resolve the new block type automatically.
What is the difference between @PG_xxx.pdl and @PG_xxx_Standard.pdl?
@PG_<blocktype>.pdl is the original picture often used as the process-area icon. @PG_<blocktype>_Standard.pdl is the dedicated faceplate containing all operator views and buttons. Modern APL blocks always open _Standard.pdl when the faceplate button is clicked; @PG_xxx.pdl is kept only for backward compatibility with PCS 7 V6.x projects.
Is S7_m_c = true mandatory for a non-alarming calculation block?
Yes for faceplate integration. The BlockType HMI attribute is exported only when S7_m_c is true, even if the block generates no process messages. Setting S7_m_c = true on a calculation block adds a single "Acknowledged" state to the Alarm Line but does not generate nuisance messages.
Can I call OpenFaceplate() from a C-script on a non-APL picture window?
Yes. The C-script receives lpszPictureName as the picture window name. Read BlockType via GetPropChar(lpszPictureName, "BlockType") and call OpenFaceplate(szType, lpszPictureName). Make sure the picture window's AdaptSize is set so the 100 × 50 / 100 × 100 standard faceplate size is honoured; refer to the TIA Portal Openness guide for faceplate sizing rules when authoring new pictures.
Why does the picture open on the second click only?
The block-icon C-action uses OpenFaceplate() in "create" mode, which generates a new picture-window instance on the first click and a bring-to-front on subsequent clicks. Add SetPropChar(lpszPictureName, "Visible", 1); immediately before the OpenFaceplate() call to ensure the picture-window is visible on the first click.