找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1009|回复: 2

[求助] 此程序有点问题,请大师们能帮忙修正

[复制链接]

已领礼包: 3199个

财富等级: 富可敌国

发表于 2014-3-16 14:38:15 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
本帖最后由 lucas3 于 2014-3-16 14:39 编辑

试用中发现了以下几个问题,望大师们给改改,谢谢
1.线型与线型比例,不能将LINE的线型与线型比例刷到多段线PL上,PL线的同样不能刷到L线上,但是颜色可以
2.字型比例,只能在单行文字之间刷,多行文字之间不行,单行文字刷到多行文字不行,多行文字刷到单行文字不行,但是文字内容可以相互刷。
3.“箭头散”与“色,层绝对” 不知道有何用?没试出效果
3.下方的 “反向选择”好像也没有什么作用。

对话框:
  1. brush : dialog {    label = "分类格式刷 欢迎使用!  HUIHL";    : boxed_column {        label = "要刷取的项目";        : row {            : column {                : toggle {                    label = "线型";                    key = "xx";                    mnemonic = "E";                    fixed_width = true;                }                  : toggle {                    label = "线型比例";                    key = "xxbl";                    mnemonic = "M";                    fixed_width = true;                }  
  2.                 : toggle {
  3.                     label = "颜色";
  4.                     key =  "yc";
  5.         width=16;
  6.                     fixed_width = true;
  7.                 }  
  8.                 : toggle {
  9.                     label = "文字类型";
  10.                     key = "wzlx";
  11.                     mnemonic = "N";
  12.                     fixed_width = true;
  13.                 }  
  14.                 : toggle {
  15.                     label = "字高";
  16.                     key = "zg";
  17.                     mnemonic = "Q";
  18.                     fixed_width = true;
  19.                 }  
  20.                 : toggle {
  21.                     label = "字形比例";
  22.                     key = "zxbl";
  23.                     mnemonic = "I";
  24.                     fixed_width = true;
  25.                 }  
  26.     : toggle {
  27.                     label = "文字内容";
  28.                     key = "wznr";
  29.                     mnemonic = "I";
  30.                     fixed_width = true;
  31.                 }  

  32.             }
  33.             : column {
  34.                 : toggle {
  35.                     label = "标注样式";
  36.                     key = "cc";
  37.                     mnemonic = "s";
  38.       width=15;
  39.                     fixed_width = true;
  40.                 }  
  41.                 : toggle {
  42.                     label = "层";
  43.                     key = "c";
  44.                     mnemonic = "d";
  45.                     fixed_width = true;
  46.                 }  
  47.                 : toggle {
  48.                     label = "箭头(散)";
  49.                     key = "jt";
  50.                     mnemonic = "T";
  51.                     fixed_width = true;
  52.                 }  
  53.                 : toggle {
  54.                     label = "字体角度";
  55.                     key = "ztjd";
  56.                     mnemonic = "a";
  57.                     fixed_width = true;
  58.                 }  
  59.             



  60.     : toggle {
  61.                    label = "圆、弧半径";
  62.                    key = "bj";
  63.                    mnemonic = "p";
  64.                    fixed_width = true;
  65.                 }
  66.     : toggle {
  67.                     label = "色、层绝对";
  68.                     key = "scjd";
  69.                     mnemonic = "u";
  70.                     fixed_width = true;
  71.                 }  

  72.    




  73.             }  //column



  74.         }  //row  

  75. :text{
  76. value="Email//:huihl@netease.com";
  77. is_bold=false;
  78. height=1;}  

  79. :row{   : toggle {
  80.                     label = "反向选中";
  81.                     key = sf;
  82.                     mnemonic = "u";
  83.                     fixed_width = true;
  84.                 }  

  85. : toggle {
  86.                     label = "记住选择";
  87.                     key = jzxz;
  88.                     mnemonic = "u";
  89.                     fixed_width = true;
  90.                 }   
  91. }

  92.   }  //box


  93. :row{

  94. :text{
  95. value="下列是对象选择过滤器(与型,色层绝对)";
  96. is_bold=false;
  97. height=1;}  
  98. : toggle {
  99.                     label = "全选/框选";
  100.                     key = qx;
  101.                     mnemonic = "u";
  102.                     fixed_width = true;
  103.                 }   


  104. }//endrow

  105.   
  106. :boxed_row{
  107. :column{  
  108. :popup_list{
  109.     key="tt1";
  110.     width=10;
  111.     list="";
  112.     }

  113. :popup_list{
  114.     key="tt2";
  115.     width=10;
  116.     list="";
  117.     }
  118. }


  119. :column{  
  120. :popup_list{
  121.     key="tt3";
  122.     width=10;
  123.     list="";
  124.     }

  125. :popup_list{
  126.     key="tt4";
  127.     width=10;
  128.     list="";
  129.     }
  130. }
  131. }//endrow
  132. ok_cancel;
  133. }  //dialog


LISP:
  1. (defun c:ddbrush(/ sss ee leng n ss standard ok) ;本程序是类似于R14应用程序中经常用的格式刷的功能
  2. (setq sss (entsel "请输入要刷子原形") )
  3. (setq mother (entget (car sss)))
  4. (setq moname (cdr (assoc 0 mother)))
  5. (setq standard (list -3 '("ACAD" (1000 . "DSTYLE") (1002 . "{") (1002 . "}"))))

  6. (setq id (load_dialog (findfile "ddbrush.dcl")))
  7. (if (not (new_dialog "brush" id))
  8.         (exit)
  9. )


  10. (if (= jzxz 1) (init))
  11. (initl)
  12. ;--------------------
  13. (setq mc (assoc 8 mother) mx  (assoc 6 mother) my  (assoc 62 mother))
  14. (setq myy (cadr (assoc (cdr mc) nn1)) mxx (caddr (assoc (cdr mc) nn1)))
  15. ;--------------------------

  16. (setq ok 0)
  17. (action_tile "accept" "(do_set)(done_dialog 1)")
  18. (start_dialog)
  19. (unload_dialog id)
  20. (if (= ok 0) (exit))        ;如果取消就退出


  21. (prompt "请选择要修改的实体")
  22. (if (= qx 1) (setq ss (ssget "x")) (setq ss (ssget ) ))
  23. (print "请您耐心等待,程序正在处理......")
  24. (setq leng (sslength ss) n 0 str "")
  25. (repeat leng
  26.         (setq ee (ssname ss n))
  27.         (setq aa (entget ee))
  28.         (setq name (cdr (assoc 0 aa)))

  29. (setq yesno f)
  30. (if (and (= tt1 0) (= tt2 0) (= tt3 0) (= tt4 0)) (setq yesno t)
  31.         (progn
  32.         (setq tc (assoc 8 aa) tx  (assoc 6 aa) ty  (assoc 62 aa))
  33.         (setq tyy (cadr (assoc (cdr tc) nn1)) txx (caddr (assoc (cdr tc) nn1)))
  34.         

  35.         (setq ttt1 f)
  36.         (if (= tt1 0) (setq ttt1 t))
  37.         (if (and (not (= tt1 0)) (= (car (nth (1- tt1) nn1)) (cdr tc)))        (setq ttt1 t) );;处理层
  38.         

  39.         
  40.         (setq ttt2 f)
  41.         (if (= tt2 0) (setq ttt2 t)                                                        ;处理线型
  42.                 (if  (NULL tx)  
  43.                         ( if (= (nth (1- tt2) nn2) txx) (setq ttt2 t))
  44.                         (if (= (nth (1- tt2) nn2) (cdr tx)) (setq ttt2 t))
  45.                 )
  46.         )


  47.         (setq ttt3 f)                                                                        ;处理颜色
  48.         (if (= tt3 0) (setq ttt3 t)
  49.                 (if (NULL ty)
  50.                         ( if (= tt3  tyy) (setq ttt3 t))
  51.                         (if (= tt3 (cdr ty))  (setq ttt3  t))
  52.                 )
  53.         )

  54.         
  55.         
  56.         (setq ttt4 f)                                                                        ;处理实体
  57.         (if (= tt4 0) (setq ttt4 t)
  58.                 (if (= (nth (1- tt4) nn4) name) (setq ttt4 t))
  59.         )



  60.         (setq yesno (and ttt1 ttt2 ttt3 ttt4))
  61.         
  62.         );endprogn
  63. );endif


  64. (if (= yesno t)
  65.         (progn
  66. ( if (and (or (= moname "DIMEMSION") (= moname "CIRCLE") (= moname "ARC") (= moname "INSERT") (= moname "LINE") (= moname "PLINE")  (= moname "LEADER"))
  67.           (or (= name "DIMEMSION") (= name "INSERT") (= name "LINE")  (= name "CIRCLE") (= name "ARC") (= name "PLINE")  (= name "LEADER")))
  68.         (progn
  69.         (if (= xx 1) (myreplace 6))                                                        ;线型
  70.         (if (= xxbl 1) (myreplace 48))                                                        ;线型比例
  71.         );ENDPROGN
  72. )        ;ENDIF
  73.         


  74. (if (and (or (= name "TEXT") (= name "MTEXT") (= name "ATTDEF")) (or (= moname "TEXT") (= moname "MTEXT") (= moname "ATTDEF")))
  75.         (progn
  76.         (if (= wzlx 1) (myreplace 7))                                                          ;自设系统变量,如果sss不为空,一切字体类型都要更换
  77.         
  78.         (if (= zxbl 1) (if  (or (= moname "MTEXT") (= name "MTEXT")) ()        (myreplace 41)));字宽比
  79.         (if (= zg 1) (myreplace 40))                                                        ;字高
  80.         
  81.         (if (= ztjd 1) (myreplace 50))                                                        ;逆时针弧度值
  82.         (if (= ztjd 1) (myreplace 51))                                                        ;斜体斜角弧度值
  83.         );;endprogn
  84. );;endif        

  85. (if (and (or (= name "TEXT") (= name "MTEXT") (= name "DIMENSION")) (or (= moname "TEXT") (= moname "MTEXT") (= moname "DIMENSION")))
  86.         (if (= wznr 1) (myreplace 1))                                                        ;文字内容
  87. )

  88. ;;;以下两项为专属修改
  89. (if (and (= moname "DIMENSION") (= "DIMENSION" name))
  90.         (if (= cc 1)
  91.                 (progn
  92.                 (modim)
  93.                 (myreplace 3)                                                                ;改变尺寸的标注风格
  94.                 )                                                                         ;改变尺寸
  95.         )
  96. )        

  97. (if (and (= moname "SOLID") (= name "SOLID") (= jt 1)) (mysol))                                ;改变箭头的大小
  98.         
  99. (if (and (or (= moname "CIRCLE") (= moname "ARC")) (or (= name "CIRCLE") (= name "ARC")) (= bj 1)) (myreplace 40))  ;半径

  100. ;;;以下两项为基本属性修改
  101.         (if (= c 1) (myreplace 8))                ;层
  102.         (if (= yc 1) (myreplace 62))                ;颜色
  103.         );;;;endprogn
  104. );;;;;endif


  105.    
  106. (setq n (1+ n))
  107. )        ;endrep

  108. (setq ss nil)
  109. (princ "\n请尊重原作者的辛勤劳动,同时,如果您愿意请为非洲贫困儿童献一份爱心!\n您在使用本程序时如有问题,请与<a href=\"mailto:huihl@netease.com\">huihl@netease.com</a>联系!\n")
  110. (command "line" '(0 0) "")                ;此语句是为了回退(undo)的需要而编写,即一次只能回退一条操作。


  111. )        ;endfun

  112. (defun modim( / exmo exmo3 exch)

  113. (setq exmo (entget (car sss) '("ACAD")))
  114. (setq exmo3 (assoc -3 exmo))
  115. (setq exch (entget ee '("ACAD")))
  116. (setq exch3 (assoc -3 exch))
  117. (princ "\nsecond\n\n")
  118. (princ exch)
  119. (princ "\n\n first\n")
  120. (princ exmo3)
  121.   ;;判断标注对象的样式是否是替换样式
  122.   (cond
  123.     ((and exmo3 exch3) (setq exch (subst exmo3 (assoc -3 exch) exch)))
  124.     ((and exmo3 (not exch3))(setq exch (append exch (list  exmo3))))
  125.     ((and (not exmo3) exch3) (setq  exch (subst standard (assoc -3 exch) exch)))
  126.     )
  127. ;;;(if (not (or (NULL (assoc -3 exch)) (NULL exmo3))) (setq exch (subst exmo3 (assoc -3 exch) exch)))
  128. ;;;(if (NULL (assoc -3 exch))  (setq exch (append exch (list  exmo3))))
  129. ;;;(if (NULL exmo3) (setq  exch (subst standard (assoc -3 exch) exch)))


  130. (princ "\n\nstart newsecond\n")
  131. (princ exch)
  132. (princ "\n\nend\n")
  133. (entmod exch)
  134. )


  135. (defun myreplace(attrib / variey1 variey2 variety xxxx yyyy)

  136. (if (NULL variey1) (setq variey1  (assoc attrib aa)))
  137. (setq variey2 (cdr (assoc attrib mother)))
  138. (if (NULL variey2) (setq variey2  (assoc attrib mother)))


  139. (if (and (not (null variey1)) (not (null variey2)))           
  140.                         (progn (setq aa
  141.                               (subst (cons attrib variey2) (assoc                         attrib aa) aa)) (entmod aa))                )                ;endif母有子有,即母子属性不随层
  142.         

  143.                
  144. (if (and  (null variey1) (not (null variey2)) ) (setq aa (append aa                         (list  (assoc attrib mother))))
  145. )  ;endif母有子没有,即母属性不随层,但子属性随层

  146. ;以下,母没有子有,即母属性随层,但子属性不随层,分三种情况。。。。。(不知何故cond总是有问题,故用三个if的拙法完

  147. (if (= scjd 1) (setq xxxx mxx yyyy myy) (setq xxxx "BYLAYER" yyyy 256))  ;用于色层绝对

  148. (if (and (not (null variey1)) (null variey2) (= attrib 6)) (setq aa   (subst (cons attrib xxxx) (assoc attrib aa) aa)) )                ;线型

  149. (if  (and (not (null variey1)) (null variey2) (= attrib 62)) (setq aa   (subst (cons attrib yyyy) (assoc attrib aa) aa)))                ;颜色,注:随层为256;随块为0


  150. ;;以下是母子都没有的情况
  151. (if (and (null variey1) (null variey2) (= attrib 6))  (setq aa (append aa (list  (cons attrib xxxx))))        )
  152. (if (and (null variey1) (null variey2) (= attrib 62))  (setq aa (append aa (list  (cons attrib yyyy))))        )



  153. (if (and (not (null variey1)) (null variey2)  (= attrib 48 )) (progn (setq aa   (subst (cons attrib 1) (assoc attrib aa) aa)) (princ "ok") (princ aa)))                ;线型比例
  154. (entmod aa)
  155. )  ;endsubfun


  156. (defun mysol(/ ll pt0 pt1)                                                   ;该函数用于修改箭头的大小
  157. (setq ll (distance (cdr (assoc 10 mother)) (cdr (assoc 13 mother))))
  158.                 (setq pt0 (cdr (assoc 10 aa)) pt1 (cdr (assoc 11  aa)) pt3 (cdr (assoc 13  aa)))
  159.                 (setq rate (/ ll (distance pt0 pt3)))
  160.                 (setq pt0 (snpt pt3 pt0 rate) pt1 (snpt pt3 pt1 rate))               
  161.                 (setq aa                 
  162.                         (subst (cons 10 pt0) (assoc 10 aa) aa)
  163.                 )   
  164.                 (setq aa                 
  165.                         (subst (cons 11 pt1) (assoc 11 aa) aa)
  166.                 )   

  167.         (entmod aa)
  168. )

  169. (defun snpt(p1 p2 rate / sx1 sx2 sx3 sy1 sy2 sy3 )
  170. (setq sx1 (car p1) sy1 (cadr p1) sx2 (car p2) sy2 (cadr p2))
  171. (setq sx3 (+ (* rate (- sx2 sx1)) sx1) )
  172. (setq sy3 (+ (* rate (- sy2 sy1)) sy1) )
  173. (list sx3 sy3 0.0)
  174. )

  175. (defun do_set(/ n)
  176. (setq sf (atoi (get_tile "sf")))
  177. (setq jzxz (atoi (get_tile "jzxz")))

  178. (if (= sf 1) (setq n 1) (setq n 0))

  179. (setq xx (+ (atoi (get_tile "xx")) n))
  180. (setq xxbl (+ (atoi (get_tile "xxbl")) n))
  181. (setq yc (+ (atoi (get_tile "yc")) n))
  182. (setq wzlx (+ (atoi (get_tile "wzlx")) n))
  183. (setq  zg (+ (atoi (get_tile "zg")) n))
  184. (setq zxbl (+ (atoi (get_tile "zxbl")) n))
  185. (setq wznr (+ (atoi (get_tile "wznr")) n))

  186. (setq cc (+ (atoi (get_tile "cc")) n))
  187. (setq c (+ (atoi (get_tile "c")) n))
  188. (setq jt (+ (atoi (get_tile "jt")) n))
  189. (setq ztjd (+ (atoi (get_tile "ztjd")) n))
  190. (setq bj (+ (atoi (get_tile "bj")) n))
  191. (setq scjd (+ (atoi (get_tile "scjd")) n))

  192. (setq tt1 (atoi (get_tile "tt1")))
  193. (setq tt2 (atoi (get_tile "tt2")))
  194. (setq tt3 (atoi (get_tile "tt3")))
  195. (setq tt4 (atoi (get_tile "tt4")))

  196. (setq qx (atoi (get_tile "qx")))
  197. (setq ok 1)

  198. )

  199. (defun init()

  200. (set_tile "jzxz" (itoa jzxz))
  201. (if (= sf 1) (setq n 1) (setq n 0))
  202. (set_tile "sf" (itoa sf))
  203. (set_tile "xx" (itoa (- xx n)))
  204. (set_tile "xxbl" (itoa (- xxbl n)))
  205. (set_tile "yc" (itoa (- yc n)))
  206. (set_tile "wzlx" (itoa (- wzlx n)))
  207. (set_tile "zg" (itoa (- zg n)))
  208. (set_tile "zxbl" (itoa (- zxbl n)))
  209. (set_tile "wznr" (itoa (- wznr n)))

  210. (set_tile "cc" (itoa (- cc n)))
  211. (set_tile "c" (itoa (- c n)))
  212. (set_tile "jt" (itoa (- jt n)))
  213. (set_tile "ztjd" (itoa (- ztjd n)))
  214. (set_tile "bj" (itoa (- bj n)))
  215. (set_tile "scjd" (itoa (- scjd n)))

  216. (set_tile "qx" (itoa qx))
  217. )

  218. (defun initl()
  219. (setq nn1 '() nn2 '() nn3 '() nn4 '("LINE" "PLINE" "CIRCLE" "ARC" "TEXT" "MTEXT" "ATTDEF" "DIMENSION" "INSERT" "SOLID") n 0)
  220. (start_list "tt1" 3)
  221. (add_list "过滤层(不过滤)")
  222. (setq blk (tblnext "LAYER" 1))

  223. (while (not (NULL blk))
  224. (setq n (1+ n))
  225. (setq tname (cdr (nth 1 blk)))
  226. (setq nn1 (append nn1 (list (list  tname (cdr (nth 3 blk)) (cdr (nth 4 blk))))))
  227. (add_list tname)
  228. (setq blk (tblnext "LAYER" NIL))
  229. )
  230. (end_list)


  231. (start_list "tt2" 3)
  232. (add_list "过滤线型(不过滤)")
  233. (setq blk (tblnext "LTYPE" 1))
  234. (while (not (NULL blk))
  235. (setq tname (cdr (nth 1 blk)))
  236. (setq nn2 (append nn2 (list  tname)))
  237. (add_list tname)
  238. (setq blk (tblnext "LTYPE" NIL))

  239. )
  240. (end_list)

  241. (start_list "tt3" 3)
  242. (add_list "过滤颜色(不过滤)")
  243. (setq n 0)
  244. (repeat 255
  245. (setq n (1+ n))
  246. (add_list (itoa n))
  247. )
  248. (end_list)

  249. (start_list "tt4" 3)
  250. (add_list "过滤实体(不过滤)")
  251. (setq n 0)
  252. (setq len (length nn4))
  253. (repeat len

  254. (add_list (nth n nn4))
  255. (setq n (1+ n))
  256. )
  257. (end_list)

  258. )


ddbrush.lsp

11.06 KB, 下载次数: 4, 下载积分: D豆 -1 , 活跃度 1

论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 1268个

财富等级: 财源广进

发表于 2014-3-17 11:07:09 | 显示全部楼层
联系作者   

点评

发过邮件了,总是被退信,应该是邮箱已失效了吧  详情 回复 发表于 2014-3-17 11:33
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 3199个

财富等级: 富可敌国

 楼主| 发表于 2014-3-17 11:33:30 | 显示全部楼层

发过邮件了,总是被退信,应该是邮箱已失效了吧
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-25 00:28 , Processed in 0.345694 second(s), 44 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表