snddd2000 发表于 2012-12-27 17:06
原理就是收集图中的所有此块名的dxf的2组码,作为ssget的过滤条件
- (defun ssgetblock-X (blknamelst / ss0 n count ent0 str BlkName0)
- (setq ss0 (ssget "X" '((0 . "INSERT"))))
- (setq n 0
- count (sslength ss0)
- str ""
- )
- (repeat count
- (setq ent0 (ssname ss0 n))
- (setq BlkName0 (vla-get-effectivename
- (vlax-ename->vla-object ent0)
- )
- )
- (if (member BlkName0 blknamelst)
- (setq str (strcat str ",`" (cdr (assoc 2 (entget ent0)))))
- )
- (setq n (1+ n))
- ) ;end repeat
- (ssget (list (cons 0 "INSERT") (cons 2 str)))
- )
- (setq ss1 (ssgetblock-X (list "块名1""块名2""块名3" ... ...))) ;取块
|