Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Gatte2 in dyinamic blocs

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
msarqui
921 Views, 6 Replies

Gatte2 in dyinamic blocs

Hi guys,

 

I'm looking for a way to adapt the GATTE2 code to accept dynamic blocks.

I did a search and found several posts about it, but all unsolved.

http://www.theswamp.org/index.php?topic=37602.msg426157#msg426157

http://www.cadtutor.net/forum/showthread.php?93037-gatte-for-use-on-dynamic-blocks

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/gatte-command-for-dyanmic-block/td-p/...

http://www.cadtutor.net/forum/showthread.php?44232-Gatte-for-Db-S

 

and the closest solution (in my opinion)

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-atribute/td-p/3387047/...

 

I can not give up. So I'll ask... Someone could please change the GATTE2 code to also work with dynamic blocks?

I found the code here: http://www.cadtutor.net/forum/showthread.php?50268-GATTE2-%28Global-Attribute-Edit-with-Layout-Selec...

 

;|											;;
	GATTE2: By Steve K (Date 10/2009)						;;
	v1.0	Initial Release								;;
	v1.01	Minor amendments (nothing externally noticable)				;;
	v1.02	Localised variables & Working again..					;;
											;;
	Description: 	A drawback of the standard GATTE command is that the user	;;
			can not chose which layouts to replace text on (it will		;;
			overwrite the text on every layout). 				;;
			GATTE2 gives the user the option to select which layouts	;;
			to apply the attribute change to.				;;
											|;
											;;
(defun c:gatte2(/ *error* en obj doc tag atts attstr txtstr tablst laystr count
		blkObj blkName sel)
  (vl-load-com)

  ; Error Handler (Lee Mac's)							;
  (defun *error* (err)
    (if doc (vla-EndUndoMark doc))
    (if (not (wcmatch (strcase err) "*BREAK,*CANCEL*,*EXIT*"))
      (princ (strcat "\n** Error: " err " **")))
    (princ))

  ; Get Layout Name Function							;
  ; @param	An object.							;
  ; @return	Layout Name object is on.					;
  (defun getlayout (Obj)
    (vla-get-Name
      (vla-get-layout
	(vla-objectidtoobject
	  (vla-get-ActiveDocument
	    (vlax-get-acad-object))
	  (vla-get-ownerid Obj)))))

  ; Main Process								;
  (Cond ((not (setq en (nentsel)))
	 (princ "\nNothing Selected."))
	((and (not (= (length en) 4))
	      (not (eq (cdr (assoc 0 (entget (setq en (car en))))) "ATTRIB")))
	 (princ "\nEntity not an Attribute or Block."))
	((if (listp en)
	   (progn
	     (setq blkObj (vlax-ename->vla-object (car (nth 3 en))))
	     (if (setq atts (vlax-invoke blkObj 'getAttributes))
	       (progn
		 (foreach att atts
		   (if attstr
		     (setq attstr (strcat attstr " " (vla-get-tagstring att)))
		     (setq attstr (vla-get-tagstring att))))
		 (while (not (member (setq tag (strcase (getstring (strcat
								     "\nKnown tag names for block: " attstr
								     "\nEnter an attribute name: "))))
				     (mapcar 'vla-get-tagstring atts)))
		   (princ "Entry not an Attribute.")
		   )
		 (setq obj (nth (vl-position tag (mapcar 'vla-get-tagstring atts)) atts))
		 nil
		 )
	       T
	       )
	     )
	     (not (setq obj (vlax-ename->vla-object en)))
	   )
	 (princ "\nNo Tags Exist.")
	 )
	((not (setq tablst (GetTabList)))
	 (princ "\nNo Tabs Selected."))
	( T; Else Proceed
	 (setq count 0
	       doc (vla-get-activedocument (vlax-get-acad-object))
	       blkName (vla-get-name
			 (vla-ObjectIdtoObject doc
			   (vla-get-OwnerId Obj))))
	 (princ (strcat "\nBlock Name: " blkName " \tAttribute tag: " (vla-get-tagstring obj)))
	 (vla-StartUndoMark doc)
	 (setq txtstr (getstring T "\nEnter new Text String: "))
	 (setq laystr (car tablst))
	 (foreach lay (cdr tablst)
	   (setq laystr (strcat laystr (chr 44) lay))
	   )
	 (if (ssget "_X" (list (cons 0 "insert") (cons 2 blkName) (cons 410 laystr) (cons 67 1)))
	   (progn
	     (princ (strcat "\nThe following attributes were changed to \"" txtstr "\".."))
	     (vlax-for bl (setq sel (vla-get-activeselectionset doc))
	       (foreach att (vlax-invoke bl 'getAttributes)
		 (if (eq (vla-get-tagstring att) (vla-get-tagstring obj))
		   (progn
		     (setq count (1+ count))
		     (princ (strcat "\nLayout: " (getlayout bl) "\tOld Text: " (if (eq (vla-get-textstring att) "")
										 "*empty*" (vla-get-textstring att))))
		     (vla-put-textstring att txtstr))
		   )
		 )
	       )
	     (vla-delete sel)
	     (princ (strcat "\nModified " (itoa count) " attributes total.\n"))
	     (vla-EndUndoMark doc)
	     )(princ "\nNo Blocks Found."))
	 ))
  (princ)
  )
											;;
;|									End: GATTE2	;;
											|;


;; CAB's Get Layouts Program								;;
											;;
(defun GetTabList (/ dclfile dcl# layouts ptr tablist)
  (setq dclfile "LayoutSelect.dcl")
  (cond
    ((< (setq dcl# (load_dialog dclfile)) 0) ; Error 
     (prompt (strcat "\nCannot load " dclfile "."))
    )
    ((not (new_dialog "layoutselect" dcl#)) ; Error 
     (prompt (strcat "\nProblem with " dclfile "."))
    )
    (t ; No DCL problems: fire it up 
     (setq layouts (orderedLayoutList))
     (start_list "layouts")
     (foreach one layouts
       (add_list one)
     )
     (end_list)
    (action_tile "layouts" "(setq ptr $value)")
    (action_tile "ok" "(done_dialog 5)")
    (action_tile "cancel" "(done_dialog 1)")
     (setq action (start_dialog))
     (unload_dialog dcl#)
     (if (and ptr (= action 5)) ;  get the list of selections to list of numbers
       (setq ptr     (read (strcat "(" ptr ")"))
             tablist (mapcar '(lambda (x) (nth x layouts)) ptr))
     )
    ) ; end cond T
  ) ; end cond
  tablist
)
											;;
;;											;;


;; 	OrderedLayoutList:	Similar to (layoutlist) except returns list that is	;;
;;				ordered by current tab order (not alphabetically)	;;
											;;
(defun orderedLayoutList (/ laylst)
  (vl-load-com)
  (vlax-for lay (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
    (setq laylst (cons lay laylst))
    )
  (cdr (mapcar 'vla-get-name (vl-sort laylst
				      (function
					(lambda (a b)
					  (< (vla-get-taborder a)(vla-get-taborder b))
					  )))))
  )
											;;
;;											;;

LayoutSelect.DCL

 

layoutselect : dialog { label = "   Layout Selector by CAB v1.0";
   : boxed_row { label = "< Tabs >";
      :list_box { key  = "layouts"; height = 15 ; width = 30 ;
        fixed_width = true; multiple_select = true; alignment = centered ;
      }
    } 
    : row {
     : button { key = "ok" ; label = "OK" ; fixed_width = true ;} 
     : cancel_button {}
   }
}

Many thanks!

Marcelo

6 REPLIES 6
Message 2 of 7
marko_ribar
in reply to: msarqui

Marcelo, I've modified your code and not quite sure if it's 100% OK, but it worked for me on my example DWG...

 

;|											;;
	GATTE2: By Steve K (Date 10/2009)						;;
	v1.0	Initial Release								;;
	v1.01	Minor amendments (nothing externally noticable)				;;
	v1.02	Localised variables & Working again..					;;
											;;
	Description: 	A drawback of the standard GATTE command is that the user	;;
			can not chose which layouts to replace text on (it will		;;
			overwrite the text on every layout). 				;;
			GATTE2 gives the user the option to select which layouts	;;
			to apply the attribute change to.				;;
											|;
;;
(defun c:gatte2 ( /       *error* en      obj     doc     tag
                  atts    attstr  txtstr  tablst  laystr  count
                  blkobj  blkname sel
                )
  (vl-load-com)

                                        ; Error Handler (MR's)							;
  (defun *error* ( err )
    (if doc
      (vla-endundomark doc)
    )
    (if err
      (prompt err)
    )
    (princ)
  )

                                        ; Get Layout Name Function							;
                                        ; @param	An object.							;
                                        ; @return	Layout Name object is on.					;
  (defun getlayout ( Obj )
    (vla-get-name
      (vla-get-layout
        (vla-objectidtoobject
          (vla-get-activedocument
            (vlax-get-acad-object)
          )
          (vla-get-ownerid Obj)
        )
      )
    )
  )

                                        ; Main Process								;
  (cond
    ((not (setq en (nentsel)))
     (princ "\nNothing Selected.")
    )
    ((and (not (= (length en) 4))
          (not
            (eq (cdr (assoc 0 (entget (setq en (car en))))) "ATTRIB")
          )
     )
     (princ "\nEntity not an Attribute or Block.")
    )
    ((if (listp en)
       (progn
         (setq blkobj (vlax-ename->vla-object (car (nth 3 en))))
         (if (setq atts (vlax-invoke blkobj 'getAttributes))
           (progn
             (foreach att atts
               (if attstr
                 (setq
                   attstr (strcat attstr " " (vla-get-tagstring att))
                 )
                 (setq attstr (vla-get-tagstring att))
               )
             )
             (while (not (member (setq tag
                                        (strcase
                                          (getstring (strcat
                                                       "\nKnown tag names for block: "
                                                       attstr
                                                       "\nEnter an attribute name: "
                                                     )
                                          )
                                        )
                                 )
                                 (mapcar 'vla-get-tagstring atts)
                         )
                    )
               (princ "Entry not an Attribute.")
             )
             (setq obj
                    (nth
                      (vl-position tag (mapcar 'vla-get-tagstring atts))
                      atts
                    )
             )
             nil
           )
           T
         )
       )
       (not (setq obj (vlax-ename->vla-object en)))
     )
     (princ "\nNo Tags Exist.")
    )
    ((not (setq tablst (gettablist)))
     (princ "\nNo Tabs Selected.")
    )
    (T                                  ; Else Proceed
     (setq count   0
           doc     (vla-get-activedocument (vlax-get-acad-object))
           blkname (vla-get-effectivename
                     (vla-objectidtoobject
                       doc
                       (vla-get-ownerid obj)
                     )
                   )
     )
     (princ (strcat "\nBlock Name: "
                    blkname
                    " \tAttribute tag: "
                    (vla-get-tagstring obj)
            )
     )
     (vla-startundomark doc)
     (setq txtstr (getstring T "\nEnter new Text String: "))
     (setq laystr (car tablst))
     (foreach lay (cdr tablst)
       (setq laystr (strcat laystr (chr 44) lay))
     )
     (cond 
       ( (ssget "_A"
                (list (cons 0 "INSERT")
                      (cons 2 blkname)
                      (cons 410 laystr)
                )
         )
         (princ
           (strcat "\nThe following attributes were changed to \""
                   txtstr
                   "\".."
           )
         )
         (vlax-for bl (setq sel (vla-get-activeselectionset doc))
           (foreach att (vlax-invoke bl 'getattributes)
             (if (eq (vla-get-tagstring att) (vla-get-tagstring obj))
               (progn
                 (setq count (1+ count))
                 (princ (strcat "\nLayout: "
                                (getlayout bl)
                                "\tOld Text: "
                                (if (eq (vla-get-textstring att) "")
                                  "*empty*"
                                  (vla-get-textstring att)
                                )
                        )
                 )
                 (vla-put-textstring att txtstr)
               )
             )
           )
         )
         (vla-delete sel)
         (princ
           (strcat "\nModified " (itoa count) " attributes total.\n")
         )
       )
       ( (ssget "_A"
                (list (cons 0 "INSERT")
                      (cons 410 laystr)
                )
         )
         (princ
           (strcat "\nThe following attributes were changed to \""
                   txtstr
                   "\".."
           )
         )
         (vlax-for bl (setq sel (vla-get-activeselectionset doc))
           (if (eq blkname (vla-get-effectivename bl))
             (foreach att (vlax-invoke bl 'getattributes)
               (if (eq (vla-get-tagstring att) (vla-get-tagstring obj))
                 (progn
                   (setq count (1+ count))
                   (princ (strcat "\nLayout: "
                                  (getlayout bl)
                                  "\tOld Text: "
                                  (if (eq (vla-get-textstring att) "")
                                    "*empty*"
                                    (vla-get-textstring att)
                                  )
                          )
                   )
                   (vla-put-textstring att txtstr)
                 )
               )
             )
           )
         )
         (vla-delete sel)
         (princ
           (strcat "\nModified " (itoa count) " attributes total.\n")
         )
       )
       ( t (princ "\nNo Blocks Found.") )
     )
    )
  )
  (*error* nil)
)
;;
;|									End: GATTE2	;;
											|;


;; CAB's Get Layouts Program								;;
;;
(defun gettablist ( / dclfile fn dcl# layouts ptr tablist )
                                        ;(setq dclfile "LayoutSelect.dcl")
  (setq dclfile (vl-filename-mktemp nil nil ".dcl"))
  (setq fn (open dclfile "w"))
  (write-line
    "layoutselect : dialog { label = \"   Layout Selector by CAB v1.0\";"
    fn
  )
  (write-line "   : boxed_row { label = \"< Tabs >\";" fn)
  (write-line
    "      :list_box { key  = \"layouts\"; height = 15 ; width = 30 ;"
    fn
  )
  (write-line
    "        fixed_width = true; multiple_select = true; alignment = centered ;"
    fn
  )
  (write-line "      }" fn)
  (write-line "    } " fn)
  (write-line "    : row {" fn)
  (write-line
    "     : button { key = \"ok\" ; label = \"OK\" ; fixed_width = true ;} "
    fn
  )
  (write-line "     : cancel_button {}" fn)
  (write-line "   }" fn)
  (write-line "}" fn)
  (close fn)
  (cond
    ((< (setq dcl# (load_dialog dclfile)) 0) ; Error 
     (prompt (strcat "\nCannot load " dclfile "."))
    )
    ((not (new_dialog "layoutselect" dcl#)) ; Error 
     (prompt (strcat "\nProblem with " dclfile "."))
    )
    (t                                  ; No DCL problems: fire it up 
     (setq layouts (orderedLayoutList))
     (start_list "layouts")
     (foreach one layouts
       (add_list one)
     )
     (end_list)
     (action_tile "layouts" "(setq ptr $value)")
     (action_tile "ok" "(done_dialog 5)")
     (action_tile "cancel" "(done_dialog 1)")
     (setq action (start_dialog))
     (unload_dialog dcl#)
     (vl-file-delete dclfile)
     (if (and ptr (= action 5))         ;  get the list of selections to list of numbers
       (setq ptr     (read (strcat "(" ptr ")"))
             tablist (mapcar '(lambda (x) (nth x layouts)) ptr)
       )
     )
    )                                   ; end cond T
  )                                     ; end cond
  tablist
)
;;
;;											;;


;; 	OrderedLayoutList:	Similar to (layoutlist) except returns list that is	;;
;;				ordered by current tab order (not alphabetically)	;;
;;
(defun orderedlayoutlist ( / laylst )
  (vl-load-com)
  (vlax-for lay (vla-get-layouts
                  (vla-get-activedocument (vlax-get-acad-object))
                )
    (setq laylst (cons lay laylst))
  )
  (mapcar 'vla-get-name
          (vl-sort laylst
                   (function
                     (lambda (a b)
                       (< (vla-get-taborder a) (vla-get-taborder b))
                     )
                   )
          )
  )
)
;;
;;

Regards,

HTH, M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 3 of 7
marko_ribar
in reply to: marko_ribar

There were some mistakes (lascks) in my previously posted code... Please, verify this one...

 

;|											;;
	GATTE2: By Steve K (Date 10/2009)						;;
	v1.0	Initial Release								;;
	v1.01	Minor amendments (nothing externally noticable)				;;
	v1.02	Localised variables & Working again..					;;
											;;
	Description: 	A drawback of the standard GATTE command is that the user	;;
			can not chose which layouts to replace text on (it will		;;
			overwrite the text on every layout). 				;;
			GATTE2 gives the user the option to select which layouts	;;
			to apply the attribute change to.				;;
											|;
;;
(defun c:gatte2 ( /       *error* en      obj     doc     tag
                  atts    attstr  txtstr  tablst  laystr  count
                  blkobj  blkname sel
                )
  (vl-load-com)

  ; Error Handler (MR's)							;
  (defun *error* ( err )
    (if doc
      (vla-endundomark doc)
    )
    (if err
      (prompt err)
    )
    (princ)
  )

  ; Get Layout Name Function							;
  ; @param	An object.							;
  ; @return	Layout Name object is on.					;
  (defun getlayout ( obj )
    (vla-get-name
      (vla-get-layout
        (vla-objectidtoobject
          (vla-get-activedocument
            (vlax-get-acad-object)
          )
          (vla-get-ownerid obj)
        )
      )
    )
  )

  ; Main Process								;
  (cond
    ((not (setq en (nentsel)))
     (princ "\nNothing Selected.")
    )
    ((and (not (= (length en) 4))
          (not
            (eq (cdr (assoc 0 (entget (setq en (car en))))) "ATTRIB")
          )
     )
     (princ "\nEntity not an Attribute or Block.")
    )
    ((if (listp en)
       (progn
         (setq blkobj (vlax-ename->vla-object (car (nth 3 en))))
         (if (and (not (vl-catch-all-error-p
                         (setq atts (vl-catch-all-apply
                                      'vlax-invoke
                                      (list blkobj 'getattributes)
                                    )
                         )
                       )
                  )
                  atts
             )
           (progn
             (foreach att atts
               (if attstr
                 (setq
                   attstr (strcat attstr " " (vla-get-tagstring att))
                 )
                 (setq attstr (vla-get-tagstring att))
               )
             )
             (while (not (member (setq tag
                                        (strcase
                                          (getstring (strcat
                                                       "\nKnown tag names for block: "
                                                       attstr
                                                       "\nEnter an attribute name: "
                                                     )
                                          )
                                        )
                                 )
                                 (mapcar 'vla-get-tagstring atts)
                         )
                    )
               (princ "Entry not an Attribute.")
             )
             (setq obj
                    (nth
                      (vl-position tag (mapcar 'vla-get-tagstring atts))
                      atts
                    )
             )
             nil
           )
           T
         )
       )
       (not (setq obj (vlax-ename->vla-object en)))
     )
     (princ "\nNo Tags Exist.")
    )
    ((not (setq tablst (gettablist)))
     (princ "\nNo Tabs Selected.")
    )
    (T ; Else Proceed
     (setq count   0
           doc     (vla-get-activedocument (vlax-get-acad-object))
           blkname (vla-get-effectivename
                     (vla-objectidtoobject
                       doc
                       (vla-get-ownerid obj)
                     )
                   )
     )
     (princ (strcat "\nBlock Name: "
                    blkname
                    " \tAttribute tag: "
                    (vla-get-tagstring obj)
            )
     )
     (vla-startundomark doc)
     (setq txtstr (getstring T "\nEnter new Text String: "))
     (setq laystr (car tablst))
     (foreach lay (cdr tablst)
       (setq laystr (strcat laystr (chr 44) lay))
     )
     (cond
       ((ssget "_A"
               (list (cons 0 "INSERT")
                     (cons 2 blkname)
                     (cons 410 laystr)
               )
        )
        (princ
          (strcat "\nThe following attributes were changed to \""
                  txtstr
                  "\".."
          )
        )
        (vlax-for bl (setq sel (vla-get-activeselectionset doc))
          (foreach att (vlax-invoke bl 'getattributes)
            (if (eq (vla-get-tagstring att) (vla-get-tagstring obj))
              (progn
                (setq count (1+ count))
                (princ (strcat "\nLayout: "
                               (getlayout bl)
                               "\tOld Text: "
                               (if (eq (vla-get-textstring att) "")
                                 "*empty*"
                                 (vla-get-textstring att)
                               )
                       )
                )
                (vla-put-textstring att txtstr)
              )
            )
          )
        )
        (vla-delete sel)
        (princ
          (strcat "\nModified " (itoa count) " attributes total.\n")
        )
       )
       ((if
          (ssget "_A"
                 (list (cons 0 "INSERT")
                       (cons 2 "`**")
                       (cons 410 laystr)
                 )
          )
           (vl-position
             blkname
             (mapcar 'vla-get-effectivename
                     (mapcar 'vlax-ename->vla-object
                             (vl-remove-if
                               'listp
                               (mapcar 'cadr
                                       (ssnamex
                                         (ssget "_P")
                                       )
                               )
                             )
                     )
             )
           )
        )
        (princ
          (strcat "\nThe following attributes were changed to \""
                  txtstr
                  "\".."
          )
        )
        (vlax-for bl (setq sel (vla-get-activeselectionset doc))
          (if (eq blkname (vla-get-effectivename bl))
            (foreach att (vlax-invoke bl 'getattributes)
              (if (eq (vla-get-tagstring att) (vla-get-tagstring obj))
                (progn
                  (setq count (1+ count))
                  (princ (strcat "\nLayout: "
                                 (getlayout bl)
                                 "\tOld Text: "
                                 (if (eq (vla-get-textstring att) "")
                                   "*empty*"
                                   (vla-get-textstring att)
                                 )
                         )
                  )
                  (vla-put-textstring att txtstr)
                )
              )
            )
          )
        )
        (vla-delete sel)
        (princ
          (strcat "\nModified " (itoa count) " attributes total.\n")
        )
       )
       (t (princ "\nNo Blocks Found."))
     )
    )
  )
  (*error* nil)
)
;;
;|									End: GATTE2	;;
											|;


;; CAB's Get Layouts Program								;;
;;
(defun gettablist ( / dclfile fn dcl# layouts ptr tablist )
  ;(setq dclfile "LayoutSelect.dcl")
  (setq dclfile (vl-filename-mktemp nil nil ".dcl"))
  (setq fn (open dclfile "w"))
  (write-line
    "layoutselect : dialog { label = \"   Layout Selector by CAB v1.0\";"
    fn
  )
  (write-line "   : boxed_row { label = \"< Tabs >\";" fn)
  (write-line
    "      :list_box { key  = \"layouts\"; height = 15 ; width = 30 ;"
    fn
  )
  (write-line
    "        fixed_width = true; multiple_select = true; alignment = centered ;"
    fn
  )
  (write-line "      }" fn)
  (write-line "    } " fn)
  (write-line "    : row {" fn)
  (write-line
    "     : button { key = \"ok\" ; label = \"OK\" ; fixed_width = true ;} "
    fn
  )
  (write-line "     : cancel_button {}" fn)
  (write-line "   }" fn)
  (write-line "}" fn)
  (close fn)
  (cond
    ((< (setq dcl# (load_dialog dclfile)) 0) ; Error 
     (prompt (strcat "\nCannot load " dclfile "."))
    )
    ((not (new_dialog "layoutselect" dcl#)) ; Error 
     (prompt (strcat "\nProblem with " dclfile "."))
    )
    (t ; No DCL problems: fire it up 
     (setq layouts (orderedLayoutList))
     (start_list "layouts")
     (foreach one layouts
       (add_list one)
     )
     (end_list)
     (action_tile "layouts" "(setq ptr $value)")
     (action_tile "ok" "(done_dialog 5)")
     (action_tile "cancel" "(done_dialog 1)")
     (setq action (start_dialog))
     (unload_dialog dcl#)
     (vl-file-delete dclfile)
     (if (and ptr (= action 5))
  ;  get the list of selections to list of numbers
       (setq ptr     (read (strcat "(" ptr ")"))
             tablist (mapcar '(lambda (x) (nth x layouts)) ptr)
       )
     )
    ) ; end cond T
  ) ; end cond
  tablist
)
;;
;;											;;


;; 	OrderedLayoutList:	Similar to (layoutlist) except returns list that is	;;
;;				ordered by current tab order (not alphabetically)	;;
;;
(defun orderedlayoutlist ( / laylst )
  (vl-load-com)
  (vlax-for lay (vla-get-layouts
                  (vla-get-activedocument (vlax-get-acad-object))
                )
    (setq laylst (cons lay laylst))
  )
  (mapcar 'vla-get-name
          (vl-sort laylst
                   (function
                     (lambda (a b)
                       (< (vla-get-taborder a) (vla-get-taborder b))
                     )
                   )
          )
  )
)
;;
;;

Sorry for my inconveniences...

Hope that now should be fine...

Regards, M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 4 of 7
msarqui
in reply to: marko_ribar

Hello Marco
I'll do some tests and I will feedback you soon.
Thank you
Marcelo
Message 5 of 7
msarqui
in reply to: marko_ribar

It is working for me.
Thank you Marko!
Message 6 of 7
rapidcad
in reply to: msarqui

So, I'm testing a little bit here - are you sure it works on invisible attributes? - mine fail, says "Entry not an Attribute"...

 

example.JPG

ADN CAD Developer/Operator
Message 7 of 7
peesemte
in reply to: msarqui

Apologies for necroing this post but it is the closest solution to what I'd like to achieve.

Sooooooooooo:

 

-I would like to autonumber block attribute ''ZONE''.

-I am using various blocks (different shapes and sizes) and they all have ''ZONE'' attribute in them.

-So far I have tested a number of lisps, including Lee Mac's solutions.

 

Why nothing worked so far?

-Seems like all the lisps work only on one kind of block at the time so when I batch select different blocks it only works on one kind and ignores the rest.

-I have tested this GATTE2 and it does all of them at once only it doesn't sequence them

-this leads me to believe that perhaps I was working on normal and dynamic blocks without knowing it and this is what caused other lisps to fail.

 

So here is my question: 

 

Can we adapt above GATTE2 to not only override an attributes but also do so in a sequence?

Ideally after I plan and place my blocks (other lisps usually sequence while placing blocks one at the time and I work on big floor plans so it is obviously better to have ability to renumber blocks once plans are approved)

 

Many thanks to anyone willing to take a swing at this oldie but goodie and best regards to all of you who contributed so far.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta