cutecutemissu Posted June 17, 2011 Share Posted June 17, 2011 (edited) Hello: Is there a command that can offset multiple text by a specify distance? Or some lsp routine that can do the job? even a routine that can offset a single text to either side by a specify distance will really help. I am relatively new to the lsp routine. Some help will really be appreciated. Edited June 17, 2011 by cutecutemissu Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 17, 2011 Share Posted June 17, 2011 Welcome to the forum Did you try the command : mirror with the system variable ( mirrtext ) set to 0 ? Quote Link to comment Share on other sites More sharing options...
cutecutemissu Posted June 17, 2011 Author Share Posted June 17, 2011 (edited) Welcome to the forum Did you try the command : mirror with the system variable ( mirrtext ) set to 0 ? Thanks for the reply. Unfortunately for the task I need to complete, the command, mirror, would not be much of a help. Because there are too many texts need to be moved, but they do not all need to be moved by a certain distance. Some texts need to be moved by a certain distance to one side of the existing text, some need to be moved to the other side of the existing text. I did found a lsp done by Tim B. Webb in 2000. The lsp code can offset text. The limitations of the code are the following: · It can only offset a text by a pre-specify distance written in the code. – means you cannot specify the offset distance · It can only offset one text at a time. · It can only offset the text to the left of the existing text – means you can’t offset the text to the other side. The positives about this lsp is that it does offset text so the layer, color are kept the same. It’s a credit to the original wirter of the lsp. I have tried to modify the lsp to overcome the limitations but with little success. Can anyone help? Please see below for the original lsp. ;Tip1634: OFFTX.LSP Offset Text (c)2000, Tim B. Webb[/font][/size] [font=Calibri][size=3] [/size][/font] [size=3][font=Calibri] (defun C:OFFTX (/ FTR HT STYL IF72 IF73 COLOR QUACKAS8 AS62CLY CLRS TIMS OLDERR RT ANG ANG1[/font][/size] [size=3][font=Calibri] TXVAL ASS10 ASS11 NXT PRMPT CURTX)[/font][/size] [size=3][font=Calibri] (setvar "cmdecho" 0)[/font][/size] [size=3][font=Calibri] (setq OLDERR *ERROR*)[/font][/size] [size=3][font=Calibri] (setq *ERROR* TRAPERR)[/font][/size] [size=3][font=Calibri] (setq TIMS t)[/font][/size] [size=3][font=Calibri] (setq CLRS (getvar "cecolor"))[/font][/size] [size=3][font=Calibri] (setq CLY (getvar "clayer"))[/font][/size] [size=3][font=Calibri] (initget "O o N n")[/font][/size] [size=3][font=Calibri] (setq PRMPT (getkword "\n<Offset>/New text: "))[/font][/size] [size=3][font=Calibri] (if (or (= PRMPT "N") (= PRMPT "n"))[/font][/size] [size=3][font=Calibri] (progn (while (= CURTX NIL) (setq CURTX (car (entsel "\nText to offset: "))))[/font][/size] [size=3][font=Calibri] (setq TXSTR (prompt "\nText: "))[/font][/size] [size=3][font=Calibri] (setq QUACK (entget CURTX))[/font][/size] [size=3][font=Calibri] (setq AS8 (cdr (assoc 8 QUACK)))[/font][/size] [size=3][font=Calibri] (setvar "clayer" AS8)[/font][/size] [size=3][font=Calibri] (if (= (setq AS62 (cdr (assoc 62 QUACK))) NIL)[/font][/size] [size=3][font=Calibri] (setq COLOR "bylayer")[/font][/size] [size=3][font=Calibri] (setq COLOR AS62)[/font][/size] [size=3][font=Calibri] ) ;_ end of if[/font][/size] [size=3][font=Calibri] (setq IF72 (cdr (assoc 72 QUACK)))[/font][/size] [size=3][font=Calibri] (setq IF73 (cdr (assoc 73 QUACK)))[/font][/size] [size=3][font=Calibri] (cond ((and (= IF72 0) (= IF73 0)) (setq TYPEX "L"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 1) (= IF73 0)) (setq TYPEX "C"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 4) (= IF73 2)) (setq TYPEX "M"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 4) (= IF73 0)) (setq TYPEX "M"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 2) (= IF73 0)) (setq TYPEX "R"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 0) (= IF73 3)) (setq TYPEX "TL"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 1) (= IF73 3)) (setq TYPEX "TC"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 2) (= IF73 3)) (setq TYPEX "TR"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 0) (= IF73 2)) (setq TYPEX "ML"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 1) (= IF73 2)) (setq TYPEX "MC"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 2) (= IF73 2)) (setq TYPEX "MR"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 0) (= IF73 1)) (setq TYPEX "BL"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 1) (= IF73 1)) (setq TYPEX "BC"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 2) (= IF73 1)) (setq TYPEX "BR"))[/font][/size] [size=3][font=Calibri] ) ;_ end of cond[/font][/size] [size=3][font=Calibri] (setq HT (cdr (assoc 40 QUACK)))[/font][/size] [size=3][font=Calibri] (setq STYL (cdr (assoc 7 QUACK)))[/font][/size] [size=3][font=Calibri] (setvar "textstyle" STYL)[/font][/size] [size=3][font=Calibri] (setq FTR (* HT 1.6667))[/font][/size] [size=3][font=Calibri] (setq RT (cdr (assoc 50 QUACK)))[/font][/size] [size=3][font=Calibri] (setq ANG (- RT (/ pi 2)))[/font][/size] [size=3][font=Calibri] (setq ANG1 (/ (* RT 180) pi))[/font][/size] [size=3][font=Calibri] (setq TXVAL (cdr (assoc 1 QUACK)))[/font][/size] [size=3][font=Calibri] (if (= TYPEX "L")[/font][/size] [size=3][font=Calibri] (progn (setq ASS10 (cdr (assoc 10 QUACK)))[/font][/size] [size=3][font=Calibri] (setq NXT (polar ASS10 ANG FTR))[/font][/size] [size=3][font=Calibri] (command "cecolor" COLOR)[/font][/size] [size=3][font=Calibri] (command "Dtext" NXT HT ANG1)[/font][/size] [size=3][font=Calibri] ) ;_ end of progn[/font][/size] [size=3][font=Calibri] (progn (setq ASS11 (cdr (assoc 11 QUACK)))[/font][/size] [size=3][font=Calibri] (setq NXT (polar ASS11 ANG FTR))[/font][/size] [size=3][font=Calibri] (command "cecolor" COLOR)[/font][/size] [size=3][font=Calibri] (command "Dtext" "j" TYPEX NXT HT ANG1)[/font][/size] [size=3][font=Calibri] ) ;_ end of progn[/font][/size] [size=3][font=Calibri] ) ;_ end of if[/font][/size] [size=3][font=Calibri] ) ;_ end of progn[/font][/size] [size=3][font=Calibri] ) ;_ end of if[/font][/size] [size=3][font=Calibri] (if (or (= PRMPT "O") (= PRMPT "o") (= PRMPT NIL))[/font][/size] [size=3][font=Calibri] (progn[/font][/size] [size=3][font=Calibri] (while TIMS[/font][/size] [size=3][font=Calibri] (setq TIMS (grread t 2 1))[/font][/size] [size=3][font=Calibri] (if (= (cadr TIMS) 13)[/font][/size] [size=3][font=Calibri] (setq TIMS NIL)[/font][/size] [size=3][font=Calibri] ) ;_ end of if[/font][/size] [size=3][font=Calibri] (if (= CURTX NIL)[/font][/size] [size=3][font=Calibri] (progn (while (= CURTX NIL) (setq CURTX (car (entsel "\nText to offset: "))))[/font][/size] [size=3][font=Calibri] ) ;_ end of progn[/font][/size] [size=3][font=Calibri] (setq CURTX (car (entsel "\nText to offset: ")))[/font][/size] [size=3][font=Calibri] ) ;_ end of if[/font][/size] [size=3][font=Calibri] (if (= CURTX NIL)[/font][/size] [size=3][font=Calibri] (setq TIMS NIL)[/font][/size] [size=3][font=Calibri] (progn (setq QUACK (entget CURTX))[/font][/size] [size=3][font=Calibri] (setq AS8 (cdr (assoc 8 QUACK)))[/font][/size] [size=3][font=Calibri] (setvar "clayer" AS8)[/font][/size] [size=3][font=Calibri] (if (= (setq AS62 (cdr (assoc 62 QUACK))) NIL)[/font][/size] [size=3][font=Calibri] (setq COLOR "bylayer")[/font][/size] [size=3][font=Calibri] (setq COLOR AS62)[/font][/size] [size=3][font=Calibri] ) ;_ end of if[/font][/size] [size=3][font=Calibri] (setq IF72 (cdr (assoc 72 QUACK)))[/font][/size] [size=3][font=Calibri] (setq IF73 (cdr (assoc 73 QUACK)))[/font][/size] [size=3][font=Calibri] (cond ((and (= IF72 0) (= IF73 0)) (setq TYPEX "L"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 1) (= IF73 0)) (setq TYPEX "C"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 4) (= IF73 2)) (setq TYPEX "M"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 4) (= IF73 0)) (setq TYPEX "M"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 2) (= IF73 0)) (setq TYPEX "R"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 0) (= IF73 3)) (setq TYPEX "TL"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 1) (= IF73 3)) (setq TYPEX "TC"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 2) (= IF73 3)) (setq TYPEX "TR"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 0) (= IF73 2)) (setq TYPEX "ML"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 1) (= IF73 2)) (setq TYPEX "MC"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 2) (= IF73 2)) (setq TYPEX "MR"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 0) (= IF73 1)) (setq TYPEX "BL"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 1) (= IF73 1)) (setq TYPEX "BC"))[/font][/size] [size=3][font=Calibri] ((and (= IF72 2) (= IF73 1)) (setq TYPEX "BR"))[/font][/size] [size=3][font=Calibri] ) ;_ end of cond[/font][/size] [size=3][font=Calibri] (setq HT (cdr (assoc 40 QUACK)))[/font][/size] [size=3][font=Calibri] (setq STYL (cdr (assoc 7 QUACK)))[/font][/size] [size=3][font=Calibri] (setvar "textstyle" STYL)[/font][/size] [size=3][font=Calibri] (setq FTR (* HT 1.6667))[/font][/size] [size=3][font=Calibri] (setq RT (cdr (assoc 50 QUACK)))[/font][/size] [size=3][font=Calibri] (setq ANG (- RT (/ pi 2)))[/font][/size] [size=3][font=Calibri] (setq ANG1 (/ (* RT 180) pi))[/font][/size] [size=3][font=Calibri] (setq TXVAL (cdr (assoc 1 QUACK)))[/font][/size] [size=3][font=Calibri] (if (= TYPEX "L")[/font][/size] [size=3][font=Calibri] (progn (setq ASS10 (cdr (assoc 10 QUACK)))[/font][/size] [size=3][font=Calibri] (setq NXT (polar ASS10 ANG FTR))[/font][/size] [size=3][font=Calibri] (command "cecolor" COLOR)[/font][/size] [size=3][font=Calibri] (command "text" NXT HT ANG1 TXVAL)[/font][/size] [size=3][font=Calibri] ) ;_ end of progn[/font][/size] [size=3][font=Calibri] (progn (setq ASS11 (cdr (assoc 11 QUACK)))[/font][/size] [size=3][font=Calibri] (setq NXT (polar ASS11 ANG FTR))[/font][/size] [size=3][font=Calibri] (command "cecolor" COLOR)[/font][/size] [size=3][font=Calibri] (command "text" "j" TYPEX NXT HT ANG1 TXVAL)[/font][/size] [size=3][font=Calibri] ) ;_ end of progn[/font][/size] [size=3][font=Calibri] ) ;_ end of if[/font][/size] [size=3][font=Calibri] ) ;_ end of progn[/font][/size] [size=3][font=Calibri] ) ;_ end of if[/font][/size] [size=3][font=Calibri] ) ;_ end of while[/font][/size] [size=3][font=Calibri] ) ;_ end of progn[/font][/size] [size=3][font=Calibri] ) ;_ end of if[/font][/size] [size=3][font=Calibri] (setvar "clayer" CLY)[/font][/size] [size=3][font=Calibri] (setvar "cecolor" CLRS)[/font][/size] [size=3][font=Calibri] (princ "\nDone.")[/font][/size] [size=3][font=Calibri] (setq *ERROR* OLDERR)[/font][/size] [size=3][font=Calibri] (princ)[/font][/size] [size=3][font=Calibri]) ;_ end of defun[/font][/size] [font=Calibri][size=3] [/size][/font] [size=3][font=Calibri](defun TRAPERR (MSG)[/font][/size] [size=3][font=Calibri] (if *ERROR*[/font][/size] [size=3][font=Calibri] (princ (strcat "\nTrapped Error : " MSG))[/font][/size] [size=3][font=Calibri] ) ;_ end of if[/font][/size] [size=3][font=Calibri] (setq *ERROR* OLDERR)[/font][/size] [size=3][font=Calibri] (princ)[/font][/size] [size=3][font=Calibri]) ;_ end of defun[/font][/size] [font=Calibri][size=3] [/size][/font] [font=Calibri][size=3] [/size][/font] [font=Calibri][size=3] [/size][/font] Edited April 2, 2015 by SLW210 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 17, 2011 Share Posted June 17, 2011 Please read THIS for Code posting . Are you trying to move some texts to specific distance ? and others to another specific distance ? If yes, please mention the two distances to allow me to include these distance in the routine . Thanks Quote Link to comment Share on other sites More sharing options...
cutecutemissu Posted June 17, 2011 Author Share Posted June 17, 2011 Please read THIS for Code posting . Are you trying to move some texts to specific distance ? and others to another specific distance ? If yes, please mention the two distances to allow me to include these distance in the routine . Thanks The distances that I need to offset text are different most of the time. Would it be possible to write the routine so that the users have the option to input the offset distance? I was trying to modify the above code to do that, but it was not an easy thing to do. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 17, 2011 Share Posted June 17, 2011 Hope this what you mean . (defun c:Test (/ ss rep dis i ssNme p) (vl-load-com) ; Tharwat 17. 06. 2011 (if (and (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT")))) (progn (initget "Left Right") (setq rep (getkword "\n Specify the Direction [left/Right]:")) ) (setq dis (getdist "\n Specify the Distance :")) ) (if (eq rep "Left") (repeat (setq i (sslength ss)) (setq ssNme (ssname ss (setq i (1- i)))) (vla-move (vlax-ename->vla-object ssNme) (vlax-3d-point (setq p (cdr (assoc 10 (entget ssNme))))) (vlax-3d-point (list (- (car p) dis) (cadr p))) ) ) (repeat (setq i (sslength ss)) (setq ssNme (ssname ss (setq i (1- i)))) (vla-move (vlax-ename->vla-object ssNme) (vlax-3d-point (setq p (cdr (assoc 10 (entget ssNme))))) (vlax-3d-point (list (+ (car p) dis) (cadr p))) ) ) ) (princ) ) (princ) ) Tharwat Quote Link to comment Share on other sites More sharing options...
cutecutemissu Posted June 17, 2011 Author Share Posted June 17, 2011 Hope this what you mean . This is awesome! Would it be possible to have the option to move the text up/down? Because offset to the left/right option is useful for texts that are written vertically; offset to the top/down will be useful for text that are written horizontally. Many thanks again! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 17, 2011 Share Posted June 17, 2011 Here it goes for all directions . (defun c:Test (/ ss rep dis i ssNme p) (vl-load-com) ; Tharwat 17. 06. 2011 (if (and (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT")))) (progn (initget "Left Right Up Down") (setq rep (getkword "\n Specify the Direction [left/Right/Up/Down]:" ) ) ) (setq dis (getdist "\n Specify the Distance :")) ) (cond ((eq rep "Left") (repeat (setq i (sslength ss)) (setq ssNme (ssname ss (setq i (1- i)))) (vla-move (vlax-ename->vla-object ssNme) (vlax-3d-point (setq p (cdr (assoc 10 (entget ssNme))))) (vlax-3d-point (list (- (car p) dis) (cadr p))) ) ) ) ((eq rep "Right") (repeat (setq i (sslength ss)) (setq ssNme (ssname ss (setq i (1- i)))) (vla-move (vlax-ename->vla-object ssNme) (vlax-3d-point (setq p (cdr (assoc 10 (entget ssNme))))) (vlax-3d-point (list (+ (car p) dis) (cadr p))) ) ) ) ((eq rep "Up") (repeat (setq i (sslength ss)) (setq ssNme (ssname ss (setq i (1- i)))) (vla-move (vlax-ename->vla-object ssNme) (vlax-3d-point (setq p (cdr (assoc 10 (entget ssNme))))) (vlax-3d-point (list (car p) (+ (cadr p) dis)) ) ) ) ) ((eq rep "Down") (repeat (setq i (sslength ss)) (setq ssNme (ssname ss (setq i (1- i)))) (vla-move (vlax-ename->vla-object ssNme) (vlax-3d-point (setq p (cdr (assoc 10 (entget ssNme))))) (vlax-3d-point (list (car p) (- (cadr p) dis)) ) ) ) ) ) (princ) ) (princ) ) Tharwat Quote Link to comment Share on other sites More sharing options...
cutecutemissu Posted June 17, 2011 Author Share Posted June 17, 2011 Many Thanks, Tharwat!! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 18, 2011 Share Posted June 18, 2011 Many Thanks, Tharwat!! You're welcome Quote Link to comment Share on other sites More sharing options...
CHLUCFENG Posted June 18, 2011 Share Posted June 18, 2011 Nice work Tharwat. Your code has enhanced since the first time you helped me. Thanks, then and now. Good to see you still moving forward. CL Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 18, 2011 Share Posted June 18, 2011 Nice work Tharwat. Your code has enhanced since the first time you helped me. Thanks, then and now. Good to see you still moving forward. CL I am glad to hear that , and thanks for the nice words CL . Regards. Tharwat Quote Link to comment Share on other sites More sharing options...
boxero Posted April 2, 2015 Share Posted April 2, 2015 Hi Great lisp, it is nearly something I need. Could someone help to modify this great lisp to move All texts from layers (which I could define and add inside lisp) about the same distance right and then up. I want to do it automatically so I don't want be asked about how much to move text left right or left as it always would be the same. Regards Quote Link to comment Share on other sites More sharing options...
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.