Visibility parameter inside block editor if present

Visibility parameter inside block editor if present

msarqui
Collaborator Collaborator
1,151 Views
2 Replies
Message 1 of 3

Visibility parameter inside block editor if present

msarqui
Collaborator
Collaborator

Hi guys,

 

I have a simple routine to turn off (BVHIDE) some objects inside the block editor.

My problem is, if the block has no visibility parameter, AutoCAD will give an error. ** No Visibility Parameter Present. **

So, inside the block editor, how can I know if the block has a visibility parameter?

 

Thanks,

Marcelo

0 Likes
Accepted solutions (1)
1,152 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution
(defun c:beditorvisible ()
  (setq visibility nil)
  (setq beditorsecim (STD-SSLIST(ssget "_x")));Select all block entities
  (foreach beditorobje beditorsecim
    (setq beditorobjevla (vlax-ename->vla-object beditorobje));Block entities to vla objects
    (if (= "AcDbBlockVisibilityParameterEntity" (vlax-get-property beditorobjevla 'ObjectName ));if object name is visibility parameter.
      (progn
        (setq visibility "ON")
        (princ "\nThis block contains visibility parameter.")
        );progn
       );if
    );foreach
  );defun


   ;;; Selection Set => ordered list of entities
(defun STD-SSLIST (ss / n lst)
;|#+ STANDALONE nil END #+ STANDALONE|;
;|#- STANDALONE|;
  (if (eq 'PICKSET (type ss))
    (repeat (setq n (fix (sslength ss)))	; fixed
      (setq lst (cons (ssname ss (setq n (1- n))) lst))))
;|END #- STANDALONE|;
)

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

This code only works in block editor. There is other ways to find blocks visibility properties outside block editor.

 

 

 

This could help

 

 

0 Likes
Message 3 of 3

msarqui
Collaborator
Collaborator

Hi zabidinbostan

 

This is pretty cool!

It was exactly what I was looking for.

 

Many thanks,

Marcelo

0 Likes