woodman78 Posted January 21, 2010 Share Posted January 21, 2010 Does anybody have a lisp that will launch a dim set to the current dimstyle but with override text already set. I want one that will read "Existing Road". Thanks. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 21, 2010 Share Posted January 21, 2010 Hi Woodman, Try this: ;; Dimension Reactor ~ Lee Mac - 21.01.10 (defun c:DimReact nil (vl-load-com) (if (not (vl-position "DIMOVER" (mapcar (function strcase) (mapcar (function vlr-data) (mapcar (function cadr) (vlr-reactors :vlr-command-reactor)))))) (progn (vlr-command-reactor "DIMOVER" (list (cons :vlr-commandEnded 'DimOver))) (princ "\n<< Reactor Initiated >>")) (princ "\n** Reactor Already Running **")) (princ)) (defun DimOver (Reactor Arguments / ent obj) (if (and (wcmatch (strcase (car Arguments)) "*DIM*") (setq ent (entlast)) (wcmatch (strcase (vla-get-ObjectName (setq obj (vlax-ename->vla-object ent)))) "*DIMENSION*")) (vla-put-TextOverride obj "Existing Road")) (princ)) (defun c:DimReactOFF (/ Reac) (vl-load-com) (if (and (setq Reac (car (vl-remove-if-not (function (lambda (x) (eq "DIMOVER" (strcase (vlr-data x))))) (mapcar (function cadr) (vlr-reactors :vlr-command-reactor))))) (vlr-added-p Reac)) (progn (vlr-remove Reac) (princ "\n<< Reactor Deactivated >>")) (princ "\n** Reactor Not Running **")) (princ)) Type "DimReact" to switch it on (only need to do this once per session), and "DimReactOff" to switch it off. Quote Link to comment Share on other sites More sharing options...
woodman78 Posted January 22, 2010 Author Share Posted January 22, 2010 Thanks for that LeeMac. Can it be setup as a toggle so that I can toggle it on and off with a button on a ribbon rather than having 2?? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 22, 2010 Share Posted January 22, 2010 Certainly, all the code was there - just needed a small modification ;; Dimension Reactor ~ Lee Mac - 21.01.10 (defun c:DimReact (/ Reac) (vl-load-com) (if (not (and (setq Reac (car (vl-remove-if-not (function (lambda (x) (eq "DIMOVER" (strcase (cond ((vlr-data x)) ("")))))) (mapcar (function cadr) (vlr-reactors :vlr-command-reactor))))) (vlr-added-p Reac))) (progn (vlr-command-reactor "DIMOVER" (list (cons :vlr-commandEnded 'DimOver))) (princ "\n<< Reactor Initiated >>")) (progn (vlr-remove Reac) (princ "\n<< Reactor Deactivated >>"))) (princ)) (defun DimOver (Reactor Arguments / ent obj) (if (and (wcmatch (strcase (car Arguments)) "*DIM*") (setq ent (entlast)) (wcmatch (strcase (vla-get-ObjectName (setq obj (vlax-ename->vla-object ent)))) "*DIMENSION*")) (vla-put-TextOverride obj "Existing Road")) (princ)) Quote Link to comment Share on other sites More sharing options...
woodman78 Posted January 22, 2010 Author Share Posted January 22, 2010 LeeMac, I'm getting this error on running it: Command: dimreact ; error: bad argument type: stringp nil Quote Link to comment Share on other sites More sharing options...
woodman78 Posted January 22, 2010 Author Share Posted January 22, 2010 LeeMac I have looked at this in VLIDE to try to spot the problem. The following shoes up on the error trace: ............... LOG Error trace ............... :ERROR-BREAK [2] (STRCASE nil) [3] (# #) [4] (VL-REMOVE-IF-NOT (quote #) (#)) [5] (C:DIMREACT) :CALLBACK-ENTRY :ARQ-SUBR-CALLBACK ............... ............... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 22, 2010 Share Posted January 22, 2010 Code updated, please try again Quote Link to comment Share on other sites More sharing options...
CADMASTER1128 Posted January 22, 2010 Share Posted January 22, 2010 Was a LISP needed for this? Is it not possible to Right Click (on dim) --> Properties --> and then select Text Overide? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 22, 2010 Share Posted January 22, 2010 Was a LISP needed for this? Is it not possible to Right Click (on dim) --> Properties --> and then select Text Overide? Yeah, but this may is quicker Quote Link to comment Share on other sites More sharing options...
CADMASTER1128 Posted January 22, 2010 Share Posted January 22, 2010 Of course, why didnt I think of that? LOL Quote Link to comment Share on other sites More sharing options...
woodman78 Posted January 25, 2010 Author Share Posted January 25, 2010 Thanks for that LeeMac. Worked a treat.. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 25, 2010 Share Posted January 25, 2010 Thanks for that LeeMac. Worked a treat.. You're welcome Woodman Quote Link to comment Share on other sites More sharing options...
woodman78 Posted February 24, 2010 Author Share Posted February 24, 2010 LeeMac, I have this up and running now in my ribbon but is there a way to set the override text to be on more than one line? Thanks. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 24, 2010 Share Posted February 24, 2010 LeeMac, I have this up and running now in my ribbon but is there a way to set the override text to be on more than one line? Thanks. Yes, use the "\\X" symbol: ;; Dimension Reactor ~ Lee Mac - 21.01.10 (defun c:DimReact (/ Reac) (vl-load-com) (if (not (and (setq Reac (car (vl-remove-if-not (function (lambda (x) (eq "DIMOVER" (strcase (cond ((vlr-data x)) ("")))))) (mapcar (function cadr) (vlr-reactors :vlr-command-reactor))))) (vlr-added-p Reac))) (progn (vlr-command-reactor "DIMOVER" (list (cons :vlr-commandEnded 'DimOver))) (princ "\n<< Reactor Initiated >>")) (progn (vlr-remove Reac) (princ "\n<< Reactor Deactivated >>"))) (princ)) (defun DimOver (Reactor Arguments / ent obj) (if (and (wcmatch (strcase (car Arguments)) "*DIM*") (setq ent (entlast)) (wcmatch (strcase (vla-get-ObjectName (setq obj (vlax-ename->vla-object ent)))) "*DIMENSION*")) (vla-put-TextOverride obj "Existing\\XRoad")) (princ)) 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.