这是接近未测试
- ; simple find block
- ; by Alan H nov 2013
- (setq ans (getstring "\nEnter attribute value"))
- (setq oldtag1 "yourattibute") ;attribute tag name
- (setq ss1 (ssget "x" '((0 . "INSERT") (2 . "yourblockname")(410 . "Model"))) ; change block name
- (setq inc (sslength ss1))
- (repeat inc
- (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 (setq inc (1- inc))) )'getattributes)
- (if (= oldtag1 (strcase (vla-get-tagstring att)))
- (progn
- (if (= ans (vla-get-textstring att ))
- (progn
- (setq pt1 (vla-get-insertionpoint att))
- (command "zoom" "c" pt1 100) ; zooms in on block
- ) ; end progn
- ) ; end if ans
- )); end if oldtag1
- ) ; foreach att
- ) ; end repeat
- (princ)
|