Jump to content

Dim Override text


woodman78

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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

 

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

Link to comment
Share on other sites

  • 5 weeks later...

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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