Hey, Im new to autocad scripting although im familiar with scripting in general.
I want to write a script that will select all text thats inside the current layout's scope, chspace to bring it to paperspace and then change their size.
I would really appreciate some help to point me in the right direction. I still couldnt find a proper reference for all auto lisp commands
Any help is greatly appreciated.
Thanks 🙂
Maybe this can start you off using Lisp:
(ssget "X" '((0 . "TEXT"))) ; select all Text objects
(command"_.Tilemode""0") ; goto Paper space
(command"_.Mspace") ; goto Model space
(command"_.Chspace""_P""") ; move all selected Text objects to Pspace
Not sure how you would like to change their size though.
You may have to step through each text object using lisp to change the Text's Height
@Anonymous wrote:
Hey, Im new to autocad scripting although im familiar with scripting in general.
I want to write a script that will select all text thats inside the current layout's scope, chspace to bring it to paperspace and then change their size.
I would really appreciate some help to point me in the right direction.
Hi normad,
the following code is just a demo and a starting point for what you are trying to achieve.
Should work as expected, if the Viewpot is a rectangular one and in WCS...
In this demo, as you have stated
"chspace to bring it to paperspace and then change their size."
I did modified the text size one and half times, as a demo, inside the entmod function.
(defun c:demo ( / ACVP ADOC ENT FLAG FLAG1 I LL MSLLPT MSURPT PSLLPT PSURPT SS UR) (if (and (= (getvar 'TILEMODE) 0) (= (getvar 'CVPORT) 1) );; and (progn (setq flag1 T) (vl-cmdf "_.mspace") (while (not flag) (setq flag1 (getkword "\nActivate the desired viewport, and press ENTER!")) (if (and (= (getvar 'TILEMODE) 0) (/= (getvar 'CVPORT) 1) (not flag1) );; and (setq flag T) );; if );; while (setq aDoc (vla-get-activedocument (vlax-get-acad-object)) AcVp (vla-get-activepviewport aDoc) );; setq (vla-put-target AcVp (vlax-3d-point '(0 0 0))) (vlax-invoke-method AcVp 'GetBoundingBox 'll 'ur) (setq psllpt (vlax-safearray->list ll);; PSpace viewport lower left point psurpt (vlax-safearray->list ur);; PSpace viewport upper right point msllpt (trans psllpt 3 2);; MSpace viewport lower left point msurpt (trans psurpt 3 2);; MSpace viewport upper right point );; setq (if (setq ss (ssget "_W" msurpt msllpt '((0 . "TEXT")))) (progn (vl-cmdf "_.chspace" ss "" "") (repeat (setq i (sslength ss)) (setq ent (entget (ssname ss (setq i (1- i))))) (entmod (subst (cons 40 (* (cdr (assoc 40 ent)) 1.5)) (assoc 40 ent) ent)) );; repeat );; progn );; if );; progn (prompt "\nCommand only allowed in Paper Space!") );; if (princ) );; demo
@Anonymous wrote:
I still couldnt find a proper reference for all auto lisp commands
Any help is greatly appreciated.
All the Auto LISP functions, can be found at AutoCAD 2015 Help under AutoCAD Developer Help Home Page in AutoLISP, in AUTOLISP,
under Functions By Name and Feature Reference
You may also get some ideas/tutorials at AfraLISP and Lee Mac Programming
HTH
Henrique