WIN7 64位 需要管理员身份才能修改注册表。
个人认为,插件全局变量最好不要在注册表中保存,一来图纸较多时增加了注册表的负荷,二来没有管理员身份登录时,无法修改这些系统变量;VLISP的全局变量,我倾向于保存在词典中:

- ;;; 读取或创建自己的词典数据
- (defun ss-ldata-get (dict l)
- (if (snvalid dict)
- (mapcar (function (lambda (a / b)
- (if (and (car a) (= (type (car a)) 'STR) (snvalid (car a)))
- (if (setq b (vlax-ldata-get dict (car a) nil));_(vlax-ldata-get "GSLS" "#gsls_ctbl#" nil)
- (set (read (car a)) (read b))
- (if (and (cdr a) (= (type (cdr a)) 'STR) (snvalid (cdr a)))
- (progn (vlax-ldata-put dict (car a) (cdr a))
- (set (read (car a)) (read (cdr a)))))))))
- l)
- )
- )
- ;;; 保存自己的词典数据
- (defun ss-ldata-put (dict l)
- (if (snvalid dict)
- (mapcar (function (lambda (a / b)
- (if (and (car a) (= (type (car a)) 'STR) (snvalid (car a)))
- (if (or (setq b (vl-prin1-to-string (eval (read (car a)))))
- (setq b (cdr a)))
- (vlax-ldata-put dict (car a) b)))))
- l)
- )
- )
使用举例:

- (defun c:ss_CSSZ(/ dialog_name dialog_column_name)
- (setq dialog_name "高山流水结构工具箱"
- dialog_column_name "全局参数设置")
- (ss-ldata-get "GSLS" (list (cons "#GSLS_CTBL#" "100.0")
- (cons "#GSLS_HTBL#" "1.0")
- (cons "#GSLS_WK_PYJL#" "0.0")
- (cons "#GSLS_pline_union_max_distance#" "5.0")
- (cons "gsls_pline_wid" "50.")
- (cons "gsls_pline_off" "200.")
- (cons "CS_YDIS" "1.2")
- (cons "gsls_hatchpat_path" ""F:\\\\结构填充图案"" )
- (cons "gsls_hgj_gjzj" "30.0")
- (cons "gsls_filletrad" "100.0")))
- (if (= (init initlist-acad "dlg" "gslstool.ini") 1)
- (progn
- (ss-ldata-put "GSLS" (list (cons "#GSLS_CTBL#" "100.0");_(vlax-ldata-get "GSLS" "#GSLS_CTBL#")
- (cons "#GSLS_HTBL#" "1.0")
- (cons "#GSLS_WK_PYJL#" "0.0")
- (cons "#GSLS_pline_union_max_distance#" "5.0")
- (cons "gsls_pline_wid" "50.")
- (cons "gsls_pline_off" "200.")
- (cons "CS_YDIS" "1.2")
- (cons "gsls_hatchpat_path" ""F:\\\\结构填充图案"" )
- (cons "gsls_filletrad" "100.0")))
- (princ "\n高山流水结构工具箱全局参数初始化成功!")
- )
- (princ "\n***初始化失败,命令被取消***"))
- (princ)
- )
|