Jump to content

Recommended Posts

Posted

Hello people:

I need to adjust the size of texts in model space

The problem is that there is text, mtext and attributes

Does anyone have an LSP routine in which you can enter the desired text height and modify it globally in a selection per window?

Any comments are welcome, thank you.

 

Posted

Weekend so CAD is off but, you should be able to work this out - the syntax below isn't correct, just to give you the idea:

 

(ssget....) with a filter for text, mtext and attributes (ssget '((0 . "*text,attribute"))) - noting the wild card in text to get mtext too

(setq counter 0) - a counter, can call it anything

(while (< counter < sslength (selection set)))

(setq ent (ssname counter (selection set)))

Then entmod the text size (dxf code 40) - the autodesk help from the search "autocad lisp entmod" gets a good example

set counter + 1

End while loop

Posted (edited)

Maybe this will help you

(defun c:altObjs (/ cj a e l n at vlaObj)
  (if (setq a (getreal "\nNew height for (M)Texts/attributes: "))
    (if (setq cj (ssget '((0 . "*TEXT,INSERT"))))
      (while (setq e (ssname cj (setq n (if n (1+ n) 0))))
        (if (wcmatch (cdr (assoc 0 (setq l (entget e)))) "*TEXT")
	  (entmod (subst (cons 40 a) (assoc 40 l) l))
	  (if (= (vla-get-hasAttributes (setq vlaObj (vlax-ename->vla-object e))) :vlax-true)
	    (foreach at (vlax-safearray->list (variant-value (vla-getattributes vlaObj)))
	      (vla-put-Height at a)
	    )
	  )
	)
      )
    )
  )
  (princ)
)

 

Edited by GLAVCVS
  • Like 2
  • Thanks 1
Posted

Note: Note that the iteration uses foreach, not vlax-for. This is to make the code compatible with older versions of AutoCAD.

  • Thanks 1

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