AutoLISP: Split Dimensions

This is a re-post of a previous post that deserves to be re-posted. The routine was posted at theswamp.org by Kerry and can be found here: http://www.theswamp.org/index.php?topic=33493.msg389031#msg389031

The routine simply splits an existing dimension and lets you click a point between the dimension to define a new inner dimension.

Here’s how:

  • SPLITDIMS [enter] to start
  • Select dimension to split
  • pick a new point

SplitDims


(defun c:LegLengthMod ( / ss dimobjs)
  
  ;; codehimbelonga KerryBrown@theSwamp 2010.05.28
  ;; http://www.theswamp.org/index.php?topic=33493.msg389031#msg389031

  (vl-load-com)
  (if (and (setq ss (ssget '((0 . "DIMENSION"))))
           (setq dimobjs (mapcar 'vlax-ename->vla-object
                                 (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
                         )
           )
      )
    (foreach dim dimobjs
      (vla-put-extlinefixedlensuppress dim :vlax-true)
      (vla-put-extlinefixedlen dim (* 2 (vla-get-textheight dim)))
    )
  )
  (princ)
)


(defun c:SplitDims (/ sel newpt ent edata elist)
    
  ;; codehimbelonga KerryBrown@theSwamp 2010.05.28
  

  (if (and (setq sel (entsel "\nSelect Dimension to Split."))
           (setq newpt (getpoint "\Select new Dim Point"))
      )
    (progn (setq ent   (car sel)
                 edata (entget ent)
                 elist (vl-remove-if
                         '(lambda (pair)
                            (member (car pair)
                                    (list -1 2 5 102 310 300 330 331 340 350 360 410)
                            )
                          )
                         edata
                       )
           )
           (entmod (subst (cons 14 newpt) (assoc 14 elist) edata))
           (entmakex (subst (cons 13 newpt) (assoc 13 elist) elist))
    )
  )
  (princ)
)

About AutoCAD Tips

This blog serves as a knowledge base for myself (and anyone else) so that I can reference tips & tricks that I have learned and also refer others to it as well. I hope that this blog helps you learn at least one tip to make your drafting/design experience better.
This entry was posted in AutoLISP, AutoLISP: Dimensions, AutoLISP: Modify, Dimensions. Bookmark the permalink.

4 Responses to AutoLISP: Split Dimensions

  1. Alvaro says:

    Very good. Congratulations.

  2. Vance Goynes says:

    Love this site! There’s always relevant information, that helps in my productivity.

  3. KuoHsin WONG says:

    Thank you for your lisp!The lisp works well when I select a point between the dimension extension lines,but when I select a point beyond the dimension extension lines,the result turns not to be that good,I believe you notice it too,have you solved the problem? best regards!

  4. gopi says:

    This lisp is working good in model space but in the layouts the dimscale linear value is changing. Showing the error dimension value

Leave a comment