The same truss can be shown in three different display styles: beam, thick line and thin line. Beam style is the default, but for more complicated constructions, thick line or thin line may be used to see the connections more clearly.
Snapshot 2: thick line style
Snapshot 3: thin line style
Snapshot 4: a single joint of the previous truss has been moved, and all connecting beams moved with it
Snapshot 5: the GraphPlot
view and input code of Snapshot 4
Creating and editing trusses is done in "add" or "move" modes.
In "add" mode, click and drag to add and extend a new beam, which follows the mouse until the button is released. Beams can be placed anywhere, but if started or ended within the "snap to" distance of the end of an existing beam, a connection is automatically made. Clicking an existing junction deletes all beams joining at that point.
In "move" mode, existing beams can be moved around by clicking and dragging the joints. The beams can be made longer or shorter. No beams are added.
The "snap to" distances provide some flexibility. A small value allows beams very close to each other without locking onto each other. Smaller settings make it necessary to be very precise in moving or connecting existing joints. A large value avoids these difficulties but reduces the number of separate joints that can simultaneously exist.
The "GraphicsComplex" mode shows the GraphicsComplex
object line drawing of the truss that was constructed and the input code. It is worth noting that the use of GraphicsComplex[pts,objects]
simplifies the code: the first argument is a list of all the (end-) points used in the image; in the second argument, the points are indexed by position in the list.
The "GraphPlot" mode shows a GraphPlot
with appropriate edge and vertex information and the input code.
The code can be copied (as "Plain Text"), pasted into a Mathematica notebook and executed. The generated code can be edited further, the Line
command replaced by something more complicated (such as is done here with "beam").
Besides any real utility, this Demonstration showcases the Wolfram Language EventHandler
command, a more generalized and powerful version of ClickPane
, or the use of Locator
controls, which have a limited repertoire of actions possible when the primary mouse button is clicked. The Mathematica help system shows how to add/delete/move Locator
objects (movable points) or add line segments to a growing list in ClickPane
, but the behavior of the program can depend on a variety of conditions (values of variables, position of the mouse, state of a key, etc.).
Disabled in the source code is a "build" mode that tests the state of the Alt (or Cmd) key to toggle "add"/"move" behavior in one mode.