LDCad Aligning parts using rotation scripts


RE: Aligning parts using rotation scripts
#20
8 Align parts / Linkage Animations, revised

This is a follow-up to provide information about revised scripts for aligning parts and the linkages animation. The appropriate scripts can be downloaded from BrickSafe and installed as per the original description albeit that the installation will also install the script linkages.lua into the sub-directory named global.

8.1 Align Parts / Rotation around current view plane

The only changes related to aligning parts is changes to the align parts / Rotation Parameters dialog. Two “choice” dialogs now exist. The first (see Figure 24) allows aligning the parts according to the currently active view plane.

[Image: 100_axis_of_rotation.png]
Figure 24 – Rotate around view plane option

Note that if the current view plane option is selected, ensure that when a part alignment macro is invoked the appropriate view plane is active. Otherwise, your results may not be as expected.

8.2 Part Selection Sequence

The second dialog displayed when the Rotation Parameters dialog is invoked is shown in Figure 25. This allows a user to decide the sequence that parts are to be selected when running the part alignment script. If you don’t like the default option, make a one-time change to the script align parts.lua and change the initial value of the variable part_selection_order_option_mi.

[Image: 107_alignment_part_selection_sequence.png]
Figure 25 – Alignment Part Selection Sequence

8.3 Linkage Animation Changes

The Linkages animation have been modified in a couple of ways. Firstly (and hopefully invisible to anyone), the animations now make use of the same compound rotation.lua code module as that used by the part alignment scripts. There are a number of other changes and additions which are perhaps more visible.

If  you install the linkages module as a custom/global script, your LDCad menu structure will look something like that shown in Figure 26.

[Image: 101_linkages_menu_00.png]
Figure 26 - Linkages added to scripts Global menu

8.4 Linkage Menu Change

Logic has been added for a crank-slider animation. As there are now multiple animations available, a menu option named Choose linkage animation has been added for the user to identify which animation they want to run (refer to Figure 27). Selecting this menu option causes the dialog shown in Figure 28 to be displayed.

[Image: 102_linkages_menu_01.png]
Figure 27 - Linkage menu

[Image: 103_linkages_animation_choose.png]
Figure 28 - Animation selection

Further menu options allow for;
  • identifying which parts are involved in the animation (menu option Pick the animation parts which was previously named 4 bar linkage selection)
  • identifying the sequence in which the animation parts are being selected (Figure 29). This is equivalent to that for the part alignment logic (refer to section 8.2) but is pertinent to the linkage animations.

[Image: 104_linkages_part_selection_sequence.png]
Figure 29 - Animation part selection sequence

8.5 Crank Slider Animation

Code has been added for the animation of a crank-slider mechanism. The default part selection sequence is illustrated in Figure 30. The axes have been highlighted in the screenshot to illustrate which axis will be used when the animation is run using the current view plane as the rotation axis.

[Image: 105_linkages_crank_selection.png]
Figure 30 - Crank Slider Default Part Selection Sequence

The model used in this animation was authored by Walt White and is available on rebrickable.com.

The result of running the animation is shown here:
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: Aligning parts using rotation scripts - by David Manley - 2022-02-24, 2:34

Forum Jump:


Users browsing this thread: 12 Guest(s)