明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 33973|回复: 111

[资源] 动态填充(强烈推荐)

  [复制链接]
发表于 2011-1-7 11:10 | 显示全部楼层 |阅读模式
本帖最后由 xiaxiang 于 2011-1-9 17:11 编辑

Author: TheSwamp@Andrea
this allow user to select a closed polyline and scale in real time the hatch !
you can switch to the next Hatch patern by pressing the TAB key.
  1. (progn   
  2.     (setq mess1   "\nPlease pick Boundary or point inside hatch region")
  3.     (setq mess2   "\n- Hatch Pattern Switched to : ")
  4.     (setq mess3   "\nPress SPACE bar to Make a choice and than ENTER to edit:")
  5.     (setq mess4   "\nPlease select Hatch to edit : ")   
  6.     (setq mess5   "\n(D)ynamic or (V)alue <D>: ")
  7.     (setq mess6   "\nDynamic Scale...")
  8.     (setq mess7   "\nEnter the Hatch Scale Value <")
  9.     (setq mess8   ";Scale: ")   
  10.     (setq mess9   ";Angle: ")
  11.     (setq mess10  ";Pattern: ")
  12.     (setq mess11  ";Origin: ")
  13.     (setq mess12  ";PAT File: ")
  14.     (setq cmess0  "\nPress SPACE bar for select/ENTRER to activate/V to enter a Value:")
  15.     (setq cmess1  "\nNew Scale Value :")
  16.     (setq cmess2  "\nNew Angle Value :")
  17.     (setq cmess3  "\nNew Pattern Name :")
  18.     (setq cmess4  "\nNew Origin Coordinates (list) :")
  19.     (setq cmess5  "\nNew Color Value :")
  20.    
  21.     (setq var256  "BYLAYER")
  22.     (setq var0    "BYBLOCK")
  23.   )






本帖子中包含更多资源

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

x

点评

非常感谢  发表于 2012-3-14 20:21

评分

参与人数 2金钱 +16 收起 理由
死神去了 + 10 好程序
fl202 + 6

查看全部评分

"觉得好,就打赏"
还没有人打赏,支持一下

本帖被以下淘专辑推荐:

发表于 2011-1-7 12:49 | 显示全部楼层
能不要明经币么...
回复 支持 1 反对 0

使用道具 举报

发表于 2017-9-3 20:41 | 显示全部楼层
xyp1964 发表于 2011-1-9 14:44
(defun c:test933 ()
  (if (setq s1 (car (entsel "\n选择: ")))
    (xyp-Grread-Change s1 "比例" 41  ...

错误: no function definition: XYP-GRREAD-CHANGE请版主查看,谢谢(2006版本)
发表于 2017-9-8 17:30 | 显示全部楼层
teykmcqh 发表于 2011-4-19 01:46
请楼主尽快提供使用方法说明,否则请斑竹给予删除!

我也是不会用呃,我在用的2016版,请赐教
发表于 2011-1-7 12:21 | 显示全部楼层
程序不错,好用,比较有创意
发表于 2011-1-7 14:13 | 显示全部楼层
CAD2011就有这个功能
发表于 2011-1-8 01:52 | 显示全部楼层
楼主明经币大大的多
发表于 2011-1-8 10:23 | 显示全部楼层
老外的有:
前一半
  1. ;|                                                                        ;;
  2.         H O S         COMMAND        -> Changed for DHATCH (Dynamic HATCH)                ;;
  3.         (Hatch Object Scaling v. 2)                                        ;;
  4.         By: Andrea Andreetti dec. 2009                                        ;;
  5.                                                                         ;;
  6.         Update 1 - By: Ronjonp (theswamp)                                ;;
  7.                 Rotation angle revised                                        ;;
  8.                                                                         ;;
  9.         Update 2 - By Andrea Andreetti                                        ;;
  10.                 ORTHOMODE added with F8                                        ;;
  11.                 Color Switch from 1 to 9                                 ;;
  12.                 Switch Hatch Pattern during Rotation                        ;;
  13.                                                                         ;;
  14.         Update 2.1 -By Andrea Andreetti                                        ;;
  15.                 Fix1 :  ColorToggle variable added to fix                ;;
  16.                         Color Swaping without rescaling the Hatch        ;;
  17.                 Fix2 :        PatternToggle Variable added for same reason        ;;
  18.                         when swapping the Hatch Pattern                        ;;
  19.                 Fix3 :        English and French message detection                ;;
  20.                 HOS became DHATCH (dynamic Hatch)                        ;;
  21.                                                                         ;;
  22.         Update 2.2 -By Andrea Andreetti                                        ;;
  23.                 - New Feature allowing to move the HatchOrigin                ;;
  24.                                                                         ;;
  25.         Upgrade Dhatch v.3 -bY Andrea Andreetti 2008/12/23                ;;
  26.                 -Solid Hatch accepted                                        ;;
  27.                 -Work for Ellipse                                        ;;
  28.                 -You can select object or click INSIDE a closed object        ;;
  29.                 -New Options: (S)cale/(H)atch/(O)rigin/(C)olor                ;;
  30.                 -You can change Origin in real time and continu the function.
  31.                 -Osnap follow the SNAPANG variable.                        ;;
  32.                 -Diffrent ggrdraw vector color when using the Origin option.
  33.                 -Color option show the 256 autoCAD color dialog Box during the hatch.
  34.                 -Auto-Language version detection. (French / English)        ;;
  35.                                                                         ;;
  36.         Update Dhatch v.3.1.0 -by Andrea Andreetti 2008/12/23                ;;
  37.                 -Undo Redo management                                        ;;
  38.         Update dHATCH V.3.1.1 -by Andrea Andreetti 2008/12/23                ;;
  39.                 -Case Sensitive when choosing options FIXED                ;;
  40.                                                                         ;;
  41.         Upgrade Dhatch 4.0 by Andrea Andreetti 2008/12/25                ;;
  42.                 -New function DHEDIT (editor)                                ;;
  43.         Update Dhatch 4.1 By A.A. 2008-12-28                                ;;
  44.                 DHSL DHatch String Language detection function                ;;
  45.         Update Dhatch 4.2 By A.A. 2008-12-29                                ;;
  46.                 Scale option allow to put Number Value                        ;;
  47.                                                                         |;


  48. ;;                                        ;;
  49. ;;        FRENCH/ENGLISH DETEXTION        ;;
  50. ;;                                        ;;
  51.                                         ;;
  52. (defun DHSL ()
  53. (vl-load-com)  
  54. (if (vl-string-search "(FR)" (strcase (ver)))
  55.   (progn
  56.     (setq mess1   "\nSelectionnez votre entit??Hachurer...")
  57.     (setq mess2   "\n- Type de Hachure chang??: ")
  58.     (setq mess3   "\n(E)chelle/(H)achurage/(O)rigine/(C)couleur:")
  59.     (setq mess4   "\nS閘ectionnez l'hachure ?閐iter : ")
  60.     (setq mess5          "\n(D)ynamique ou (V)aleur <D>: ")
  61.     (setq mess6   "\n蒫helle Dynamique...")
  62.     (setq mess7   "\n蒫helle de votre hachurage <")
  63.     (setq var256  "DUCALQUE")
  64.     (setq var0    "DUBLOCK")
  65.   )
  66.   (progn
  67.     (setq mess1   "\nSelect Entity to Hatch...")
  68.     (setq mess2   "\n- Hatch Pattern Switched to : ")
  69.     (setq mess3   "\n(S)cale/(H)atch pattern/(O)rigin/(C)olor:")
  70.     (setq mess4   "\nPlease select Hatch to edit : ")   
  71.     (setq mess5          "\n(D)ynamic or (V)alue <D>: ")
  72.     (setq mess6   "\nDynamic Scale...")
  73.     (setq mess7   "\nEnter the Hatch Scale Value <")
  74.     (setq var256  "BYLAYER")
  75.     (setq var0    "BYBLOCK")
  76.   )
  77. )
  78. )
  79.                                         ;;
  80. ;;                                        ;;
  81. ;;        FRENCH/ENGLISH DETEXTION        ;;
  82. ;;                                        ;;



  83. ;;                                        ;;
  84. ;;        DHATCH         COMMAND                        ;;
  85. ;;                                        ;;
  86.                                         ;;
  87. (defun c:Dhatch (/ #DCswitch dr_sel1 entVLA OTD)
  88. (DHSL)  
  89. (setq HatchEdition nil)  

  90. (if (not #DCswitch)(setq #DCswitch 0))
  91. (setq dr_sel1 nil)  
  92.   (while (or
  93.            (= dr_sel1 nil)
  94.            (and
  95.            (/= (cdr (assoc 0 (setq dr_sel1data (entget (car dr_sel1))))) "LWPOLYLINE")
  96.            (/= (cdr (assoc 0 (setq dr_sel1data (entget (car dr_sel1))))) "CIRCLE")
  97.            (/= (cdr (assoc 0 (setq dr_sel1data (entget (car dr_sel1))))) "ELLIPSE")
  98.            )
  99.          )
  100. (setq dr_sel1 (entsel mess1))
  101. (if (not dr_sel1)
  102.   (progn
  103.   (setq FicPoint (cadr (grread t 4 4)))
  104.   (vl-cmdf "._boundary" FicPoint "")
  105.   (if (> (getvar "cmdactive") 0)
  106.     (progn
  107.     (command)
  108.     (setq OTD nil)
  109.     )
  110.     (progn
  111.     (setq dr_sel1 (list (setq TD (entlast)) FicPoint))
  112.     (setq OTD T)
  113.     )   
  114.     )
  115.   )
  116.   )
  117. )   

  118. (setq entVLA (vlax-ename->vla-object (car dr_sel1)))  
  119.   
  120. (if (or
  121.       (eq (vla-get-ObjectName entVLA) "AcDbEllipse")
  122.       (eq (vla-get-ObjectName entVLA) "AcDbCircle")
  123.       (and
  124.       (eq (vla-get-ObjectName entVLA) "AcDbPolyline")
  125.       (eq (vla-get-Closed entVLA) :vlax-true)
  126.       )
  127.     )
  128. (progn
  129. (vla-GetBoundingBox entVLA 'x 'y)
  130. (setq LLpoint  (vlax-safearray->list x))
  131. (setq URpoint  (vlax-safearray->list y))
  132. (setq centerpoint (polar LLpoint (angle LLpoint URpoint) (/ (distance LLpoint URpoint) 2)))
  133. )
  134. )

  135. (redraw)
  136. (vla-StartUndoMark (vla-get-ActiveDocument (vlax-get-ACAD-Object)))
  137. (oHexecute)  
  138. (setq hatchent nil)
  139. (if OTD (entdel TD))
  140. (redraw)
  141. (vla-EndUndoMark (vla-get-ActiveDocument (vlax-get-ACAD-Object)))
  142. )
  143.                                         ;;
  144. ;;                                        ;;
  145. ;;        DHATCH         COMMAND                        ;;
  146. ;;                                        ;;



  147. ;;                                ;;
  148. ;;        DHATCHEDIT                ;;
  149. ;;                                ;;
  150.                                 ;;
  151. (defun c:Dhatchedit (/)
  152. (DHSL)  
  153. (setq hatchdata nil)
  154. (setq HatchEdition T)
  155. (setq OTD nil)

  156. (setq dr_sel1 nil)  
  157.   (while (or
  158.            (= dr_sel1 nil)
  159.            (and
  160.            (/= (cdr (assoc 0 (setq hatchdata (entget (car dr_sel1))))) "HATCH")
  161.            )
  162.          )
  163. (setq dr_sel1 (entsel mess4))
  164.     )


  165. (setq entVLA (vlax-ename->vla-object (car dr_sel1)))
  166. (vla-GetBoundingBox entVLA 'x 'y)
  167. (setq LLpoint  (vlax-safearray->list x))
  168. (setq URpoint  (vlax-safearray->list y))
  169. (setq centerpoint (polar LLpoint (angle LLpoint URpoint) (/ (distance LLpoint URpoint) 2)))
  170. (entdel (car dr_sel1))
  171.   
  172. (redraw)
  173. (vla-StartUndoMark (vla-get-ActiveDocument (vlax-get-ACAD-Object)))
  174. (oHexecute)  
  175. (setq hatchent nil)
  176. (redraw)
  177. (vla-EndUndoMark (vla-get-ActiveDocument (vlax-get-ACAD-Object)))
  178. )
  179.                                 ;;
  180. ;;                                ;;
  181. ;;        DHATCHEDIT                ;;
  182. ;;                                ;;



  183. ;;                                ;;
  184. ;;        DHATCH         ORTHOMODE        ;;
  185. ;;                                ;;
  186.                                 ;;
  187. (defun HOSortho ()
  188.   
  189. (defun dtr (a)
  190. (* pi (/ a 180.0))
  191. )

  192. (defun rtd (a)
  193. (/ (* a 180) pi)
  194. )
  195.   
  196.     (setq distP (distance centerpoint cursorpoint))
  197.     (setq NorthP (polar centerpoint (+ snapA (dtr 90)) distP))
  198.     (setq WestP  (polar centerpoint (+ snapA (dtr 180)) distP))
  199.     (setq EastP  (polar centerpoint snapA distP))
  200.     (setq SouthP (polar centerpoint (- snapA (dtr 90)) distP))
  201.   
  202. (if (and
  203.       (< (distance cursorpoint NorthP) (distance cursorpoint WestP))
  204.       (< (distance cursorpoint NorthP) (distance cursorpoint EastP))
  205.       (< (distance cursorpoint NorthP) (distance cursorpoint SouthP))
  206.     )
  207. (setq cursorpoint NorthP)
  208. )

  209. (if (and
  210.       (< (distance cursorpoint WestP) (distance cursorpoint NorthP))
  211.       (< (distance cursorpoint WestP) (distance cursorpoint EastP))
  212.       (< (distance cursorpoint WestP) (distance cursorpoint SouthP))
  213.     )
  214. (setq cursorpoint WestP)
  215. )  

  216. (if (and
  217.       (< (distance cursorpoint EastP) (distance cursorpoint WestP))
  218.       (< (distance cursorpoint EastP) (distance cursorpoint NorthP))
  219.       (< (distance cursorpoint EastP) (distance cursorpoint SouthP))
  220.     )
  221. (setq cursorpoint EastP)
  222. )

  223. (if (and
  224.       (< (distance cursorpoint SouthP) (distance cursorpoint WestP))
  225.       (< (distance cursorpoint SouthP) (distance cursorpoint EastP))
  226.       (< (distance cursorpoint SouthP) (distance cursorpoint NorthP))
  227.     )
  228. (setq cursorpoint SouthP)
  229. )  
  230. )
发表于 2011-1-8 10:23 | 显示全部楼层
后一半
  1.                                 ;;
  2. ;;                                ;;
  3. ;;        DHATCH         ORTHOMODE        ;;
  4. ;;                                ;;



  5. ;;                                ;;
  6. ;;        DHATCH         function        ;;
  7. ;;                                ;;
  8.                                 ;;

  9. (defun oHexecute (/ fi si LP A_hps)
  10. (setvar "CMDECHO" 0)
  11. (setq orthm (getvar "ORTHOMODE"))
  12. (setq snapa (getvar "SNAPANG"))
  13. (setq #dcswitch 0)
  14. (setq Operation nil)
  15.   
  16. (setq hatchlist (gethatchlin (findfile "acad.PAT")))
  17. (setq hatch# (1- (vl-list-length hatchlist)))


  18. (if (not HatchEdition)
  19.   (progn
  20. (vl-cmdf "_-hatch" "_S" (car dr_sel1) "" "")
  21. (setq hatchdata (entget (entlast)))
  22. (if (eq (cdr (assoc 0 hatchdata)) "HATCH")
  23.     (entdel (entlast))
  24. )
  25.     (setq A_cecolor (getvar "CECOLOR")
  26.           A_hpang (getvar "HPANG")
  27.           A_hpscale (getvar "HPSCALE")
  28.           A_hpname (getvar "HPNAME")
  29.           A_hporigin centerpoint)
  30. )
  31.   (progn
  32.     (if (assoc 62 hatchdata)
  33.       (setq A_cecolor (itoa (cdr (assoc 62 hatchdata))))
  34.       (setq A_cecolor var256)
  35.     )
  36.     (setq A_hpscale (cdr (assoc 41 hatchdata)))
  37.     (setq A_hpang (getvar "HPANG"))
  38.     (setq A_hpname (cdr (assoc 2 hatchdata)))
  39.     (setq A_hporigin centerpoint)          
  40.   )
  41. )

  42.     (princ mess3)
  43.     (while (and (setq input (grread t 4 4))               
  44.                 (or (= (car input) 5)                                  ; *cursor
  45.                     (and (= (car input) 2) (= (cadr input) 15))          ; F8 Orthomode
  46.                     (and (= (car input) 2) (= (cadr input) 104))  ; h = Hatch
  47.                     (and (= (car input) 2) (= (cadr input) 72))   ; H
  48.                     ;(and (= (car input) 2) (= (cadr input) 14))          ; R = Rotation
  49.                     (and (= (car input) 2) (= (cadr input) 115))  ; s = Scale
  50.                     (and (= (car input) 2) (= (cadr input) 83))          ; S
  51.                     (and (= (car input) 2) (= (cadr input) 101))  ; e = Echelle
  52.                     (and (= (car input) 2) (= (cadr input) 69))   ; E
  53.                     (and (= (car input) 2) (= (cadr input) 111))  ; o = Origin
  54.                     (and (= (car input) 2) (= (cadr input) 79))   ; O
  55.                     (and (= (car input) 2) (= (cadr input) 99))          ; c = Color
  56.                     (and (= (car input) 2) (= (cadr input) 67))   ; C
  57.                 )
  58.            )

  59.       
  60. (if (= (car input) 5) (setq cursorpoint (cadr input)))     
  61. (if (or
  62.       (and (= (car input) 2) (= (cadr input) 104))
  63.       (and (= (car input) 2) (= (cadr input) 72))
  64.     )
  65.       (setq Operation "HATCH" Thatch T)
  66. )
  67.       
  68. (if (and (= (car input) 2) (= (cadr input) 15)) (setq Operation "ORTHO"))
  69.       
  70. (if (or
  71.       (and (= (car input) 2) (= (cadr input) 115));S
  72.       (and (= (car input) 2) (= (cadr input) 83))
  73.       (and (= (car input) 2) (= (cadr input) 101));E
  74.       (and (= (car input) 2) (= (cadr input) 69))
  75.     )
  76.       (setq Operation "SCALE")
  77. )
  78. (if (or
  79.       (and (= (car input) 2) (= (cadr input) 111))
  80.       (and (= (car input) 2) (= (cadr input) 79))
  81.     )
  82.   (setq Operation "ORIGIN")
  83. )
  84.       
  85. (if (or
  86.       (and (= (car input) 2) (= (cadr input) 99))
  87.       (and (= (car input) 2) (= (cadr input) 67))
  88.     )
  89.   (setq Operation "COLOR")
  90. )

  91. (if (eq Operation "COLOR")
  92.   (progn
  93.     (setq ccol (read A_cecolor))
  94.     (if (eq (strcase A_cecolor) "BYBLOCK") (setq ccol 0))
  95.     (if (eq (strcase A_cecolor) "BYLAYER") (setq ccol 256))
  96.     (setq Ncol (acad_colordlg ccol 8))
  97.     (if Ncol
  98.       (progn
  99.         (setq A_cecolor (itoa Ncol))
  100.         (if (eq A_cecolor 256)(setq A_cecolor var256))
  101.         (if (eq A_cecolor 0)(setq A_cecolor var0))
  102.        )
  103.       )
  104.     (setq Operation nil)
  105.    )
  106. )
  107.       
  108. ;;SWITCH HATCH MODE                ;;
  109.                                 ;;
  110.       (if (eq Operation "HATCH")
  111.         (progn
  112.           (setq Operation nil)
  113.           (setq input (grread t 4 4))
  114.                (if (>= #dcswitch hatch#)
  115.                  (setq #dcswitch 0)
  116.                  (setq #dcswitch (1+ #dcswitch))
  117.                )
  118.           (setvar "HPNAME" A_hpname)
  119.                (princ (strcat mess2
  120.                               (setq A_hpname (nth #dcswitch hatchlist))
  121.                       )
  122.                )               
  123.                (princ mess3)                    
  124.         )
  125.       )
  126.                                 ;;
  127. ;;SWITCH HATCH MODE                ;;

  128.       
  129. ;;SWITCH ORTHOMODE                ;;
  130.                                 ;;
  131. (if (eq Operation "ORTHO")
  132.   (progn
  133.     (if (eq orthm 1)
  134.            (progn (setvar "ORTHOMODE" 0) (setq orthm 0))
  135.            (progn (setvar "ORTHOMODE" 1) (setq orthm 1))
  136.          )
  137.     (setq Operation nil)
  138.   )
  139. )
  140. (if (eq orthM 1)
  141.   (HOSortho)
  142.   )      
  143.                                 ;;
  144. ;;SWITCH ORTHOMODE                ;;


  145. ;;SWITCH SCALE                        ;;
  146.                                 ;;
  147. (if (eq Operation "SCALE")
  148.   (progn
  149.     (initget "D V")
  150.     (setq gkw (getKword mess5))
  151.     (if        (eq gkw "D")
  152.       (progn
  153.         (princ mess6)
  154.         (while (and (setq inputX (grread t 5 0))
  155.                     (= (car inputX) 5)
  156.                )
  157.           (setq cursorpoint (cadr inputX))
  158.           (setq A_hpscale (distance cursorpoint centerpoint))
  159.           (MODIFHATCH A_hpname A_cecolor A_hpang A_hpscale A_hporigin)
  160.           (setq Operation nil)
  161.         )
  162.         (princ mess3)
  163.       )
  164.       (progn
  165.         (setq A_hps (getreal (strcat mess7
  166.                                      (rtos A_hpscale)
  167.                                      ">: "
  168.                              )
  169.                     )
  170.         )
  171.         (if A_hps
  172.           (setq A_hpscale A_hps)
  173.         )
  174.         (setq Operation nil)
  175.         (princ mess3)
  176.       )
  177.     )
  178.   )
  179. )


  180.                                 ;;
  181. ;;SWITCH SCALE                        ;;


  182. ;;SWITCH ORIGIN                        ;;
  183.                                 ;;
  184. (if (eq Operation "ORIGIN")
  185.   (progn
  186.    
  187. (while (and (setq input (grread t 4 4))               
  188.                 (or (= (car input) 5)                    
  189.                     ))
  190.   (redraw)
  191. (setq cursorpoint (cadr input))
  192. (setq cursorX (car cursorpoint))
  193. (setq cursorY (cadr cursorpoint))
  194. (grdraw cursorpoint centerpoint 12 1)   
  195. (if hatchent
  196.   (progn
  197. (setq A_hpang A_LastAng)
  198. (setq hatchentData (entget hatchent))
  199. (setq hatchdatax (subst (cons 43 cursorX)(assoc 43 hatchentData) hatchentData))
  200. (setq hatchdatax (subst (cons 44 cursorY)(assoc 44 hatchdatax) hatchdatax))
  201. (entmod hatchdatax)
  202. (setq hatchent (cdr (car hatchdatax)))
  203. )
  204. )
  205. )
  206. (setq centerpoint (cadr input))
  207. )
  208. )
  209.                                 ;;
  210. ;;SWITCH ORIGIN                        ;;
  211.       
  212.       
  213. ;;UPDATE HATCH
  214. (MODIFHATCH A_hpname A_cecolor A_hpang A_hpscale A_hporigin)


  215. ;;UPDATE ANGLE
  216. (if (not (eq Operation "ORIGIN"))
  217.   (progn   
  218. (setq rangle (+ (angle cursorpoint centerpoint) (angtof "135")))
  219. (grdraw cursorpoint centerpoint 4 1)
  220. (setq entVLA (vlax-ename->vla-object hatchent))
  221. (vla-put-PatternAngle entVLA rangle)
  222.   )
  223.   (setq Operation nil)
  224. )
  225.      
  226. (princ)
  227. )
  228. )
  229.                                 ;;
  230. ;;                                ;;
  231. ;;        H O S         function        ;;
  232. ;;                                ;;



  233. ;;                                ;;
  234. ;;        HATCH UPDATE                ;;
  235. ;;                                ;;
  236.                                 ;;
  237. (defun MODIFHATCH (hatch col Rot sca orig)
  238.   
  239. (redraw)

  240. (if hatchdata
  241.   (progn
  242. (grdraw cursorpoint centerpoint 4 1)
  243. ;;origin
  244. (setq orig A_hporigin)   
  245. (setq cursorX (car orig))
  246. (setq cursorY (cadr orig))
  247. (setq hatchdatax (subst (cons 43 cursorX)(assoc 43 hatchentData) hatchdata))
  248. (setq hatchdatax (subst (cons 44 cursorY)(assoc 44 hatchdatax) hatchdatax))

  249. ;;scale
  250. (setq hatchdatax (subst (cons 41 sca) (assoc 41 hatchdatax) hatchdatax))

  251. ;;HatchPattern

  252. (setq hatchdatax (subst (cons 2 hatch) (assoc 2 hatchdatax) hatchdatax))

  253. ;;Color
  254. (if (eq (strcase col) var256);BYLAYER
  255.   (setq hatchdatax  (vl-remove (assoc 62 hatchdatax) hatchdatax))
  256. )

  257. (if (eq (strcase col) var0);BYBLOCK
  258.   (setq col 0)
  259. )  

  260. (if (numberp (read col))
  261.   (progn
  262. (if (not (assoc 62 hatchdatax))
  263.     (setq hatchdatax (append hatchdatax (list (cons 62 (read col)))))
  264.     (setq hatchdatax (subst (cons 62 (read col)) (assoc 62 hatchdatax) hatchdatax))
  265. )
  266. )
  267. )

  268. (if hatchent
  269.     (progn (command "._erase" hatchent "") (setq hatchent nil))
  270.   )
  271. (setq hatchent (entmakex hatchdatax))
  272. (setq hatchdata hatchdatax)
  273. )
  274. )
  275. )
  276.                                 ;;
  277. ;;                                ;;
  278. ;;        HATCH UPDATE                ;;
  279. ;;                                ;;





  280. ;|                                                ;;
  281.         PAT or LIN file reader                        ;;
  282.                                                 |;
  283.                                                 ;;
  284. (defun getHatchLIN (acadftype / lino acadftype l1 commaPos ALLLIST)
  285. (setq HATCHLIST nil
  286.       LINESLIST nil)
  287. (if (findfile acadftype)
  288.   (progn
  289.   (setq lino (open acadftype "r"))
  290.   (while (setq l1 (read-line lino))
  291.     (if (and
  292.           (eq (substr l1 1 1) "*")
  293.           (setq commaPos (vl-string-search "," l1))
  294.         )
  295.       (setq ALLLIST (append ALLLIST (list (substr l1 2 (1- commaPos)))))
  296.     )
  297.   )
  298. )
  299. )
  300. (close lino)
  301. (if (eq (strcase (vl-filename-extension acadftype)) ".PAT")
  302. (setq HATCHLIST (mapcar 'strcase ALLLIST))
  303. (setq LINESLIST (mapcar 'strcase ALLLIST))  
  304. )
  305. )
  306.                                                 ;;
  307. ;|                                                |;

发表于 2011-1-8 21:49 | 显示全部楼层
很好的程序,谢谢,可惜在2010上用不了
发表于 2011-1-9 14:44 | 显示全部楼层
(defun c:test933 ()
  (if (setq s1 (car (entsel "\n选择: ")))
    (xyp-Grread-Change s1 "比例" 41 0)
  )
  (princ)
)

本帖子中包含更多资源

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

x
发表于 2011-1-9 15:19 | 显示全部楼层
回复 xyp1964 的帖子

回版主,试了下,选择填充时,CAD提示  "选择: ; 错误: no function definition: XYP-GRREAD-CHANGE",烦请版主看下,谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-18 05:58 , Processed in 0.382031 second(s), 35 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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