Select mv blocks by style

Select mv blocks by style

john_nordmark2
Enthusiast Enthusiast
723 Views
1 Reply
Message 1 of 2

Select mv blocks by style

john_nordmark2
Enthusiast
Enthusiast

Hi,

Is it possible to select mv blocks of specific style name with lisp? I want to change layer on specific mv blocks in a lot of models.

0 Likes
724 Views
1 Reply
Reply (1)
Message 2 of 2

felix.corre
Advocate
Advocate

Hi,

Lisp that creates the entity list "ListMvb" of MVBLOCKs with the specified style:

 

 

 

(defun C:ListMVBbyStyle ( / ListMvb)
  (setq MVName (Getstring "\nMVBlock Style Name?: "))
  (setq c 0)
  (setq i 0)
  (setq js (ssget "X" '((0 . "AEC_MVBLOCK_REF"))))
  (repeat (sslength js)
    (setq bloc (ssname js i))
    (setq vlabloc (vlax-ename->vla-object bloc))
    (setq StyleVLA (vlax-get-property vlabloc 'StyleName))
    (if	(= StyleVLA MVName)
      (progn
	(setq ListMvb (cons bloc ListMvb))
	(setq c (+ c 1))
      )      
    )
    (setq i (+ i 1))
  )
  (prompt (strcat "\n****Number of MVBLOCK " MVName "=" (itoa c)))
  (print)
 )

Felix.