Jump to content

Align the extension lines to the short line of each selected size


Recommended Posts

Posted (edited)

Hello everyone.
You need to select several sizes and align the extension lines to the short line of each selected size.
Maybe there is such a program?

dimension lines.png

Edited by Nikon
  • Nikon changed the title to Align the extension lines to the short line of each selected size
Posted (edited)

I don't think we've understood your question yet (at least I haven't). 

You might need to elaborate a bit and add some more images.

Edited by GLAVCVS
Posted

I'm guessing they have a drawing and want all the long blue dim extension lines to be shortened to where the dimension is. but the top blue one looks like its pulling from the right and left like the dimension itself is inside the feature its measuring. were the bottom red is only pulling from the right.

Posted (edited)
3 hours ago, GLAVCVS said:

I don't think we've understood your question yet (at least I haven't). 

You might need to elaborate a bit and add some more images.

Sometimes the extension lines of associative dimensions are stretched (for example, to the origin of coordinates ) when inserted into another drawing.

Now I've found a way to disable dimensions associativity, but I don't really like it. I only find out that the dimensions have lost their connection with the object when I insert them into another drawing (or turn on the annotation monitor).
So I thought it would be possible to align the extension lines to a smaller extension line. 
Maybe there is a better way...

; disable associativity of only selected dimensions
(defun c:DimAssOf ( / ss)
  (vl-load-com)

  (prompt "\nSelect DIMENSION to disable associativity: ")
  (setq ss (ssget '((0 . "DIMENSION")))) 

  (if ss
    (progn
      (command "_.DIMDISASSOCIATE" ss "")
      (prompt
        (strcat
          "\nDone: associativity is disabled for "
          (itoa (sslength ss))
          " dimensions."
        )
      )
    )
  )

  (princ)
)


extension lines.dwg

Edited by Nikon
Posted
1 hour ago, mhupp said:

I'm guessing they have a drawing and want all the long blue dim extension lines to be shortened to where the dimension is. but the top blue one looks like its pulling from the right and left like the dimension itself is inside the feature its measuring. were the bottom red is only pulling from the right

The blue dimension should become the same as the red one.

Posted
(defun c:DimAssOf ( / ss e le n)
  (vl-load-com)

  (prompt "\nSelect DIMENSION to disable associativity: ")
  (setq ss (ssget '((0 . "DIMENSION"))))

  (if ss
    (progn
      (command "_.DIMDISASSOCIATE" ss "")
      (prompt
        (strcat
          "\nDone: associativity is disabled for "
          (itoa (sslength ss))
          " dimensions."
        )
      )
      (while (setq e (ssname ss (setq n (if n (1+ n) 0))))
	(setq le (entget e))
	(entmod (subst (list 14 (cadr (assoc 13 le)) (caddr (assoc 14 (entget e))) 0.0) (assoc 14 le) le))
      )
    )
  )

  (princ)
)

 

  • Like 1
Posted
1 minute ago, GLAVCVS said:
(defun c:DimAssOf ( / ss e le n)
  (vl-load-com)

  (prompt "\nSelect DIMENSION to disable associativity: ")
  (setq ss (ssget '((0 . "DIMENSION"))))

  (if ss
    (progn
      (command "_.DIMDISASSOCIATE" ss "")
      (prompt
        (strcat
          "\nDone: associativity is disabled for "
          (itoa (sslength ss))
          " dimensions."
        )
      )
      (while (setq e (ssname ss (setq n (if n (1+ n) 0))))
	(setq le (entget e))
	(entmod (subst (list 14 (cadr (assoc 13 le)) (caddr (assoc 14 (entget e))) 0.0) (assoc 14 le) le))
      )
    )
  )

  (princ)
)

 

Do you really need to disassociate the dimension?

If you don't need to for another reason, you can delete that part of the code.

  • Like 1
Posted
3 minutes ago, GLAVCVS said:

Do you really need to disassociate the dimension?

If you don't need to for another reason, you can delete that part of the code.

Like that

1763667260880.thumb.jpg.c6c797f758556e9ab9bd292bdfd08016.jpg

  • Thanks 1
Posted (edited)
39 minutes ago, GLAVCVS said:

Do you really need to disassociate the dimension?

If you don't need to for another reason, you can delete that part of the code.

@GLAVCVS Thank you very much, but you only need to choose the "stretched" dimensions.
If you choose the usual dimensions, they may change.

dim 0.png

Yes, associativity can be left on.

(defun c:DimAlignExtLine ( / ss e le n)
  (vl-load-com)

  (prompt "\nSelect the dimensions for alignment: ")
  (setq ss (ssget '((0 . "DIMENSION"))))

  (if ss
    (progn
    (while (setq e (ssname ss (setq n (if n (1+ n) 0))))
	(setq le (entget e))
	(entmod (subst (list 14 (cadr (assoc 13 le)) (caddr (assoc 14 (entget e))) 0.0) (assoc 14 le) le))
      )
    )
  )

  (princ)
)

 

Edited by Nikon
  • 10 months later...
Posted (edited)
12 hours ago, ScottMC said:

here's 2 for h&v alignment

👍 👍

 

 

Edited by Nikon
Posted
;;; DIMFL - Shorten the extension lines of selected dimensions.
;;;
;;; Applies a per-dimension override of DIMFXLON / DIMFXL, so the extension line
;;; starts at a fixed distance from the dimension line instead of at the
;;; definition point. Fixes the dimensions you pick, not the whole style.
;;;
;;; NO MEASUREMENT CHANGES. Definition points are not moved; only how far the
;;; extension line is DRAWN. A 50 stays a 50.
;;; Reversible with the Restore option. One Ctrl+Z undoes the whole pass.
;;;
;;; WARNING: if a dimension looks wrong because its definition point MOVED, this
;;; fixes the look but not the value, and makes the error harder to spot. Check
;;; the numbers before shortening anything.

(vl-load-com)

(defun R0:DFL-Get (obj prop / r)
  (setq r (vl-catch-all-apply 'vlax-get (list obj prop)))
  (if (vl-catch-all-error-p r) nil r))

(defun R0:DFL-Put (obj prop val / r)
  (setq r (vl-catch-all-apply 'vlax-put (list obj prop val)))
  (not (vl-catch-all-error-p r)))

;; (logand 4 nil) throws, so a missing layer record answers "not locked".
(defun R0:DFL-Bloqueada (en / cap)
  (setq cap (tblsearch "LAYER" (cdr (assoc 8 (entget en)))))
  (and cap (= 4 (logand 4 (cdr (assoc 70 cap))))))

;; Default length = whatever the first picked dimension already carries. Whoever
;; set up the style usually chose a number that suits the drawing scale.
(defun R0:DFL-Sugerido (ss / i en obj v)
  (setq i 0 v nil)
  (while (and (< i (sslength ss)) (null v))
    (setq en  (ssname ss i) i (1+ i)
          obj (vlax-ename->vla-object en)
          v   (R0:DFL-Get obj 'ExtLineFixedLen))
    (if (or (not (numberp v)) (<= v 1e-9)) (setq v nil)))
  (if v v 2.5))

(defun c:DIMFL ( / *error* ss i en obj largo sug modo hechos fallo bloq und doc)

  (defun *error* (msg)
    (if und (vl-catch-all-apply 'vla-EndUndoMark (list doc)))
    (if (and msg (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*BREAK*,*EXIT*,*ABORT*")))
      (princ (strcat "\n[X] DIMFL: " msg)))
    (princ))

  (princ "\nDIMFL | Shorten extension lines (no measurement is changed).")
  (princ "\n  Select dimensions: ")

  (if (null (setq ss (ssget '((0 . "DIMENSION")))))
    (princ "\n[!] DIMFL: nothing selected.")
    (progn
      (princ "\n  Shorten = fixed length extension lines")
      (princ "\n  Restore = back to starting at the definition point (LONG again)")
      (initget "Shorten Restore")
      (setq modo (getkword "\n  [Shorten/Restore] <Shorten>: "))
      (if (null modo) (setq modo "Shorten"))

      (if (= modo "Shorten")
        (progn
          (setq sug (R0:DFL-Sugerido ss))
          (initget 6)
          (setq largo (getdist (strcat "\n  Extension line length <"
                                       (rtos sug 2 3) ">: ")))
          (if (null largo) (setq largo sug))))

      (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)) und T)
      (vla-StartUndoMark doc)

      (setq i 0 hechos 0 fallo 0 bloq 0)
      (while (< i (sslength ss))
        (setq en (ssname ss i) i (1+ i))
        (if (R0:DFL-Bloqueada en)
          (setq bloq (1+ bloq))
          (progn
            (setq obj (vlax-ename->vla-object en))
            ;; ExtLineFixedLen = DIMFXL, ExtLineFixedLenSuppress = DIMFXLON.
            ;; Despite the "Suppress" name the value follows DIMFXLON: 0 = off
            ;; (long lines), -1 = on (fixed length). Length first, switch second.
            (if (= modo "Shorten")
              (if (and (R0:DFL-Put obj 'ExtLineFixedLen largo)
                       (R0:DFL-Put obj 'ExtLineFixedLenSuppress -1))
                (setq hechos (1+ hechos))
                (setq fallo (1+ fallo)))
              (if (R0:DFL-Put obj 'ExtLineFixedLenSuppress 0)
                (setq hechos (1+ hechos))
                (setq fallo (1+ fallo))))
            (vl-catch-all-apply 'vla-Update (list obj)))))

      (vla-EndUndoMark doc)
      (setq und nil)

      (princ (strcat "\n\n[OK] DIMFL: " (itoa hechos) " dimension(s) "
                     (if (= modo "Shorten")
                       (strcat "with a " (rtos largo 2 3) " extension line")
                       "restored: their lines are LONG again")))
      (if (> bloq 0) (princ (strcat "\n  " (itoa bloq) " on locked layers: skipped.")))
      (if (> fallo 0) (princ (strcat "\n  " (itoa fallo) " did not accept the change.")))
      (if (= modo "Shorten")
        (princ "\n  No measurement changed. To revert: DIMFL, Restore option.")
        (princ "\n  To shorten them again: DIMFL, Shorten option."))))
  (princ))

(princ "\n[DIMFL] loaded. Type DIMFL to shorten extension lines.")
(princ)

 

  • Like 1
Posted
5 hours ago, Romero said:
;;; NO MEASUREMENT CHANGES. Definition points are not moved; only how far the
;;; extension line is DRAWN. A 50 stays a 50.

An interesting solution‼️

  • Like 1

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