Interactive Free Body Diagrams - mkraska/meclib GitHub Wiki

Authoring steps

  • prepare an interactive meclib question according to MecLib Question Setup in interactive mode.
  • for debugging purposes keep the input fields unhidden.
  • set up the meclib control list initdata as shown below.
  • in the preview, compose the correct solution and transfer the result to another set of variables tansdata and tans much like initdata and init. Use tans as model answer for the objects input field. This allows you to generate the correct answer in the preview.
  • Add PRTs as required. Use the specific feedback functions.

Force and Moment Generators

Interactive free body diagrams require a force and moment generator and eventually objects which can be activated and de-activated.

In the image below you see a force generator, a moment generator, static (pre-defined, immutable) force and moment objects, as well as an interactively generated force and moment each.

The generators consist of a name input box- It is pre-filled with a unique, unused name, which can be overwritten. New objects are created by simply dragging the gray arrow to some location on the canvas. Objects are deleted by doubleclicking the arrow.

jsfiddle

[
  [ "grid", "", "", 0,8, 0, 8, 40 ],
  [ "force", "F", [1,4], [1,5] ],
  [ "force", "F", [1,3], [2,3], -5 ],
  [ "moment","M_0",[3.1,2],[2.7,2.6],[3.5,2.6] ],
  [ "forceGen", "F_1", [0.5,7.5] ],
  [ "momentGen", "M_1", [2.5,7.5] ]
]

Example Question

In the left image below you see a force generator, a moment generator and a system consisting of a beam, supported by a fixed bearing and a bar and subjected to a line load. The image is generated with the following specification

initdata: [ 
  [ "grid", "", "", -1, 6, -2, 4, 40],
  [ "forceGen", "F_1", [-0.5,3.5]],
  [ "momentGen", "M_1", [1.5,3.5]],  
  [ "beam", "", pA, pB, 0.15],
  [ "bar", "", pB, pC, "show" ],
  [ "fix12", "A", pA, 0, "show" ],
  [ "fix12", "C", pC, 0, "show" ],
  [ "label", "\\(B\\)", pB+[-0.2,-0.5] ],
  [ "q", "", "q_0", pA+[0,0.3], pB+[0,0.3], 0.7,0.7,0, "show"]
];
init: stackjson_stringify(float(initdata));

In the right image, you see the same system, with line load replaced by a resultant force and the supports replaced by reaction forces.

The right image is generated in the preview from teacher's answer tans in the "objects" input field of the STACK question.

tansdata: [ 
  [ "grid", "", "", -1.5, 6, -2, 4, 40],
  [ "forceGen", "F_1", [-0.5,3.5]],
  [ "momentGen", "M_1", [1.5,3.5]],  
  [ "beam", "", pA, pB, 0.15],
  [ "bar", "", pB, pC, "hide" ],
  [ "fix12", "A", pA, 0, "hide" ],
  [ "fix12", "C", pC, 0, "show" ],
  [ "label", "\\(B\\)", pB+[-0.2,-0.5] ],
  [ "q", "", "q_0", pA+[0,0.3], pB+[0,0.3], 0.7,0.7,0, "hide"],
  [ "force", "3 q_0 a", [1.5, 1.6], [1.5, 0.6], 10, "active"],
  [ "force", "A_v", pA, pA+[0,1], 10, "active"],
  [ "force", "A_h", pA, pA+[1,0], 10, "active"],
  [ "force", "B", pB, pB+[1,-0.5], 10, "active"]
];
tans: stackjson_stringify(float(tansdata));

Assessment