大神都不出手做对话框版么?
我先抛块砖
- (defun c:ST (/ SSLists)
- (setq SSLists (Sub-SS-SSLists))
- (dcl_contents SSLists)
- )
- (defun dcl_contents (SSLists / dcl_id S_D)
- (sssetfirst)
- (if (> (setq dcl_id (load_dialog "随图选择集")) 0)
- (if (new_dialog "SuiTuSS" dcl_id)
- (progn (action_tile "AddSS" "(done_dialog 1)")
- (action_tile "ChsSS" "(done_dialog 2)")
- (action_tile "DelSS" "(done_dialog 3)")
- (action_tile "SSName" "(setq SSNam $value)")
- (start_list "SSList") ;_已有选择集列表
- (mapcar 'add_list SSLists)
- (end_list)
- (action_tile "SSList" "(setq SSLst $value)")
- (mode_tile "SSName" 2) ;_鼠标焦点
- (action_tile "cancel" "(done_dialog 0)")
- (setq S_D (start_dialog))
- (cond
- ((= S_D 1) (Sub-SS-CreateSS SSNam))
- ((= S_D 2) (Sub-SS-ChooseSS (nth (read SSLst) SSLists)))
- ((= S_D 3) (Sub-SS-DelSS (nth (read SSLst) SSLists)))
- )
- (start_dialog)
- (unload_dialog dcl_id)
- )
- (princ "\n无法显示对话框!")
- )
- (princ "\n无法加载对话框!")
- )
- (princ)
- )
- ;;;================================================================================
- ;;;自贡黄明儒
- (defun Sub-SS-CreateSS (SSNam / SS n en listxz SSLists)
- (if SSNam
- (progn
- (setq SS (ssget))
- (repeat (setq n (sslength SS))
- (setq en (ssname SS (setq n (1- n))))
- (setq listxz (append listxz (list (cdr (assoc 5 (entget en))))))
- )
- (VL-CATCH-ALL-APPLY 'vlax-ldata-put (list "SS-Data-SSXZJ" SSNam listxz))
- )
- )
- (setq SSLists (Sub-SS-SSLists))
- (dcl_contents SSLists)
- )
- ;;调出选择集
- (defun Sub-SS-ChooseSS (SSNam / N1 RESULT SS1)
- (setq result (VL-CATCH-ALL-APPLY 'vlax-ldata-get (list "SS-Data-SSXZJ" SSNam)))
- (if (VL-CATCH-ALL-ERROR-P result)
- nil
- (progn
- (setq ss1 (ssadd))
- (repeat (length result)
- (setq n1 (car result))
- (setq result (cdr result))
- (ssadd (handent n1) ss1)
- )
- )
- )
- (sssetfirst nil ss1)
- )
- (defun Sub-SS-DelSS (SSNAM / SSLists)
- (VL-CATCH-ALL-APPLY 'vlax-ldata-delete (list "SS-Data-SSXZJ" SSNam)) ;_删除单个选择集
- (setq SSLists (Sub-SS-SSLists))
- (dcl_contents SSLists)
- )
- (defun Sub-SS-DelSSAll (/ SSLists)
- (YX:Put-Dict-DelDict "SS-Data-SSXZJ") ;_删除词典,清空选择集
- (setq SSLists (Sub-SS-SSLists))
- (dcl_contents SSLists)
- )
- (defun Sub-SS-SSLists (/ LIS SSNAMS X)
- (if (setq lis (vlax-ldata-list "SS-Data-SSXZJ"))
- (setq SSNAMlst (mapcar '(lambda (x) (car x)) lis))
- (setq SSNAMlst nil)
- )
- )
|