hmw7374 发表于 2011-7-16 19:53:18

请教一些lisp程序编写中的问题

(defun C:gps_txt_zlkb ( / buchang1 e0 ent ent_tmp i loop no point pt ss ss1 txt txt_num txt_num_ws txt_str txt2 txt2_num);!!!文字增量拷贝
(gps->error-init(list'("cmdecho" 0 )    nil));end init
(if (null $buchang) (setq $buchang 1))
(setq $buchang (ureal 1 "" "\n增减值(正为增,负为减)" $buchang) buchang1 $buchang)   
(setq ss (ssget ":L"))
(if ss (progn   
(setq e0 (gps->entlast))
(setq pt (getpoint "指定基点:"))   
(command "copy" ss "" pt pause)   
(setq loop T)
(while loop      
   
    (foreach ent (gps->ss-2lst (gps->entlastent e0))
      (setq txt (gps->txt-getvalue ent))
      (if txt
                (progn
                (setq txt_num (gps->get_str_num txt));数字
例如:“ (setq txt (gps->txt-getvalue ent))”中gps后边的->是什么意思?

Andyhon 发表于 2011-7-16 20:28:54

本帖最后由 Andyhon 于 2011-7-16 21:45 编辑

(setq txt (gps->txt-getvalue ent))

gps->txt-getvalue 是一个函数
这个函数的命名最好是有着 '顾名思义' 的识别作用

txt-getvalue 解读成 得到文字内容
gps-> 应是个人专用前导符 用以区隔其他的人所写的函式

ljpnb 发表于 2011-7-16 20:29:35

gps->txt-getvalue 是一个自定义函数

hmw7374 发表于 2011-7-16 20:46:56

多谢楼上2位!

xchrimp 发表于 2011-7-16 21:36:41

xchrimp 发表于 2011-7-16 21:37:26

页: [1]
查看完整版本: 请教一些lisp程序编写中的问题