[Scilab-users] Understanding block interfaces
Andreas Stewering-Bone
Andreas.Stewering-Bone at gmx.de
Thu Aug 30 10:10:18 CEST 2012
Hello
I have some general questions about block and palette building.
I would like to have a block with parameter dialog. Some of the parameters are shown on the block graphic interface (gr_i). But something changed if I compare the behavior between scicos and xcos.
Only a static graphical image is shown with the parameters defined in section define (build block time). I do not want to show the image, I would like to see the actual text string.
No I will shorty explain how I construct the block:
- Definition of the block (Section define)
model.label = ["XCos_SocketCAN_BCM_recieve"];
exprs=[sci2exp(CANID); sci2exp(INTERFACE);sci2exp(CHECKTIMEOUT);sci2exp(TIMEOUT);sci2exp(TIMESTAMP);sci2exp(CHECKNOFRAMES); sci2exp(DEBUG)];
gr_i=['xset(''font'',1,5);xstringb(orig(1),orig(2),[''SocketCAN BCM recieve'';''CANID: ''+string(CANID);''Interface: ''+INTERFACE;],sz(1),sz(2));']
x=standard_define([6 4],model,exprs,gr_i)
x.graphics.out_label = ["Msg"];
Section plot
exprs=arg1.graphics.exprs;
CANID = exprs(1);
INTERFACE = exprs(2);
standard_draw(arg1)
- Build the block
macros_path = get_absolute_file_path("buildmacros.sce");
tbx_build_macros(TOOLBOX_NAME, macros_path);
blocks = ["XCOS_SocketCAN_BCM_rcv"];
tbx_build_blocks(myscilabpath, blocks);
- Load block palette
pal = xcosPal("Xcos Linux CAN toolbox blocks");
blocks = ["XCOS_SocketCAN_BCM_rcv"];
for i=1:size(blocks, "*")
h5 = ls(root_tlbx + "/images/h5/" + blocks(i) + "." + ["sod" "h5"]);
gif = ls(root_tlbx + "/images/gif/" + blocks(i) + "." + ["png" "jpg" "gif"]);
svg = ls(root_tlbx + "/images/svg/" + blocks(i) + "." + ["png" "jpg" "gif" "svg"]);
pal = xcosPalAddBlock(pal, h5(1), gif(1), svg(1));
//pal = xcosPalAddBlock(pal, h5(1), [], []);
end
if ~xcosPalAdd(pal) then
error(msprintf(gettext("%s: Unable to export %s.\n"), "can_toolbox.start", "pal"));
end
Whre is my problem.
There are some basic blocks with the behavior I like to have, CONSTRAINT_c for example.
Best regards
Andreas
More information about the users
mailing list