the output produced by Box To run this example you will need the following file(s): ./wheatstone.box. If the example requires more than one file, then you should put them into the same directory. You can then launch Box with box -l g ./wheatstone.box.
include "electric" // This is not a real Wheatstone bridge. // We replace some of the resistors with other components, just to make // the thing more interesting! wheatstone = Window[][ d1 = 20.0 // d1 = half diagonal p1 = (0, -d1), p2 = (d1, 0), p3 = (0, d1), p4 = (-d1, 0) BBox[d2 = 22.0, (-d2, -d2), (d2, d2)] // Places the four components. // Each component has two connections. Here we want to rotate and translate // ("rt") a resistor such that the first of its terminals is near to // the point p1 and the second one is near to p2. r12 = Put[resistor, "rt", Near[0, p1], Near[1, p2]] // We proceed in a similar way for the other components: r23 = Put[diode, "rt", Near[0, p2], Near[1, p3]] r34 = Put[inductance, "rt", Near[0, p3], Near[1, p4]] r41 = Put[resistor, "rt", Near[0, p4], Near[1, p1]] // Actually show the components r12, r23, r34, r41 // Connecting the four resistors Lines[0.4, p1, r12.Get[0]; r12.Get[1], p2; p2, r23.Get[0]; r23.Get[1], p3; p3, r34.Get[0]; r34.Get[1], p4; p4, r41.Get[0]; r41.Get[1], p1;] // Drawing small circles on the nodes // Here you see how a single Circle instruction can be used to draw many // circles. To start a new circle one should use the separator ";" and // specify only the quantities that changed with respect to the previous // circle. Here we change only the center, so we need to specify the radius // only once! Circles[0.8, p1; p2; p3; p4] ] wheatstone.Save["wheatstone.png", Window["rgb24", .Res[Dpi[150]]]]