-
Notifications
You must be signed in to change notification settings - Fork 3
MecLib Question Setup
MecLib is all about using STACK questions in Moodle for engineering mechanics.
A STACK question consists of the following sections:
- Question variables (Maxima code)
- Question text (CAS text, i.e. text with embedded injections of Maxima values)
- Input (definition of input fields)
- PRT (potential response tree, where the feedback is computed)
- optional: General feedback (CAS text, usually a worked solution)
Template for Meclib objects. See Test Examples and the individual object pages for examples.
initdata: [
[ "grid", "x","y", -5,5,-4,5, 50 ],
...
];
init: stackjson_stringify(initdata);
You also can provide a similar structure as model answer:
tansdata: [
[ "grid", "x","y", -5,5,-4,5, 50 ],
...
];
tans: stackjson_stringify(initdata);
German version:
stack_include("https://raw.githubusercontent.com/mkraska/meclib/main/Maxima/fb_value.mac");
English version:
stack_include("https://raw.githubusercontent.com/mkraska/meclib/main/Maxima/fb_value_EN.mac");
stack_include("https://raw.githubusercontent.com/mkraska/meclib/main/Maxima/fb_fbd.mac");
There are two hidden input fields.
-
objects
stores the full state of the graphics widget. -
names
contains special information for feedback functions.
Copy this text to the question variables (remove the div if you don't want a float right image):
<p hidden>[[input:objects]] [[validation:objects]]</p>
<p hidden>[[input:names]] [[validation:names]] </p>
<div style="float:right">
[[jsxgraph width='500px' height='400px' input-ref-objects="stateRef" input-ref-names="fbd_names" ]]
var mode = "STACK";
const initstring = {#init#};
const centeredLabelStyle = {size:0, showInfobox:false, label:{offset:[-6,0],
anchorX:'left', anchorY:'middle'}};
// End of STACK header
[[include src="https://raw.githubusercontent.com/mkraska/meclib/main/meclib.js" /]]
[[/jsxgraph]]</div>
In non-interactive mode, modifications of the objects, if possible, aren't stored.
Add the following lines to the question text:
<div style="float:right">
[[jsxgraph width='250px' height='250px' ]]
var mode = "STACK"; // as opposed to "jsfiddle" which is used in the test environment
var stateRef; // is empty in the non-interactive case
const initstring = {#init#}; // injection of the list of objects
var decsep = {#stackfltsep#}; // injection of the decimal separator setting
const centeredLabelStyle = {size:0, showInfobox:false, label:{offset:[-6,0],
anchorX:'left', anchorY:'middle'}};
// End of STACK header
[[include src="https://raw.githubusercontent.com/mkraska/meclib/main/meclib.js" /]]
[[/jsxgraph]]</div>
Specify properties of the input fields:
-
objects
- Input type: String (Zeichenkette),
- Model answer:
tans
- Students must verify: no
- Show validation: no
-
names
- Input type: algebraic,
- Model answer: []
- Forbid float: no
- Students must verify: no
- Show validation: no
{@fb_vars(sans, tans, vars, label)@}
{@fb_unit(S_, , 0.005)@}
{@fb_number(S_, , 0.005)@}
A question can have more than one Meclib image. Currently, inclusion of meclib is required in each individual [[jsxgraph]]
region.
You have to define individual variables for the contents, similar to init
in the question variables or in the feedback variables.
Example: FBD 01 (general feedback with separate image) in the Demo Moodle Course
In order to try code snippets in jsfiddle,
- copy the code from the wiki page to the clipboard
- follow the link for the JSXGraph version you want to try
- Replace the code in the HTML section (contents of
<p hidden id="init">
) with the content of the clipboard