给你一个开始(伍德曼78或布拉茨,男孩)
这适用于非关联图案填充。。。没有弧。
修改它以处理所有图案填充应该不需要太多。
为了确保没有选择不同的图案,它将首先提示输入填充图案,然后提示选择要合并的所有图案填充。
- ;-----------------------------------------------
- ;; ø Remove_nth ø (Lee Mac) ;;
- ;; ~ Removes the nth item in a list. ;;
- (defun Remove_nth (i lst / j)
- (setq j -1)
- (vl-remove-if
- (function
- (lambda (x)
- (eq i (setq j (1+ j))))) lst))
- ;-----------------------------------------------
- ;; massoc (Jaysen Long) ;;
- ;; Extracts info from list by key ;;
- (defun massoc (key alist / x nlist)
- (foreach x alist
- (if
- (eq key (car x))
- (setq nlist (cons x nlist))
- )
- )
- (reverse nlist)
- );defun
- ;-----------------------------------------------
- (defun c:MH ( / hentinfo ss i n entinfo ptlist pickpntlst entlist MergedHatchList)
- (while (/= (cdr (assoc 0 hentinfo)) "HATCH")
- (setq hentinfo (car (entsel "\nSelect Hatch Pattern to use:")))
- (If hentinfo (setq hentinfo (entget hentinfo)) (princ "\nMissed. Try again.")))
- (while (not ss) (princ "Select hatch entities to merge:")(setq ss (ssget '((0 . "HATCH")))))
- (setq MergedHatchList
- (list (cons 0 "HATCH")
- (cons 100 "AcDbEntity")
- (assoc 8 hentinfo)
- (cons 100 "AcDbHatch")
- (assoc 10 hentinfo)
- (assoc 210 hentinfo)
- (assoc 2 hentinfo)
- (assoc 70 hentinfo)
- (assoc 71 hentinfo)
- (cons 91 (sslength ss))
- ) i -1)
- (repeat (sslength ss)
- (setq n -1 newlist nil)
- (setq entinfo (entget (ssname ss (setq i (1+ i)))))
- (setq ptlist (cdr (massoc 10 entinfo)))
- (setq pickpntlst (append pickpntlst (list (last ptlist))))
- (repeat (cdr (assoc 93 entinfo))(setq newlist (append newlist (list (nth (setq n (1+ n)) ptlist)))))
- (setq entlist (append (append (mapcar '(lambda (x) (assoc x entinfo)) '(92 72 73 93)) newlist)(list (assoc 97 entinfo))))
- (setq MergedHatchList (append MergedHatchlist entlist))
- (entdel (ssname ss i))
- )
- (setq MergedHatchList
- (append MergedHatchList
- (append
- (mapcar '(lambda (x) (assoc x hentinfo)) '(75 76 52 41 77 78 53 43 44 45 46 79 47))
- (cons (cons 98 (sslength ss)) pickpntlst))))
- (entmake MergedHatchList)
- )
MH\u MERGE\u图案填充。lsp |