MC-Basic:COMMON or DIM SHARED or DIM ... AS CONST LONG or DOUBLE or STRING or STRING OF UTF8 or JOINT OF or LOCATION OF/zh-hans

From SoftMC-Wiki
Jump to: navigation, search
语言: English  • 中文(简体)‎

缩写

格式

Common Shared | Dim Shared | Dim <const_name>As Const Long | Double | String | String of UTF8 |  Joint | Location = <const_value>

适用版本

所有版本
从版本4.5.10起声明UTF-8字符串是用的

描述

这些命令用于定义各种范围中的用户常量。

System常量通过配置文件中的 Common Shared命令(程序块之前),用户任务(程序块之前)和终端进行定义。

Task常量是通过用户任务中的 Dim Shared 定义的(程序块之前)。

Local 常量通过程序,子程序和功能块中用户任务中的Dim 命令进行定义。

与点变量不同,点常量不与特定机器人类型相关联,因为它们实际上是仅由坐标数定义的向量

类型

Long, Double, String, Joint or Location

取值范围

单位

关节和位置常量:用户定义位置单位

默认

使用范围

Configuration, Task or Terminal

从4.5.17版起,全局(common shared)声明也可以从库上下文中获得。

限制

  • 不支持数组和子程序或函数定义(参数和返回值)。
  • 用户常量必须在声明中给出值
  • 用户常量只能在声明语句中写入。 之后,他们变成只读。
  • 用户常量不能通过“by-reference”传递给子程序和函数。 他们必须始终被“by value”传递。

例子

‘SCARA robot Declaration :

common shared scara as group axnm=a1 axnm=a2 axnm=a3 axnm=a4  model = 4    

Common Shared LConst as Const Long = 100

Dim Shared SConst as Const String  = “Task1.Prg”

Program

Dim  JConst as Const Joint of XYZR    = {0.0, 0.0, 0.0}

Dim  LocConst as Const Location of XYZR     = #{0.0, 0.0, 0.0}

<code>

End Program


参见