Find text and change layer

Discussion in 'AutoCAD' started by Cory McConnell, Aug 17, 2004.

  1. Is it possible to search mspace for mtext objects of a certain height and
    change the layer of this text?
     
    Cory McConnell, Aug 17, 2004
    #1
  2. Cory McConnell

    T.Willey Guest

    Yes.
    (setq ss (ssget "x" (list
    (cons 0 "MTEXT")
    (cons 410 "MODEL")
    (cons 40 4.5); <- change this to match your text height.
    ))
    )

    This will get you a selection set of all mtext in model space. Then just change there layer whatever way you like.

    Tim
     
    T.Willey, Aug 17, 2004
    #2
  3. Cory McConnell

    T.Willey Guest

    You could also use the filter command within acad. Once all text entities are highlighted, use the change prop dialog box. At the top change it from all to mtext. Then just change the layer there.

    Just another option.
    Tim
     
    T.Willey, Aug 17, 2004
    #3
  4. Yes, use QSelect. Either type in from command line, or on the properties
    flyout, it's the icon that looks like a funnel. Very nifty tool.
     
    John Michalik, Aug 17, 2004
    #4
  5. Cory McConnell

    Jim Claypool Guest

    Use (mtextchg HGT "NEWLAYER")

    (defun mtextchg (hgt newlayer / ss cnt ename ent)
    (setq ss (ssget "x" (list (cons 0 "MTEXT") (cons 40 hgt))))
    (if ss
    (progn
    (setq cnt 0)
    (repeat (sslength ss)
    (setq ename (ssname ss 0))
    (setq ent (entget ename))
    (entmod (subst (cons 8 newlayer) (assoc 8 ent) ent))
    (setq cnt (1+ cnt))
    );end repeat
    );end progn
    );end if
    (princ)
    )
     
    Jim Claypool, Aug 17, 2004
    #5
  6. Cory McConnell

    T.Willey Guest

    Wow Jim. First I saw the attribute addition one, now this one. You must have a niffty little tool box for text and attributes. Very nice.

    Tim
     
    T.Willey, Aug 17, 2004
    #6
  7. Cory McConnell

    Jim Claypool Guest

    These little routines usually get written when someone comes up with a
    problem.

    have a niffty little tool box for text and attributes. Very nice.
     
    Jim Claypool, Aug 17, 2004
    #7
  8. Wow that was quick. Thanks guys.
     
    Cory McConnell, Aug 17, 2004
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.