Jump to content

Recommended Posts

Posted

Hello everyone,

I've been trying to write a lisp routine to go through and grab all text of a specific layer and then change the Text style of that selection to a different text style. The problem I'm having is that I set-up all my text to be annotative so I need it to correctly change to the annotative scale. When I use the change command in lisp to change the textstyle it changes it to the correct style but does not regenerate (even with using regen) so the text turns into a VERY small text. If I change the text style by the drop down menu to something else and then back to the one I desire it puts it to the correct scale (can't do this for over 100 text that I have to change:( ). Is there a lisp command to change the text style without using the command "change"? I'm not sure if this is the problem or it's just ACAD being ACAD. lol

Posted

After you change the stylename, you'll have to manually fix the size to be based on the newly chosen textstyle properties.

Posted (edited)

Actually it is better to use the "sssetfirst" function for this situation and Ctr+1 to adjust the text height of all the section set.

 

(sssetfirst nil (ssget "_x" '((0 . "TEXT,MTEXT")(7 . "Annotative")(8 . "[color=red][b]LAYERNAME[/b][/color]"))))

 

Tharwat

Edited by Tharwat
Codes modified for better situations
Posted

I'd avoid entmod'ing annotative objects when possible. Things have a way of going crazy in some releases. Plus, what you are doing is not different than his usage of CHANGE.

Posted

Yeah ..... the main bad issue for the Annotative texts is the text height of it.

Posted
Yeah ..... the main bad issue for the Annotative texts is the text height of it.

What?........

Posted

I mean if a drawing has multiple text heights of annotative text style , that's definitely would let texts go crazy when changing heights .

Posted
I mean if a drawing has multiple text heights of annotative text style , that's definitely would let texts go crazy when changing heights .

No, it's a bug with some versions and editing annotative text with entmod. It sets the actual size as the factor, which is then multiplied by the cannoscale variable, which makes the text huge.

Posted

OK.

 

So how to step through the Text heights of Annotative text height in a selection set ? :)

Posted
OK.

 

So how to step through the Text heights of Annotative text height in a selection set ? :)

Height from text object, actual height for text of specific textstyle from the textstyle data dump, based on annotative scale of text object, do a little math and you have it.

Posted
I'd avoid entmod'ing annotative objects when possible. Things have a way of going crazy in some releases. Plus, what you are doing is not different than his usage of CHANGE.

 

You got that right, thats why i stay away from entmod function when dealing with text (ANY TEXT)

 

Have a look at this:

 (defun CS  (st / a dat)
 (setq a (ssget  '((0 . "TEXT,MTEXT"))))
 (repeat (sslength a)
   (setq dat (entget (ssname a 0))
         dat (subst (cons 7 st) (assoc 7 dat) dat))
   (entmod dat)
   (ssdel (ssname a 0) a)
 )
)

When it encounters Annotative MText (Boom)

 

you can avoid that Using VL

 (defun CS ( st / a)
 (vl-load-com)
 (if (setq a (ssget  '((0 . "TEXT,MTEXT"))))
 (mapcar '(lambda (j)
                  (vla-put-stylename (vlax-ename->vla-object j) st))
                  (vl-remove-if 'listp (mapcar 'cadr (ssnamex a))))
   )
(princ)
 )

 

USAGE:

command: (CS "ROMANS")

 

:)

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...