Split Dimension String??!?

Discussion in 'AutoCAD' started by Matt W, Jun 8, 2004.

  1. Matt W

    Matt W Guest

    Is there a way (or is anyone willing to "donate" some code) to split a
    dimension string??
    I.E. Let's say I have a dimension that is 12'-0". I'd like to be able to
    select the dimension, then pick a point somewhere in between the ends (let's
    say 5' from one end) and erase the 12' dimension and create two *new*
    dimensions; one that would be 5'-0", the other would be 7'-0".

    Of course these dimensions would vary based on the length of the original
    dimension and where the user picked between the end points.
     
    Matt W, Jun 8, 2004
    #1
  2. Matt W

    Rudy Tovar Guest

    Try our Express Dimension within MASi

    Features:
    ======
    Grouping
    Stacking
    Aligning
    Breaking
    Offsetting
    Perimeter
    Joining
    --

    AUTODESK
    Authorized Developer
    http://www.Cadentity.com
    MASi
     
    Rudy Tovar, Jun 8, 2004
    #2
  3. Matt W

    GaryDF Guest

    Don't know the author.
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;; Split and Glue Dims Functions
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;
    (defun Qj (Q@) (* PI (/ Q@ 180.0)))
    (defun DIMGLUEIT ()
    (ARCH:F_S-VAR)
    (cond ((= ARCH#CLAY "Off") (ARCH:LYR "A-DIMS")))
    (defun-q *ERROR*
    (QQ)
    (if (/= QQ "Function cancelled")
    (prompt (strcat "\nError: " QQ "\n"))
    )
    (setq *ERROR* ())
    (prin1)
    )
    (setvar "cmdecho" 0)
    (setvar "osmode" 0)
    (setq Ql (entsel "\n* Select First Dimension to Glue *")
    Q& (entget (car Ql))
    )
    (while (/= (cdr (assoc 0 Q&)) "DIMENSION")
    (princ "\nSelected Entity is not a dimension")
    (setq Ql (entsel "\n* Select First Dimension to Glue *")
    Q& (entget (car Ql))
    )
    )
    (setq Q1 (list (cadr (assoc 13 Q&))
    (caddr (assoc 13 Q&))
    )
    Q# (list (cadr (assoc 14 Q&))
    (caddr (assoc 14 Q&))
    )
    Q0 (list (cadr (assoc 10 Q&))
    (caddr (assoc 10 Q&))
    )
    Q$ (* (/ (cdr (assoc 50 Q&)) PI) 180)
    QO (inters Q1
    (polar Q1 (Qj (+ Q$ 90)) 10)
    Q0
    (polar Q0 Q$ 10)
    ()
    )
    Q| (inters Q#
    (polar Q# (Qj (+ Q$ 90)) 10)
    Q0
    (polar Q0 Q$ 10)
    ()
    )
    )
    (princ "\n ")
    (setq Q% (entsel "\n* Select Second Dimension to Glue *")
    Q?j (entget (car Q%))
    )
    (while (/= (cdr (assoc 0 Q?j)) "DIMENSION")
    (princ "\n* Selected Entity is not a Dimension *")
    (setq Q% (entsel "\n* Select Second Dimension to Glue *")
    Q?j (entget (car Q%))
    )
    )
    (setq Qjj (list (cadr (assoc 13 Q?j)) (caddr (assoc 13 Q?j)))
    Q@j (list (cadr (assoc 14 Q?j)) (caddr (assoc 14 Q?j)))
    QQj (inters Qjj
    (polar Qjj (Qj (+ Q$ 90)) 10)
    Q0
    (polar Q0 Q$ 10)
    ()
    )
    Qlj (inters Q@j
    (polar Q@j (Qj (+ Q$ 90)) 10)
    Q0
    (polar Q0 Q$ 10)
    ()
    )
    Q&j (if (< (distance QO QQj) (distance Q| QQj))
    Q#
    Q1
    )
    Q1j (if (< (distance QO QQj) (distance QO Qlj))
    Q@j
    Qjj
    )
    )
    (command "ERASE" Ql "" "ERASE" Q% "" "DIM" "rot" Q$ Q&j Q1j Q0 ""
    "EXIT")
    (setvar "CMDECHO" 1)
    (setq *ERROR* ())
    (ARCH:F_R-VAR)
    (prin1)
    )
    ;;;
    (defun DIMSPLITIT ()
    (ARCH:F_S-VAR)
    (cond ((= ARCH#CLAY "Off") (ARCH:LYR "A-DIMS")))
    (defun-q *ERROR*
    (Qj)
    (if (/= Qj "Function cancelled")
    (prompt (strcat "\nError: " Qj "\n"))
    )
    (setq *ERROR* ())
    (prin1)
    )
    (setvar "cmdecho" 0)
    (setq Q@ (entsel "\n*Select Dimension to Split *")
    QQ (entget (car Q@))
    )
    (while (/= (cdr (assoc 0 QQ)) "DIMENSION")
    (princ "\nSelected entity is not a dimension\n")
    (setq Q@ (entsel "\nSelect dimension to split: ")
    QQ (entget (car Q@))
    )
    )
    (setq Ql (list (cadr (assoc 13 QQ)) (caddr (assoc 13 QQ)))
    Q& (list (cadr (assoc 14 QQ)) (caddr (assoc 14 QQ)))
    Q1 (list (cadr (assoc 10 QQ)) (caddr (assoc 10 QQ)))
    Q# (* (/ (cdr (assoc 50 QQ)) PI) 180)
    Q0 (entget (car (entsel "\n* Select Split Line *")))
    )
    (while (/= (cdr (assoc 0 Q0)) "LINE")
    (princ "\n* Selected Entity is not a Line *\n")
    (setq Q0 (entget (car (entsel "\n* Select Split Line *"))))
    )
    (setq Q$ (list (cadr (assoc 10 Q0)) (caddr (assoc 10 Q0)))
    QO (list (cadr (assoc 11 Q0)) (caddr (assoc 11 Q0)))
    Q| (inters Ql Q& Q$ QO ())
    Q% Q|
    )
    (if (equal (inters Ql Q& Q$ QO) ())
    (setq Q% (if (< (distance Q$ Q|) (distance QO Q|))
    Q$
    QO
    )
    )
    )
    (command "ERASE" Q@ "" "DIM" "rot" Q# Ql Q% Q1 "" "rot" Q# Q% Q& Q1 ""
    "EXIT")
    (setvar "CMDECHO" 1)
    (setq *ERROR* ())
    (ARCH:F_R-VAR)
    (prin1)
    )

    Gary
     
    GaryDF, Jun 8, 2004
    #3
  4. Here are some that I wrote a while ago. Enjoy!

    Dimsplit
    Dimjoin
    Dimdivide
    Dimoffset

    --
    Daniel J. Altamura, R.A.
    Altamura Architectural Consulting
    and SoftWorx, Autodesk Authorized Developer
    --------------------------------------------------------------------
    (defun C:DIMSPLIT (/ OBJ_PICK DIM_PICK DIM_ENT DIM_NODE1 DIM_NODE2 DIM_DEF
    DIM_POINT DIM_OBJ)
    ;(STORE)
    (command ".undo" "group")
    (setvar "osmode" 0)
    (setq DIM_PICK 1)
    (while (and DIM_PICK (/= OBJ_PICK "DIMENSION"))
    (setq DIM_PICK (entsel "\nSelect Dimension: "))
    (if DIM_PICK
    (progn
    (setq OBJ_PICK (cdr (assoc 0 (entget (car DIM_PICK))))
    DIM_ENT (entget (car DIM_PICK))
    )
    (if (/= OBJ_PICK "DIMENSION") (prompt "\nThis is not a Dimension
    object."))
    )
    )
    )
    (if (or (= (cdr (assoc 70 DIM_ENT)) 32) ; IF ALIGNED OR ROTATED DIMENSION
    (= (cdr (assoc 70 DIM_ENT)) 160)
    (= (cdr (assoc 70 DIM_ENT)) 33)
    (= (cdr (assoc 70 DIM_ENT)) 161)
    )
    (progn
    (setq DIM_NODE1 (cdr (assoc 13 DIM_ENT))
    DIM_NODE2 (cdr (assoc 14 DIM_ENT))
    DIM_DEF (cdr (assoc 10 DIM_ENT))
    DIM_POINT (getpoint "\nPick split point: ")
    )
    (if DIM_POINT
    (progn
    (if (or (= (cdr (assoc 70 DIM_ENT)) 33) (= (cdr (assoc 70
    DIM_ENT)) 161)) ; IF ALIGNED DIMENSION, RESET SPLIT POINT TO ALIGN BETWEEN
    NODES
    (setq DIM_POINT (inters (polar DIM_POINT (angle DIM_DEF
    DIM_NODE2) 12.0) DIM_POINT DIM_NODE1 DIM_NODE2 nil))
    )
    (setq DIM_OBJ (subst (cons 13 DIM_POINT) (assoc 13 DIM_ENT)
    DIM_ENT))
    (entmod DIM_OBJ)
    (command "copy" DIM_PICK "" DIM_POINT DIM_POINT)
    (setq DIM_ENT (entget (entlast))
    DIM_OBJ (subst (cons 14 DIM_NODE1) (assoc 14 DIM_ENT)
    DIM_ENT)
    )
    (entmod DIM_OBJ)
    )
    )
    )
    (if DIM_PICK (prompt "\nThis is neither a Rotated nor an Aligned
    Dimension."))
    )
    (command ".undo" "end")
    ;(RESTORE)
    (princ)
    )

    (defun C:DIMJOIN (/ OBJ1_PICK DIM1_PICK DIM1_ENT DIM1_NODE1 DIM1_NODE2
    DIM1_OBJ
    OBJ2_PICK DIM2_PICK DIM2_ENT DIM2_NODE1 DIM2_NODE2
    DIMCASE)
    ;(STORE)
    (command ".undo" "group")
    (setvar "osmode" 0)
    (setq DIM1_PICK 1
    DIM2_PICK 1
    )
    (while (and DIM1_PICK (/= OBJ1_PICK "DIMENSION"))
    (setq DIM1_PICK (entsel "\nSelect First Dimension: "))
    (if DIM1_PICK
    (progn
    (setq OBJ1_PICK (cdr (assoc 0 (entget (car DIM1_PICK))))
    DIM1_ENT (entget (car DIM1_PICK))
    )
    (if (/= OBJ1_PICK "DIMENSION") (prompt "\nThis is not a Dimension
    object."))
    )
    )
    )
    (if (or (= (cdr (assoc 70 DIM1_ENT)) 32) ; IF ALIGNED OR ROTATED DIMENSION
    (= (cdr (assoc 70 DIM1_ENT)) 160)
    (= (cdr (assoc 70 DIM1_ENT)) 33)
    (= (cdr (assoc 70 DIM1_ENT)) 161)
    )
    (progn
    (if (= OBJ1_PICK "DIMENSION")
    (progn
    (while (and DIM2_PICK (/= OBJ2_PICK "DIMENSION"))
    (setq DIM2_PICK (entsel "\nSelect Second Dimension: "))
    (if DIM2_PICK
    (progn
    (setq OBJ2_PICK (cdr (assoc 0 (entget (car DIM2_PICK))))
    DIM2_ENT (entget (car DIM2_PICK))
    )
    (if (/= OBJ2_PICK "DIMENSION") (prompt "\nThis is not a
    Dimension object."))
    )
    )
    )
    (if (or (= (cdr (assoc 70 DIM2_ENT)) 32) ; IF ALIGNED OR ROTATED
    DIMENSION
    (= (cdr (assoc 70 DIM2_ENT)) 160)
    (= (cdr (assoc 70 DIM2_ENT)) 33)
    (= (cdr (assoc 70 DIM2_ENT)) 161)
    )
    (progn
    (setq DIM1_NODE1 (cdr (assoc 13 DIM1_ENT))
    DIM1_NODE2 (cdr (assoc 14 DIM1_ENT))
    DIM2_NODE1 (cdr (assoc 13 DIM2_ENT))
    DIM2_NODE2 (cdr (assoc 14 DIM2_ENT))
    )
    (if (= (fix (distance DIM1_NODE2 DIM2_NODE1)) 0.0)
    (setq DIM1_OBJ (subst (cons 14 DIM2_NODE2) (assoc 14 DIM1_ENT)
    DIM1_ENT) DIMCASE 1)
    )
    (if (= (fix (distance DIM1_NODE2 DIM2_NODE2)) 0.0)
    (setq DIM1_OBJ (subst (cons 14 DIM2_NODE1) (assoc 14
    DIM1_ENT) DIM1_ENT) DIMCASE 2)
    )
    (if (= (fix (distance DIM1_NODE1 DIM2_NODE1)) 0.0)
    (setq DIM1_OBJ (subst (cons 13 DIM2_NODE2) (assoc 13 DIM1_ENT)
    DIM1_ENT) DIMCASE 3)
    )
    (if (= (fix (distance DIM1_NODE1 DIM2_NODE2)) 0.0)
    (setq DIM1_OBJ (subst (cons 13 DIM2_NODE1) (assoc 13 DIM1_ENT)
    DIM1_ENT) DIMCASE 4)
    )
    (if DIMCASE
    (progn
    (entmod DIM1_OBJ)
    (command "erase" DIM2_PICK "")
    )
    (prompt "\nDimensions are not coincident.")
    )
    )
    (if DIM2_PICK (prompt "\nThis is neither a Rotated nor an
    Aligned Dimension."))
    )
    )
    )
    )
    (if DIM1_PICK (prompt "\nThis is neither a Rotated nor an Aligned
    Dimension."))
    )
    (command ".undo" "end")
    ;(RESTORE)
    (princ)
    )

    (defun C:DIMDIVIDE (/ OBJ_PICK DIM_PICK DIM_ENT DIM_NODE1 DIM_NODE2 DIM_DEF
    DIM_POINT DIM_OBJ)
    ;(STORE)
    (command ".undo" "group")
    (setvar "osmode" 0)
    (setq DIM_PICK 1)
    (while (and DIM_PICK (/= OBJ_PICK "DIMENSION"))
    (setq DIM_PICK (entsel "\nSelect Dimension: "))
    (if DIM_PICK
    (progn
    (setq OBJ_PICK (cdr (assoc 0 (entget (car DIM_PICK))))
    DIM_ENT (entget (car DIM_PICK))
    )
    (if (/= OBJ_PICK "DIMENSION") (prompt "\nThis is not a Dimension
    object."))
    )
    )
    )
    (if (or (= (cdr (assoc 70 DIM_ENT)) 32) ; IF ALIGNED OR ROTATED DIMENSION
    (= (cdr (assoc 70 DIM_ENT)) 160)
    (= (cdr (assoc 70 DIM_ENT)) 33)
    (= (cdr (assoc 70 DIM_ENT)) 161)
    )
    (progn
    (if (not DIM_DIV) (setq DIM_DIV 2))
    (initget 6)
    (setq DIM_DIV (DEFNUM DIM_DIV "\nNumber of divisions"))
    (if (and (= OBJ_PICK "DIMENSION") (> DIM_DIV 1))
    (progn
    (setq DIM_ENT (entget (car DIM_PICK))
    DIM_NODE1 (cdr (assoc 13 DIM_ENT))
    DIM_NODE2 (cdr (assoc 14 DIM_ENT))
    DIM_DEF (cdr (assoc 10 DIM_ENT))
    DIM_POINT (polar DIM_NODE1 (angle DIM_NODE1 DIM_NODE2) (/
    (distance DIM_NODE1 DIM_NODE2) DIM_DIV))
    DIM_OBJ (subst (cons 14 DIM_POINT) (assoc 14 DIM_ENT)
    DIM_ENT)
    )
    (entmod DIM_OBJ)
    (setq DIM_NODE2 (cdr (assoc 14 DIM_OBJ)))
    (command "copy" DIM_PICK "" DIM_NODE1 DIM_NODE2)
    (setq DIM_ENT (entget (entlast))
    DIM_OBJ (subst (cons 10 DIM_DEF) (assoc 10 DIM_ENT) DIM_ENT)
    )
    (entmod DIM_OBJ)
    (repeat (- DIM_DIV 2)
    (command "copy" (ENTLAST) "" DIM_NODE1 DIM_NODE2)
    (setq DIM_ENT (entget (entlast))
    DIM_OBJ (subst (cons 10 DIM_DEF) (assoc 10 DIM_ENT)
    DIM_ENT)
    )
    (entmod DIM_OBJ)
    )
    )
    )
    )
    (if DIM_PICK (prompt "\nThis is neither a Rotated nor an Aligned
    Dimension."))
    )
    (command ".undo" "end")
    ;(RESTORE)
    (princ)
    )

    (defun C:DIMOFFSET (/ OBJ_PICK DIM_SIDE DIM_PICK DIM_ENT DIM_NODE1 DIM_NODE2
    DIM_INT DIM_DEF DIM_POINT DIM_OBJ)
    ;(STORE)
    (command ".undo" "group")
    (if (not DIM_OFFS) (setq DIM_OFFS (* 0.375 (getvar "dimscale"))))
    (initget 2)
    (setq DIM_OFFS (DEFDIST DIM_OFFS "Specify offset distance"))
    (setq DIM_PICK 1 OBJ_PICK 1)
    (while (and DIM_PICK (/= OBJ_PICK "DIMENSION"))
    (setq DIM_PICK (entsel "\nSelect Dimension to offset: "))
    (if DIM_PICK
    (progn
    (setq OBJ_PICK (cdr (assoc 0 (entget (car DIM_PICK))))
    DIM_ENT (entget (car DIM_PICK))
    )
    (if (/= OBJ_PICK "DIMENSION") (prompt "\nThis is not a Dimension
    object."))
    )
    )
    )
    (if (or (= (cdr (assoc 70 DIM_ENT)) 32) ; IF ALIGNED OR ROTATED DIMENSION
    (= (cdr (assoc 70 DIM_ENT)) 160)
    (= (cdr (assoc 70 DIM_ENT)) 33)
    (= (cdr (assoc 70 DIM_ENT)) 161)
    )
    (progn
    (setq DIM_SIDE (getpoint "\nSpecify point on side to offset: "))
    (if DIM_SIDE
    (if (and (= OBJ_PICK "DIMENSION") (> DIM_OFFS 0))
    (progn
    (setvar "osmode" 0)
    (setq DIM_ENT (entget (car DIM_PICK))
    DIM_NODE1 (cdr (assoc 13 DIM_ENT))
    DIM_NODE2 (cdr (assoc 14 DIM_ENT))
    DIM_DEF (cdr (assoc 10 DIM_ENT))
    DIM_INT (polar DIM_SIDE (angle DIM_DEF DIM_NODE2) 12.0)
    DIM_POINT (inters (polar DIM_DEF (+ (angle DIM_DEF
    DIM_NODE2) (DTR 90.0)) 12.0) DIM_DEF DIM_SIDE DIM_INT nil)
    )
    (command "copy" DIM_PICK "" DIM_NODE2 (polar DIM_NODE2 (angle
    DIM_POINT DIM_SIDE) DIM_OFFS))
    (setq DIM_ENT (entget (entlast))
    DIM_OBJ (subst (cons 13 DIM_NODE1) (assoc 13 DIM_ENT)
    DIM_ENT)
    )
    (entmod DIM_OBJ)
    (setq DIM_ENT (entget (entlast))
    DIM_OBJ (subst (cons 14 DIM_NODE2) (assoc 14 DIM_ENT)
    DIM_ENT)
    )
    (entmod DIM_OBJ)
    (setq DIM_ENT (entget (entlast))
    DIM_DEF (polar DIM_DEF (angle DIM_POINT DIM_SIDE)
    DIM_OFFS)
    DIM_OBJ (subst (cons 10 DIM_DEF) (assoc 10 DIM_ENT)
    DIM_ENT)
    )
    (entmod DIM_OBJ)
    )
    )
    )
    )
    (if DIM_PICK (prompt "\nThis is neither a Rotated nor an Aligned
    Dimension."))
    )
    (command ".undo" "end")
    ;(RESTORE)
    (princ)
    )
     
    Daniel J. Altamura, R.A., Jun 8, 2004
    #4
  5. Matt W

    GaryDF Guest

    Missing some functons

    Gary


     
    GaryDF, Jun 8, 2004
    #5
  6. Matt W

    GaryDF Guest

    Try this one, commented out layer and restore code functions:

    (defun Qj (Q@) (* PI (/ Q@ 180.0)))
    (defun DIMGLUEIT ()
    ;;(ARCH:F_S-VAR)
    ;;(cond ((= ARCH#CLAY "Off") (ARCH:LYR "A-DIMS")))
    (defun-q *ERROR*
    (QQ)
    (if (/= QQ "Function cancelled")
    (prompt (strcat "\nError: " QQ "\n"))
    )
    (setq *ERROR* ())
    (prin1)
    )
    (setvar "cmdecho" 0)
    (setvar "osmode" 0)
    (setq Ql (entsel "\n* Select First Dimension to Glue *")
    Q& (entget (car Ql))
    )
    (while (/= (cdr (assoc 0 Q&)) "DIMENSION")
    (princ "\nSelected Entity is not a dimension")
    (setq Ql (entsel "\n* Select First Dimension to Glue *")
    Q& (entget (car Ql))
    )
    )
    (setq Q1 (list (cadr (assoc 13 Q&))
    (caddr (assoc 13 Q&))
    )
    Q# (list (cadr (assoc 14 Q&))
    (caddr (assoc 14 Q&))
    )
    Q0 (list (cadr (assoc 10 Q&))
    (caddr (assoc 10 Q&))
    )
    Q$ (* (/ (cdr (assoc 50 Q&)) PI) 180)
    QO (inters Q1
    (polar Q1 (Qj (+ Q$ 90)) 10)
    Q0
    (polar Q0 Q$ 10)
    ()
    )
    Q| (inters Q#
    (polar Q# (Qj (+ Q$ 90)) 10)
    Q0
    (polar Q0 Q$ 10)
    ()
    )
    )
    (princ "\n ")
    (setq Q% (entsel "\n* Select Second Dimension to Glue *")
    Q?j (entget (car Q%))
    )
    (while (/= (cdr (assoc 0 Q?j)) "DIMENSION")
    (princ "\n* Selected Entity is not a Dimension *")
    (setq Q% (entsel "\n* Select Second Dimension to Glue *")
    Q?j (entget (car Q%))
    )
    )
    (setq Qjj (list (cadr (assoc 13 Q?j)) (caddr (assoc 13 Q?j)))
    Q@j (list (cadr (assoc 14 Q?j)) (caddr (assoc 14 Q?j)))
    QQj (inters Qjj
    (polar Qjj (Qj (+ Q$ 90)) 10)
    Q0
    (polar Q0 Q$ 10)
    ()
    )
    Qlj (inters Q@j
    (polar Q@j (Qj (+ Q$ 90)) 10)
    Q0
    (polar Q0 Q$ 10)
    ()
    )
    Q&j (if (< (distance QO QQj) (distance Q| QQj))
    Q#
    Q1
    )
    Q1j (if (< (distance QO QQj) (distance QO Qlj))
    Q@j
    Qjj
    )
    )
    (command "ERASE" Ql "" "ERASE" Q% "" "DIM" "rot" Q$ Q&j Q1j Q0 ""
    "EXIT")
    (setvar "CMDECHO" 1)
    (setq *ERROR* ())
    ;;(ARCH:F_R-VAR)
    (prin1)
    )
    ;;;
    (defun DIMSPLITIT ()
    ;;(ARCH:F_S-VAR)
    ;;(cond ((= ARCH#CLAY "Off") (ARCH:LYR "A-DIMS")))
    (defun-q *ERROR*
    (Qj)
    (if (/= Qj "Function cancelled")
    (prompt (strcat "\nError: " Qj "\n"))
    )
    (setq *ERROR* ())
    (prin1)
    )
    (setvar "cmdecho" 0)
    (setq Q@ (entsel "\n*Select Dimension to Split *")
    QQ (entget (car Q@))
    )
    (while (/= (cdr (assoc 0 QQ)) "DIMENSION")
    (princ "\nSelected entity is not a dimension\n")
    (setq Q@ (entsel "\nSelect dimension to split: ")
    QQ (entget (car Q@))
    )
    )
    (setq Ql (list (cadr (assoc 13 QQ)) (caddr (assoc 13 QQ)))
    Q& (list (cadr (assoc 14 QQ)) (caddr (assoc 14 QQ)))
    Q1 (list (cadr (assoc 10 QQ)) (caddr (assoc 10 QQ)))
    Q# (* (/ (cdr (assoc 50 QQ)) PI) 180)
    Q0 (entget (car (entsel "\n* Select Split Line *")))
    )
    (while (/= (cdr (assoc 0 Q0)) "LINE")
    (princ "\n* Selected Entity is not a Line *\n")
    (setq Q0 (entget (car (entsel "\n* Select Split Line *"))))
    )
    (setq Q$ (list (cadr (assoc 10 Q0)) (caddr (assoc 10 Q0)))
    QO (list (cadr (assoc 11 Q0)) (caddr (assoc 11 Q0)))
    Q| (inters Ql Q& Q$ QO ())
    Q% Q|
    )
    (if (equal (inters Ql Q& Q$ QO) ())
    (setq Q% (if (< (distance Q$ Q|) (distance QO Q|))
    Q$
    QO
    )
    )
    )
    (command "ERASE" Q@ "" "DIM" "rot" Q# Ql Q% Q1 "" "rot" Q# Q% Q& Q1 ""
    "EXIT")
    (setvar "CMDECHO" 1)
    (setq *ERROR* ())
    ;;(ARCH:F_R-VAR)
    (prin1)
    )
     
    GaryDF, Jun 8, 2004
    #6
  7. If you are referring to my (STORE) and (RESTORE) functions, I commented them
    out of the code. Everything should work. Did you try them out?
     
    Daniel J. Altamura, R.A., Jun 8, 2004
    #7
  8. I did forget to include the angle conversion fuctions. Here they are:

    ;*** CONVERTS DEGREES TO RADIANS AND VISCA-VERSA ***

    (defun DTR (A) (* PI (/ A 180.0)))
    (defun RTD (A) (* (/ A PI) 180.0))
     
    Daniel J. Altamura, R.A., Jun 8, 2004
    #8
  9. Matt W

    Matt W Guest

    This is pretty sweet!!
    Thanks for posting this!!

    Much appreciated!!

    --
    Matt W

    There are 3 kinds of people:
    Those who can count, and those who can't.



    | I did forget to include the angle conversion fuctions. Here they are:
    |
    | ;*** CONVERTS DEGREES TO RADIANS AND VISCA-VERSA ***
    |
    | (defun DTR (A) (* PI (/ A 180.0)))
    | (defun RTD (A) (* (/ A PI) 180.0))
    |
    | --
    | Daniel J. Altamura, R.A.
    | Altamura Architectural Consulting
    | and SoftWorx, Autodesk Authorized Developer
    | --------------------------------------------------------------------
    |
    |
    | | > Missing some functons
    | >
    | > Gary
    | >
    | >
    | > | > > Here are some that I wrote a while ago. Enjoy!
    | > >
    | > > Dimsplit
    | > > Dimjoin
    | > > Dimdivide
    | > > Dimoffset
    | > >
    | > > --
    | > > Daniel J. Altamura, R.A.
    | > > Altamura Architectural Consulting
    | > > and SoftWorx, Autodesk Authorized Developer
    | > > --------------------------------------------------------------------
    | > > (defun C:DIMSPLIT (/ OBJ_PICK DIM_PICK DIM_ENT DIM_NODE1 DIM_NODE2
    | DIM_DEF
    | > > DIM_POINT DIM_OBJ)
    | > > ;(STORE)
    | > > (command ".undo" "group")
    | > > (setvar "osmode" 0)
    | > > (setq DIM_PICK 1)
    | > > (while (and DIM_PICK (/= OBJ_PICK "DIMENSION"))
    | > > (setq DIM_PICK (entsel "\nSelect Dimension: "))
    | > > (if DIM_PICK
    | > > (progn
    | > > (setq OBJ_PICK (cdr (assoc 0 (entget (car DIM_PICK))))
    | > > DIM_ENT (entget (car DIM_PICK))
    | > > )
    | > > (if (/= OBJ_PICK "DIMENSION") (prompt "\nThis is not a
    Dimension
    | > > object."))
    | > > )
    | > > )
    | > > )
    | > > (if (or (= (cdr (assoc 70 DIM_ENT)) 32) ; IF ALIGNED OR ROTATED
    | DIMENSION
    | > > (= (cdr (assoc 70 DIM_ENT)) 160)
    | > > (= (cdr (assoc 70 DIM_ENT)) 33)
    | > > (= (cdr (assoc 70 DIM_ENT)) 161)
    | > > )
    | > > (progn
    | > > (setq DIM_NODE1 (cdr (assoc 13 DIM_ENT))
    | > > DIM_NODE2 (cdr (assoc 14 DIM_ENT))
    | > > DIM_DEF (cdr (assoc 10 DIM_ENT))
    | > > DIM_POINT (getpoint "\nPick split point: ")
    | > > )
    | > > (if DIM_POINT
    | > > (progn
    | > > (if (or (= (cdr (assoc 70 DIM_ENT)) 33) (= (cdr (assoc 70
    | > > DIM_ENT)) 161)) ; IF ALIGNED DIMENSION, RESET SPLIT POINT TO ALIGN
    | BETWEEN
    | > > NODES
    | > > (setq DIM_POINT (inters (polar DIM_POINT (angle DIM_DEF
    | > > DIM_NODE2) 12.0) DIM_POINT DIM_NODE1 DIM_NODE2 nil))
    | > > )
    | > > (setq DIM_OBJ (subst (cons 13 DIM_POINT) (assoc 13 DIM_ENT)
    | > > DIM_ENT))
    | > > (entmod DIM_OBJ)
    | > > (command "copy" DIM_PICK "" DIM_POINT DIM_POINT)
    | > > (setq DIM_ENT (entget (entlast))
    | > > DIM_OBJ (subst (cons 14 DIM_NODE1) (assoc 14 DIM_ENT)
    | > > DIM_ENT)
    | > > )
    | > > (entmod DIM_OBJ)
    | > > )
    | > > )
    | > > )
    | > > (if DIM_PICK (prompt "\nThis is neither a Rotated nor an Aligned
    | > > Dimension."))
    | > > )
    | > > (command ".undo" "end")
    | > > ;(RESTORE)
    | > > (princ)
    | > > )
    | > >
    | > > (defun C:DIMJOIN (/ OBJ1_PICK DIM1_PICK DIM1_ENT DIM1_NODE1 DIM1_NODE2
    | > > DIM1_OBJ
    | > > OBJ2_PICK DIM2_PICK DIM2_ENT DIM2_NODE1 DIM2_NODE2
    | > > DIMCASE)
    | > > ;(STORE)
    | > > (command ".undo" "group")
    | > > (setvar "osmode" 0)
    | > > (setq DIM1_PICK 1
    | > > DIM2_PICK 1
    | > > )
    | > > (while (and DIM1_PICK (/= OBJ1_PICK "DIMENSION"))
    | > > (setq DIM1_PICK (entsel "\nSelect First Dimension: "))
    | > > (if DIM1_PICK
    | > > (progn
    | > > (setq OBJ1_PICK (cdr (assoc 0 (entget (car DIM1_PICK))))
    | > > DIM1_ENT (entget (car DIM1_PICK))
    | > > )
    | > > (if (/= OBJ1_PICK "DIMENSION") (prompt "\nThis is not a
    | Dimension
    | > > object."))
    | > > )
    | > > )
    | > > )
    | > > (if (or (= (cdr (assoc 70 DIM1_ENT)) 32) ; IF ALIGNED OR ROTATED
    | DIMENSION
    | > > (= (cdr (assoc 70 DIM1_ENT)) 160)
    | > > (= (cdr (assoc 70 DIM1_ENT)) 33)
    | > > (= (cdr (assoc 70 DIM1_ENT)) 161)
    | > > )
    | > > (progn
    | > > (if (= OBJ1_PICK "DIMENSION")
    | > > (progn
    | > > (while (and DIM2_PICK (/= OBJ2_PICK "DIMENSION"))
    | > > (setq DIM2_PICK (entsel "\nSelect Second Dimension: "))
    | > > (if DIM2_PICK
    | > > (progn
    | > > (setq OBJ2_PICK (cdr (assoc 0 (entget (car
    DIM2_PICK))))
    | > > DIM2_ENT (entget (car DIM2_PICK))
    | > > )
    | > > (if (/= OBJ2_PICK "DIMENSION") (prompt "\nThis is not
    a
    | > > Dimension object."))
    | > > )
    | > > )
    | > > )
    | > > (if (or (= (cdr (assoc 70 DIM2_ENT)) 32) ; IF ALIGNED OR
    | ROTATED
    | > > DIMENSION
    | > > (= (cdr (assoc 70 DIM2_ENT)) 160)
    | > > (= (cdr (assoc 70 DIM2_ENT)) 33)
    | > > (= (cdr (assoc 70 DIM2_ENT)) 161)
    | > > )
    | > > (progn
    | > > (setq DIM1_NODE1 (cdr (assoc 13 DIM1_ENT))
    | > > DIM1_NODE2 (cdr (assoc 14 DIM1_ENT))
    | > > DIM2_NODE1 (cdr (assoc 13 DIM2_ENT))
    | > > DIM2_NODE2 (cdr (assoc 14 DIM2_ENT))
    | > > )
    | > > (if (= (fix (distance DIM1_NODE2 DIM2_NODE1)) 0.0)
    | > > (setq DIM1_OBJ (subst (cons 14 DIM2_NODE2) (assoc 14
    DIM1_ENT)
    | > > DIM1_ENT) DIMCASE 1)
    | > > )
    | > > (if (= (fix (distance DIM1_NODE2 DIM2_NODE2)) 0.0)
    | > > (setq DIM1_OBJ (subst (cons 14 DIM2_NODE1) (assoc 14
    | > > DIM1_ENT) DIM1_ENT) DIMCASE 2)
    | > > )
    | > > (if (= (fix (distance DIM1_NODE1 DIM2_NODE1)) 0.0)
    | > > (setq DIM1_OBJ (subst (cons 13 DIM2_NODE2) (assoc 13
    DIM1_ENT)
    | > > DIM1_ENT) DIMCASE 3)
    | > > )
    | > > (if (= (fix (distance DIM1_NODE1 DIM2_NODE2)) 0.0)
    | > > (setq DIM1_OBJ (subst (cons 13 DIM2_NODE1) (assoc 13
    DIM1_ENT)
    | > > DIM1_ENT) DIMCASE 4)
    | > > )
    | > > (if DIMCASE
    | > > (progn
    | > > (entmod DIM1_OBJ)
    | > > (command "erase" DIM2_PICK "")
    | > > )
    | > > (prompt "\nDimensions are not coincident.")
    | > > )
    | > > )
    | > > (if DIM2_PICK (prompt "\nThis is neither a Rotated nor an
    | > > Aligned Dimension."))
    | > > )
    | > > )
    | > > )
    | > > )
    | > > (if DIM1_PICK (prompt "\nThis is neither a Rotated nor an Aligned
    | > > Dimension."))
    | > > )
    | > > (command ".undo" "end")
    | > > ;(RESTORE)
    | > > (princ)
    | > > )
    | > >
    | > > (defun C:DIMDIVIDE (/ OBJ_PICK DIM_PICK DIM_ENT DIM_NODE1 DIM_NODE2
    | DIM_DEF
    | > > DIM_POINT DIM_OBJ)
    | > > ;(STORE)
    | > > (command ".undo" "group")
    | > > (setvar "osmode" 0)
    | > > (setq DIM_PICK 1)
    | > > (while (and DIM_PICK (/= OBJ_PICK "DIMENSION"))
    | > > (setq DIM_PICK (entsel "\nSelect Dimension: "))
    | > > (if DIM_PICK
    | > > (progn
    | > > (setq OBJ_PICK (cdr (assoc 0 (entget (car DIM_PICK))))
    | > > DIM_ENT (entget (car DIM_PICK))
    | > > )
    | > > (if (/= OBJ_PICK "DIMENSION") (prompt "\nThis is not a
    Dimension
    | > > object."))
    | > > )
    | > > )
    | > > )
    | > > (if (or (= (cdr (assoc 70 DIM_ENT)) 32) ; IF ALIGNED OR ROTATED
    | DIMENSION
    | > > (= (cdr (assoc 70 DIM_ENT)) 160)
    | > > (= (cdr (assoc 70 DIM_ENT)) 33)
    | > > (= (cdr (assoc 70 DIM_ENT)) 161)
    | > > )
    | > > (progn
    | > > (if (not DIM_DIV) (setq DIM_DIV 2))
    | > > (initget 6)
    | > > (setq DIM_DIV (DEFNUM DIM_DIV "\nNumber of divisions"))
    | > > (if (and (= OBJ_PICK "DIMENSION") (> DIM_DIV 1))
    | > > (progn
    | > > (setq DIM_ENT (entget (car DIM_PICK))
    | > > DIM_NODE1 (cdr (assoc 13 DIM_ENT))
    | > > DIM_NODE2 (cdr (assoc 14 DIM_ENT))
    | > > DIM_DEF (cdr (assoc 10 DIM_ENT))
    | > > DIM_POINT (polar DIM_NODE1 (angle DIM_NODE1 DIM_NODE2)
    | (/
    | > > (distance DIM_NODE1 DIM_NODE2) DIM_DIV))
    | > > DIM_OBJ (subst (cons 14 DIM_POINT) (assoc 14 DIM_ENT)
    | > > DIM_ENT)
    | > > )
    | > > (entmod DIM_OBJ)
    | > > (setq DIM_NODE2 (cdr (assoc 14 DIM_OBJ)))
    | > > (command "copy" DIM_PICK "" DIM_NODE1 DIM_NODE2)
    | > > (setq DIM_ENT (entget (entlast))
    | > > DIM_OBJ (subst (cons 10 DIM_DEF) (assoc 10 DIM_ENT)
    | DIM_ENT)
    | > > )
    | > > (entmod DIM_OBJ)
    | > > (repeat (- DIM_DIV 2)
    | > > (command "copy" (ENTLAST) "" DIM_NODE1 DIM_NODE2)
    | > > (setq DIM_ENT (entget (entlast))
    | > > DIM_OBJ (subst (cons 10 DIM_DEF) (assoc 10 DIM_ENT)
    | > > DIM_ENT)
    | > > )
    | > > (entmod DIM_OBJ)
    | > > )
    | > > )
    | > > )
    | > > )
    | > > (if DIM_PICK (prompt "\nThis is neither a Rotated nor an Aligned
    | > > Dimension."))
    | > > )
    | > > (command ".undo" "end")
    | > > ;(RESTORE)
    | > > (princ)
    | > > )
    | > >
    | > > (defun C:DIMOFFSET (/ OBJ_PICK DIM_SIDE DIM_PICK DIM_ENT DIM_NODE1
    | DIM_NODE2
    | > > DIM_INT DIM_DEF DIM_POINT DIM_OBJ)
    | > > ;(STORE)
    | > > (command ".undo" "group")
    | > > (if (not DIM_OFFS) (setq DIM_OFFS (* 0.375 (getvar "dimscale"))))
    | > > (initget 2)
    | > > (setq DIM_OFFS (DEFDIST DIM_OFFS "Specify offset distance"))
    | > > (setq DIM_PICK 1 OBJ_PICK 1)
    | > > (while (and DIM_PICK (/= OBJ_PICK "DIMENSION"))
    | > > (setq DIM_PICK (entsel "\nSelect Dimension to offset: "))
    | > > (if DIM_PICK
    | > > (progn
    | > > (setq OBJ_PICK (cdr (assoc 0 (entget (car DIM_PICK))))
    | > > DIM_ENT (entget (car DIM_PICK))
    | > > )
    | > > (if (/= OBJ_PICK "DIMENSION") (prompt "\nThis is not a
    Dimension
    | > > object."))
    | > > )
    | > > )
    | > > )
    | > > (if (or (= (cdr (assoc 70 DIM_ENT)) 32) ; IF ALIGNED OR ROTATED
    | DIMENSION
    | > > (= (cdr (assoc 70 DIM_ENT)) 160)
    | > > (= (cdr (assoc 70 DIM_ENT)) 33)
    | > > (= (cdr (assoc 70 DIM_ENT)) 161)
    | > > )
    | > > (progn
    | > > (setq DIM_SIDE (getpoint "\nSpecify point on side to offset: "))
    | > > (if DIM_SIDE
    | > > (if (and (= OBJ_PICK "DIMENSION") (> DIM_OFFS 0))
    | > > (progn
    | > > (setvar "osmode" 0)
    | > > (setq DIM_ENT (entget (car DIM_PICK))
    | > > DIM_NODE1 (cdr (assoc 13 DIM_ENT))
    | > > DIM_NODE2 (cdr (assoc 14 DIM_ENT))
    | > > DIM_DEF (cdr (assoc 10 DIM_ENT))
    | > > DIM_INT (polar DIM_SIDE (angle DIM_DEF DIM_NODE2)
    | 12.0)
    | > > DIM_POINT (inters (polar DIM_DEF (+ (angle DIM_DEF
    | > > DIM_NODE2) (DTR 90.0)) 12.0) DIM_DEF DIM_SIDE DIM_INT nil)
    | > > )
    | > > (command "copy" DIM_PICK "" DIM_NODE2 (polar DIM_NODE2
    | (angle
    | > > DIM_POINT DIM_SIDE) DIM_OFFS))
    | > > (setq DIM_ENT (entget (entlast))
    | > > DIM_OBJ (subst (cons 13 DIM_NODE1) (assoc 13
    DIM_ENT)
    | > > DIM_ENT)
    | > > )
    | > > (entmod DIM_OBJ)
    | > > (setq DIM_ENT (entget (entlast))
    | > > DIM_OBJ (subst (cons 14 DIM_NODE2) (assoc 14
    DIM_ENT)
    | > > DIM_ENT)
    | > > )
    | > > (entmod DIM_OBJ)
    | > > (setq DIM_ENT (entget (entlast))
    | > > DIM_DEF (polar DIM_DEF (angle DIM_POINT DIM_SIDE)
    | > > DIM_OFFS)
    | > > DIM_OBJ (subst (cons 10 DIM_DEF) (assoc 10 DIM_ENT)
    | > > DIM_ENT)
    | > > )
    | > > (entmod DIM_OBJ)
    | > > )
    | > > )
    | > > )
    | > > )
    | > > (if DIM_PICK (prompt "\nThis is neither a Rotated nor an Aligned
    | > > Dimension."))
    | > > )
    | > > (command ".undo" "end")
    | > > ;(RESTORE)
    | > > (princ)
    | > > )
    | > >
    | > >
    | >
    | >
    |
    |
     
    Matt W, Jun 8, 2004
    #9
  10. Matt W

    Rudy Tovar Guest

    This code looked hacked!

     
    Rudy Tovar, Jun 8, 2004
    #10
  11. You made my day. Thanks for the kudos. I'm glad it worked out for you.
     
    Daniel J. Altamura, R.A., Jun 8, 2004
    #11
  12. Matt W

    GaryDF Guest

    error: no function definition: DEFDIST
    error: no function definition: DEFNUM

    Gary
     
    GaryDF, Jun 8, 2004
    #12
  13. Matt W

    Jürg Menzi Guest

    Kelvinator...

    Cheers
     
    Jürg Menzi, Jun 9, 2004
    #13
  14. My apologizies. That's what I get when I try to quickly strip out a program
    and post it too quickly. Below is the code with (hopefully) all the missing
    functions included. Let me know if it works for you or not.

    Dan

    --
    Daniel J. Altamura, R.A.
    Altamura Architectural Consulting
    and SoftWorx, Autodesk Authorized Developer
    --------------------------------------------------------------------
    (defun C:DIMSPLIT (/ OBJ_PICK DIM_PICK DIM_ENT DIM_NODE1 DIM_NODE2 DIM_DEF
    DIM_POINT DIM_OBJ)
    ;(STORE)
    (command ".undo" "group")
    (setvar "osmode" 0)
    (setq DIM_PICK 1)
    (while (and DIM_PICK (/= OBJ_PICK "DIMENSION"))
    (setq DIM_PICK (entsel "\nSelect Dimension: "))
    (if DIM_PICK
    (progn
    (setq OBJ_PICK (cdr (assoc 0 (entget (car DIM_PICK))))
    DIM_ENT (entget (car DIM_PICK))
    )
    (if (/= OBJ_PICK "DIMENSION") (prompt "\nThis is not a Dimension
    object."))
    )
    )
    )
    (if (or (= (cdr (assoc 70 DIM_ENT)) 32) ; IF ALIGNED OR ROTATED DIMENSION
    (= (cdr (assoc 70 DIM_ENT)) 160)
    (= (cdr (assoc 70 DIM_ENT)) 33)
    (= (cdr (assoc 70 DIM_ENT)) 161)
    )
    (progn
    (setq DIM_NODE1 (cdr (assoc 13 DIM_ENT))
    DIM_NODE2 (cdr (assoc 14 DIM_ENT))
    DIM_DEF (cdr (assoc 10 DIM_ENT))
    DIM_POINT (getpoint "\nPick split point: ")
    )
    (if DIM_POINT
    (progn
    (if (or (= (cdr (assoc 70 DIM_ENT)) 33) (= (cdr (assoc 70
    DIM_ENT)) 161)) ; IF ALIGNED DIMENSION, RESET SPLIT POINT TO ALIGN BETWEEN
    NODES
    (setq DIM_POINT (inters (polar DIM_POINT (angle DIM_DEF
    DIM_NODE2) 12.0) DIM_POINT DIM_NODE1 DIM_NODE2 nil))
    )
    (setq DIM_OBJ (subst (cons 13 DIM_POINT) (assoc 13 DIM_ENT)
    DIM_ENT))
    (entmod DIM_OBJ)
    (command "copy" DIM_PICK "" DIM_POINT DIM_POINT)
    (setq DIM_ENT (entget (entlast))
    DIM_OBJ (subst (cons 14 DIM_NODE1) (assoc 14 DIM_ENT)
    DIM_ENT)
    )
    (entmod DIM_OBJ)
    )
    )
    )
    (if DIM_PICK (prompt "\nThis is neither a Rotated nor an Aligned
    Dimension."))
    )
    (command ".undo" "end")
    ;(RESTORE)
    (princ)
    )

    (defun C:DIMJOIN (/ OBJ1_PICK DIM1_PICK DIM1_ENT DIM1_NODE1 DIM1_NODE2
    DIM1_OBJ
    OBJ2_PICK DIM2_PICK DIM2_ENT DIM2_NODE1 DIM2_NODE2
    DIMCASE)
    ;(STORE)
    (command ".undo" "group")
    (setvar "osmode" 0)
    (setq DIM1_PICK 1
    DIM2_PICK 1
    )
    (while (and DIM1_PICK (/= OBJ1_PICK "DIMENSION"))
    (setq DIM1_PICK (entsel "\nSelect First Dimension: "))
    (if DIM1_PICK
    (progn
    (setq OBJ1_PICK (cdr (assoc 0 (entget (car DIM1_PICK))))
    DIM1_ENT (entget (car DIM1_PICK))
    )
    (if (/= OBJ1_PICK "DIMENSION") (prompt "\nThis is not a Dimension
    object."))
    )
    )
    )
    (if (or (= (cdr (assoc 70 DIM1_ENT)) 32) ; IF ALIGNED OR ROTATED DIMENSION
    (= (cdr (assoc 70 DIM1_ENT)) 160)
    (= (cdr (assoc 70 DIM1_ENT)) 33)
    (= (cdr (assoc 70 DIM1_ENT)) 161)
    )
    (progn
    (if (= OBJ1_PICK "DIMENSION")
    (progn
    (while (and DIM2_PICK (/= OBJ2_PICK "DIMENSION"))
    (setq DIM2_PICK (entsel "\nSelect Second Dimension: "))
    (if DIM2_PICK
    (progn
    (setq OBJ2_PICK (cdr (assoc 0 (entget (car DIM2_PICK))))
    DIM2_ENT (entget (car DIM2_PICK))
    )
    (if (/= OBJ2_PICK "DIMENSION") (prompt "\nThis is not a
    Dimension object."))
    )
    )
    )
    (if (or (= (cdr (assoc 70 DIM2_ENT)) 32) ; IF ALIGNED OR ROTATED
    DIMENSION
    (= (cdr (assoc 70 DIM2_ENT)) 160)
    (= (cdr (assoc 70 DIM2_ENT)) 33)
    (= (cdr (assoc 70 DIM2_ENT)) 161)
    )
    (progn
    (setq DIM1_NODE1 (cdr (assoc 13 DIM1_ENT))
    DIM1_NODE2 (cdr (assoc 14 DIM1_ENT))
    DIM2_NODE1 (cdr (assoc 13 DIM2_ENT))
    DIM2_NODE2 (cdr (assoc 14 DIM2_ENT))
    )
    (if (= (fix (distance DIM1_NODE2 DIM2_NODE1)) 0.0)
    (setq DIM1_OBJ (subst (cons 14 DIM2_NODE2) (assoc 14 DIM1_ENT)
    DIM1_ENT) DIMCASE 1)
    )
    (if (= (fix (distance DIM1_NODE2 DIM2_NODE2)) 0.0)
    (setq DIM1_OBJ (subst (cons 14 DIM2_NODE1) (assoc 14
    DIM1_ENT) DIM1_ENT) DIMCASE 2)
    )
    (if (= (fix (distance DIM1_NODE1 DIM2_NODE1)) 0.0)
    (setq DIM1_OBJ (subst (cons 13 DIM2_NODE2) (assoc 13 DIM1_ENT)
    DIM1_ENT) DIMCASE 3)
    )
    (if (= (fix (distance DIM1_NODE1 DIM2_NODE2)) 0.0)
    (setq DIM1_OBJ (subst (cons 13 DIM2_NODE1) (assoc 13 DIM1_ENT)
    DIM1_ENT) DIMCASE 4)
    )
    (if DIMCASE
    (progn
    (entmod DIM1_OBJ)
    (command "erase" DIM2_PICK "")
    )
    (prompt "\nDimensions are not coincident.")
    )
    )
    (if DIM2_PICK (prompt "\nThis is neither a Rotated nor an
    Aligned Dimension."))
    )
    )
    )
    )
    (if DIM1_PICK (prompt "\nThis is neither a Rotated nor an Aligned
    Dimension."))
    )
    (command ".undo" "end")
    ;(RESTORE)
    (princ)
    )

    (defun C:DIMDIVIDE (/ OBJ_PICK DIM_PICK DIM_ENT DIM_NODE1 DIM_NODE2 DIM_DEF
    DIM_POINT DIM_OBJ)
    ;(STORE)
    (command ".undo" "group")
    (setvar "osmode" 0)
    (setq DIM_PICK 1)
    (while (and DIM_PICK (/= OBJ_PICK "DIMENSION"))
    (setq DIM_PICK (entsel "\nSelect Dimension: "))
    (if DIM_PICK
    (progn
    (setq OBJ_PICK (cdr (assoc 0 (entget (car DIM_PICK))))
    DIM_ENT (entget (car DIM_PICK))
    )
    (if (/= OBJ_PICK "DIMENSION") (prompt "\nThis is not a Dimension
    object."))
    )
    )
    )
    (if (or (= (cdr (assoc 70 DIM_ENT)) 32) ; IF ALIGNED OR ROTATED DIMENSION
    (= (cdr (assoc 70 DIM_ENT)) 160)
    (= (cdr (assoc 70 DIM_ENT)) 33)
    (= (cdr (assoc 70 DIM_ENT)) 161)
    )
    (progn
    (if (not DIM_DIV) (setq DIM_DIV 2))
    (initget 6)
    (setq DIM_DIV (DEFNUM DIM_DIV "\nNumber of divisions"))
    (if (and (= OBJ_PICK "DIMENSION") (> DIM_DIV 1))
    (progn
    (setq DIM_ENT (entget (car DIM_PICK))
    DIM_NODE1 (cdr (assoc 13 DIM_ENT))
    DIM_NODE2 (cdr (assoc 14 DIM_ENT))
    DIM_DEF (cdr (assoc 10 DIM_ENT))
    DIM_POINT (polar DIM_NODE1 (angle DIM_NODE1 DIM_NODE2) (/
    (distance DIM_NODE1 DIM_NODE2) DIM_DIV))
    DIM_OBJ (subst (cons 14 DIM_POINT) (assoc 14 DIM_ENT)
    DIM_ENT)
    )
    (entmod DIM_OBJ)
    (setq DIM_NODE2 (cdr (assoc 14 DIM_OBJ)))
    (command "copy" DIM_PICK "" DIM_NODE1 DIM_NODE2)
    (setq DIM_ENT (entget (entlast))
    DIM_OBJ (subst (cons 10 DIM_DEF) (assoc 10 DIM_ENT) DIM_ENT)
    )
    (entmod DIM_OBJ)
    (repeat (- DIM_DIV 2)
    (command "copy" (ENTLAST) "" DIM_NODE1 DIM_NODE2)
    (setq DIM_ENT (entget (entlast))
    DIM_OBJ (subst (cons 10 DIM_DEF) (assoc 10 DIM_ENT)
    DIM_ENT)
    )
    (entmod DIM_OBJ)
    )
    )
    )
    )
    (if DIM_PICK (prompt "\nThis is neither a Rotated nor an Aligned
    Dimension."))
    )
    (command ".undo" "end")
    ;(RESTORE)
    (princ)
    )

    (defun C:DIMOFFSET (/ OBJ_PICK DIM_SIDE DIM_PICK DIM_ENT DIM_NODE1 DIM_NODE2
    DIM_INT DIM_DEF DIM_POINT DIM_OBJ)
    ;(STORE)
    (command ".undo" "group")
    (if (not DIM_OFFS) (setq DIM_OFFS (* 0.375 (getvar "dimscale"))))
    (initget 2)
    (setq DIM_OFFS (DEFDIST DIM_OFFS "Specify offset distance"))
    (setq DIM_PICK 1 OBJ_PICK 1)
    (while (and DIM_PICK (/= OBJ_PICK "DIMENSION"))
    (setq DIM_PICK (entsel "\nSelect Dimension to offset: "))
    (if DIM_PICK
    (progn
    (setq OBJ_PICK (cdr (assoc 0 (entget (car DIM_PICK))))
    DIM_ENT (entget (car DIM_PICK))
    )
    (if (/= OBJ_PICK "DIMENSION") (prompt "\nThis is not a Dimension
    object."))
    )
    )
    )
    (if (or (= (cdr (assoc 70 DIM_ENT)) 32) ; IF ALIGNED OR ROTATED DIMENSION
    (= (cdr (assoc 70 DIM_ENT)) 160)
    (= (cdr (assoc 70 DIM_ENT)) 33)
    (= (cdr (assoc 70 DIM_ENT)) 161)
    )
    (progn
    (setq DIM_SIDE (getpoint "\nSpecify point on side to offset: "))
    (if DIM_SIDE
    (if (and (= OBJ_PICK "DIMENSION") (> DIM_OFFS 0))
    (progn
    (setvar "osmode" 0)
    (setq DIM_ENT (entget (car DIM_PICK))
    DIM_NODE1 (cdr (assoc 13 DIM_ENT))
    DIM_NODE2 (cdr (assoc 14 DIM_ENT))
    DIM_DEF (cdr (assoc 10 DIM_ENT))
    DIM_INT (polar DIM_SIDE (angle DIM_DEF DIM_NODE2) 12.0)
    DIM_POINT (inters (polar DIM_DEF (+ (angle DIM_DEF
    DIM_NODE2) (DTR 90.0)) 12.0) DIM_DEF DIM_SIDE DIM_INT nil)
    )
    (command "copy" DIM_PICK "" DIM_NODE2 (polar DIM_NODE2 (angle
    DIM_POINT DIM_SIDE) DIM_OFFS))
    (setq DIM_ENT (entget (entlast))
    DIM_OBJ (subst (cons 13 DIM_NODE1) (assoc 13 DIM_ENT)
    DIM_ENT)
    )
    (entmod DIM_OBJ)
    (setq DIM_ENT (entget (entlast))
    DIM_OBJ (subst (cons 14 DIM_NODE2) (assoc 14 DIM_ENT)
    DIM_ENT)
    )
    (entmod DIM_OBJ)
    (setq DIM_ENT (entget (entlast))
    DIM_DEF (polar DIM_DEF (angle DIM_POINT DIM_SIDE)
    DIM_OFFS)
    DIM_OBJ (subst (cons 10 DIM_DEF) (assoc 10 DIM_ENT)
    DIM_ENT)
    )
    (entmod DIM_OBJ)
    )
    )
    )
    )
    (if DIM_PICK (prompt "\nThis is neither a Rotated nor an Aligned
    Dimension."))
    )
    (command ".undo" "end")
    ;(RESTORE)
    (princ)
    )

    ;*** DEFAULT DISTANCE FUNCTION ***

    (defun DEFDIST (dist msg / temp bm)
    (setq bm (getvar "blipmode"))
    (setvar "blipmode" BM)
    (while
    (progn
    (cond
    ((setq temp (getdist (strcat "\n" msg (if dist (strcat " <"
    (rtos dist (getvar "lunits") (getvar "luprec")) ">") "") ": ")))
    (progn (setq dist temp) nil)
    )
    ((and (not temp) dist) nil)
    (T (princ "\nInvalid ..."))
    )
    )
    )
    dist
    )

    ;*** DEFAULT NUMBER FUNCTION ***

    (defun DEFNUM (dnum msg / temp)
    (while
    (progn
    (initget 4)
    (cond
    ((setq temp (getint (strcat "\n" msg (if dnum (strcat " <"
    (rtos dnum 2 0) ">") "") ": ")))
    (progn
    (setq dnum temp)
    nil
    )
    )
    ((and (not temp) dnum) nil)
    (T (princ "\nInvalid ..."))
    )
    )
    )
    dnum
    )

    ;*** CONVERTS DEGREES TO RADIANS AND VISCA-VERSA ***

    (defun DTR (A) (* PI (/ A 180.0)))
    (defun RTD (A) (* (/ A PI) 180.0))

    (princ)
     
    Daniel J. Altamura, R.A., Jun 9, 2004
    #14
  15. Matt W

    OLD-CADaver Guest

    I'm interested in your STORE and RESTORE functions in this routine. Would you post them so that we could compare notes?
     
    OLD-CADaver, Jun 9, 2004
    #15
  16. Matt W

    GaryDF Guest

    Thanks...good routines...I like then better than the ones I have been
    using. My only comment, would be to always place the dot when
    using an AutoCAD command name in your routine. I have redefined
    COPY for 2005 to act like COPY of 2004. Your routine kept
    bombing out on me until I added the dot

    (command ".copy" DIM_PICK "" DIM_NODE1 DIM_NODE2)
    (command ".undo" "group") already had the dot.............................

    Gary
     
    GaryDF, Jun 9, 2004
    #16
  17. Yeah, I know... shame on me. This is something that I have been meaning to
    do. Your point is well taken.
    I'm glad you like the routines. Glad I could help.

    Dan
     
    Daniel J. Altamura, R.A., Jun 9, 2004
    #17
  18. Matt W

    Steve Doman Guest

    Cool routines Dan. Thanks for sharing!
    Steve Doman
     
    Steve Doman, Jun 10, 2004
    #18
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.