Jump to content

Recommended Posts

Posted

Please I need a code to change the font type of attributes.Can some one help me.

Posted
Why can you not use BEDIT and edit the block attributes.

 

Thanks a lot It works.

Posted

I forget where I got this from, but to do this via a lisp you could change this about:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Changes Block Text (Block Change Text)
;;Changes block text attributes
;;Note this changes the block itself and not just the attributes
(defun c:BlkChTxt (/ InsLst TxtStyl cTxtstyl TxtWidth TxtHeight)
 (setq InsLst (entget (car (entsel "\nPlease choose a Block: "))))
 (while (/= (cdr (assoc 0 InsLst)) "INSERT")
   (setq InsLst (entget (car (entsel "\nWrong, choose a Block: "))))
 )
 (setq TxtStyl ""
   cTxtstyl (getvar "TEXTSTYLE")
 )
 (while (not (tblsearch "STYLE" TxtStyl))
   (initget 1)
   (setq TxtStyl
     (getstring
       (strcat
         "\nNew style name for block text (default is current text style) <"
         cTxtstyl
         ">:"
       )
     )
   )
   (if (= TxtStyl "")
     (setq TxtStyl cTxtstyl)
   )
 )
 (initget 4)
 (setq
   TxtWidth (getreal
   "\nNew text width for block text(0 for no change)<0>: "
   )
 )
 (if (= TxtWidth nil)
   (setq TxtWidth 0)
 )
 (initget 4)
 (setq
   TxtHeight (getreal
   "\nNew text height for block text(0 for no change)<0>: "
   )
 )
 (if (= TxtHeight nil)
   (setq TxtHeight 0)
 )
 ($ChBlkTxt InsLst TxtStyl TxtWidth TxtHeight)
)


(defun $ChBlkTxt (InsLst TxtStyl TxtWidth TxtHeight / x edata)
 (setq
 x (cdr
   (assoc -2 (cdr (tblsearch "BLOCK" (cdr (assoc 2 InsLst)))))
   )
 )
 (while x
   (if x
     (progn (setq edata (entget x))
       (if (or (= (cdr (assoc 0 edata)) "TEXT")
       (= (cdr (assoc 0 edata)) "MTEXT")
       (= (cdr (assoc 0 edata)) "ATTDEF")
     )
     (progn
       (if (/= TxtWidth 0)
         (setq edata (entmod
           (subst (cons 41 TxtWidth)
           (assoc 41 edata)
           edata
         )
       )
     )
   )
            (if (/= TxtHeight 0)
              (setq edata (entmod
                (subst (cons 40 TxtHeight)
                  (assoc 40 edata)
                  edata
                )
              )
            )
          )
            (setq edata (entmod
              (subst (cons 7 TxtStyl)
                (assoc 7 edata)
                edata
              )
            )
          )
        )
      )
   )
 )
   (setq x (entnext x))
 )
 (if (getvar "DIMASSOC")
   (command "_ATTSYNC" "N" (cdr (assoc 2 InsLst)))
   ($attsync (cdr (assoc 2 InsLst)) TxtWidth TxtHeight TxtStyl)
 )
 (command "REGEN")
 (princ)
)

   (defun $attsync (BlkName TxtWidth TxtHeight TxtStyl / ss1 i sh)
     (defun @attsync (sh / edata)
       (if (= (cdr (assoc 0 (entget sh))) "ATTRIB")
         (progn (setq edata (entget sh))
           (if (/= TxtWidth 0)
             (setq edata (entmod
               (subst (cons 41 TxtWidth)
                 (assoc 41 edata)
                 edata
                 )
               )
             )
           )
           (if (/= TxtHeight 0)
             (setq edata (entmod
               (subst (cons 40 TxtHeight)
                 (assoc 40 edata)
                 edata
                 )
               )
             )
           )
           (setq edata (entmod
             (subst (cons 7 TxtStyl)
               (assoc 7 edata)
               edata
             )
           )
         )
       (entupd sh)
       )
     )
   )
   (setq ss1 nil
     ss1 (ssget "X"
       (list '(0 . "INSERT") '(66 . 1) (cons 2 BlkName)
         )
       )
     )
     (setq i 0)
     (repeat (sslength ss1)
       (setq sh (ssname ss1 i))
       (while (/= (cdr (assoc 0 (entget sh))) "SEQEND")
       (@attsync sh)
       (setq sh (entnext sh)
       )
     )
   (setq i (1+ i)
   )
 )
 (princ)
)
;;------------------------------------------------------------;;
;;                         End of File                        ;;
;;------------------------------------------------------------;;

Posted
I forget where I got this from, but to do this via a lisp you could change this about:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Changes Block Text (Block Change Text)
;;Changes block text attributes
;;Note this changes the block itself and not just the attributes
(defun c:BlkChTxt (/ InsLst TxtStyl cTxtstyl TxtWidth TxtHeight)
 (setq InsLst (entget (car (entsel "\nPlease choose a Block: "))))
 (while (/= (cdr (assoc 0 InsLst)) "INSERT")
   (setq InsLst (entget (car (entsel "\nWrong, choose a Block: "))))
 )



 (setq TxtStyl ""
   cTxtstyl (getvar "TEXTSTYLE")
 )
 (while (not (tblsearch "STYLE" TxtStyl))
   (initget 1)
   (setq TxtStyl
     (getstring
       (strcat
         "\nNew style name for block text (default is current text style) <"
         cTxtstyl
         ">:"
       )
     )
   )
   (if (= TxtStyl "")
     (setq TxtStyl cTxtstyl)
   )
 )
 (initget 4)
 (setq
   TxtWidth (getreal
   "\nNew text width for block text(0 for no change)<0>: "
   )
 )
 (if (= TxtWidth nil)
   (setq TxtWidth 0)
 )
 (initget 4)
 (setq
   TxtHeight (getreal
   "\nNew text height for block text(0 for no change)<0>: "
   )
 )
 (if (= TxtHeight nil)
   (setq TxtHeight 0)
 )
 ($ChBlkTxt InsLst TxtStyl TxtWidth TxtHeight)
)


(defun $ChBlkTxt (InsLst TxtStyl TxtWidth TxtHeight / x edata)
 (setq
 x (cdr
   (assoc -2 (cdr (tblsearch "BLOCK" (cdr (assoc 2 InsLst)))))
   )
 )
 (while x
   (if x
     (progn (setq edata (entget x))
       (if (or (= (cdr (assoc 0 edata)) "TEXT")
       (= (cdr (assoc 0 edata)) "MTEXT")
       (= (cdr (assoc 0 edata)) "ATTDEF")
     )
     (progn
       (if (/= TxtWidth 0)
         (setq edata (entmod
           (subst (cons 41 TxtWidth)
           (assoc 41 edata)
           edata
         )
       )
     )
   )
            (if (/= TxtHeight 0)
              (setq edata (entmod
                (subst (cons 40 TxtHeight)
                  (assoc 40 edata)
                  edata
                )
              )
            )
          )
            (setq edata (entmod
              (subst (cons 7 TxtStyl)
                (assoc 7 edata)
                edata
              )
            )
          )
        )
      )
   )
 )
   (setq x (entnext x))
 )
 (if (getvar "DIMASSOC")
   (command "_ATTSYNC" "N" (cdr (assoc 2 InsLst)))
   ($attsync (cdr (assoc 2 InsLst)) TxtWidth TxtHeight TxtStyl)
 )
 (command "REGEN")
 (princ)
)

   (defun $attsync (BlkName TxtWidth TxtHeight TxtStyl / ss1 i sh)
     (defun @attsync (sh / edata)
       (if (= (cdr (assoc 0 (entget sh))) "ATTRIB")
         (progn (setq edata (entget sh))
           (if (/= TxtWidth 0)
             (setq edata (entmod
               (subst (cons 41 TxtWidth)
                 (assoc 41 edata)
                 edata
                 )
               )
             )
           )
           (if (/= TxtHeight 0)
             (setq edata (entmod
               (subst (cons 40 TxtHeight)
                 (assoc 40 edata)
                 edata
                 )
               )
             )
           )
           (setq edata (entmod
             (subst (cons 7 TxtStyl)
               (assoc 7 edata)
               edata
             )
           )
         )
       (entupd sh)
       )
     )
   )
   (setq ss1 nil
     ss1 (ssget "X"
       (list '(0 . "INSERT") '(66 . 1) (cons 2 BlkName)
         )
       )
     )
     (setq i 0)
     (repeat (sslength ss1)
       (setq sh (ssname ss1 i))
       (while (/= (cdr (assoc 0 (entget sh))) "SEQEND")
       (@attsync sh)
       (setq sh (entnext sh)
       )
     )
   (setq i (1+ i)
   )
 )
 (princ)
)
;;------------------------------------------------------------;;
;;                         End of File                        ;;
;;------------------------------------------------------------;;

Thanks a lot mr steval P

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...