明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2884|回复: 10

怎样才能使填充的对象更换颜色

[复制链接]
发表于 2007-1-26 08:20 | 显示全部楼层 |阅读模式

(DEFUN C:CAF1 (/ pt1 pt3 ss1 pt4)

 (if (null (tblsearch "layer" "s-bearing"))
  (command "-layer" "new" "s-bearing" "c" "9" "s-bearing" "lt" "continuous" "s-bearing" ""))
 (if (null (tblsearch "layer" "s-noplot"))
  (command "-layer" "new" "s-noplot" "c" "121" "s-noplot" ""))


    (setq pt1 (getpoint "\nSELECT POINT FOR CALIF FRAMING"))
 (setq pt3 (getpoint  pt1 "\nNEXT POINT"))
 (command "pline" pt1 pt3 "")
 (setq ss1 (ssget "l"))
    (while (setq pt4 (getpoint pt3 "\nNEXT POINT"))
  (command "pline" pt3 pt4 "")
  (command "pedit" "m" ss1 "last" "" "j" "" "")
  (setq pt3 pt4)
 )
 (command "chprop" "last" "" "la" "s-noplot" "")
 (terpri)
   (command "-osnap" "none")
   (command "-bhatch" "p" "dots" "24" "0" "s" "last")
   (command "chprop" "last" "" "C" "MAGENTA" "") ;;此行程序出现无效,无法更改填充的颜色,请问怎样才能使填充的对象更换颜色?请帮忙解决谢谢啦
   (PRINC)
)

点评

提问题请不要指名道姓,另请把问题在标题中写清楚  发表于 2007-1-26 00:00
日常管理   发表于 2007-1-26 00:00
发表于 2007-1-26 08:55 | 显示全部楼层

(DEFUN C:CAF1 (/ pt1 pt3 ss1 pt4)

 (if (null (tblsearch "layer" "s-bearing"))
  (command "-layer" "new" "s-bearing" "c" "9" "s-bearing" "lt" "continuous" "s-bearing" ""))
 (if (null (tblsearch "layer" "s-noplot"))
  (command "-layer" "new" "s-noplot" "c" "121" "s-noplot" ""))


    (setq pt1 (getpoint "\nSELECT POINT FOR CALIF FRAMING"))
 (setq pt3 (getpoint  pt1 "\nNEXT POINT"))
 (command "pline" pt1 pt3 "")
 (setq ss1 (ssget "l"))
    (while (setq pt4 (getpoint pt3 "\nNEXT POINT"))
  (command "pline" pt3 pt4 "")
  (command "pedit" "m" ss1 "last" "" "j" "" "")
  (setq pt3 pt4)
 )
 (command "chprop" "last" "" "la" "s-noplot" "")
 (terpri)
   (command "-osnap" "none")
   (command "-bhatch" "p" "dots" "24" "0" "s" "last""""")
;;;  (command "chprop" "last" "" "C" 2 "")
  (SETQ VL(VLAX-ENAME->VLA-OBJECT(ENTLAST)))
  (VLA-PUT-COLOR VL 6)
  
   (PRINC)
)

 楼主| 发表于 2007-1-31 08:25 | 显示全部楼层

BDYCAD,首先感谢您的修改意见.还有,请看我上传的图,左边是我希望得到的,右边是您的程序修改后的效果.我发的程序中,最后部分,跟你的有不同,区别在:

(command "-bhatch" "p" "dots" "24" "0" "s" "last");;;这是我的

(command "-bhatch" "p" "dots" "24" "0" "s" "last""""");;;这是您的.

我的程序,在画完边界后可以选择边界中的物体,以便不将其填充,若是改成您发的,就只能对所有对象进行填充.如何才能达到我想要的效果呢?我试了,没弄出来,请您帮忙了,谢谢!

本帖子中包含更多资源

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

x
发表于 2007-1-31 13:59 | 显示全部楼层
  1. ;;;2007-01-31
  2. (DEFUN C:CAF1 (/ pt1 pt3 ss1 pt4)
  3. (if (null (tblsearch "layer" "s-bearing"))
  4.   (command "-layer" "new" "s-bearing" "c" "9" "s-bearing" "lt" "continuous" "s-bearing" ""))
  5. (if (null (tblsearch "layer" "s-noplot"))
  6.   (command "-layer" "new" "s-noplot" "c" "121" "s-noplot" ""))
  7.     (setq pt1 (getpoint "\nSELECT POINT FOR CALIF FRAMING"))
  8. (setq pt3 (getpoint  pt1 "\nNEXT POINT"))
  9. (command "pline" pt1 pt3 "")
  10. (setq ss1 (ssget "l"))
  11.     (while (setq pt4 (getpoint pt3 "\nNEXT POINT"))
  12.   (command "pline" pt3 pt4 "")
  13.   (command "pedit" "m" ss1 "last" "" "j" "" "")
  14.   (setq pt3 pt4)
  15. )
  16.   (SETQ Ename(entlast)vle(vlax-ename->vla-object Ename))
  17.   (vla-getboundingbox vle 'LL 'UR)
  18.   (setq pt1(vlax-safearray->list LL)
  19. pt3(vlax-safearray->list UR))
  20.   (vla-put-layer vle "s-noplot")
  21. ;;; (command "chprop" Ename "" "la" "s-noplot" "")
  22. (terpri)
  23.    (command "-osnap" "none")
  24.    (command "-bhatch" "p" "dots" "24" "0" "s" "c" pt1 pt3 """")
  25. ;;;  (command "chprop" "last" "" "C" 2 "")
  26.   (VLA-PUT-COLOR (VLAX-ENAME->VLA-OBJECT(ENTLAST))6)
  27.    
  28.    (PRINC)
  29. )
 楼主| 发表于 2007-3-8 17:01 | 显示全部楼层

BDYCAD,

还是有问题,您的程序将填充边界内所有物体都过滤掉了,我想要的结果是程序运行过程中画完边界后,点选边界内不需要填充的物体,填充其他区域.我弄的头都大了还是没有解决,请您再费神看看吧,谢谢: )

发表于 2007-3-9 15:40 | 显示全部楼层

试试:

(DEFUN C:CAF1 (/ pt1 pt3 ss1 pt4)

  (if (null (tblsearch "layer" "s-bearing"))
   (command "-layer" "new" "s-bearing" "c" "9" "s-bearing" "lt" "continuous" "s-bearing" ""))
  (if (null (tblsearch "layer" "s-noplot"))
   (command "-layer" "new" "s-noplot" "c" "121" "s-noplot" ""))
     (setq pt1 (getpoint "\nSELECT POINT FOR CALIF FRAMING"))
  (setq pt3 (getpoint  pt1 "\nNEXT POINT"))
  (command "pline" pt1 pt3 "")
  (setq ss1 (ssget "l"))
     (while (setq pt4 (getpoint pt3 "\nNEXT POINT"))
   (command "pline" pt3 pt4 "")
   (command "pedit" "m" ss1 "last" "" "j" "" "")
   (setq ss1 (entlast))
   (setq pt3 pt4)
  )
   (SETQ Ename(entlast)vle(vlax-ename->vla-object Ename))
   (vla-getboundingbox vle 'LL 'UR)
   (setq pt1(vlax-safearray->list LL)
  pt3(vlax-safearray->list UR))
   (vla-put-layer vle "s-noplot")
;;; (command "chprop" Ename "" "la" "s-noplot" "")
  (terpri)
    (command "-osnap" "none")
    (command "-bhatch" "p" "dots" "24" "0" "s" "c" pt1 pt3 """")
;;;  (command "chprop" "last" "" "C" 2 "")
   (vla-PUT-COLOR (VLAX-ENAME->vla-OBJECT(ENTLAST))6)
   
    (PRINC)
)

 楼主| 发表于 2007-3-12 11:42 | 显示全部楼层
byghbcx,你就是把BDYCAD的程序COPY,PASTE过来啦嘛,没有任何改动啊??
发表于 2007-3-12 14:58 | 显示全部楼层

我不是加了一句(setq ss1 (entlast))吗,难道你没有试吗.经过pedit命令后,ss1已经不在了,要重新赋值,才能将所画的线全部联接成多义线,多义线联接不成功,下面的工作无法进行,BDYCAD已经帮你把多义线的最小坐标与最大坐标求出来,然后用ssget "c"方法取得此多义线的所有对象,进行边界填充.

 楼主| 发表于 2007-3-12 15:28 | 显示全部楼层

byghbcx,你好,不好意思,没发现您加的这句.

我的意思您没有明白,您现在的程序填充的是去处了边界内所有的图元,但是我想得到的是选边界内不填充的部分图元,然后填充其他部分,并改填充颜色.怎么能达到这种效果呢?

发表于 2007-3-12 15:43 | 显示全部楼层

这个能满足你的要求吗?试试:

(DEFUN C:CAF1 (/ pt1 pt3 ss1 pt4 ss2 k a )

  (if (null (tblsearch "layer" "s-bearing"))
   (command "-layer" "new" "s-bearing" "c" "9" "s-bearing" "lt" "continuous" "s-bearing" ""))
  (if (null (tblsearch "layer" "s-noplot"))
   (command "-layer" "new" "s-noplot" "c" "121" "s-noplot" ""))
     (setq pt1 (getpoint "\nSELECT POINT FOR CALIF FRAMING"))
  (setq pt3 (getpoint  pt1 "\nNEXT POINT"))
  (command "pline" pt1 pt3 "")
  (setq ss1 (ssget "l"))
     (while (setq pt4 (getpoint pt3 "\nNEXT POINT"))
   (command "pline" pt3 pt4 "")
   (command "pedit" "m" ss1 "last" "" "j" "" "")
   (setq ss1 (entlast))
   (setq pt3 pt4)
  )
  (SETQ ss2 (SSADD))
 (SETQ k T)
 (WHILE k
   (SETQ a (CAR (ENTSEL "\n增添范围内不填充对象:")))
   (IF a
     (PROGN
       (SETQ ss2 (SSADD a ss2))
       (REDRAW a 3)
     )
     (SETQ k NIL)
   )
 )
   (SETQ Ename(entlast)vle(vlax-ename->vla-object Ename))
   (vla-put-layer vle "s-noplot")
;;; (command "chprop" Ename "" "la" "s-noplot" "")
  (terpri)
    (command "-osnap" "none")
    (command "-bhatch" "p" "dots" "24" "0" "s" ename ss2 """")
;;;  (command "chprop" "last" "" "C" 2 "")
   (vla-PUT-COLOR (VLAX-ENAME->vla-OBJECT(ENTLAST))6)
   
    (PRINC)
)

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

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-6 14:57 , Processed in 0.456727 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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