Adding a second line to a dim

Discussion in 'AutoCAD' started by mgorecki, Feb 25, 2005.

  1. mgorecki

    mgorecki Guest

    HI,
    I'm trying to add a second line of text to an existing dimension. I have tried using the "DIMPOST" command with the /X, but the dimension line does not break, the text appears on either side of the dimension line (I would like the break on horizontal dims)
    So I tried to change the dim after it was created, by using subst and entmode. Below is part of my code.

    (command "dim1" "hor" pnt1 pnt2 pnt3 "")

    (setq chg_dim (entget (entlast))) ;gets the entity info list
    (setq chg_dim (subst (cons 1 "<>\\P(NEW TEXT)") (assoc 1 chg_dim) chg_dim)) ;changes the dim text to add the
    (entmod chgdim) ;carriage return and text

    The text does not change even though when you execute the commands in the Visual Lisp Console it shows the change to the entity list.
    Thanks,
    Mark
     
    mgorecki, Feb 25, 2005
    #1
  2. mgorecki

    Jim Dee Guest

    You should simply be able to add a "\X2nd Line" not "/X2nd Line" to the
    string.

    Jim Dee
    www.caddee.com
     
    Jim Dee, Feb 25, 2005
    #2
  3. Here are some programs and the subroutine that add text to dimension.

    (defun C:DIMRW ()
    (DIMADD "R/W WIDTH" "R/W" "")
    (princ)
    )
    ;DIMPAV = add PAVEMENT text to dimension
    (defun C:DIMPAV ()
    (DIMADD "PAVEMENT" "PAVEMENT" "")
    (princ)
    )
    ;DIMFOC = add FOC TO FOC text to dimension
    (defun C:DIMFOC ()
    (DIMADD "FOC TO FOC" "FOC\\PTO FOC" "\\P")
    (princ)
    )
    ;DIMFOC1 = add FOC TO FOC text to dimension
    (defun C:DIMFOC1 ()
    (DIMADD "FOC TO FOC" "FOC TO FOC" "")
    (princ)
    )
    ;DIMBS = add BUILDING SETBACK text to dimension
    (defun C:DIMBS ()
    (DIMADD "BUILDING SETBACK" "BUILDING\\PSETBACK" "")
    (princ)
    )
    ;DIMDUE = add DRAINAGE & UTILITY EASEMENT text to dimension
    (defun C:DIMDUE ()
    (DIMADD "DRAINAGE & UTILITY EASEMENT" "DRAINAGE &\\PUTILITY EASEMENT" "")
    (princ)
    )

    ;DIMADD = subroutine to add text to dimension
    ;DT1 is the text that tells the user what they are adding to the dimension
    ;DT2 is prefix for selected dimension
    ;DT3 is suffix for selected dimension
    (defun DIMADD (DT1 DT2 DT3 / ES EG TT NT)
    (setq ES (entsel (strcat "\nSelect Dimension to add " DT1 " text ? ")))
    (while ES
    (setq EG (entget (car ES)))
    (if (= (cdr (assoc 0 EG)) "DIMENSION")
    (progn
    (setq TT (cdr (assoc 1 EG)))
    (if (= TT "")
    (setq NT (strcat DT3 "<> " DT2))
    (setq NT (strcat TT " " DT2))
    )
    (setq EG (subst (cons 1 NT) (assoc 1 EG) EG))
    (entmod EG)
    )
    (princ (strcat "\nERROR - Entity selected is [" (cdr (assoc 0 EG)) "] and
    NOT a dimension."))
    )
    (setq ES (entsel (strcat "\nSelect Dimension to add " DT1 " text ? ")))
    )
    (princ)
    )
    Alan Henderson


    tried using the "DIMPOST" command with the /X, but the dimension line does
    not break, the text appears on either side of the dimension line (I would
    like the break on horizontal dims)
    entmode. Below is part of my code.
    chg_dim)) ;changes the dim text to add the
    Visual Lisp Console it shows the change to the entity list.
     
    Alan Henderson @ A'cad Solutions, Feb 25, 2005
    #3
  4. very handy, thanks

    "Alan Henderson @ A'cad Solutions" <alan@R_E_M_O_V_Eacadsolutions.biz>
    |>Here are some programs and the subroutine that add text to dimension.
    |>


    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Feb 25, 2005
    #4
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.