TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: kruuger on March 10, 2014, 06:49:37 AM

Title: "Numbering" attributes on layouts: 1 of 5, 2 of 5, 3 of 5...
Post by: kruuger on March 10, 2014, 06:49:37 AM
hello
small tool for "numbering" block attributes. maybe someone find in usefull.
find attached sample dwg for tests.
Code: [Select]

(defun _Main (BlockName Tag1 Separator Tag2 Custom / lay tot ss)
  (setq lay (cdr (cd:DWG_LayoutsList))
        tot (itoa (length lay))
  )
  (cd:SYS_UndoBegin)
  (foreach % lay
    (if
      (setq ss     
        (ssget "_X"
          (append
           '((0 . "INSERT"))
            (list
              (cons 2 (strcase BlockName))
              (cons 410 (car %))
            )
          )
        )
      )
      (if Tag2
        (progn
          (cd:BLK_SetAttValueVLA (ssname ss 0) Tag1
            (if Custom Custom (itoa (cadr %)))
          )
          (cd:BLK_SetAttValueVLA (ssname ss 0) Tag2 tot)
        )
        (cd:BLK_SetAttValueVLA (ssname ss 0) Tag1
          (if Custom
            (strcat Custom Separator tot)
            (strcat (itoa (cadr %)) Separator tot)
          )
        )
      )
    )
  )
  (cd:SYS_UndoEnd)
  (princ (strcat "\nUpdated " tot " title borders "))
  (princ)
)

(_Main "BL1" "DRAWING_NUMBER" " of " nil nil)
(_Main "BL1" "DRAWING_NUMBER" " of " nil "%<\\AcVar ctab>%")
(_Main "BL1" "DRAWING_NUMBER" " - "  nil nil)
(_Main "BL1" "DRAWING_NUMBER" "/"    nil nil)


(_Main "BL2" "DRAWING_NUMBER" nil "TOTAL" nil)
(_Main "BL2" "DRAWING_NUMBER" nil "TOTAL" "%<\\AcVar ctab>%")

any improvements/suggestions/other situation to consider are welcome

kruuger
Title: Re: "Numbering" attributes on layouts: 1 of 5, 2 of 5, 3 of 5...
Post by: Bhull1985 on March 10, 2014, 09:11:00 AM
Wow nice pack Kruuger, thanks a lot.
I've taken the time this morning to clean it up for English-speaking persons, attached to this post is a re-formatted English version only of the same function library you've posted.
Easier to read for me, means easier to use....maybe others will find this to be the case as well
Title: Re: "Numbering" attributes on layouts: 1 of 5, 2 of 5, 3 of 5...
Post by: kruuger on March 10, 2014, 10:48:06 AM
Wow nice pack Kruuger, thanks a lot.
I've taken the time this morning to clean it up for English-speaking persons, attached to this post is a re-formatted English version only of the same function library you've posted.
Easier to read for me, means easier to use....maybe others will find this to be the case as well
thanks. it is a community work.
http://forum.cad.pl/cadpl-pack-v1-lsp-t78158.html?hilit=CADPACK%20DYSKUSJA
k.