嗯,不是真的shailujp,等等,我将为属性编写一个简短的代码。。。
编辑:针对多选和选定图元类型进行修改
- (defun c:HIH (/ _tempE hat ob a2t atb prop atb hat holes ); Hole in Hatch
- (defun _tempE (ne / tmp)
- (setq tmp (entmakex (entget (car ne))))
- (vla-transformby
- (vlax-ename->vla-object tmp)
- (vlax-tmatrix (caddr ne))
- )
- tmp
- )
- ;;; Borrowed from LM ;;;
- ;;; mod from /= to wcmatch ;;;
- (defun _selectobject ( msg obj fun / sel )
- (while
- (progn (setvar 'errno 0) (setq sel (car (setq itm ((eval fun) msg))))
- (cond
- ( (= 7 (getvar 'errno))
- (princ "\nMissed, try again.")
- )
- ( (= 'ename (type sel))
- (if (not (wcmatch (cdr (assoc 0 (entget sel))) obj))
- (princ "\nInvalid object selected.")
- )
- )
- )
- )
- )
- itm
- )
- ;;; ;;;
- (if (setq holes (ssadd) hat (_selectobject "\nSelect Hatch: " "HATCH" 'entsel))
- (progn
- [color="blue"](redraw (car hat) 3)[/color]
- (while
- (Setq ob (_selectobject "\nSelect objects to exclude hatch: " "ATTRIB,*LINE,*TEXT,CIRCLE" 'nentselp))
- (ssadd
- (if (eq (cdr (assoc 0 (entget (car ob)))) "ATTRIB")
- (progn
- (setq a2t (vlax-ename->vla-object (car ob)))
- (Setq prop (mapcar '(lambda (p)
- (vlax-get a2t p)
- )
- '("Insertionpoint" "Textstring" "Height")))
- (setq atb (vlax-invoke
- (vlax-get (vla-get-ActiveLayout
- (vla-get-activedocument (vlax-get-acad-object))
- ) 'Block ) 'AddText
- (cadr prop)
- (car prop)
- (caddr prop)
- )
- )(vlax-vla-object->ename atb)
- )
- (_tempE ob)
- ) Holes)
- [color="blue"] (redraw (ssname holes (1- (sslength holes))) 3)[/color]
- )
- (command "_.-hatchedit" (setq hat (Car hat)) "Ad" "s" holes "" "")
- (vla-put-AssociativeHatch (vlax-ename->vla-object hat) :vlax-false)
- (command "_.erase" holes "")
- )
- )(princ)
- )
编辑:针对多个选择进行修改 |