Skip to main content

Visualization Element: Online Cam Editor

The online cam editor is a visualization template that displays a cam in the visualization. With this element, you can modify the cam in online mode.

The visualization element is made available in a visualization template (SMC_VISU_CamEditor) of the SM3_Basic_Visu library. You find it in the visualization editor in the Toolbox view in the SM3_Basic_Visu tag.

The SMC_Visu_CamEditor is inserted into the visualization via a frame.

For more information about this visualization element, see: Visualization Element: Frame.

_sm_img_visuelement_cam_editor2.png

In addition to the properties of the frame element, this template contains the following properties:

Property

Description

safeCam

Reference to the cam to be edited

showPosition

Boolean variable for toggling the display of the position curve on and off

showVelocity

Boolean variable for toggling the display of the velocity curve on and off

showAcceleration

Boolean variable for toggling the display of the acceleration curve on and off

showJerk

Boolean variable for toggling the display of the jerk curve on and off

showSelectedSegment

Boolean variable for toggling the highlighting of the selected segment on and off

The cam to be edited is transferred via an instance of the SMCB.CAM_REF_MULTICORE_SAFE function block.

PROGRAM PLC_PRG
VAR
    safeCam : SMCB.CAM_REF_MULTICORE_SAFE;
END_VAR

Cam editor in online mode

In online mode, the individual segments of the cam can be selected in the graph. The segment editor on the right-hand side can be used to add and delete segments, as well as to adapt the boundary conditions of the selected segment.

_sm_img_cam_editor_online2.png

(1) Load Cam

Loads the configured cam into the editor

(2) Save Cam

Saves the edited cam

(3) Status bar

Displays status messages

(4) Segment selection

A segment can be selected using the arrows. The segment type can be changed via the list box.

(5) Master position

The master position on the left and right edge of the segment

(6) Slave position

The slave position on the left and right edge of the segment.

(7) Slave velocity

The slave velocity on the left and right edge of the segment. Not editable for all segment types.

(8) Slave acceleration

The slave acceleration on the left and right edge of the segment. Not editable for all segment types.

(9) Slave jerk

The slave jerk on the left and right edge of the segment. Not editable for all segment types.

(10) Lambda parameter

Lambda parameter for the modified sine line.

(11) Split

Divides the selected segment into two segments.

(12) Delete

Deletes the selected segment.

Using a created cam in the application

You can use the cam created with the SMC_Visu_CamEditor visualization element in the application by calling the GetCopy method of the CAM_REF_MULTICORE_SAFE instance.

PROGRAM PLC_PRG
VAR
    safeCam : SMCB.CAM_REF_MULTICORE_SAFE;
    camRef : MC_CAM_REF;
    camSegments : ARRAY[0..99] OF SMC_CAM_SEGMENT;
    error : SMC_ERROR;
END_VAR

IF safeCam.CamId <> oldCamId THEN
     error :=
         safeCam.GetCopy(
            camRef:= camRef,
            pCamSegments:= ADR(camSegments),
            arraySize:= XSIZEOF(camSegments));

      oldCamId := safeCam.CamId;
END_IF

The program first checks whether a new cam has been created (CamId <> oldCamID). If so, then a copy of this cam is created using the GetCopy method. If the call returns SMC_NO_ERROR, then the camRef instance of the MC_CAM_REF function block can be used with the SoftMotion cam function blocks MC_CamTableSelect and MC_CamIn. The GetCopy call is task-safe and therefore does not have to be made from the Visu task.