Author Topic: Graphically Dimoverride  (Read 290 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2055
Graphically Dimoverride
« on: May 07, 2020, 04:28:03 PM »
Is it possible to graphically modify dimensions line spacing "DIMDLI" from one value to another and change all dimensions within a drawing to reflect this change?

(setvar "DIMDLI" 0.25) ;old
(setvar "DIMDLI" 0.1875) ;new

(command "_dimoverride" "_DIMDLI" 0.1875 "" pause "")
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2055
Re: Graphically Dimoverride
« Reply #1 on: May 07, 2020, 06:02:38 PM »
Pardon my brain fart. I now realize that what I asked for is impossible. I will just have to move forward with modifying my dimstyle settings and change any existing dimensions with the routine below.


For example:
Code - Auto/Visual Lisp: [Select]
  1. (defun C:DIMOFFSET (/           OBJ_PICK    DIM_SIDE    DIM_PICK
  2.                     DIM_ENT     DIM_NODE1   DIM_NODE2   DIM_INT
  3.                     DIM_DEF     DIM_POINT   DIM_OBJ
  4.                    )
  5.   (ARCH:F_S-VAR)
  6.   (command ".undo" "group")
  7.   (if (not DIM_OFFS)
  8.     (setq DIM_OFFS (* 0.25 (getvar "dimscale")))
  9.   )
  10.   (initget 2)
  11.   (setq DIM_OFFS (DEFDIST DIM_OFFS "\n* Enter Offset Distance:"))
  12.   (setq DIM_PICK 1
  13.         OBJ_PICK 1
  14.   )
  15.   (while (and DIM_PICK (/= OBJ_PICK "DIMENSION"))
  16.     (setq DIM_PICK (entsel "\n* Select Dimension to Offset *"))
  17.     (if DIM_PICK
  18.       (progn
  19.         (setq OBJ_PICK (cdr (assoc 0 (entget (car DIM_PICK))))
  20.               DIM_ENT  (entget (car DIM_PICK))
  21.         )
  22.         (if (/= OBJ_PICK "DIMENSION")
  23.           (prompt "\n* This is not a Dimension *")
  24.         )
  25.       )
  26.     )
  27.   )
  28.   (if (or (= (cdr (assoc 70 DIM_ENT)) 32)                                      
  29.           (= (cdr (assoc 70 DIM_ENT)) 160)
  30.           (= (cdr (assoc 70 DIM_ENT)) 33)
  31.           (= (cdr (assoc 70 DIM_ENT)) 161)
  32.       )
  33.     (progn
  34.       (setq DIM_SIDE (getpoint "\n* Pick Side to Offset *"))
  35.       (if DIM_SIDE
  36.         (if (and (= OBJ_PICK "DIMENSION") (> DIM_OFFS 0))
  37.           (progn
  38.             (setvar "osmode" 0)
  39.             (setq DIM_ENT   (entget (car DIM_PICK))
  40.                   DIM_NODE1 (cdr (assoc 13 DIM_ENT))
  41.                   DIM_NODE2 (cdr (assoc 14 DIM_ENT))
  42.                   DIM_DEF   (cdr (assoc 10 DIM_ENT))
  43.                   DIM_INT   (polar DIM_SIDE (angle DIM_DEF DIM_NODE2) 12.0)
  44.                   DIM_POINT (inters (polar DIM_DEF
  45.                                            (+ (angle DIM_DEF
  46.                                                      DIM_NODE2
  47.                                               )
  48.                                               (DTR 90.0)
  49.                                            )
  50.                                            12.0
  51.                                     )
  52.                                     DIM_DEF
  53.                                     DIM_SIDE
  54.                                     DIM_INT
  55.                                     nil
  56.                             )
  57.             )
  58.             (command ".copy"
  59.                      DIM_PICK
  60.                      ""
  61.                      DIM_NODE2
  62.                      (polar DIM_NODE2
  63.                             (angle
  64.                               DIM_POINT
  65.                               DIM_SIDE
  66.                             )
  67.                             DIM_OFFS
  68.                      )
  69.             )
  70.             (setq DIM_ENT (entget (entlast))
  71.                   DIM_OBJ (subst (cons 13 DIM_NODE1)
  72.                                  (assoc 13 DIM_ENT)
  73.                                  DIM_ENT
  74.                           )
  75.             )
  76.             (entmod DIM_OBJ)
  77.            
  78.             (setq DIM_ENT (entget (entlast))
  79.                   DIM_OBJ (subst (cons 14 DIM_NODE2)
  80.                                  (assoc 14 DIM_ENT)
  81.                                  DIM_ENT
  82.                           )
  83.             )
  84.             (entmod DIM_OBJ)
  85.             (setq DIM_ENT (entget (entlast))
  86.                   DIM_DEF (polar DIM_DEF
  87.                                  (angle DIM_POINT DIM_SIDE)
  88.                                  DIM_OFFS
  89.                           )
  90.                   DIM_OBJ (subst (cons 10 DIM_DEF)
  91.                                  (assoc 10 DIM_ENT)
  92.                                  DIM_ENT
  93.                           )
  94.             )
  95.             (entmod DIM_OBJ)
  96.           )
  97.         )
  98.       )
  99.     )
  100.     (if DIM_PICK
  101.       (prompt
  102.         "\n* This is neither a Rotated nor an Aligned Dimension *"
  103.       )
  104.     )
  105.   )
  106.   (command ".undo" "end")
  107.   (initget "Y")  
  108.   (setq tmp
  109.          (getkword
  110.            "\n* Keep original picked dimension: [Yes] or [enter] for No *"
  111.          )
  112.   )  
  113.   (cond
  114.     ((/= tmp "Y")(entdel (car DIM_PICK)))
  115.     ((= tmp "Y")(princ))
  116.   )
  117.   (ARCH:F_R-VAR)
  118.   (princ)
  119. )
  120. [code]
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

tombu

  • Newt
  • Posts: 187
  • ByLayer=>Not0
Re: Graphically Dimoverride
« Reply #2 on: May 07, 2020, 11:38:50 PM »
This is what I use to toggle spacing between 1.0 and 0.8 since the default spacing seems to much.
Code: [Select]
(vl-load-com)
(defun c:DimLnSpcX ( / ss i ent el)
  (if (setq ss (ssget '((0 . "Dimension"))))
    (repeat (setq i (sslength ss))
      (setq ent (ssname ss (setq i (1- i)))
        el (entget ent '("ACAD"))
      )
      (if(= 1(cdr(assoc 41 el)))
(entmod (subst (cons 41 0.8)(assoc 41 el)el))
(entmod (subst (cons 41 1.0)(assoc 41 el)el))
      );; if
    );; repeat
  );; if
  (princ)
);; DimLnSpcX
I've added a macro for it to both Shortcut Menus in the CUI 'Dimension Object Menu' and 'Dimension Objects Menu' so I can right-click a selection of Dimensions to toggle the line spacing.
Code: [Select]
^P(or C:DimLnSpcX (load "DimLnSpcX.lsp"));DimLnSpcX
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

GDF

  • Water Moccasin
  • Posts: 2055
Re: Graphically Dimoverride
« Reply #3 on: May 08, 2020, 05:34:03 AM »
Thanks Tombu

I will have to play with this.

My dimscale is at 96.0 and my dimdli is at 0.25. I want the space set to dimdli 0.1875 and have the dimension spacing reflect that change graphically. I know how to modify the dimstyle.

At dimscale 96.0, the change would be from 24" baseline spacing to 18" baseline spacing.

I could not get your routine to work for me...See my modified code below:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:DimLnSpcX ( / ss i ent el)
  2.   (if (setq ss (ssget "x" '((0 . "Dimension"))))
  3.     (repeat (setq i (sslength ss))
  4.       (setq ent (ssname ss (setq i (1- i)))
  5.                 el      (entget ent '("ACAD"))
  6.       )
  7.       (if (= 1 (cdr (assoc 41 el)))
  8.                 (entmod (subst (cons 41 24.0)(assoc 41 el) el))
  9.                 (entmod (subst (cons 41 18.0)(assoc 41 el) el))
  10.       )
  11.     )
  12.   )
  13.   (princ))
  14.  
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

tombu

  • Newt
  • Posts: 187
  • ByLayer=>Not0
Re: Graphically Dimoverride
« Reply #4 on: May 08, 2020, 04:06:44 PM »
Sorry my code is for the Mtext line spacing of the dimension. The default for it is 1.0 while I prefer 0.8. What you're looking for would be in extended data. I'll see if I can make one for that.
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

GDF

  • Water Moccasin
  • Posts: 2055
Re: Graphically Dimoverride
« Reply #5 on: May 09, 2020, 10:04:13 AM »
I will restate my post:
"Pardon my brain fart. I now realize that what I asked for is impossible. I will just have to move forward with modifying my dimstyle settings and change any existing dimensions with the dim offset routine."

When doing future baseline dimensioning, the updated (setvar "DIMDLI" 0.1875), will give me graphic look that I am after. I am looking for a way to graphically change the baseline offset of existing dimensions. Ha Ha
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64