+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Full Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2016
    Join Date
    Nov 2017
    Posts
    80

    Default scaling text and objects question

    Registered forum members do not see this ad.

    so i have one of two things that i am thinking about here.

    1. i know that AutoCAD has the scale (short key SC) command. selecting it, clicking a base point, typing the scale factor and bingo you are done. i am wanting to see if i am able to throw a wrench in there. maybe it wont work i am not sure. but we get a room name file from the architects and they are just single line text with a box/rectangle around the room number. i have a scale lisp for scaling blocks and also one for resizing the text. but what i am looking for is to be able to take the text and the blocks/objects and scale it all at once with a selection and give scale factor (example of 1/2 size) and be done.

    2. be able to do a select all and group each of the room names and room numbers into individual blocks. and then i can just use the scale lisp that i already have.

    attached is the two lisps that i work with currently. i hope that i am making sence and not talking out of my
    Attached Files

  2. #2
    Senior Member pendean's Avatar
    Computer Details
    pendean's Computer Details
    Operating System:
    Windows 10 64it Pro
    Computer:
    Lenovo WorkStation
    Discipline
    Architectural
    Using
    AutoCAD 2018
    Join Date
    Jun 2011
    Location
    Texas
    Posts
    131

    Default

    Would simply using annotative blocks/text be another solution to this need?
    --
    Dean Saadallah
    AutoCAD and LT User
    BLOG|TW|FB|PIN
    --

  3. #3
    Full Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2016
    Join Date
    Nov 2017
    Posts
    80

    Default

    Quote Originally Posted by pendean View Post
    Would simply using annotative blocks/text be another solution to this need?

    at this point i think that anything would work. the problem is that they send this to us this one way. would there be a simple way for me to change these to the annotative blocks/text?

  4. #4
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    998

    Default

    You could first make a block/text (as pendean suggest) , select all the text's and rectangles in one go and use the string and insertionpoint from the text entity as base for your block insertionpoint. Dont know if the text's and rectangles are in a separate layer so you won't select other objects.

  5. #5
    Full Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2016
    Join Date
    Nov 2017
    Posts
    80

    Default

    Quote Originally Posted by rlx View Post
    You could first make a block/text (as pendean suggest) , select all the text's and rectangles in one go and use the string and insertionpoint from the text entity as base for your block insertionpoint. Dont know if the text's and rectangles are in a separate layer so you won't select other objects.
    i get all of this, however i am working with what is being sent to me. and what they are sending to me isnt set up that way. it is just the single line text with the square around the room number. so i would have to go in and make each of these a block, and then i would be able to use what i currently have. i am just wondering if there is a quick way to make them a block? or to be able to scale what i have currently. attached is what is being send to us.
    Attached Files

  6. #6
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    998

    Default

    I think if you google 'visual lisp text to attribute' you find a couple of routines able to do this.

  7. #7
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,581

    Default

    Rlx is on the money just make 2 blocks as you have text with 2 lines and 3 lines. I not sure that a blanket approach can be simply achieved but if happy with a do window, do window, approach it would be pretty easy to read the text and replace with a block. I just used your labels for the test block creating a attribute that matched and removed the text.


    Something to play with as a start needs the text angle etc checked also need to do real work now.
    Code:
    (defun c:test ( / txt1 txt2 txt3 pt)
    (while (setq ss (ssget (list(cons 0 "text"))))
    (setq pt (cdr (assoc 10(entget(ssname ss 0)))))
    (setq txt1 (cdr (assoc 1(entget(ssname ss 0)))))
    (setq txt2 (cdr (assoc 1(entget(ssname ss 0)))))
    (if (> (sslength ss) 2)
    (progn
    (setq txt3 (cdr (assoc 1(entget(ssname ss 0)))))
    (command "-insert" "3att" pt 1 1 0 txt1 txt2 txt3) ; 3 att is block name 3 attributes
    )
    (command "-insert" "2att" pt 1 1 0 txt1 txt2)
    )
    )
    )
    Last edited by BIGAL; 13th Jun 2018 at 10:54 am.
    A man who never made mistakes never made anything

  8. #8
    Super Member
    Using
    not applicable
    Join Date
    Jun 2016
    Posts
    673

    Default

    It is of course also possible to select and scale these clusters of elements programmatically.
    Note 1: Before trying c:Test use the _OverKill command to get rid of double polylines.
    Note 2: The leaders are not processed.
    Code:
    (defun KGA_Conv_Pickset_To_ObjectList (ss / i ret)
      (if ss
        (repeat (setq i (sslength ss))
          (setq ret (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) ret))
        )
      )
    )
    
    (defun KGA_Geom_ObjectMiddle (obj / ptBL ptTR)
      (vla-getboundingbox obj 'ptBL 'ptTR)
      (mapcar
        '/
        (mapcar '+ (vlax-safearray->list ptBL) (vlax-safearray->list ptTR))
        '(2.0 2.0 2.0)
      )
    )
    
    (defun c:Test ( / dis doc lyr polyLst pt restLst scl tab)
      (setq dis 40.0)          ; Search distance.
      (setq lyr "A-ANNO-NOTE") ; Layer name.
      (setq scl 0.5)           ; Scale factor.
      (setq tab (if (= 1 (getvar 'cvport)) (getvar 'ctab) "Model"))
      (setq doc (vla-get-activedocument (vlax-get-acad-object)))
      (vla-endundomark doc)
      (vla-startundomark doc)
      (if
        (and
          (setq polyLst
            (KGA_Conv_Pickset_To_ObjectList
              (ssget "_A" (list (cons 8 lyr) (cons 410 tab) '(0 . "LWPOLYLINE")))
            )
          )
          (setq restLst
            (KGA_Conv_Pickset_To_ObjectList
              (ssget "_A" (list (cons 8 lyr) (cons 410 tab) '(0 . "*TEXT,SPLINE,ELLIPSE")))
            )
          )
        )
        (progn
          (setq restLst
            (mapcar
              '(lambda (obj) (list (KGA_Geom_ObjectMiddle obj) obj))
               restLst
            )
          )
          (foreach poly polyLst
            (setq pt (KGA_Geom_ObjectMiddle poly))
            (vla-scaleentity poly (vlax-3d-point pt) scl)
            (foreach sub restLst
              (if (> dis (distance pt (car sub)))
                (progn
                  (vla-scaleentity (cadr sub) (vlax-3d-point pt) scl)
                  (setq restLst (vl-remove sub restLst))
                )
              )
            )
          )
          (princ "\nDone! ")
        )
      )
      (vla-endundomark doc)
      (princ)
    )
    BricsCAD 18

  9. #9
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    998

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by Roy_043 View Post
    It is of course also possible to select and scale these clusters of elements programmatically.
    Note 1: Before trying c:Test use the _OverKill command to get rid of double polylines.
    Note 2: The leaders are not processed.
    Code:
    (defun KGA_Conv_Pickset_To_ObjectList (ss / i ret)....  )

    Was about to suggest OP to have a look at this link :


    http://www.cadtutor.net/forum/showth...tter-narrative


    but your code is I think pretty much what OP needs. And its fast. Nicely done Roy. Got too much work at this moment to do much lisping...


    so for you!

Similar Threads

  1. Scaling objects
    By Bane in forum AutoCAD General
    Replies: 11
    Last Post: 11th May 2009, 05:18 pm
  2. Scaling Text Question
    By MS-S in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 2nd Apr 2009, 01:18 pm
  3. Scaling C3D objects
    By Alioness in forum Civil 3D & LDD
    Replies: 0
    Last Post: 27th Mar 2009, 10:01 pm
  4. I have a question about scaling objects.
    By bluetoast in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 12
    Last Post: 19th Mar 2008, 09:24 pm
  5. Scaling multiple objects question
    By alderney in forum AutoCAD General
    Replies: 5
    Last Post: 14th Feb 2007, 12:54 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