Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/19/2019 in all areas

  1. Hi, try this one (vl-load-com) (defun c:byBlock (/ col cnt lop sel) ;;;--------------------------------------------------------------------------------------------------------------------- ;;; subroutines ;; remove duplicated items in list (defun LM:unique (l) ; by Lee Mac (if l (cons (car l) (LM:Unique (vl-remove (car l) (cdr l)))))) ;; set "by block" to all entities in block definition (defun BB:setByBlock (nam / blc blk) (setq blc (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))) (setq blk (vla-item blc nam)) (vlax-for x blk (vla-put-layer x "0") (vla-put-color x acByBlock) (vla-put-linetype x "ByBlock") (vla-put-linetypescale x 1.0) (vla-put-lineweight x acLnWtByBlock) (vla-put-entityTransparency x "ByBlock:") (vla-put-material x "ByBlock") (if (eq (vla-get-objectName x) "AcDbBlockReference") (BB:setByBlock (vla-get-effectiveName x)))) ) ;;;--------------------------------------------------------------------------------------------------------------------- ;;; main (setq lop t) (while lop (princ "\nSelect blocks: ") (if (setq sel (ssget '((0 . "INSERT")))) (progn (setq cnt 0) (setq col nil) (repeat (sslength sel) (setq obx (vlax-ename->vla-object (ssname sel cnt))) (setq col (cons (vla-get-effectiveName obx) col)) (setq cnt (1+ cnt))) (setq col (LM:unique col)) (foreach x col (BB:setByBlock x)) (setq lop nil)) (princ "\nNo selection"))) (vla-regen (vla-get-ActiveDocument (vlax-get-acad-object)) acActiveViewport) (princ)) Dynamic blocks don't update and I dont know why. Vla-update doesnť work. Vla-resetBlock works but all dynamic parametres are lost.
    1 point
×
×
  • Create New...