本帖最后由 海洋闹饥荒 于 2012-5-28 23:11 编辑
程序可实现对圆或图块添加符号,并可自定位置。另外,对话框里面符号一项有记忆功能,算法在程序里,也一并奉上了。算是回馈明经了。
另外,还请各位看看我的这个帖子,提提看法。http://bbs.mjtd.com/thread-93729-1-1.html
dcl文件码会在一楼贴出,哪位大大觉得好的话,请给个币
- (defun c:ss(/ do_what pt1 idcl_id aaa cds_jidian pick_point duixiang)
- (setq idcl_id (load_dialog "check")
- )
-
- (if (> idcl_id 0)
- (progn (setq w1 "yuan")
- (setq do_what 2 h 20 start_x 0 start_y 0 aaa 1)
- (if (/= kkkkk nil) (setq w1 kkkkk))
- (while (> do_what 1)
- (if (new_dialog "circle_signal" idcl_id)
- (progn
- (set_tile "ww" w1)
- (set_tile "hh" (rtos h 2 1))
- (set_tile "xx" (rtos start_x 2 3))
- (set_tile "yy" (rtos start_y 2 3))
-
- (action_tile "ww" "(cdsw)")
- (action_tile "hh" "(cdsh)")
- (action_tile "xx" "(cdsx)")
- (action_tile "yy" "(cdsy)")
-
- (action_tile "pick_point" "(done_dialog 2)")
- (action_tile "duixiang" "(done_dialog 3)")
- (mode_tile "pick_point" aaa)
- (action_tile "accept" "(done_dialog 1)")
- (action_tile "cancel" "(done_dialog 0)")
- (setq do_what (start_dialog))
- (if (= do_what 3)
- (progn (prompt "\n请选择要加标记的圆或图块")
- (setq yuan (ssname (ssget '((0 . "CIRCLE,insert"))) 0))
- (setq aaa 0)
- (setq cds_jidian (cdr (assoc 10 (entget yuan))))
- ));;;;结束if(选择对象)
- (if (= do_what 2)
- (progn
- (initget 1)
- (setq pt1 (getpoint "\n请选择文字插入点:"))
- (setq start_x (- (car pt1) (car cds_jidian)) start_y (- (cadr pt1) (cadr cds_jidian)))
- ));;;结束if(插入点)
- ));;;;;结束外面的if
- ) ;while
- (if (= do_what 1)
- (draw_cds)
- )
- );;;;结束第一个if的progn
- (alert "不能载入对话框文件")
- );;;结束if(> idcl_id 0)
- (unload_dialog idcl_id)
- );;;defun
- ;;==================================================================
- (defun cdsw()
- (setq w1 (get_tile "ww"))
- (setq kkkkk w1)
- )
- (defun cdsh()
- (setq h (atof (get_tile "hh")))
- );将编辑框中的字符串转换成实型数,以便传给绘图程序
- (defun cdsx()
- (setq start_x (atof (get_tile "xx")))
- )
- (defun cdsy()
- (setq start_y (atof (get_tile "yy")))
- )
- ;;=================================================================
- (defun draw_cds (/ xzj neirong m i nr pt yc)
- (setq a (getvar "textstyle"))
- (setvar "textstyle" "standard")
- (prompt "\n请选择其他需要加标记的图元")
- (setq xzj (ssget '((0 . "CIRCLE,insert"))))
- (ssadd yuan xzj)
- (setq neirong (entget yuan))
- (setq m (cdr (assoc 0 neirong)))
-
- (setq i 0)
- (repeat (sslength xzj)
- (setq nr (entget (ssname xzj i)))
-
- (if (equal m "CIRCLE")
- (progn (if (= (cdr (assoc 40 neirong)) (cdr (assoc 40 nr)))
- (progn
- (setq yc (cdr (assoc 10 nr)))
- (setq pt (list (+ (car yc) start_x) (+ (cadr yc) start_y ) 0.0))
- (command "text" pt h 0 w1)
- )));progn
- (progn (if (equal (cdr (assoc 2 neirong)) (cdr (assoc 2 nr)))
- (progn
- (setq yc (cdr (assoc 10 nr)))
- (setq pt (list (+ (car yc) start_x) (+ (cadr yc) start_y ) 0.0))
- (command "text" pt h 0 w1)
- )))
- );if
- (setq i (+ i 1))
- );repeat
- (setvar "textstyle" a)
- )
由于我自己的程序里已经对高度一项做了更改,这里就没做对比。
|