MHJ-SoftwareMHJ WikiOnline manuals PLC-Lab 3D Studio v1

Tutorial 3 – Pick & Place

11 min readUpdated 2026-06-01

This page is relevant for ✅Studio ❌Player

Blender logo / PLC-Lab 3D Studio logo
Blender logo / PLC-Lab 3D Studio logo

Simple pick-and-place station – different views Image: Simple pick-and-place station in different views

Information

In this tutorial you will create a pick-and-place device using Blender. The station is built from simple box primitives only. The 3D object names are extended with skill names. The pick-and-place sequence is as follows: cubes are conveyed on Conveyor 1 to the gripper. The gripper moves down, the magnet is enabled, then the gripper moves up again. The gripper travels forward to Conveyor 2 and places the cube there (move down and disable the magnet, move up and return). Conveyor 2 transports the cube to the drop-off area. The file is imported into PLC-Lab 3D Studio and configured. Finally, the device is simulated using a small C# script.

Video: Pick & Place

Station sequence shown in the video:

This tutorial as a video

Watch this video if you have no prior experience with Blender:

Blender Pick & Place Tutorial

Playing the video connects to YouTube (Google). No data is transferred until you click.

3D scene description

In the image below, the project tree with the objects is shown on the left, and the 3D scene on the right. Parent/child relationships are visible in the tree. The pick-and-place device consists of two axes (X, Y). The Y axis (vertical) must be a child object of the X axis (horizontal). This means: when the X axis moves forward toward the conveyor, the Y axis moves along automatically—linked motion.

Pick-and-place station
Pick-and-place station
No. Object Description Dimensions (mm)
1 Conveyor**{Conveyor}{Collider}{Y}** Conveyor belt 60×600×10
2 Creator-Cube**{Creator}** Creates cubes 40×40×40
3 Child-Cube**{Player}****{Collider}** Template cube 40×40×40
1 Conveyor**{Conveyor}.003{Collider}****{Y}** Conveyor belt 60×600×10
4 Pick&Place-Base**{Collider}** 70×70×40
5 Pick&Place-1**{Collider}** 40×40×120
6 Pick&Place-2 X-Axis {Collider}M1{Drive-2-Point}****{-z} Moving X axis 20×20×220
7 Pick&Place-3 Y-Axis**{Collider}M2{Drive-2-Point}****{-z}** Moving Y axis 10×10×65
8 Pick&Place-4**{Collider}** 20×20×6
9 Pick&Place-Magnet**{Magnet}** Switchable magnet 10×10×1
10 Light-Sensor**{LightBarrier}** {-z} Photoelectric sensor to detect a workpiece at the pick position. Important: because the origin of the light beam coincides with the origin (pivot point) of the 3D object, you must move the object origin to the point where the light beam should start. 1×1×50
11 Ground{Collider}{sm-hide} Floor approx. 1000×1000×10

The object names include the following skills, which are automatically added when loading the file in PLC-Lab 3D Studio:

Skill Description Notes
{Collider} 3D object acts as a solid body No additional configuration required.
{Conveyor} 3D object is a conveyor belt Must be configured in PLC-Lab 3D Studio.
{Magnet} 3D object is a magnet Must be configured in PLC-Lab 3D Studio.
{LightBarrier} 3D object is a light barrier / photoelectric sensor Must be configured in PLC-Lab 3D Studio.
{Drive-2-Point} Linear motion between two end positions Must be configured in PLC-Lab 3D Studio.

Gripper detail with magnet:

Image Description
Pick-and-place station (1) Y axis
(2) Magnet
(3) Sensor
(4) Conveyor belt

Creating the 3D objects

First, create all required box objects. You should also assign colors (appearance/material) to the objects. The dimensions are listed in the table above. Add skills to define each object’s behavior: include the skill names (with curly braces) in each object name so the skills are detected. The skill token can appear anywhere in the object name.

Texturing

Add the color/material name string "Metal" or "Alu" and PLC-Lab 3D Studio can automatically adjust the appearance accordingly. This string can be anywhere in the material name. For details on texturing, see here.

Note

Reference axis: {Y} or {-z} are not skills—they are presets for the referenced skill. For example, {Y} presets the reference axis to the Y axis. Case is ignored. In Stop mode, PLC-Lab 3D Player shows the local orientation (if the skill uses a reference axis) via the axes X (red), Y (green), and Z (blue). This makes it easy to verify the setup.

Tip

It is common to modify the 3D scene and export again. PLC-Lab 3D Studio monitors the exported file. When it changes, the Reload button appears on the left next to the camera slots. Use it to reload the updated file.

Arranging the 3D objects

Place the objects so the overall layout matches the images. Exact distances are not critical.

Object hierarchy

See the project tree in the image above. The following objects require parent/child relationships for the 3D simulation to work correctly:

  • The template cube (3) must be a child of the Creator (2).
  • The pick-and-place assembly must be hierarchical: objects 8, 9, and 10 must be children of (7). (7) must be a child of (6). (6) must be a child of (5). (5) must be a child of (4). This is visible in the tree structure in the image above.

Create the project folder

Create a new folder in Windows Explorer with any name. This folder will contain all files required for the 3D simulation (project folder for this example).

Symbol file

Create a file named station0.symbols.csv. It contains all variables/symbols required for the simulation.

File content:

txt
I0.0;B0;BOOL;Cube is at pick position
I0.1;B1_0;BOOL;M1 is on max position
I0.2;B1_1;BOOL;M1 is on min position
I0.3;B2_0;BOOL;M2 is on max position
I0.4;B2_1;BOOL;M2 is on min position
Q0.0;M1_0;BOOL;M1 to max position
Q0.1;M1_1;BOOL;M1 to min position
Q0.2;M2_0;BOOL;M2 to max position
Q0.3;M2_1;BOOL;M2 to min position
Q0.4;Q1;BOOL;Conveyor 1 on
Q0.5;Q2;BOOL;Conveyor 2 on
Q0.6;Q3;BOOL;Magnet on

Save the file.

Export the 3D scene from Blender

Export the Blender scene as an FBX file. In the export settings, set Apply Scalings to FBX Units Scale. Make sure all 3D objects have a scale of 1, then copy the FBX file into the new folder.

Import into PLC-Lab 3D Studio

Use the CAD button in the upper-left corner to import the FBX file into PLC-Lab 3D Studio. After import, set the camera position so you have a good overview of the station. Save the camera view to Slot 1 using Shift + 1. You can recall it with 1.

Skill configuration

Info

For certain objects, you must set the reference axis. In these cases, a gizmo is displayed to visualize the local X, Y, and Z axes. The axis directions are indicated by colored arrows: blue = Z, red = X, green = Y. Negative axis directions are also available: Xn, Yn, Zn.

Image: Axis orientations of the objects. Note: the cube at the pick-and-place station must still be removed, otherwise the sensor is triggered immediately and the belt stops. The cube was used to make it easier to set the Y-axis stroke.

Axis orientations in the image:

Some objects use a reference axis. The correct axis must be entered in the skill settings. Examples:

No. Description
1 X axis: Z direction (blue arrow)
2 Y axis: negative Z direction (blue arrow)
3 Light sensor: negative Z direction (blue arrow)
4 Conveyor 1: conveying direction = negative Y direction (green arrow)
5 Conveyor 2: conveying direction = negative Y direction (green arrow)

Perform the settings below in Stop mode. In this mode, a simple mouse click on a 3D object is sufficient to open the skill settings—holding Ctrl is not required.

Conveyor 1

Move the mouse over Conveyor 1 (1) under the gripper. When the outline appears, left-click it. This opens the settings (2) of the first skill on the object (Conveyor skill).

Conveyor settings
Conveyor settings

The conveyor has the skills {Conveyor} and {Collider}. In the image, (2) shows the Conveyor skill properties.

Set the Conveyor skill properties as follows:

  • Axis → Y
  • MoveForward → Q1
  • SpeedDefault → 10
Note

Axis defines the conveyor’s transport direction. Here, the belt shall convey along the local Y axis. If you built the 3D scene yourself, you may need to select a different axis depending on how your scene is oriented. Use the gizmo to identify axes: blue = Z, red = X, green = Y. Negative directions Xn, Yn, Zn are available as well.

Conveyor 2

Click Conveyor 2 to select it. Set the Conveyor skill properties as follows:

  • Axis → Y
  • MoveBackward → Q2
  • SpeedDefault → 16

Creator

Creator settings (floating cube): create a cube every 5 seconds and place it on the belt. If the maximum count of 5 is reached, the oldest cube is removed.

Creator settings
Creator settings
  • CreateNextItem → 1
  • MaxNumberOfChilds → 5
  • AutoDestroy → Yes
  • CreateAlways → Yes
  • PauseInSecondsAfterCreate → 5

Drive – X axis

The X axis moves the gripper between Conveyor 1 and Conveyor 2. X-axis drive settings:

X-axis settings
X-axis settings
  • Axis → Zn (see the axis visualization on the 3D object)
  • ToMax → M1_0
  • ToMin → M1_1
  • IsAtMax → B1_0
  • IsAtMin → B1_1
  • DurationInSeconds → 0.5
  • StrokeLength → 70 (Enter the value in mm that matches your setup. The Y axis should end up centered above Conveyor 2.)
Tip: Demo mode

Use Demo mode to repeatedly move the axis to the max and min positions. This is a quick way to verify that the max position is correct.

Drive – Y axis

The Y axis moves the gripper up and down. Y-axis drive settings:

Y-axis settings
Y-axis settings
  • Axis → Zn (see the axis visualization on the 3D object)
  • ToMax → M2_0
  • ToMin → M2_1
  • IsAtMax → B2_0
  • IsAtMin → B2_1
  • DurationInSeconds → 0.5
  • StrokeLength → 23 (Enter the value in mm that matches your setup. The magnet should dip into the cube and the end of the Y axis should touch the cube.)

Light sensor

The light sensor outputs a BOOL signal when a cube is under the gripper. Light sensor settings:

Light sensor settings
Light sensor settings
  • Axis → Zn (see the axis visualization on the 3D object)
  • BoolValue → B0
  • IsNC → Off

Reminder if you built the scene yourself: the object origin (pivot point) of the light sensor must be moved to the point where the light beam should start. This is important because the beam origin matches the object origin.

Magnet (grip)

The switchable magnet can hold a cube. The magnet is a small, flat box object under the Y axis. Magnet settings:

Magnet settings
Magnet settings
  • OnOff → Q3

The control program

In this section, the mechatronic model is controlled using a C# script. Alternatively, you can implement the logic in a PLC program.

Select device CSharpScript (1) and click the wrench button (2) to the right. The device settings (3) are displayed.

Verify the settings:

Setting Value Comment
CSharpFile Program.cs Filename of the C# module containing the class.
Subfolder MySkript Folder to be created for the C# project.
ExecutingIntervalMS 10 Execution interval (ms) for the C# script.

The editor Microsoft Code should already be installed, and PathCodeEditor (4) should point to it. This is not required for the simulation below. See Installing the editor 'Microsoft Code'. Any plain text editor is sufficient to edit the C# file.

Click Create C# script. An empty C# project is created, including the corresponding input and output variables. Remove the existing void MainPrg() function entirely from Program.cs and paste the final code instead. Save Program.cs.

After pressing Run, the station should execute correctly. Not working? See these checks.

Final code for the pick-and-place station:

csharp
int StepNr = 0;

void MainPrg()
{
    ConsoleString = "StepNr: " + StepNr.ToString();

    if (StepNr == 0)
    {
        Q1 = true; // Conveyor 1 on
    }

    Q2 = Q1; // Conveyor 2 follows Conveyor 1

    if (StepNr == 0 && B0) // cube detected
    {
        StepNr++;
        Q1 = false; // stop conveyors
    }

    if (StepNr == 1)
    {
        M2_0 = true; // move Y axis down
        StepNr++;
    }

    if (StepNr == 2 && B2_0) // Y axis is down
    {
        M2_0 = false;
        Q3 = true; // magnet on
        StepNr++;
    }

    if (StepNr == 3)
    {
        M2_1 = true; // move Y axis up
        StepNr++;
    }

    if (StepNr == 4 && B2_1) // Y axis is up
    {
        M2_1 = false;
        StepNr++;
    }

    if (StepNr == 5)
    {
        M1_0 = true; // extend X axis
        StepNr++;
    }

    if (StepNr == 6 && B1_0) // X axis is extended
    {
        M1_0 = false;
        M2_0 = true; // move Y axis down
        StepNr++;
    }

    if (StepNr == 7 && B2_0) // Y axis is down
    {
        M2_0 = false;
        M2_1 = true; // move Y axis up
        Q3 = false;   // magnet off
        StepNr++;
    }

    if (StepNr == 8 && B2_1) // Y axis is up
    {
        M2_1 = false;
        M1_1 = true; // retract X axis to home
        StepNr++;
    }

    if (StepNr == 9 && B1_1) // X axis is retracted
    {
        M1_1 = false;
        StepNr = 0; // restart cycle
    }
}

Trouble-shooting

After pressing Run, the station should execute correctly. However, it may not work immediately. If so, check the following:

  • Object names and skills
    Are you using the specified object names? Any copy/paste mistakes? See the overview table at the top of this page.
  • Skill and axis parameters
    Are all skill settings and axis configurations correct?
  • Cube at the sensor?
    Is there still a cube directly at the pick-and-place sensor? Remove it in Blender before starting the simulation.
  • Light sensor
    Make sure the light sensor does not touch any other object. Otherwise it may output a signal even when no cube is at the pick position.
  • Parent/child relationships
    Are the parent/child links for the X axis, Y axis, and Creator/Child set up correctly?