Author Topic: Select a text w/out pick'n it.  (Read 2165 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Swamp Rat
  • Posts: 566
Select a text w/out pick'n it.
« on: April 22, 2006, 08:29:12 PM »
Hey all, could you enlighten me with an idea of how to select a text previously created.

Here's the issue.
Code: [Select]
  (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)

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.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Select a text w/out pick'n it.
« Reply #1 on: April 22, 2006, 09:17:28 PM »
You could try something like this ..
Code: [Select]
(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
)

Using these library routines ..
Code: [Select]
;; // 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.")
  )
)
;;;------------------------------------------------------------------
;;;------------------------------------------------------------------
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Select a text w/out pick'n it.
« Reply #2 on: April 22, 2006, 09:31:56 PM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.