custom dimensions

Discussion in 'AutoCAD' started by jason s, Mar 2, 2004.

  1. jason s

    jason s Guest

    Just wondering if anyone knows if there is a way to create a new dimension style that will automatically deduct 2" from each dimension that I draw.

    I am putting lengths of pipe on a drawing and i need to put the cut length of the pipe as well as the center to center dimension. The cut length is usually 2" shorter than the center to center dimension.

    I don't want to have to go in and manually change every dimension.

    I'm using 2000i

    Thanks in advance,

    Jason
     
    jason s, Mar 2, 2004
    #1
  2. jason s

    btlsp Guest

    btlsp, Mar 2, 2004
    #2
  3. jason s

    Tom Berger Guest

    This could be done with a few lines of Lisp. The dimensions can still
    be associative, a reactor function can update your dimensions whenever
    you modify the geometry.

    Tom Berger
     
    Tom Berger, Mar 2, 2004
    #3
  4. I did this using alt units and a small routine. Setting the
    multiplier
    small like this will make the alt unit zero.


    Set a dim style to have alt units and set the following in alt
    units:

    Muliplier= .0000000001
    Prefix= Cut Size=


    (defun C:g-space (/ oc *error* dimtext)
    (setq oc (getvar "cmdecho"))

    (defun *error* (msg)
    (if (and msg
    (not (member msg
    '("console break" "Function cancelled" "quit / exit abort")))
    )
    (princ (strcat "\nError: " msg))
    )
    (setvar "cmdecho" oc)
    (princ)
    )

    (setvar "cmdecho" 0)
    (if (tblobjname "dimstyle" "g-space")
    (progn
    (command "dimstyle" "r" "g-space")
    (prompt "\nPick Dim Points:")
    (command "dimlinear")
    (while (= 1 (logand (getvar "cmdactive") 1))
    (command pause)
    )
    (setq dimtext (vlax-ename->vla-object (entlast)))
    (vla-put-alttextsuffix
    dimtext
    (strcat (rtos (- (vla-get-measurement dimtext) 3.25)) "\"")
    )
    )
    )
    (*error* nil)
    (princ)
    )


    --
    Ken Alexander
    Acad2004
    Windows2000 Prof.

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein

    dimension style that will automatically deduct 2" from each dimension
    that I draw.
    cut length of the pipe as well as the center to center dimension. The
    cut length is usually 2" shorter than the center to center dimension.
     
    Ken Alexander, Mar 2, 2004
    #4
  5. jason s

    James Buzbee Guest

    Jason,
    I don't know how proficient your are with lisp but this little routine will
    get you started. It takes two arguments; the first is a real number (2.0)
    and the second is a dimension entity passed either through entsel or a while
    loop from a selection set ( you can search for examples of using ssget and
    passing each entity to the function for multiple selection.)

    Hope this helps.

    jb

    No error checking, assumes the entity passed is a dimension that exists in
    the acive document.

    WFWW

    ;;; Use (jb:minusdim 2.0 (car(entsel "\nSelect a dimension: ")))

    (defun jb:minusdim(minus dim / dimobj dist newdist newdiststr)
    (vl-load-com)
    (setq dimobj(vlax-ename->vla-object dim))
    dist(vlax-get dimobj "Measurement"))

    ;adjust measurement
    (setq newdist(- minus dist)
    newdiststr(rtos newdist))

    ;set the override text
    (vlax-put dimobj "TextOverride" newdiststr)
    )
     
    James Buzbee, Mar 2, 2004
    #5
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.