coombsie11 Posted October 11, 2008 Posted October 11, 2008 Hi all, I am hoping that someone can please help. I am after a button command that can : remember the current layer that I am working in switch current layer to layer "TEXT" prompt me to select a placement for DTEXT in STANDARD style let me type one or more lines of DTEXT once DTEXT is complete, upon final hit of the enter button - I need the previous current layer restored. I should end up with the text I have typed in layer "TEXT", in the correct style and the current layer unchanged from what I was working in. Got a feeling this is probably childs play for most of you guys. Fingers crossed. Quote
eldon Posted October 12, 2008 Posted October 12, 2008 I'm not sure that you need a button, if you understand how AutoCAD works with DTEXT. When you start Dtext, AutoCAD remembers the previous occasion in that editing session of Dtext with its Layer, Style, size, justification and rotation. The first instance has to be placed on the correct layer, and also the sequence is broken if you change UCS, or delete the previous text. The procedure goes like this. Assuming that you have already put the first line of text correctly, and you are then working in another layer. Start DTEXT, and the command line tells you what is the current text style and height, and asks for the start point. (If you can see the previous text, it changes to stippled linetype). Now just press enter (or space bar), the command line is Enter Text: and the input cursor will drop below the previous text. Now move your cross hair to where you want the next text to be and pick with the left button. The input cursor now moves to this place, and you can enter your text which is on the same layer as the previous text, even though you are in a different layer. At the end of the text input, the working layer reverts to what it was. You do not have to actually see your previous text which may be off the screen. It is a bit complicated, and to begin with, you can easily press the Enter or pick at the wrong time. But it saves a lot of time by enabling you to write text to one layer whilst you are working in another layer. Unfortunately it does not work with MTEXT, so it is one secret advantage of DTEXT Enjoy Quote
CmdrDuh Posted October 12, 2008 Posted October 12, 2008 your other option is to write a small program that detects the text command and does your layer settings for you. I can help you with that if you need Quote
VVA Posted October 13, 2008 Posted October 13, 2008 Hi all, I am hoping that someone can please help. Try it. Use this command CrOn - Command Reactor On CrOff - Command reactor off Load this lisp, type in command line CrON and draw DTEXT, DIMENSION, HATCH, LEADER or TABLE ;;; CrOn - Command Reactor On (defun C:CrOn () (vl-load-com) (setq *OldLayer* (getvar "CLAYER")) (vl-cmdf "_layer" "_make" "_DIM" "_color" 151 "" "") ;_DIMENSION (vl-cmdf "_layer" "_make" "_HATCH" "_color" 5 "" "") ;_HATCH (vl-cmdf "_layer" "_make" "_TEXT" "_color" 6 "" "") ;_TEXT (vl-cmdf "_layer" "_make" "_TABLE" "_color" 6 "" "") ;_TABLE (vl-cmdf "_layer" "_make" "_LEADER" "_color" 6 "" "") ;_LEADER (setvar "clayer" *OldLayer*) (setq *OldLayer* nil) (if *vlr-cmd* (progn (setq *vlr-cmd* nil) (vlr-remove-all :vlr-command-reactor) ) ;_ end of progn ) ;_ end of if (if (not *vlr-cmd*) (setq *vlr-cmd* (vlr-command-reactor "cmd" '((:vlr-commandwillstart . cmd-start) (:vlr-commandended . cmd-end) (:vlr-commandcancelled . cmd-end) (:vlr-commandfailed . cmd-end))))) ) ;;;CrOff - Command reactor off (defun C:CrOff () (setq *vlr-cmd* nil) (vlr-remove-all :vlr-command-reactor) ) ;;;;;;------------------------------------------------------------- (defun cmd-start (calling-reactor startcommandInfo / thecommandstart) (setq thecommandstart (nth 0 startcommandInfo)) (if (null *OldLayer*)(setq *OldLayer* (getvar "CLAYER"))) (cond ((wcmatch thecommandstart "DIM*") ;_Command DIM* (DIMALIGNED DIMLINEAR and so on) (setvar "clayer" "_DIM") ) ((wcmatch thecommandstart "*HATCH*") ;_Command *HATCH* (setvar "clayer" "_HATCH") ) ((wcmatch thecommandstart "*TEXT") ;_Command *TEXT (TEXT DTEXT) (setvar "clayer" "_TEXT") ) ((wcmatch thecommandstart "*TABLE") ;_Command *TABLE (setvar "clayer" "_TABLE") ) ((wcmatch thecommandstart "*LEADER") ;_Command *QLEADER MLEADER (setvar "clayer" "_LEADER") ) (t nil)) (princ)) ;;;------------------------------------------------------------- (defun cmd-end (calling-reactor cmd / cmd_name) (setq cmd_name (strcase (car cmd))) (if (or (wcmatch cmd_name "*HATCH*") (wcmatch cmd_name "DIM*") (wcmatch cmd_name "*TEXT") (wcmatch cmd_name "*TABLE") (wcmatch cmd_name "*LEADER") ) (progn (if *OldLayer* (setvar "clayer" *OldLayer*)) (setq *OldLayer* nil) )) (princ)) Quote
Lee Mac Posted October 13, 2008 Posted October 13, 2008 Not sure if this helps much, as quite a few people have already replied to your post, but I quickly modified an old LISP that I had to try to incorporate what you were looking for. My posted LISP is not at all tested however and so I do not even know if it will work. But let me know if it is any use. ; .: Text Inserter :. ; ; .: by Lee McDonnell :. (defun c:texta (/ dwgscal tagpt tagtxt) (princ "\nInitialising...") (if (not (getenv "tag:tsize")) (setenv "tag:tsize" (rtos (getvar "TEXTSIZE"))) ) ; end if (princ (strcat "\nType \"TEXTSET\" to Change Base Variables -- Current Settings:" "\n\tText Height: " (getenv "tag:tsize") ) ; end strcat ) ; end princ (defun *error*(msg) (setq varLst (list "CMDECHO" "OSMODE" "CLAYER" "DIMSCALE") oldVars (mapcar 'getvar varLst) ); end setq (if oldVars (mapcar 'setvar varLst oldVars) ); end if (princ "\nError Or Esc Pressed... ") (princ) ); end of *error* (if (/= (setq dwgscal (getreal "\nType Drawing Scale: 1:")) nil) (progn (while (and (/= (setq tagpt (getpoint "\nSelect Text Point: ")) nil) (/= (setq tagtxt (getstring "Specify Text: ")) "") ) ; end and (entmake (list '(0 . "TEXT") '(8 . "TEXT") (cons 10 tagpt) (cons 40 (* dwgscal (atof (getenv "tag:tsize")))) (cons 1 tagtxt) '(50 . 0.0) '(7 . "STANDARD") '(71 . 0) '(72 . 1) '(73 . 2) (cons 11 tagpt) ) ; end list ) ; end entmake (setq tagtxt "") ) ; end while ) ; end progn (alert "Drawing Scale Must Be Greater Than \nOr Equal To One.") ) ; end if (princ "\n\tFunction Complete.") (princ) ) ; end program ; Base Variables (defun c:textset (/ tsize) (if (not (getenv "tag:tsize")) (setenv "tag:tsize" (rtos (getvar "TEXTSIZE"))) ) ; end if (princ (strcat "\nCurrent Settings:" "\n\tText Height: " (getenv "tag:tsize") ) ; end strcat ) ; end princ (if (setq tsize (getreal (strcat "\nSpecify Text Height <" (getenv "tag:tsize") ">: "))) (setenv "tag:tsize" (rtos tsize)) ) ; end if (princ "\nBase Variables Set.") (princ) ) ; end program Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.