Author Topic: How to create the realtime update?  (Read 1856 times)

0 Members and 1 Guest are viewing this topic.

gskelly

  • Newt
  • Posts: 185
How to create the realtime update?
« on: March 18, 2009, 07:02:51 PM »
Hello,

I wanted a routine to move text along its rotation angle so I came up with an easy solution using the move command. How would I do this without the move command but still see the text move in real time as I drag it along?

Thanks.

Code: [Select]
(defun nss:slide_text ( / *error* oom osa oos oce te en)
;;;=============================================================================
;;; A text slide function making use of ortho and snapang with move command.
;;;=============================================================================

    ;;;=========================================================================
    ;; Define the local error handler
    (defun *error* (msg)
       
        ;; Reset system variables to user values
        (if oom (setvar "ORTHOMODE" oom))
        (if osa (setvar "SNAPANG"   osa))
        (if oos (setvar "OSMODE"    oos))
        (if oce (setvar "CMDECHO"   oce))
       
        ;; Make sure the entity is not highlighted
        (if en (redraw (car en) 4))
    )
    ;;;=========================================================================

    ;; Get user to select a text or mtext
    (while (not te)
        (if (setq en (entsel "Select text to slide: "))
            (cond
                ((wcmatch (cdr (assoc 0 (setq te (entget (car en))))) "*TEXT")
                    te)
                (T
                    (setq te NIL)))))

    ;; Save the user's preferences for the system variables
    (setq oom (getvar "ORTHOMODE"))
    (setq osa (getvar "SNAPANG"))
    (setq oos (getvar "OSMODE"))
    (setq oce (getvar "CMDECHO"))

    ;; Set snapang to text rotation, ortho on, cmdecho off and osmode off
    (setvar "ORTHOMODE" 1)
    (setvar "SNAPANG" (cdr (assoc 50 te)))
    (setvar "OSMODE"    0)
    (setvar "CMDECHO"   0)

    ;; Run the move command with a pause for the displacement point
    (command "_MOVE" (cdr (assoc -1 te)) "" (cadr en) pause)
    (while (> (getvar "CMDACTIVE") 0)
        (command pause))
   
    ;; Restore the system variables to user's settings.
    (setvar "ORTHOMODE" oom)
    (setvar "SNAPANG"   osa)
    (setvar "OSMODE"    oos)
    (setvar "CMDECHO"   oce)
   
    ;; Exit quietly
    (prin1)
)
;;;=============================================================================
Bricscad v12

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to create the realtime update?
« Reply #1 on: March 18, 2009, 07:12:03 PM »
grread & entmake

That is one way.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

gskelly

  • Newt
  • Posts: 185
Re: How to create the realtime update?
« Reply #2 on: March 18, 2009, 10:32:16 PM »
Thanks Tim... I ended up getting pulled away to do taxes and my eyes hurt now so I'll have to do more reading on grread tomorrow.

My limited understanding of grread was to use for cursor position. I have attempted to simulate a fence selection method with grread and grdraw.

Hmmm... to mimic the move behaviour I guess I would create a copy and move it as I see fit based on the cursor position I get from grread until I get an enter or space keystroke.

Thanks again!
Bricscad v12