Results 1 to 5 of 5

Thread: baby steps in lisp/script attribute visibilty

  1. #1
    Member
    Join Date
    2012-04
    Posts
    11
    Login to Give a bone
    0

    Default baby steps in lisp/script attribute visibilty

    have a very specific function
    on our drawings we have multiple blocks with standard attribute definitions
    information is displayed for internal and client use
    when construction is finished we send a pdf copy of our documents to our clients

    what we want to do is search through all our drawings find the same attributes in each block and make them invisible before pdf creation

    not being a programmer i see the steps as follows

    scan all blocks
    find attribute x
    turn x off

    i can batch scripts or lisp files so the routine only needs to work for an open drawing

    any ideas to help me on my way

  2. #2
    Member
    Join Date
    2015-10
    Posts
    7
    Login to Give a bone
    0

    Unhappy Re: baby steps in lisp/script attribute visibilty

    I could see two ways to do this (though neither require any programming): 1) Put the attributes on their own layer or 2) Make the blocks dynamic with a visibility component (though this could be tedious if you have a large number in each drawing).
    Last edited by mtp-kitebrdr; 2014-03-27 at 01:16 PM.

  3. #3
    100 Club
    Join Date
    2000-11
    Location
    Ontario, Canada
    Posts
    116
    Login to Give a bone
    0

    Default Re: baby steps in lisp/script attribute visibilty

    You might be able to use a variation of the following:

    Code:
    ;; ATTVIS LOCATES ALL BLOCK REFERENCES IN THE ACTIVE LAYOUT WHICH CONTAIN AN
    ;; ATTRIBUTE REFERENCE WITH A PARTICULAR TAG (T_G) STRING, AND SETS SAID
    ;; ATTRIBUTE REFERENCES TO EITHER INVISIBLE (YN = NIL) OR VISIBLE (YN /= NIL)
    ;; -> T_G CAN ALSO BE A LIST OF TAG STRINGS
    (defun attvis (t_g yn / ACTBLK N-ATTLST N-ATTS TG-LST)
      (vl-load-com)
      (setq actblk (vlax-get-property
    		 (vlax-get-property
    		   (vlax-get-property
    		     (vlax-get-acad-object)
    		     'activedocument
    		     ); vlax-get-property
    		   'activelayout
    		   ); vlax-get-property
    		 'block
    		 ); vlax-get-property
    	tg-lst (cond ((= 'STR (type t_g)) (list (strcase t_g))); single string
    		     ((and (listp t_g)
    			   (< 0 (length t_g))
    			   (not (vl-member-if-not
    				  '(lambda (a)
    				     (= 'STR (type a))
    				     ); lambda
    				  t_g
    				  ); vl-member-if-not
    				); not
    			   ); and
    		      (mapcar 'strcase t_g)
    		      ); list of strings
    		     (t nil)
    		     ); cond
    	); setq
      (if tg-lst
        (progn
          (vlax-for n actblk
    	(if
    	  (and
    	    (= "AcDbBlockReference" (vlax-get-property n 'objectname))
    	    (= 'safearray (type (setq n-atts (vlax-variant-value (vla-getattributes n)))))
    	    (< 0 (vlax-safearray-get-u-bound n-atts 1))
    	    (< 0 (length (setq n-attlst (vlax-safearray->list n-atts))))
    	    ); and
    	  (foreach x n-attlst
    	    (if (member (strcase (vlax-get-property x 'tagstring)) tg-lst)
    	      (vlax-put-property x 'visible (if yn :vlax-true :vlax-false))
    	  ); if
    	); foreach
          ); if
        ); vlax-for
          ); progn
        (prompt "\nInvalid Data ")
        ); if
      (princ)
      ); defun

  4. #4
    Member
    Join Date
    2012-04
    Posts
    11
    Login to Give a bone
    0

    Default Re: baby steps in lisp/script attribute visibilty

    the dynamic block thing is not going to work quite simply we have at least 10,000 blocks we use and anything up to 400 blocks on certain drawings the man hours involved in setting up that system is frightening

    good idea though keep posting messages

  5. #5
    Member
    Join Date
    2012-04
    Posts
    11
    Login to Give a bone
    0

    Default Re: baby steps in lisp/script attribute visibilty

    ill try this later today im under pressure to get something sorted today i will post my results later

Similar Threads

  1. Lisp routine to show visibilty splays
    By earld in forum AutoLISP
    Replies: 12
    Last Post: 2022-05-06, 07:02 AM
  2. Controlling Visibilty States With Lisp
    By sovby254640 in forum AutoLISP
    Replies: 6
    Last Post: 2013-08-06, 12:16 PM
  3. How can i use Visibilty States in a Lisp?
    By ReachAndre in forum AutoLISP
    Replies: 13
    Last Post: 2009-08-14, 02:27 AM
  4. script/lisp: read attribute value
    By David van Erk in forum AutoLISP
    Replies: 4
    Last Post: 2006-08-10, 05:02 PM
  5. Having trouble with toggeling Attribute visibilty
    By T_Livingston in forum VBA/COM Interop
    Replies: 3
    Last Post: 2005-11-18, 02:17 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •