本帖最后由 飞雪神光 于 2024-1-11 20:41 编辑
- (defun c:KK (/ cz dcl_id dcllst dd elsts fn fname jpg_insertxx show_list ss ss-enlst tmnames)
- (defun cz (/ e)
- (setq e (cadr (nth nn tmnames3)))
- (command "zoom" "o" e "")
- )
- (defun show_list (key newlist)
- (start_list key)
- (mapcar 'add_list newlist)
- (end_list)
- )
- (defun ss-enlst (ss / enlst)
- (cond
- ((= (type ss) 'PICKSET)
- (vl-remove-if-not
- '(lambda (x) (= (type x) 'ENAME))
- (mapcar 'cadr (ssnamex SS))
- )
- )
- ((= (type ss) 'LIST)
- (setq enlst (ssadd))
- (last (mapcar '(lambda (x) (ssadd x enlst)) ss))
- )
- )
- )
- (defun jpg_insertxx (e0 item / obj att jgb aobj)
- (vlax-get (setq obj (vlax-ename->vla-object e0))
- "HasAttributes"
- )
- (progn (setq att (vlax-invoke obj "GetAttributes"))
- (setq jgb (mapcar '(lambda (aobj)
- (list (vlax-get aobj "TagString")
- (vlax-get aobj "TextString")
- )
- )
- att
- )
- )
- )
- (cadr (assoc item jgb))
- )
- (defun lm-Str2num (String / positioni YPOutString)
- (setq positioni -1 aiilst'() jci 0)
- (repeat (strlen string)
- (setq ascm(vl-string-elt string (setq positioni (+ positioni 1))))
- (if(< 47 ascm 58)
- (setq aiilst(append aiilst (list ascm)))
- (setq jci (1+ jci))
- )
- )
- (atoi(car(mapcar'VL-LIST->STRING(reverse (list aiilst)))))
- )
- (setq
- ss (ssget (list '(0 . "insert") '(66 . 1) (cons 2 "14315445")))
- elsts (ss-enlst ss)
- tmnames1 (mapcar '(lambda (x) (list (lm-Str2num (jpg_insertxx x "图号")) (strcat (jpg_insertxx x "图号") (jpg_insertxx x "图名")) x)) elsts)
- tmnames2 (vl-sort tmnames1 '(lambda (x y) (< (car x) (car y))))
- tmnames3 (mapcar 'cdr tmnames2)
- tmnames (mapcar 'car tmnames3)
- )
- (setq fname (vl-filename-mktemp nil nil ".dcl"))
- (setq fn (open fname "w")
- dcllst '("xx:dialog {"
- " label = \"图框定位by--个人使用)\" ;"
- " :list_box {"
- " height = 30 ;"
- " key = \"dcl-tks\" ;"
- " }"
- " :button {"
- " height = 2 ;"
- " is_cancel = true ;"
- " key = \"dcl-cancel\" ;"
- " label = \"取消\" ;"
- " width = 38 ;"
- " }}"
- )
- )
-
- (foreach x dcllst (write-line x fn))
- (close fn)
- (setq dcl_id (load_dialog fname))
- (new_dialog "xx" dcl_id)
- (vl-file-delete fname)
- (show_list "dcl-tks" tmnames)
- (action_tile "dcl-tks" "(setq nn(atoi(get_tile \"dcl-tks\")))(done_dialog 1)")
- (setq dd (start_dialog))
- (if (= dd 1)
- (cz)
- )
- (unload_dialog dcl_id)
- )
|