Repository navigation
docs(examples): make every example script run, animate oscillating cranks - #51
Merged
Merged
Conversation
…anks Four of the twelve scripts under docs/examples/ failed on 1.1.1 already. The three synthesis demos called len(result) and 'if result:' on a SynthesisResult, which lost __len__ and __bool__ before 1.0. Fixed, the motion demo then stopped on the first double-rocker it animated: every demo drove whatever synthesis returned with a full-turn Crank, which cannot pass the position where coupler and rocker align. solution_to_linkage() now honours FourBarSolution.arc_limits, a field that existed but nothing in pylinkage read: set from crank_angle_limits(), the linkage is built around an ArcCrank sweeping that range on whichever side of the ground line the crank starts. The demos animate through a small show() helper that does exactly that and says so when the crank oscillates. Also corrects the teaching content the scripts had wrong: - fourbar_from_lengths_demo labelled (2,4,3,1) double-crank and (3,4,3,2) double-rocker; both are change points. Replaced with lengths that are what they claim, and the table assembles with the crank vertical so the rocker-crank closes. - Three demos always came back empty: the five-position approximate function generation (its angle pairs gave a negative crank length), the straight-line path (three collinear points are degenerate for Burmester theory; the middle point is now bowed by a hundredth), and both fixed-ground-pivot demos. Arbitrary frame points never lie on the center-point curve, so those two now synthesize freely, list the pivots the solutions propose, and fix one pair, which is the workflow that works. All twelve scripts run to completion with DeprecationWarning as an error.
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four of the twelve scripts under
docs/examples/failed — on 1.1.1 too. They areliteralincluded in the docs' Examples page, so they were broken there as well.What was wrong
len(result)andif result:on aSynthesisResult, which lost__len__/__bool__before 1.0.motion_generation_demostopped on the first double-rocker it tried to animate: every demo drove whatever synthesis returned with a full-turnCrank, which cannot pass the position where coupler and rocker align.fourbar_from_lengths_demofailed the same way on a non-Grashof entry.fourbar_from_lengths_demolabelled (2, 4, 3, 1) double-crank and (3, 4, 3, 2) double-rocker — both are change points — and its rocker-crank could not assemble at crank angle 0.One library change
solution_to_linkage()now honoursFourBarSolution.arc_limits. The field existed but nothing in pylinkage read it (the editor server fills it and builds its own mechanism dict). Set it — fromcrank_angle_limits()— and the linkage is built around anArcCranksweeping that range instead of aCrank. The limits are relative to the ground line ascrank_angle_limits()returns them, and are placed on whichever side of the ground line the crank starts. Nothing sets the field inside pylinkage, so existing output is unchanged. Tests cover both sides of the ground line and rotated frames.The demos animate through a small
show()helper that does exactly that and prints the swept range when the crank oscillates.Demo content
Verification
docs/examples/*.pyrun to completion under-W error::DeprecationWarning(matplotlib on Agg).