Code Red > AutoLISP (Vanilla / Visual)
Select a text w/out pick'n it.
(1/1)
Hangman:
Hey all, could you enlighten me with an idea of how to select a text previously created.
Here's the issue.
--- Code: --- (setq pt1 (getpoint "\nSelect Corner or Edge of Entity: "))
(setq ang1 (getangle pt1 "\nSelect angle or Return for 45: "))
(if (= ang1 nil)
(setq ang1 (/ pi 4))
);end if
(setq ang2 (cvunit ang1 "radian" "degree"))
(command "dtext" pt1 ang2 pause)
--- End code ---
So, after the dtext has been written. Be it two, three, or four lines or more, is it possible to assign each line of text to a variable without physically selecting each line ? And if so, how can this be done ?
Thank you.
Kerry:
You could try something like this ..
--- Code: ---(DEFUN test (/ dtext-ss dtext-list index ent)
(kb:mark)
(VL-CMDF "dtext" '(0 0 0) 35 0.0 pause)
(SETQ dtext-ss (kb:catch)
dtext-list '()
index -1
)
(SETQ dtext-list
(REVERSE
(WHILE
(SETQ ent (SSNAME dtext-ss (SETQ index (1+ index))))
(SETQ
dtext-list (CONS (CDR (ASSOC 1 (ENTGET ent)))
dtext-list
)
)
)
)
)
dtext-list
)
--- End code ---
Using these library routines ..
--- Code: ---;; // MarkCatch.LSP
;; based on New Rider Articles { I think }
;;;-----------------------------------------------------------------------------------
;;;-----------------------------------------------------------------------------------
;;; KB:mark
;;; Mark data base to allow KB:catch.
;;;
(defun kb:mark ( / val)
(setq val (getvar "cmdecho"))
(setvar "cmdecho" 0)
(if (setq *KG:mark (entlast))
nil
(progn (entmake '((0 . "POINT") (10 0.0 0.0 0.0)))
(setq *KG:mark (entlast))
(entdel *KG:mark)
)
)
(setvar "cmdecho" val)
(princ)
)
;;;-----------------------------------------------------------------------------------
;;;-----------------------------------------------------------------------------------
;;; KB:catch
;;; returns selection set of entities since last KB:mark.
;;;
(defun kb:catch (/ ss tmp)
(if *KG:mark
(progn (setq ss (ssadd))
(while (setq *KG:mark (entnext *KG:mark)) (ssadd *KG:mark ss))
(command "._select" ss "")
(setq tmp ss)
)
(alert "*KG:mark not set. \n Run KB:mark before KB:catch.")
)
)
;;;------------------------------------------------------------------
;;;------------------------------------------------------------------
--- End code ---
CAB:
See the subroutines in this lisp.
http://www.theswamp.org/index.php?topic=7794.msg99078#msg99078
Navigation
[0] Message Index
Go to full version