I have already achieved what you are describing with creating a custom mask to encapsulate a C-script block. However, I have done this manually in a Plecs model, where I have dragged the C-script and in- and out ports from the Plecs library and manually connected them in my model.
What I would like to do, is to do this from a script, so I can create multiple of these masked subsystems by running this script. I have previously achieved this in Matlab/Simulink. A short snippet of the code:
% Add the block with the relevant parameters
add_block(‘simulink/User-Defined Functions/S-Function’,lib_name + “/” + blockName,‘FunctionName’,block_sWrapper,‘Parameters’,parameters_mask);
maskObj = Simulink.Mask.create(gcb);
set_param(gcb,‘MaskStyleString’,edit_str,…
‘MaskVariables’,parameters_order,…
‘MaskPromptString’,parameters_text,…
‘MaskValueString’,parameters_value,…
‘MaskDisplay’,“image(” + “‘C:\MATLAB\R2023b\EltwinMClib\Mask_icons" + blockName + ".png’)”)
As you can see from the code, Matlab allows me to create a block from a script, create a custom mask for it, and set the parameters of the mask all from within a script. This it what I would hopefully like to do in Plecs as well.