源码 圆或图块添加符号 对话框编辑框记忆功能
本帖最后由 海洋闹饥荒 于 2012-5-28 23:11 编辑程序可实现对圆或图块添加符号,并可自定位置。另外,对话框里面符号一项有记忆功能,算法在程序里,也一并奉上了。算是回馈明经了。
另外,还请各位看看我的这个帖子,提提看法。http://bbs.mjtd.com/thread-93729-1-1.html
dcl文件码会在一楼贴出,哪位大大觉得好的话,请给个币
(defun c:ss(/ do_whatpt1 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"))
(setqkkkkk 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)
)
由于我自己的程序里已经对高度一项做了更改,这里就没做对比。
代码
错误: 输入的字符串有缺陷 circle_signal:dialog{
label="圆加符号";
:boxed_row{label="符号参数";
:column{:edit_box{label="新符号";
key="ww";
edit_width=8;
}
:edit_box{label="符号高度";
key="hh";
edit_width=8;}
} //column
} //boxed_row
:boxed_row{label="符号插入点";
:column{ :button{label="选择一个对象";
key="duixiang";
width=5;
fixed_width=true;
is_default=true;
alignment=centered;}
:button{
label="插入点<<";
key="pick_point";
width=5;
fixed_width=true;
is_default=true;
alignment=centered;}
:edit_box{label="X相对坐标";
key="xx";
edit_width=8;}
:edit_box{label="Y相对坐标";
key="yy";
edit_width=8;}
} //column
}//boxed_row
ok_cancel;
} 给个演示图像,不知道怎么用呢
楼主能不能放过图示看一下。。谢谢 qq229918602 发表于 2012-5-27 22:21 static/image/common/back.gif
楼主能不能放过图示看一下。。谢谢
上图了。。。。。。。。。。。。。 tianyi1230 发表于 2012-5-27 21:14 static/image/common/back.gif
给个演示图像,不知道怎么用呢
上图了,对同一半径的圆和相同的图块可添加符号,插入点根据第一个选择的图元指定 手机看不清。 smartstar 发表于 2012-6-1 18:55 static/image/common/back.gif
手机看不清。
好程序,赞一个! 多发好贴,造福人民!!!
页:
[1]
2