Cables Tutorial 2 : Creating Hooks and Loops

In this tutorial, you will learn how to use hook and loop groups to attach and detach objects during runtime. We will define attachment points, create hook and loop groups, and define the logic required to connect and disconnect them following user input.

For more information, refer to the documentation about Hook and Loop Groups.

Requirements

This module assumes that Cables Tutorial 1: Creating a Cable System is completed and you have a functional mobile crane with a cable system. If this module is not completed, you can use the mobile crane.vxmechanism located in the samples (<Vortex Demo Scenes Folder>\Equipment\MobileCrane\Dynamic\Design\mobile crane.vxmechanism) and skip steps 1-6.

Adding Attachment Points

In this step, we will add attachment points to the mobile crane's hook, the spreader bar, and the concrete pipe. These will be used to determine the location of the attachment(s) between the mechanisms.

  1. Open the Mobile Crane mechanism completed in Cables Tutorial 1: Creating a Cable System
  2. Under the Assemblies folder in the Explorer, open the Weight Hook assembly by double-clicking on it.
  3. In the Dynamics section of the Toolbox, insert an Attachment Point. Rename it 'Hook Attachment'
  4. Under Parameters in the Hook Attachment properties, set the Parent Part to Hook Shackle.

    Note

    The more efficient way to add an attachment is to right-click on the parent part in the explorer, then selecting "Insert Attachment Point" from the contextual menu.
  5. Under Inputs, modify the translation component of its Local Transform to [-0.017 m, 0.000 m, -0.329 m]



  6. Save (Ctrl + S) and close the Weight Hook assembly.
  7. Open the SpreaderBar_Rigging_Workshop mechanism (<Vortex Sample Folder>\Equipment\SlingCable\Dynamic\Design\SpreaderBar_Rigging_Workshop.vxmechanism)
  8. Open the SpreaderBar assembly.
  9. Insert an attachment point to each of these parts :
    • Loop
    • Hook_Rear
    • Hook_Front
  10. Rename the attachments Loop_att, Hook_Rear_att, Hook_Front_att. Keep the translation component of their local transform at [0,0,0]
  11. Save (Ctrl + S) and close the SpreaderBar assembly.


  12. Open the Concrete Pipe Large_Workshop mechanism (<Vortex Demo Scenes Folder>\Equipment\SlingCable\Dynamic\Design\Concrete Pipe Large_Workshop.vxmechanism)
  13. Open its assembly (Concrete Pipe Large_Workshop_Assembly.vxassembly).
  14. Insert two Attachment Points to the only part in the assembly :
    • Pipe_Front [4.123 m, 0.000 m, 1.128 m]
    • Pipe_Rear [-4.179 m, 0.000 m, 1.114 m]
  15. Save (Ctrl + S) and close the Concrete Pipe Large assembly.

Defining Loop Groups


In this section, we define loop groups for the concrete pipe and the spreader bar. A loop group and a hook group that have the same label can be attached to each other.

Note

In this training exercise, loop groups are defined at the scene level for simplicity. If there were multiple instances of the concrete pipe or the spreader bar, it would've been more efficient to define the loop groups at the mechanism level. That way, there is no need to create loop groups for every instance, since they already exist in the mechanism. The same principle applies for Hook Groups.
  1. Open the Mobile Crane Workshop scene (<Vortex Sample Folder>\Scenario\MobileCrane Scene\MobileCrane Weight Hook Pipe_Workshop.vxscene)
  2. Insert the Mobile Crane, SpreaderBar_Rigging_Workshop, and Concrete Pipe Large_Workshop mechanisms in the scene. Those are the three mechanisms to which we added attachment points in the previous section.
  3. Using the Move (Ctrl + 2) and Rotate (Ctrl + 3) tools, place them in the scene to match the layout shown in the image :



  4. In the Dynamics section of the Toolbox, insert a Loop Group. Rename it "Pipe Loop Front".



  5. Under Parameters > Anchoring Points, change the size to 1.
  6. Set the Anchoring Point to the Pipe_Front attachment point, found in the Concrete Pipe Large assembly.
  7. Under Labels, change the size to 1. Name the label 0 to "Concrete Pipe Label"


  8. Duplicate (Ctrl + D) the Loop Group and rename it "Pipe Loop Rear"
  9. Change the Anchoring Point to the Pipe_Rear attachment point, found in the Concrete Pipe Large assembly.

    Note

    Notice that the label remains the same in both loop groups. We will use the same label for both hooks from the spreader bar and both loops from the concrete pipe. This way, hooking will be possible even if the spreader bar is turned around and the hooks are inverted.
  10. Repeat steps 4 to 7 for the Spreader Loop Group using these values:
    • Name: "Spreader Loop"
    • Anchoring Point: Loop_att, under the SpreaderBar assembly
    • Label: "Spreader Label"

Defining Hook Groups

In this step, we define hook groups for the spreader bar and the mobile crane hook block.

  1. In the Dynamics section of the Toolbox, insert a Hook Group. Rename it "Spreader Hook Front".



  2. Under Parameters > Anchoring Points, change the size to 1.
  3. Set the Anchoring Point to the Hook_Front_att attachment point, found in the SpreaderBar assembly.
  4. Under Labels, change the size to 1. Name the label 0 to "Concrete Pipe Label"
  5. Duplicate (Ctrl + D) the Hook Group and rename it "Spreader Hook Rear"
  6. Change the Anchoring Point to the Hook_Rear_att attachment point, found in the SpreaderBar assembly.
  7. Repeat steps 1 to 4 for the Mobile Crane Hook group using these values:
    • Name: "Mobile Crane Hook"
    • Anchoring Point: Hook Attachment, under the Weight Hook assembly of the Mobile Crane.
    • Label: "Spreader Label"
  8. Save (Ctrl + S) the scene.

Adding Hooking Logic

In this section, we will add logic that attaches our different hook and loop groups together when pressing buttons on the controller.

  1. In the Input Devices section of the Toolbox, insert a Joystick.
  2. In the Basics section of the Toolbox, insert a Connection Container. Rename it "Connections - Hooking"
  3. Open the Connection Container. Select the Joystick from the Explorer and drag-and-drop ToggleButton2 and ToggleButton3 into the Connections Workspace.
  4. Select the three Hook Groups previously created and insert the Hook input into the Connections Workspace.
  5. Connect ToggleButton2 with both Spreader Hook inputs and ToggleButton3 with the Mobile Crane Hook input.



  6. Test (F7) the simulation. Notice the colors of the attachments change depending on the distance between hook and loop groups and whether a hook is triggered.

Tuning Hooking Parameters

In this section, we will tune parameters in order to make it easier for the user to hook and unhook components during runtime.

  1. Select the Loop Groups (Pipe Loop Front, Pipe Loop Rear, Spreader Loop Group) and access their properties.
  2. Under Inputs, modify the Hooking Range to 0.75 m and Extended Range to 0.25 m.
  3. Select the Hook Groups (Spreader Hook Rear, Spreader Hook Front, Mobile Crane Hook) and access their properties.
  4. Under Inputs, deselect Always Allow Unhooking.
  5. Under Parameters > Hooking Constraints, modify the following properties:
    • Attract Max Force: 5000 N
    • Attach Distance: 0.015 m
    • Detach Force: 500 N
  6. Save (Ctrl + S) the scene.

Up Next: Cables Module 3: Spline Cables