Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

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??

Posted

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))

Posted

LeeMac, I'm getting this error on running it:

 

Command: dimreact

; error: bad argument type: stringp nil

Posted

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

...............

 

...............

Posted

Was a LISP needed for this? Is it not possible to Right Click (on dim) --> Properties --> and then select Text Overide?

Posted
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 :twisted:

Posted

Of course, why didnt I think of that? LOL

Posted

Thanks for that LeeMac. Worked a treat..

  • 5 weeks later...
Posted

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.

Posted
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))

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...