View Full Version : Routine similar to qselect, help
jgardner.79905
2005-09-23, 05:14 PM
I am trying to come up with a routine that will automatically select all the "text" in my drawing by "style" "=" to "Text4.5" and automatically change the width factor to .6, kinda like qselect but through a lisp routine rather than going through the qselect dialog. Is this even possible or am i dreaming? Anyone have any ideas?!!!!!
mathew.worland
2005-09-23, 05:32 PM
Use a selection set and cycle through each text item, if the style = Text4.5 then change the width to .6
Matt Worland
jgardner.79905
2005-09-23, 06:02 PM
I am new at creating a selection set could you give me an example maybe?
mathew.worland
2005-09-23, 06:19 PM
I am new at creating a selection set could you give me an example maybe?
(setq ssSelection (ssget "X"(list (cons 0 "text,mtext"))))
(repeat (setq intCount (sslength ssSelection))
(setq intCount (1- intCount)
entSelection (ssname ssSelection intCount)
objSelection (vlax-ename->vla-object entSelection)
)
(if (= (vla-get-stylename objSelection) "Text4.5")
(vla-put-ScaleFactor objSelection 0.6))
(princ))
I have not tested this, but give it a try.
jgardner.79905
2005-09-23, 06:38 PM
Seems to almost work. I asks to select objects he when enter is hit it returns
*Cancel*
bad argument typ: lsetsetp nil
I would fix it myself but you used some commands I'm not familiar with, and it seems that the way you have set it up will work a lot better that I might. Think you can still help?
mathew.worland
2005-09-23, 06:45 PM
Try to copy it again. I mis-spelled a word. I got this version to work on my computer with a different style name. Sorry about the typo.
jgardner.79905
2005-09-23, 06:54 PM
shouled I recopy your original post, because there doesn't seem to be anything in your lat reply.
mathew.worland
2005-09-23, 06:56 PM
shouled I recopy your original post, because there doesn't seem to be anything in your lat reply.
Yes, I edited the post to show the correct version.
tyeelaw13
2005-10-11, 11:24 PM
here's the cht lisp routine.. you can select all text and change style, width, height, etc.. But it won't work on mtext!
[Moderator Action = ON]
Please do not post Copyright Code here on AUGI.com
AUGI can not take any chances with regard Copyright infringements that may exist.
From the header of the file posted...
;;; CHTEXT.lsp
;;; (C) Copyright 1988-1992 by Autodesk, Inc.
;;;
;;; This program is copyrighted by Autodesk, Inc. and is licensed
;;; to you under the following conditions. You may not distribute
;;; or publish the source code of this program in any form.
Copyright file has been removed.
Thanks for your understanding,
Mike
Forum Moderator
[Moderator Action = ON]
CAB2k
2005-10-12, 10:09 PM
Another routine.
One thing to consider is that Mtext has no ScaleFactor. The mtext width factor is
controlled by the text style width factor.
(defun c:test ()
(text_width_update "Text4.5" 0.6)
(princ)
)
(defun text_width_update (txtstyle txtwidth / ent ss elist str)
(setq ss (ssget "X"
(list '(0 . "TEXT") (cons 7 txtstyle))
)
)
(while (and ss (> (sslength ss) 0))
(setq ent (ssname ss 0))
(setq elist (entget ent))
(setq elist (subst (cons 41 txtwidth) (assoc 41 elist) elist))
(entmod elist)
(entupd ent)
(ssdel ent ss)
)
)
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.