+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16
  1. #1
    Full Member
    Using
    AutoCAD 2009
    Join Date
    Apr 2009
    Posts
    82

    Default Match Text Height, Width & Oblique

    Registered forum members do not see this ad.

    Hi All,

    Please help me regarding that when im using match properties to match the Width, Height or Oblique of Mtext and Attributes it will not change or match the text i want,

    Please provide me some route that will match the fonts Style,Effects and sizes of multitext or attribute

    Thank you all

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,227

    Default

    Match Properties should be able to accomplish this task - make sure that Text is ticked in the Match Properties Settings.

    Quote Originally Posted by VisDak View Post
    Please provide me some route that will match the fonts Style,Effects and sizes of multitext or attribute...

    This is not a LISP Supermarket - but more a help and advice site.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  3. #3
    Full Member
    Using
    AutoCAD 2009
    Join Date
    Apr 2009
    Posts
    82

    Default

    Yes Lee,

    its all ticked and the Text are checked on Match Properties Settings, i dont understand also, i also used the 2009 version same situation maybe the text width and oblique aré not included in Match properties,

    see image,

    Thanks lee,
    Attached Images

  4. #4
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,227

    Default

    I was experimenting with different ways to code this type of program, and with the advice of some of the guys over at the Swamp, this is what I came up with:

    Code:
    (defun c:mtxt (/ tEnt tObj ss)
      (vl-load-com)
      (if (and (setq tEnt (car (entsel "\nSelect Source Text: ")))
               (wcmatch (cdadr (entget tEnt)) "ATT*,*TEXT")
               (setq tObj (vlax-ename->vla-object tEnt)))
        (while (setq ss (ssget '((0 . "*TEXT,ATT*"))))
          (foreach Obj (mapcar 'vlax-ename->vla-object
                         (vl-remove-if 'listp
                           (mapcar 'cadr (ssnamex ss))))
            (foreach fun '(Layer Color Height ObliqueAngle ScaleFactor StyleName)
              (if (and (vlax-property-available-p tObj fun)
                       (vlax-property-available-p Obj fun t))
                (vlax-put-property Obj fun
                  (vlax-get-property tObj fun))))))
        (princ "\n<< Nothing Selected >>"))
      (princ))
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  5. #5
    Full Member
    Using
    AutoCAD 2009
    Join Date
    Apr 2009
    Posts
    82

    Default

    Hi All,

    Good Day to all, i have here a Lisp route the will modify all the text width factor but only works on Dtext, not applicable on Mtext and Attribute,

    Kindly Please arrange this code so that it will be used also on Mtext attributes and Dimensions, thanks all

    Code:
    (defun c:chw (/ ennyi23 wb23 shell23 loui23 el23)
     (initget 7)
     (prompt "\nSelect text(s).... ")
      (command "select" "au" pause)
      (setq ennyi23 (ssget "p"))
      (setvar "cmdecho" 0)
      (initget 7)
      (setq wb23 (getdist "\nEnter New Width Factor: "))
      (setq shell23 (sslength ennyi23))
      (prompt "\nChanging width of selected texts... stand by.")
      (command "undo" "mark")
      (setq loui23 0)
          (while (< loui23 shell23)
            (setq el23 (entget (ssname ennyi23 loui23)))
            (if (= "TEXT" (cdr (assoc 0 el23)))
              (progn
                (setq el23 (subst (cons 41 wb23) (assoc 41 el23) el23))
                (entmod el23)
              )
            )
            (setq loui23 (1+ loui23))
          )
      (setvar "cmdecho" 1)
      (princ)
    )

  6. #6
    Full Member
    Using
    AutoCAD 2009
    Join Date
    Apr 2009
    Posts
    82

    Default

    Thank Lee,

    the code is work on Dtext , on Mtxt and Att, are not, but i like it is a dynamic match text properties,

    (Layer Color Height ObliqueAngle ScaleFactor StyleName) this will be great when this route are also applicalbe on Mtxt and Att.

    many thanks Lee,

  7. #7
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,227

    Default

    Quote Originally Posted by VisDak View Post
    Thank Lee,

    the code is work on Dtext , on Mtxt and Att, are not, but i like it is a dynamic match text properties,

    (Layer Color Height ObliqueAngle ScaleFactor StyleName) this will be great when this route are also applicalbe on Mtxt and Att.

    many thanks Lee,
    MTEXT is difficult as the formatting is achieved through the TextString, and not by separate properties.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  8. #8
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,227

    Default

    Try this one - source cannot be MTEXT.

    Code:
    (defun c:mtxt (/ tEnt tObj ss)
      (vl-load-com)
      (if (and (setq tEnt (car (nentsel "\nSelect Source Text: ")))
               (wcmatch (cdadr (entget tEnt)) "ATT*,TEXT")
               (setq tObj (vlax-ename->vla-object tEnt)))
        (while (setq Obj (car (nentsel "\nSelect Destination Object: ")))
          (setq Obj (vlax-ename->vla-object Obj))
          (cond ((vl-position (vla-get-ObjectName Obj)
                   '("AcDbAttribute" "AcDbText" "AcDbMText"))
                 (foreach fun '(Layer Color Height ObliqueAngle ScaleFactor StyleName)
                   (if (and (vlax-property-available-p tObj fun)
                            (vlax-property-available-p Obj fun t))
                     (vlax-put-property Obj fun
                       (vlax-get-property tObj fun))))
                (if (eq (vla-get-ObjectName Obj) "AcDbMText")
                 (vla-put-TextString Obj
                   (strcat "{\\Q"
                     (rtos (rtd (vla-get-ObliqueAngle tObj))) ";\\W"
                       (rtos (vla-get-ScaleFactor tObj)) ";"
                         (mip_mtext_unformat (vla-get-TextString Obj)) "}"))))
                (t (princ "\nMissed, Try Again..."))))                   
        (princ "\n<< Nothing Selected >>"))
      (princ))
    
    (defun mip_MTEXT_Unformat ( Mtext / text Str )
      (setq Text "")
       (while (/= Mtext "")
            (cond
              ((wcmatch (strcase (setq Str (substr Mtext 1 2))) "\\[\\{}]")
                (setq Mtext (substr Mtext 3) Text   (strcat Text Str)))
              ((wcmatch (substr Mtext 1 1) "[{}]")(setq Mtext (substr Mtext 2)))
              ((wcmatch (strcase (setq Str (substr Mtext 1 2))) "\\[LO`~]")
           (setq Mtext (substr Mtext 3)))
              ((wcmatch (strcase (substr Mtext 1 2)) "\\[ACFHQTW]")
                (setq Mtext (substr Mtext (+ 2 (vl-string-search ";" Mtext)))))
          ((wcmatch (strcase (substr mtext 1 4)) "\\PQ[CRJD],\\PXQ")  ;;;Add by KPblC
           (setq mtext (substr mtext (+ 2 (vl-string-search ";" mtext)))))
              ((wcmatch (strcase (substr Mtext 1 2)) "\\P")
                (if (or
               (zerop (strlen Text))
               (= " " (substr Text (strlen Text)))
               (= " " (substr Mtext 3 1)))
                   (setq Mtext (substr Mtext 3))
                   (setq Mtext (substr Mtext 3) Text (strcat Text " "))))
          ((wcmatch (strcase (substr Mtext 1 2)) "\\S")
                (setq Str   (substr Mtext 3 (- (vl-string-search ";" Mtext) 2))
                      Text  (strcat Text (vl-string-translate "#^\\" "/^\\" Str))
                      Mtext (substr Mtext (+ 4 (strlen Str)))))
          (t (setq Text (strcat Text (substr Mtext 1 1)) Mtext (substr Mtext 2)))))
      Text)
    
    (defun rtd (x)
      (* 180. (/ x pi)))
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  9. #9
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,227

    Default

    As an upgrade, this can match MTEXT to MTEXT and DTEXT/ATTRIB* to MTEXT.

    Only thing left is MTEXT -> DTEXT/ATTRIB* (the hardest one )

    Code:
    (defun c:mtxt (/ tEnt tObj ss)
      (vl-load-com)
      (if (and (setq tEnt (car (nentsel "\nSelect Source Text: ")))
               (wcmatch (cdadr (entget tEnt)) "ATT*,*TEXT")
               (setq tObj (vlax-ename->vla-object tEnt)))
        (while (setq Obj (car (nentsel "\nSelect Destination Object: ")))
          (setq Obj (vlax-ename->vla-object Obj))
          (cond ((vl-position (vla-get-ObjectName Obj)
                   '("AcDbAttribute" "AcDbAttributeDefinition" "AcDbText" "AcDbMText"))
                 (foreach fun '(Layer Color Height ObliqueAngle ScaleFactor StyleName)
                   (if (and (vlax-property-available-p tObj fun)
                            (vlax-property-available-p Obj fun t))
                     (vlax-put-property Obj fun
                       (vlax-get-property tObj fun))))
                 (cond ((and (eq (vla-get-ObjectName Obj) "AcDbMText")
                             (vl-position (vla-get-ObjectName tObj)
                               '("AcDbAttributeDefinition" "AcDbAttribute" "AcDbText")))
                        (vla-put-TextString Obj
                          (strcat "{\\Q"
                            (rtos (rtd (vla-get-ObliqueAngle tObj))) ";\\W"
                              (rtos (vla-get-ScaleFactor tObj)) ";"
                                (mip_mtext_unformat (vla-get-TextString Obj)) "}")))
                       ((= (vla-get-ObjectName Obj) (vla-get-ObjectName tObj) "AcDbMText")
                        (vla-put-TextString Obj
                          (vl-String-Subst
                            (mip_mtext_unformat
                              (vla-get-TextString Obj))
                                (mip_mtext_unformat
                                  (vla-get-TextString tObj))
                                    (vla-get-TextString tObj))))))
                (t (princ "\nMissed, Try Again..."))))                   
        (princ "\n<< Nothing Selected >>"))
      (princ))
    
    (defun mip_MTEXT_Unformat ( Mtext / text Str )
      (setq Text "")
       (while (/= Mtext "")
            (cond
              ((wcmatch (strcase (setq Str (substr Mtext 1 2))) "\\[\\{}]")
                (setq Mtext (substr Mtext 3) Text   (strcat Text Str)))
              ((wcmatch (substr Mtext 1 1) "[{}]")(setq Mtext (substr Mtext 2)))
              ((wcmatch (strcase (setq Str (substr Mtext 1 2))) "\\[LO`~]")
           (setq Mtext (substr Mtext 3)))
              ((wcmatch (strcase (substr Mtext 1 2)) "\\[ACFHQTW]")
                (setq Mtext (substr Mtext (+ 2 (vl-string-search ";" Mtext)))))
          ((wcmatch (strcase (substr mtext 1 4)) "\\PQ[CRJD],\\PXQ")  ;;;Add by KPblC
           (setq mtext (substr mtext (+ 2 (vl-string-search ";" mtext)))))
              ((wcmatch (strcase (substr Mtext 1 2)) "\\P")
                (if (or
               (zerop (strlen Text))
               (= " " (substr Text (strlen Text)))
               (= " " (substr Mtext 3 1)))
                   (setq Mtext (substr Mtext 3))
                   (setq Mtext (substr Mtext 3) Text (strcat Text " "))))
          ((wcmatch (strcase (substr Mtext 1 2)) "\\S")
                (setq Str   (substr Mtext 3 (- (vl-string-search ";" Mtext) 2))
                      Text  (strcat Text (vl-string-translate "#^\\" "/^\\" Str))
                      Mtext (substr Mtext (+ 4 (strlen Str)))))
          (t (setq Text (strcat Text (substr Mtext 1 1)) Mtext (substr Mtext 2)))))
      Text)
    
    (defun rtd (x)
      (* 180. (/ x pi)))
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  10. #10
    Full Member
    Using
    AutoCAD 2009
    Join Date
    Apr 2009
    Posts
    82

    Default

    Registered forum members do not see this ad.

    Thank Lee,

    Yes it works i'll be using Dtext source, to match destinations of Mtxt and attributes, Great Lee

    Cheers

Similar Threads

  1. 3D modeling and length, width, height question
    By deadseasquirrels in forum AutoCAD 3D Modelling & Rendering
    Replies: 14
    Last Post: 23rd Feb 2012, 08:40 pm
  2. Height and Width of cell
    By guyzen2004 in forum AutoCAD General
    Replies: 4
    Last Post: 19th Sep 2007, 04:22 pm
  3. Match Polyline Width
    By Brunello19 in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 16th Nov 2005, 02:27 pm
  4. Attribute height and width factor - changing many at once?
    By Kad in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 30th Aug 2005, 12:01 pm
  5. Oblique Text
    By chixwithtrix in forum AutoCAD General
    Replies: 2
    Last Post: 6th Apr 2005, 02:51 am

Bookmarks

Posting Permissions

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