Skip to content

4.12 BasScript Program Class

Overview

BasScript lets you construct BAS instruction sequences for the teach pendant in a structured way from the host PC, covering motion, logic, program calls, communication, vision, and Modbus commands.
By chaining BasScript.* method calls in Python you generate a script flow identical to that on the teach pendant, making it easy to automatically create, edit, or reuse complex programs.

Constructor

Method NameBasScript( name )
DescriptionCorresponds to the instructions in the teaching pendant program editor
Request Parametersname : Script name
Compatible robot software versionCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): v7.6.0.0+
NotesAll methods under BasScript follow the same compatible robot software versions as this class

4.12.1 Motion to Point Instruction

Method NameBasScript.move_joint( pose_type , pose_index , speed_type , speed_value , smooth_type , smooth_distance , extra_param )
DescriptionCorresponds to the MoveJoint instruction in the teaching pendant program writing
Request Parameterspose_type : Pose type
pose_index : Pose index
speed_type : Speed type
speed_value : Speed value
smooth_type : Smooth type
smooth_distance : Smooth distance
extra_param : Extra parameter
Return ValueStatusCodeEnum: Function execution result

4.12.2 Linear Motion to Point Instruction

Method NameBasScript.move_line( pose_type , pose_index , speed_type , speed_value , smooth_type , smooth_distance , extra_param )
DescriptionCorresponds to the MoveLine instruction in the teaching pendant program writing
Request Parameterspose_type : Pose type
pose_index : Pose index
speed_type : Speed type
speed_value : Speed value
smooth_type : Smooth type
smooth_distance : Smooth distance
extra_param : Extra parameter
Return ValueStatusCodeEnum: Function execution result

4.12.3 Arc Motion to Point Instruction

Method NameBasScript.move_circle( pose_type1 , pose_index1 , pose_type2 , pose_index2 , speed_type , speed_value , smooth_type , smooth_distance , extra_param )
DescriptionCorresponds to the MoveCircle instruction in the teaching pendant program writing
Request Parameterspose_type1 : First pose type
pose_index1 : First pose index
pose_type2 : Second pose type
pose_index2 : Second pose index
speed_type : Speed type
speed_value : Speed value
smooth_type : Smooth type
smooth_distance : Smooth distance
extra_param : Extra parameter
Return ValueStatusCodeEnum: Function execution result

4.12.4 If Conditional Instruction

Method NameBasScript.logi_if( param1 , index , param2 , value , operator )
DescriptionCorresponds to the IF logical statement in the teaching pendant program writing
Request Parametersparam1 : First parameter
index : Index
param2 : Second parameter
value : Value
operator : Logical operator
Return ValueStatusCodeEnum: Function execution result

4.12.5 ElseIf Conditional Branch Instruction

Method NameBasScript.logi_else_if( param1 , index , param2 , value , operator )
DescriptionCorresponds to the ELIF logical statement in the teaching pendant program writing
Request Parametersparam1 : First parameter
index : Index
param2 : Second parameter
value : Value
operator : Logical operator
Return ValueStatusCodeEnum: Function execution result

4.12.6 Else Instruction

Method NameBasScript.logi_else()
DescriptionCorresponds to the ELSE logical statement in the teaching pendant program writing
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result

4.12.7 End Conditional Instruction

Method NameBasScript.logi_end_if()
DescriptionCorresponds to the ENDIF logical statement in the teaching pendant program writing
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result

4.12.8 While Loop Instruction

Method NameBasScript.logi_while( param1 , index , param2 , value , operator )
DescriptionCorresponds to the WHILE logical statement in the teaching pendant program writing
Request Parametersparam1 : First parameter
index : Index
param2 : Second parameter
value : Value
operator : Logical operator
Return ValueStatusCodeEnum: Function execution result

4.12.9 End Loop Instruction

Method NameBasScript.logi_end_while()
DescriptionCorresponds to the ENDWHILE logical statement in the teaching pendant program writing
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result

4.12.10 Switch Multi-branch Selection Instruction

Method NameBasScript.logi_switch( param , index )
DescriptionCorresponds to the SWITCH logical statement in the teaching pendant program writing
Request Parametersparam : Parameter
index : Index
Return ValueStatusCodeEnum: Function execution result

4.12.11 Case Branch Instruction

Method NameBasScript.logi_case( param , value )
DescriptionCorresponds to the CASE logical statement in the teaching pendant program writing
Request Parametersparam : Parameter
value : Value
Return ValueStatusCodeEnum: Function execution result

4.12.12 Default Branch Instruction

Method NameBasScript.logi_default()
DescriptionCorresponds to the DEFAULT logical statement in the teaching pendant program writing
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result

4.12.13 End Multi-branch Selection Instruction

Method NameBasScript.logi_end_switch()
DescriptionCorresponds to the ENDSWITCH logical statement in the teaching pendant program writing
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result

4.12.14 Goto Jump Instruction

Method NameBasScript.logi_goto( index )
DescriptionCorresponds to the GOTO jump statement in the teaching pendant program writing
Request Parametersindex : Index of the target label
Return ValueStatusCodeEnum: Function execution result

4.12.15 Label Instruction

Method NameBasScript.logi_label( index )
DescriptionCorresponds to the LABEL label statement in the teaching pendant program writing
Request Parametersindex : Label index
Return ValueStatusCodeEnum: Function execution result

4.12.16 Skip Condition Instruction

Method NameBasScript.logi_skip_condition( param1 , index , param2 , value , operator )
DescriptionCorresponds to the SKIP CONDITION jump statement in the teaching pendant program writing
Request Parametersparam1 : First parameter
index : Index
param2 : Second parameter
value : Value
operator : Logical operator
Return ValueStatusCodeEnum: Function execution result

4.12.17 Break Loop Instruction

Method NameBasScript.logi_break()
DescriptionCorresponds to the BREAK statement in the teaching pendant program writing
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result

4.12.18 Skip Loop Instruction

Method NameBasScript.logi_continue()
DescriptionCorresponds to the CONTINUE statement in the teaching pendant program writing
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result

4.12.19 Assignment Instruction

Method NameBasScript.assign_value( param1 , index , param2 , value , opt_index , opt_value )
DescriptionCorresponds to the ASSIGN assignment statement in the teaching pendant program writing
Request Parametersparam1 : First parameter
index : Index
param2 : Second parameter
value : Value
opt_index : Optional index
opt_value : Optional value
Return ValueStatusCodeEnum: Function execution result

4.12.20 Wait Condition Instruction

Method NameBasScript.wait( param1 , index , param2 , value , operator )
DescriptionCorresponds to the WAIT COND wait condition statement in the teaching pendant program writing
Request Parametersparam1 : First parameter
index : Index
param2 : Second parameter
value : Value
operator : Logical operator
Return ValueStatusCodeEnum: Function execution result

4.12.21 Wait Time Instruction

Method NameBasScript.wait_time( param , value )
DescriptionCorresponds to the WAIT TIME wait time statement in the teaching pendant program writing
Request Parametersparam : Parameter
value : Time value
Return ValueStatusCodeEnum: Function execution result

4.12.22 Pause Instruction

Method NameBasScript.pause()
DescriptionCorresponds to the PAUSE pause statement in the teaching pendant program writing
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result

4.12.23 Abort Instruction

Method NameBasScript.abort()
DescriptionCorresponds to the ABORT terminate statement in the teaching pendant program writing
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result

4.12.24 Call Synchronous Program Call Instruction

Method NameBasScript.call( name )
DescriptionCorresponds to the CALL synchronous program call in the teaching pendant program writing
Request Parametersname : Program name
Return ValueStatusCodeEnum: Function execution result

4.12.25 Run Asynchronous Program Call Instruction

Method NameBasScript.run( name )
DescriptionCorresponds to the RUN asynchronous program call in the teaching pendant program writing
Request Parametersname : Program name
Return ValueStatusCodeEnum: Function execution result

4.12.26 Load Program Instruction

Method NameBasScript.load( param , value )
DescriptionCorresponds to the LOAD load program in the teaching pendant program writing
Request Parametersparam : Parameter
value : Value
Return ValueStatusCodeEnum: Function execution result

4.12.27 Unload Program Instruction

Method NameBasScript.unload( param , value )
DescriptionCorresponds to the UNLOAD unload program in the teaching pendant program writing
Request Parametersparam : Parameter
value : Value
Return ValueStatusCodeEnum: Function execution result

4.12.28 Execute Program Instruction

Method NameBasScript.exec( param , value )
DescriptionCorresponds to the EXEC execute program in the teaching pendant program writing
Request Parametersparam : Parameter
value : Value
Return ValueStatusCodeEnum: Function execution result

4.12.29 Open Socket Connection Instruction

Method NameBasScript.socket_open( index )
DescriptionCorresponds to the SOCKET OPEN open socket connection in the teaching pendant program writing
Request Parametersindex : SK register sequence number
Return ValueStatusCodeEnum: Function execution result

4.12.30 Close Socket Connection Instruction

Method NameBasScript.socket_close( index )
DescriptionCorresponds to the SOCKET CLOSE close socket connection in the teaching pendant program writing
Request Parametersindex : SK register sequence number
Return ValueStatusCodeEnum: Function execution result

4.12.31 Connect Socket Instruction

Method NameBasScript.socket_connect( index )
DescriptionCorresponds to the SOCKET CONNECT connect socket in the teaching pendant program writing
Request Parametersindex : SK register sequence number
Return ValueStatusCodeEnum: Function execution result

4.12.32 Send Socket Data Instruction

Method NameBasScript.socket_send( index , msg_type , value )
DescriptionCorresponds to the SOCKET SEND send data in the teaching pendant program writing
Request Parametersindex : SK register sequence number
msg_type : Message type
value : Message content or sequence number
Return ValueStatusCodeEnum: Function execution result

4.12.33 Receive Socket Data Instruction

Method NameBasScript.socket_recv( index , msg_length , msg_type , value )
DescriptionCorresponds to the SOCKET RECV receive data in the teaching pendant program writing
Request Parametersindex : SK register sequence number
msg_length : Message length
msg_type : Message type
value : Message content or sequence number
Return ValueStatusCodeEnum: Function execution result

4.12.34 Read Modbus Holding Register Instruction

Method NameBasScript.modbus_read_MH( index , id , address , length , r_index )
DescriptionCorresponds to the READ_MH read Modbus holding register in the teaching pendant program writing
Request Parametersindex : Channel sequence number
id : Modbus ID
address : Register address
length : Register length
r_index : R register sequence number
Return ValueStatusCodeEnum: Function execution result

4.12.35 Read Modbus Input Register Instruction

Method NameBasScript.modbus_read_MI( index , id , address , length , r_index )
DescriptionCorresponds to the READ_MI read Modbus input register in the teaching pendant program writing
Request Parametersindex : Channel sequence number
id : Modbus ID
address : Register address
length : Register length
r_index : R register sequence number
Return ValueStatusCodeEnum: Function execution result

4.12.36 Write Modbus Holding Register Instruction

Method NameBasScript.modbus_write_MH( index , id , address , length , value_type , value )
DescriptionCorresponds to the WRITE_MH write Modbus holding register in the teaching pendant program writing
Request Parametersindex : Channel sequence number
id : Modbus ID
address : Register address
length : Register length
value_type : Value type
value : Value or index
Return ValueStatusCodeEnum: Function execution result

4.12.37 Find Vision Program Instruction

Method NameBasScript.vision_find( name )
DescriptionCorresponds to the VISION FIND find vision program in the teaching pendant program writing
Request Parametersname : Vision program name
Return ValueStatusCodeEnum: Function execution result

4.12.38 Get Vision Program Offset Instruction

Method NameBasScript.vision_get_offset( name , index , label_index )
DescriptionCorresponds to the VISION GET OFFSET get vision program offset in the teaching pendant program writing
Request Parametersname : Vision program name
index : Vision register index
label_index : Label index
Return ValueStatusCodeEnum: Function execution result

4.12.39 Get Vision Program Result Instruction

Method NameBasScript.vision_get_quantity( name , index )
DescriptionCorresponds to the VISION GET QUANTITY get vision program result in the teaching pendant program writing
Request Parametersname : Vision program name
index : R register index
Return ValueStatusCodeEnum: Function execution result

4.12.40 Set Parameter Instruction

Method NameBasScript.set_param( type , value_type , value )
DescriptionCorresponds to the SET PARAM set parameter in the teaching pendant program writing
Request Parameterstype : Parameter type
value_type : Value type
value : Value
Return ValueStatusCodeEnum: Function execution result

4.12.41 Extra Parameter Class

Method NameExtraParam()
DescriptionExtra parameter class, used to construct complex robot control commands
Request ParametersNone
Return ValueNone

4.12.41.1 Set Acceleration

Method NameExtraParam.acceleration( value )
DescriptionSet acceleration, range is 1~120
Request Parametersvalue : Acceleration value (float)
Return ValueNone

4.12.41.2 Set RTCP Parameter

Method NameExtraParam.rctp()
DescriptionSet RTCP parameter
Request ParametersNone
Return ValueNone

4.12.41.3 Set Frame Offset

Method NameExtraParam.offset( index )
DescriptionSet frame offset
Request Parametersindex : Offset index (integer)
Return ValueNone

4.12.41.4 Set Time-Based Operation or Assignment

Method NameExtraParam.tb( second , type , name =None, index =None, status =None)
DescriptionSet time-based operation or assignment
Request Parameterssecond : Seconds (integer)
type : Execution type (string)
name : Name (for operation, string)
index : Index (for assignment, integer)
status : Status (for assignment, string)
Return ValueNone

4.12.41.5 Set Jump

Method NameExtraParam.skip( index )
DescriptionSet jump
Request Parametersindex : Label index (integer)
Return ValueNone

4.12.42 JUMP Quick Motion Instruction

4.12.42.1 JUMP Quick Motion Instruction

Method Namemove_jump( pose_type , pose_index , speed_value , speed_ratio , lim_Z_type , lim_Z_value , smooth_type , smooth_distance =0.0, extra_param =None)
DescriptionRobot point-to-point move to the specified position
Request Parameterspose_type : Target pose storage type ( MovePoseType , currently supports PR register)
pose_index : Index of the target position (integer, indicating the position in the PR register on the controller)
speed_value : Movement speed value (float, unit is mm/s)
speed_ratio : Movement speed ratio (float, unit is %, range is 0~100)
lim_Z_type : Z-axis limit type ( SpeedType , can be MR register or numerical VALUE)
lim_Z_value : Z-axis limit value (if lim_Z_type is MR register, it indicates the MR register sequence number; if it is numerical VALUE, it indicates the Z-axis limit value, unit is mm/s, range is 0~100)
smooth_type : Smooth type ( SmoothType , can be FINE or SMOOTH_DISTANCE)
smooth_distance : Smooth distance (float, only effective when smooth_type is SMOOTH_DISTANCE, range is 0~1000)
extra_param : Extra parameter ( ExtraParam , used to set the extra parameters of the MOVE instruction, optional)
Return ValueStatusCodeEnum: Function execution result

4.12.42.2 JUMP3 Quick Motion Instruction

Method Namemove_jump3( pose_type , pose_index , speed_value , speed_ratio , smooth_type , smooth_distance =0.0, extra_param =None)
DescriptionRobot point-to-point move to the specified position
Request Parameterspose_type : Target pose storage type ( MovePoseType , currently supports PR register)
pose_index : Index of the 3 target positions (list, containing 3 integers, indicating the positions in the PR register on the controller)
speed_value : Movement speed value (float, unit is mm/s)
speed_ratio : Movement speed ratio (float, unit is %, range is 0~100)
smooth_type : Smooth type ( SmoothType , can be FINE or SMOOTH_DISTANCE)
smooth_distance : Smooth distance (float, only effective when smooth_type is SMOOTH_DISTANCE, range is 0~1000)
extra_param : Extra parameter ( ExtraParam , used to set the extra parameters of the MOVE instruction, optional)
Return ValueStatusCodeEnum: Function execution result

4.12.42.3 JUMP3CP Quick Motion Instruction

Method Namemove_jump3cp( pose_type , pose_index , speed_value , smooth_type , smooth_distance =0.0, extra_param =None)
DescriptionRobot point-to-point move to the specified position
Request Parameterspose_type : Target pose storage type ( MovePoseType , currently supports PR register)
pose_index : Index of the 3 target positions (list, containing 3 integers, indicating the positions in the PR register on the controller)
speed_value : Movement speed value (float, unit is mm/s)
smooth_type : Smooth type ( SmoothType , can be FINE or SMOOTH_DISTANCE)
smooth_distance : Smooth distance (float, only effective when smooth_type is SMOOTH_DISTANCE, range is 0~1000)
extra_param : Extra parameter ( ExtraParam , used to set the extra parameters of the MOVE instruction, optional)
Return ValueStatusCodeEnum: Function execution result