Как в автокаде изменить высоту букв в атрибуте нескольких блоков одновременно
| Правила | Регистрация | Пользователи | Сообщения за день |  Справка по форуму | Файлообменник |

Вернуться   Форум DWG.RU > Программное обеспечение > AutoCAD > Как в автокаде изменить высоту букв в атрибуте нескольких блоков одновременно

Как в автокаде изменить высоту букв в атрибуте нескольких блоков одновременно

Ответ
Поиск в этой теме
Непрочитано 03.02.2020, 12:39 #1
Как в автокаде изменить высоту букв в атрибуте нескольких блоков одновременно
Kavalergrad
 
Москва
Регистрация: 21.11.2014
Сообщений: 60

Расскажите, пожалуйста, как, в Автокаде ,изменить высоту букв атрибута в нескольких блоках одновременно. Есть чертеж в котором порядка десятка видов блоков с атрибутами. А вот блоков одного вида на чертеже от 10 шт. до 43 шт. Основной атрибут - обозначение типа ВТН1.23. Чертеж создавался под масштаб 1:100, однако при распечатке пришлось поменять масштаб на 1:200. В результате обозначения на чертеже стали мелкими и нечитаемыми. Попытка редактирования высоты текста через редактор атрибутов блока ничего не дает. В редакторе высота текста изменяется, а на чертеже нет. Редактировать поодиночке каждый блок в таком объеме в ручную - смерти подобно...
Просмотров: 4495
 
Непрочитано 03.02.2020, 13:01
#2
kp+

идущий по граблям
 
Регистрация: 26.05.2005
Сообщений: 5,170


Цитата:
Сообщение от Kavalergrad Посмотреть сообщение
Попытка редактирования высоты текста через редактор атрибутов блока ничего не дает
Дустом _attsync не пробовали?
Еще рекомендуется к просмотру вот эта тема: https://forum.dwg.ru/showthread.php?t=8497
kp+ вне форума  
 
Непрочитано 03.02.2020, 13:54
#3
Nike

Шаражпроектхалтурмонтаж
 
Регистрация: 29.10.2004
Талды-Париж
Сообщений: 6,010


Код:
[Выделить все]
 
; сжатие 
(defun c:wa () (c:wAtt)) 
(defun c:цф () (c:wAtt))

; высота
(defun c:ha () (c:hAtt))
(defun c:рф () (c:hAtt))

; поворот
(defun c:ra () (c:roAtt))
(defun c:кф () (c:roAtt))

; значение
(defun c:ea () (c:edAtt))
(defun c:уф () (c:edAtt))

; смещение
(defun c:ma () (c:mvAtt))
(defun c:ьф () (c:mvAtt))


;;-----------------=={ Move Attributes }==--------------------;;
;;                                                            ;;
;;  Prompts user for a selection of attribute tag and         ;;
;;  selection of blocks containing such tag for which the     ;;
;;  change will be applied.                                   ;;
;;                                                            ;;
;;  Subsequently prompts user for a base point and            ;;
;;  displacement and proceeds to move all attributes of the   ;;
;;  selected tag within the selected blocks.                  ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;

; mvAtt roAtt edAtt

(defun c:mvAtt ( / *error* doc asel base disp lck ss tag )
  (vl-load-com)
  ;; © Lee Mac 2010

  

  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))

  (if
    (and
      (setq asel (LM:GetAttribSelection doc t))    
      (setq base (getpoint "\nSpecify Base Point: "))
      (setq disp (getpoint "\nSpecify Second Point: " base))
      (setq base (vlax-3D-point (trans base 1 0))
            disp (vlax-3D-point (trans disp 1 0))
      )        
    )              
    (progn
      (LM:StartUndo doc)

      (setq lck (LM:UnlockLayers doc) ss (cadr asel) tag (caddr asel))

      (
        (lambda ( i / e o )
          (while (setq e (ssname ss (setq i (1+ i))))
            (mapcar
              (function
                (lambda ( attrib )
                  (if (eq tag (vla-get-TagString attrib))
                    (vla-move attrib base disp)
                  )
                )
              )
              (append
                (vlax-invoke (setq o (vlax-ename->vla-object e)) 'GetAttributes)
                (vlax-invoke o 'GetConstantAttributes)
              )
            )
          )
        )
        -1
      )
      (LM:ReLockLayers lck)

      (LM:EndUndo doc)
    )
  )

  (princ)
)

;;-----------------=={ Rotate Attributes }==------------------;;
;;                                                            ;;
;;  Prompts user for a selection of attribute tag and         ;;
;;  selection of blocks containing such tag for which the     ;;
;;  change will be applied.                                   ;;
;;                                                            ;;
;;  Subsequently prompts user for a rotation angle and        ;;
;;  proceeds to set the rotation of all attributes of the     ;;
;;  selected tag within the selected blocks to the specified  ;;
;;  angle.                                                    ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;

(defun c:roAtt ( / *error* doc asel base disp lck ss tag )
  (vl-load-com)
  ;; © Lee Mac 2010

  (defun *error* ( msg )
    
    (if doc (LM:EndUndo doc))
    (if lck (LM:ReLockLayers lck))

    (if mutt (setvar 'NOMUTT mutt))
    
    (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
        (princ (strcat "\n** Error: " msg " **")))
    (princ)
  )

  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))

  (if
    (and
      (setq asel (LM:GetAttribSelection doc t))
      (setq base
        (trans
          (vlax-get (setq o (car asel))
            (if
              (and
                (or
                  (not (vlax-property-available-p o 'MTextAttribute))
                  (eq :vlax-false (vla-get-MTextAttribute o))
                )
                (not (eq acAlignmentLeft (vla-get-Alignment o)))
              )
              'TextAlignmentPoint 'InsertionPoint
            )
          )
          0 1
        )
      )
      (setq disp (getangle "\nSpecify Rotation Angle: " base))
      (setq disp (+ disp (angle '(0. 0. 0.) (trans (getvar 'UCSXDIR) 0 (trans '(0. 0. 1.) 1 0 t) t))))
    )
    (progn
      (LM:StartUndo doc)

      (setq lck (LM:UnlockLayers doc) ss (cadr asel) tag (caddr asel))

      (
        (lambda ( i / e o )
          (while (setq e (ssname ss (setq i (1+ i))))
            (mapcar
              (function
                (lambda ( attrib )
                  (if (eq tag (vla-get-TagString attrib))
                    (vla-put-rotation attrib disp)
                  )
                )
              )
              (append
                (vlax-invoke (setq o (vlax-ename->vla-object e)) 'GetAttributes)
                (vlax-invoke o 'GetConstantAttributes)
              )
            )
          )
        )
        -1
      )

      (LM:ReLockLayers lck)

      (LM:EndUndo doc)
    )
  )
  
  (princ)
)

;;-----------------=={ Массовое редактирование сжатия атрибутов}==------------------;;

(defun c:wAtt ( / *error* doc asel base disp lck ss tag )
  (vl-load-com)
  ;; © Lee Mac 2010 corr 2014 Nike

  (defun *error* ( msg )
    
    (if doc (LM:EndUndo doc))
    (if lck (LM:ReLockLayers lck))

    (if mutt (setvar 'NOMUTT mutt))
    
    (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
        (princ (strcat "\n** Error: " msg " **")))
    (princ)
  )

  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))

  (if
    (and
      (setq asel (LM:GetAttribSelection doc t))
      (setq base
        (trans
          (vlax-get (setq o (car asel))
            (if
              (and
                (or
                  (not (vlax-property-available-p o 'MTextAttribute))
                  (eq :vlax-false (vla-get-MTextAttribute o))
                )
                (not (eq acAlignmentLeft (vla-get-Alignment o)))
              )
              'TextAlignmentPoint 'InsertionPoint
            )
          )
          0 1
        )
      )
      (setq disp (getreal "\nВведите величину сжатия: "))
    )
    (progn
      (LM:StartUndo doc)

      (setq lck (LM:UnlockLayers doc) ss (cadr asel) tag (caddr asel))

      (
        (lambda ( i / e o )
          (while (setq e (ssname ss (setq i (1+ i))))
            (mapcar
              (function
                (lambda ( attrib )
                  (if (eq tag (vla-get-TagString attrib))
                    (vla-put-scalefactor attrib disp)
                  )
                )
              )
              (append
                (vlax-invoke (setq o (vlax-ename->vla-object e)) 'GetAttributes)
                (vlax-invoke o 'GetConstantAttributes)
              )
            )
          )
        )
        -1
      )

      (LM:ReLockLayers lck)

      (LM:EndUndo doc)
    )
  )
  
  (princ)
)

;;-----------------=={ Массовое редактирование высоты атрибутов}==------------------;;

(defun c:hatt ( / *error* doc asel base disp lck ss tag )
  (vl-load-com)
  ;; © Lee Mac 2010 corr 2014 Nike

  (defun *error* ( msg )
    
    (if doc (LM:EndUndo doc))
    (if lck (LM:ReLockLayers lck))

    (if mutt (setvar 'NOMUTT mutt))
    
    (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
        (princ (strcat "\n** Error: " msg " **")))
    (princ)
  )

  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))

  (if
    (and
      (setq asel (LM:GetAttribSelection doc t))
      (setq base
        (trans
          (vlax-get (setq o (car asel))
            (if
              (and
                (or
                  (not (vlax-property-available-p o 'MTextAttribute))
                  (eq :vlax-false (vla-get-MTextAttribute o))
                )
                (not (eq acAlignmentLeft (vla-get-Alignment o)))
              )
              'TextAlignmentPoint 'InsertionPoint
            )
          )
          0 1
        )
      )
      (setq disp (getreal "\nВведите высоту: "))
    )
    (progn
      (LM:StartUndo doc)

      (setq lck (LM:UnlockLayers doc) ss (cadr asel) tag (caddr asel))

      (
        (lambda ( i / e o )
          (while (setq e (ssname ss (setq i (1+ i))))
            (mapcar
              (function
                (lambda ( attrib )
                  (if (eq tag (vla-get-TagString attrib))
                    (vla-put-height attrib disp)  
                  )
                )
              )
              (append
                (vlax-invoke (setq o (vlax-ename->vla-object e)) 'GetAttributes)
                (vlax-invoke o 'GetConstantAttributes)
              )
            )
          )
        )
        -1
      )

      (LM:ReLockLayers lck)

      (LM:EndUndo doc)
    )
  )
  
  (princ)
)

;;-------------------=={ Edit Attributes }==------------------;;
;;                                                            ;;
;;  Prompts user for a selection of attribute tag and         ;;
;;  selection of blocks containing such tag for which the     ;;
;;  change will be applied.                                   ;;
;;                                                            ;;
;;  Subsequently displays a dialog interface allowing the     ;;
;;  to change such properties as content, style, alignment,   ;;
;;  height, oblique angle, and rotation. Upon clicking OK     ;;
;;  all attributes of the selected tag within the selected    ;;
;;  blocks will be modified to suit the checked properties.   ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;

(defun c:edAtt ( / *error* LM:GetSavePath LM:WriteDCL MakeList VersionNumber doc SavePath dcfname
                   dctitle TextStyles AlignLst asel dcTag dcFlag o ss tag e2 e4 e8 e16 e32 e64 )
  (vl-load-com)
  ;; © Lee Mac 2010

  (setq VersionNumber "1.1") (or mode (setq mode 2))

  (defun *error* ( msg )
    
    (if doc (LM:EndUndo doc))
    (if lck (LM:ReLockLayers lck))

    (if mutt (setvar 'NOMUTT mutt))

    (if dcTag (unload_dialog dcTag))
    
    (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
        (princ (strcat "\n** Error: " msg " **")))
    (princ)
  )

  (defun LM:GetSavePath ( / tmp )
    (cond      
      ( (setq tmp (getvar 'ROAMABLEROOTPREFIX))

        (or (eq "\\" (substr tmp (strlen tmp)))
            (setq tmp (strcat tmp "\\"))
        )
        (strcat tmp "Support")
      )
      ( (setq tmp (findfile "ACAD.pat"))

        (setq tmp (vl-filename-directory tmp))

        (and (eq "\\" (substr tmp (strlen tmp)))
             (setq tmp (substr tmp (1- (strlen tmp))))
        )
        tmp
      )
    )
  )

  (defun LM:WriteDCL ( filename / ofile )

    (cond
      ( (findfile filename) )
      
      ( (setq ofile (open filename "w"))

        (foreach str

           '(
             "edit5 : edit_box   { edit_limit = 5; fixed_width = true; }"
             "pop  : popup_list  { width = 20;     fixed_width = true; }"
             ""
             "EdAtt : dialog { key = \"dctitle\"; initial_focus = \"content\";"
             "  spacer;"
             ""
             "  : toggle    { key = \"t2\" ; label = \"Content\"; }"
             "  : edit_box  { key = \"e2\" ; width = 45; fixed_width = true; }"
             ""
             "  spacer;"
             ""
             "  : row {"
             ""
             "    : toggle  { key = \"t4\" ; label = \"Style\"        ; }"
             "    : pop     { key = \"e4\" ; }"
             ""
             "  }"
             "  : row {"
             ""
             "    : toggle  { key = \"t8\" ; label = \"Alignment\"    ; }"
             "    : pop     { key = \"e8\" ; }"
             ""
             "  }"
             "  : row {"
             ""
             "    : toggle  { key = \"t16\"; label = \"Height\"       ; }"
             "    : edit5   { key = \"e16\"; }"
             ""
             "  }"
             "  : row {"
             ""
             "    : toggle  { key = \"t32\"; label = \"Oblique Angle\"; }"
             "    : edit5   { key = \"e32\"; }"
             ""
             "  }"
             "  : row {"
             ""
             "    : toggle  { key = \"t64\"; label = \"Rotation\"     ; }"
             "    : edit5   { key = \"e64\"; }"
             ""
             "  }"
             ""
             "  spacer;"
             ""
             "  ok_cancel;"
             "}"
            )
          
          (write-line str ofile)
        )          
        (setq ofile (close ofile))

        (while (not (findfile filename)))
       
        filename
      )
    )
  )

  (defun MakeList ( key lst )
    (start_list key)
    (mapcar 'add_list lst)
    (end_list)
  )
  
  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))

  (if (not (vl-file-directory-p (setq SavePath (LM:GetSavePath))))
    (progn
      (LM:Popup "Warning" 16 "Save Path not Valid")
      (exit)
    )
  )
  
  (setq dcfname (strcat SavePath "\\LMAC_AttMod_V" VersionNumber ".dcl")
        dctitle (strcat "Attribute Modification Suite V" VersionNumber )
  )

  (setq TextStyles
    (acad_strlsort
      (vlax-for s (vla-get-TextStyles doc)
        (setq TextStyles (cons (vla-get-Name s) TextStyles))
      )
    )
  )

  (setq AlignLst
    (list
      (cons "Left"          acAlignmentLeft        )
      (cons "Center"        acAlignmentCenter      )
      (cons "Right"         acAlignmentRight       )
      (cons "Aligned"       acAlignmentAligned     )
      (cons "Middle"        acAlignmentMiddle      ) 
      (cons "Fit"           acAlignmentFit         )
      (cons "Top-Left"      acAlignmentTopLeft     )
      (cons "Top-Center"    acAlignmentTopCenter   )
      (cons "Top-Right"     acAlignmentTopRight    )
      (cons "Middle-Left"   acAlignmentMiddleLeft  )
      (cons "Middle-Center" acAlignmentMiddleCenter)
      (cons "Middle-Right"  acAlignmentMiddleRight )
      (cons "Bottom-Left"   acAlignmentBottomLeft  )
      (cons "Bottom-Center" acAlignmentBottomCenter)
      (cons "Bottom-Right"  acAlignmentBottomRight )
    )
  )

  (cond
    (
      (not (LM:WriteDCL dcfname))

      (LM:Popup "Warning" 16 "Dialog Definition File could not be Written")
      (princ "\n** DCL File Could not be Written **")
    )
    ( (not (setq asel (LM:GetAttribSelection doc nil)))

      (princ "\n*Cancel*")
    )
    ( (<= (setq dcTag (load_dialog dcfname)) 0)

      (LM:Popup "Warning" 16 "Dialog Definition File could not be Found")
      (princ "\n** DCL File could not be Found **")
    )
    ( (not (new_dialog "EdAtt" dcTag))

      (LM:Popup "Warning" 16 "Dialog could not be Loaded")
      (princ "\n** Dialog could not be Loaded **")
    )
    (t

      (mapcar 'MakeList '("e4" "e8") (list TextStyles (mapcar 'car AlignLst)))
      (set_tile "dctitle" dctitle)

      (setq o (car asel) ss (cadr asel) tag (caddr asel))

      (
        (lambda ( i ) 
          (mapcar
            (function
              (lambda ( toggle edit value )
                (mode_tile edit
                  (- 1
                    (atoi
                      (set_tile toggle (if (= (setq i (lsh i 1)) (logand i mode)) "1" "0"))
                    )
                  )
                )
                (set (read edit) (set_tile edit value))

                (action_tile toggle
                  (strcat "(setq mode ((if (eq \"1\" $value) + -) mode " (itoa i) ")) "
                          "(mode_tile " (vl-prin1-to-string edit) " (- 1 (atoi $value)))"
                  )
                )
                (action_tile edit (strcat "(setq " edit " $value)"))
              )
            )
           '("t2" "t4" "t8" "t16" "t32" "t64")
           '("e2" "e4" "e8" "e16" "e32" "e64")
            (list
              (vlax-get-property o 'TextString)
              (itoa (vl-position (vlax-get-property o 'StyleName) TextStyles))
              (itoa (vl-position (vlax-get-property o 'Alignment) (mapcar 'cdr AlignLst)))
              (rtos (vlax-get-property o 'Height))
              (angtos (vlax-get-property o 'ObliqueAngle))
              (angtos (vlax-get-property o 'Rotation))
            )
          )
        )
        1
      )

      (action_tile "accept"
        (vl-prin1-to-string
          (quote
            (progn
              (cond
                ( (not (and (setq hgt (distof e16)) (< 0 hgt)))

                  (LM:Popup "Information" 48 "Attribute Height Must be a Positive Number!")
                )
                ( (not (and (setq obl (angtof e32)) (<= (/ (* pi -17.) 36.) obl (/ (* pi 17.) 36.))))

                  (LM:Popup "Information" 48 "Oblique Angle Must be between -85 and 85 degrees")
                )
                ( (not (setq rot (angtof e64)))

                  (LM:Popup "Information" 48 "Attribute Rotation Must be Numerical")
                )
                (t
                  (setq e4 (nth (atoi e4) TextStyles) e8 (cdr (nth (atoi e8) AlignLst)) e16 hgt e32 obl e64 rot)
                  (done_dialog 1)
                )
              )
            )
          )
        )
      )
     
      (setq dcFlag (start_dialog) dcTag (unload_dialog dcTag))

      (if (= 1 dcFlag)
        (
          (lambda ( i props )
            (LM:StartUndo doc)
            (setq lck (LM:UnlockLayers doc))
            
            (while (setq e (ssname ss (setq i (1+ i))))
              (mapcar
                (function
                  (lambda ( attrib )
                    (if (eq tag (vla-get-TagString attrib))
                      (mapcar
                        (function
                          (lambda ( prop / err tmp )
                            (if (eq (car prop) 'Alignment)
                              (setq tmp (vlax-get-property attrib 'InsertionPoint))
                            )
                            (if (vl-catch-all-error-p
                                  (setq err
                                    (vl-catch-all-apply 'vlax-put-property (cons attrib prop))
                                  )
                                )
                              (princ (strcat "\nError: " (vl-catch-all-error-message err)))
                            )
                            (if (and tmp (not (eq acAlignmentLeft (cadr prop))))
                              (vlax-put-property attrib 'TextAlignmentPoint tmp)
                            )
                          )
                        )
                        props
                      )
                    )
                  )
                )
                (vlax-invoke (vlax-ename->vla-object e) 'GetAttributes)
              )
            )

            (LM:ReLockLayers lck)
            (LM:EndUndo doc)
          )
          -1
          (
            (lambda ( j )
              (vl-remove-if 'null
                (mapcar
                  (function
                    (lambda ( prop )
                      (if (= (setq j (lsh j 1)) (logand j mode))
                        (list prop (eval (read (strcat "e" (itoa j)))))
                      )
                    )
                  )
                  '(TextString StyleName Alignment Height ObliqueAngle Rotation)
                )
              )
            )
            1
          )                    
        )
        (princ "\n*Cancel*")
      )
    )
  )

  (princ)
)

;;---------------=={ Get Attribute Selection }==--------------;;
;;                                                            ;;
;;  Prompts user to select an attribute, then a selection of  ;;
;;  blocks containing such attribute                          ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  doc        - a VLA Document Object                        ;;
;;  AllowMText - Boolean flag determining whether MText       ;;
;;               attributed are selectable (T=Allow MText)    ;;
;;------------------------------------------------------------;;
;;  Returns: list of (<Attribute> <SelectionSet> <TagString>) ;;
;;------------------------------------------------------------;;

(defun LM:GetAttribSelection ( doc AllowMText / e b tag o mutt ss )
  (vl-load-com)
  ;; © Lee Mac 2010

  (if
    (and
      (setq e
        (LM:Selectif
          (lambda ( x / y )
            (and (eq "ATTRIB" (cdr (assoc 0 (entget x))))
              (or AllowMText
                (not (vlax-property-available-p (setq y (vlax-ename->vla-object x)) 'MTextAttribute))
                (eq :vlax-false (vla-get-MTextAttribute y))
              )
            )               
          )
          nentsel "\nSelect Attribute: "
        )
      )
      (princ (strcat "\n'" (cdr (assoc 2 (entget e))) "' Selected."))
      (setq b
        (LM:BlockName
          (vla-ObjectIDtoObject doc
            (vla-get-OwnerId
              (setq o (vlax-ename->vla-object e))
            )
          )
        )
      )
      (setq tag (vla-get-TagString o))
      (progn
        (setq mutt (getvar 'NOMUTT))
        (setvar 'NOMUTT 1)

        (princ "\nSelect Blocks <All> : ")
        
        (setq ss
          (cond
;;;            ( (ssget      (list (cons 0 "INSERT") (cons 2 b) (cons 66 1))) )
;;;            ( (ssget "_X" (list (cons 0 "INSERT") (cons 2 b) (cons 66 1))) )
               ( (ssget      (list (cons 0 "INSERT") (cons 66 1))) )
               ( (ssget "_X" (list (cons 0 "INSERT") (cons 66 1))) )
          )
        )

        (setvar 'NOMUTT mutt)
        ss
      )
    )
    (list o ss tag)
  )
)

;;--------------------=={ Start Undo }==----------------------;;
;;                                                            ;;
;;  Ends any active Undo marks and starts a new Undo mark     ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  doc - VLA Document Object                                 ;;
;;------------------------------------------------------------;;

(defun LM:StartUndo ( doc ) (LM:EndUndo doc)
  (vla-StartUndoMark doc)
)

;;---------------------=={ End Undo }==-----------------------;;
;;                                                            ;;
;;  Ends any active Undo marks                                ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  doc - VLA Document Object                                 ;;
;;------------------------------------------------------------;;

(defun LM:EndUndo ( doc )
  (if (= 8 (logand 8 (getvar 'UNDOCTL)))
    (vla-EndUndoMark doc)
  )
)

;;------------------=={ Unlock Layers }==---------------------;;
;;                                                            ;;
;;  Unlocks all layers in the supplied Document Object and    ;;
;;  returns a list of those which were locked                 ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  doc - VLA Document Object                                 ;;
;;------------------------------------------------------------;;
;;  Returns:  list of previously locked VLA Layer Objects     ;;
;;------------------------------------------------------------;;

(defun LM:UnlockLayers ( doc / r )
  (vlax-for l (vla-get-layers doc)
    (if (eq :vlax-true (vla-get-lock l))
      (vla-put-lock (car (setq r (cons l r))) :vlax-false)
    )
  )
  (reverse r)
)

;;-------------------=={ ReLock Layers }==--------------------;;
;;                                                            ;;
;;  Locks all layers in the supplied list                     ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  lst - list of VLA Layer Objects                           ;;
;;------------------------------------------------------------;;

(defun LM:ReLockLayers ( lst )
  (mapcar '(lambda ( l ) (vla-put-lock l :vlax-true)) lst)
)

;;-----------------------=={ Popup }==------------------------;;
;;                                                            ;;
;;  Displays a customisable message box dialog                ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  title - title for the popup                               ;;
;;  flags - bit flags determining the appearance of the popup ;;
;;  msg   - message to be displayed in the popup dialog       ;;
;;------------------------------------------------------------;;

(defun LM:Popup ( title flags msg / WSHShell result )
  ;; © Lee Mac 2010
  (setq WSHShell (vlax-create-object "WScript.Shell"))
  (setq result   (vlax-invoke WSHShell 'Popup msg 0 title flags))
  (vlax-release-object WSHShell)

  result
)

;;---------------------=={ Select if }==----------------------;;
;;                                                            ;;
;;  Continuous selection prompts until the predicate function ;;
;;  foo is validated                                          ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2010 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  foo - optional predicate function taking ename argument   ;;
;;  fun - selection function to invoke                        ;;
;;  str - prompt string                                       ;;
;;------------------------------------------------------------;;
;;  Returns:  selected entity ename if successful, else nil   ;;
;;------------------------------------------------------------;;

(defun LM:Selectif ( foo fun str / e )
  ;; © Lee Mac 2010
  (while
    (progn (setvar 'ERRNO 0) (setq e (car (fun str)))      
      (cond
        ( (= 7 (getvar 'ERRNO))

          (princ "\n** Missed, Try again **")
        )
        ( (eq 'ENAME (type e))

          (if (and foo (not (foo e)))
            (princ "\n** Invalid Object Selected **")
          )
        )
      )
    )
  )
  e
)

;;--------------------=={ Block Name }==----------------------;;
;;                                                            ;;
;;  Returns the name of a block as found in the block         ;;
;;  definition.                                               ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  obj - VLA Block Reference Object                          ;;
;;------------------------------------------------------------;;
;;  Returns:  block name, (effective if available)            ;;
;;------------------------------------------------------------;;

(defun LM:BlockName ( obj )
  (vlax-get-property obj
    (if (vlax-property-available-p obj 'EffectiveName)
      'EffectiveName 'Name
    )
  )
)

; (princ "\n:: Attribute Modification Suite | Copyright © 2010 by Lee McDonnell ::")
; (princ "\n:: Type \"mvAtt\", \"roAtt\" or \"edAtt\" to Invoke ::\n")
(princ)
Nike вне форума  
 
Автор темы   Непрочитано 03.02.2020, 15:38
#4
Kavalergrad


 
Регистрация: 21.11.2014
Москва
Сообщений: 60


[quote=kp+;1852346]Дустом _attsync не пробовали?
Еще рекомендуется к просмотру вот эта тема: https://forum.dwg.ru/showthread.php?t=8497[/QU
Нет, не помогло

Никак не пойму какой командой запускать программу в моем случае. Если командой "hatt", то никакой реакции. Если командой " _hatt", то в ответ получаешь сообщение - Неизвестная команда "HATT". Для вызова справки нажмите F1

----- добавлено через 32 сек. -----
_attsync не помогает....

Последний раз редактировалось Кулик Алексей aka kpblc, 03.02.2020 в 17:05.
Kavalergrad вне форума  
 
Непрочитано 03.02.2020, 17:32
#5
kp+

идущий по граблям
 
Регистрация: 26.05.2005
Сообщений: 5,170


Цитата:
Сообщение от Kavalergrad Посмотреть сообщение
_attsync не помогает....
А Вы точно к тому блоку его применили, в описании которого атрибуты редактировали?
На всякий случай уточняю: attsync сработает, если изменить параметры атрибутов в эталонном описании блока через battman, редактор блоков или контекстное редактирование блока. Если через редактор атрибутов только в одном/нескольких отдельно взятых экземплярах ("вхождениях") блока, вставленных в чертеже - чуда не будет.

Цитата:
Сообщение от Kavalergrad Посмотреть сообщение
Никак не пойму какой командой запускать программу в моем случае. Если командой "hatt", то никакой реакции. Если командой " _hatt", то в ответ получаешь сообщение - Неизвестная команда "HATT". Для вызова справки нажмите F1
Как использовать lisp-код, опубликованный на форуме?
kp+ вне форума  
 
Непрочитано 03.02.2020, 18:12
#6
AMDen

Инженер-проектировщик
 
Регистрация: 07.07.2016
Санкт-Петербург
Сообщений: 759


Цитата:
Сообщение от Kavalergrad Посмотреть сообщение
через редактор атрибутов
Может проблема в этом?
Надо в редакторе блока менять высоту текста атрибута.
А так же можно было б и на файл взглянуть, чтобы не гадать.
AMDen на форуме  
 
Автор темы   Непрочитано 03.02.2020, 18:14
#7
Kavalergrad


 
Регистрация: 21.11.2014
Москва
Сообщений: 60


Может и в самом деле делаю что то не так. Прикладываю файл на котором тренируюсь, что бы не запороть основной файл. У него похожая беда. Пытаюсь изменить высоту текста атрибута "Позиция" в блоке "С2000-СП4-220" со 175 до 400. Изменить в отдельно взятом блоке получается, а вот во всех сразу - нет и не пойму в чем проблема. Обычно было достаточно войти в редактор блока, выделить нужный атрибут и в его свойствах выставить нужную высоту текста или текстовый стиль, а затем сохранить с изменениями. И все менялось сразу во всем чертеже, а тут...
Миниатюры
Нажмите на изображение для увеличения
Название: Безымянный (BATTMAN).jpg
Просмотров: 199
Размер:	336.8 Кб
ID:	222732  Нажмите на изображение для увеличения
Название: Безымянный.jpg
Просмотров: 194
Размер:	276.5 Кб
ID:	222733  Нажмите на изображение для увеличения
Название: Безымянный1.jpg
Просмотров: 167
Размер:	350.2 Кб
ID:	222734  
Вложения
Тип файла: dwg
DWG 2018
Чертеж2.dwg (383.5 Кб, 8 просмотров)
Kavalergrad вне форума  
 
Непрочитано 03.02.2020, 18:29
#8
Кулик Алексей aka kpblc
Moderator

LISP, C# (ACAD 200[9,12,13,14])
 
Регистрация: 25.08.2003
С.-Петербург
Сообщений: 40,404


Сними аннотативность с описания блока.
__________________
Моя библиотека lisp-функций
---
Обращение ко мне - на "ты".
Все, что сказано - личное мнение.
Кулик Алексей aka kpblc вне форума  
 
Автор темы   Непрочитано 03.02.2020, 21:18
#9
Kavalergrad


 
Регистрация: 21.11.2014
Москва
Сообщений: 60


Ок. Снял и все получилось. Спасибо за помощь.
Kavalergrad вне форума  
Ответ
Вернуться   Форум DWG.RU > Программное обеспечение > AutoCAD > Как в автокаде изменить высоту букв в атрибуте нескольких блоков одновременно



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Возможно ли изменить интервал между буквами в Автокаде? boban AutoCAD 38 27.03.2025 15:08
Распечатка нескольких листов одновременно antisept AutoCAD 235 19.02.2025 09:01
Как редактировать несколько блоков одновременно Nastysia AutoCAD 39 28.03.2022 08:07
Как изменить одновременно текст в Автокаде в нескольких местах? maksim2210 AutoCAD 30 28.03.2017 09:07
Как можно сразу изменить содержимое текста в нескольких местах Karyavka AutoCAD 3 11.06.2013 16:14