Scale existing blocks (xyz) to match current dimscale?

Discussion in 'AutoCAD' started by z03656, Feb 11, 2005.

  1. z03656

    z03656 Guest

    I'm trying to find a lisp that will scale existing blocks (scale x,y,z) to match my current dimscale. All my reference bubbles are inserted by "dimscale".
    For one example, I'm having to scale my drawings from 1/8"=1'-0" (scalefactor=96) to 3/32"=1'-0" (scalefactor=128). I've been editing the scale x,y,z thru properties dialog to 128. I've tried other lisp out there none close to what I'm looking for.
     
    z03656, Feb 11, 2005
    #1
  2. If your reference bubbles and the like are all on the same layer, and it
    doesn't have any blocks on it that aren't scaled that way, you can use
    qselect to grab all blocks on that layer, and use your properties box change
    on all of them at once. Even if they're on different layers, you can use
    qselect to grab all the blocks of the same name at once. Almost as fast as
    applying a lisp routine, and much faster than writing one, if you won't need
    it often enough to justify that..
     
    Kent Cooper, AIA, Feb 11, 2005
    #2
  3. z03656

    z03656 Guest

    I know about using the Quick Select or Properties dialog. Is there a lisp function that can set blocks x,y,z scales to current dimscale?...
     
    z03656, Feb 14, 2005
    #3
  4. z03656

    sdmadden Guest

    Try this routine. Type bs and select a block, then type in the new blockscale

    (defun C:BS (/ p l i n e fact ins entype chm ed el flist scl)
    (setq chm 0)
    (menucmd "S=SELECT")
    (menucmd "S=*")
    (while (/= entype "INSERT")
    (setq el nil)
    (while (= el nil)
    (setq el (car (entsel "\nSelect Block:")))
    )
    (setq ed (entget el))
    (setq entype (cdr (assoc 0 ed)))
    )
    (princ "\n")
    (princ (cdr (setq name (assoc 2 ed))))
    (princ " block selected.\n")
    (setq fact (cdr (assoc 41 ed)))
    (princ "Current scale factor is ")
    (princ fact)
    (princ "\n")

    (setq flist (list (cons -4 "<AND") (cons 0 "INSERT") name (cons -4 "AND>")))
    (setq p (ssget "X" flist))

    (if p (progn
    (command "UCS" "W")
    (setq l 0 n (sslength p))
    (setq scl (getreal "\nScale Factor: "))
    (while (< l n)
    (setq e (entget (ssname p l)))
    (setq fact (/ scl (cdr (assoc 41 e))))
    (setq ins (cdr (assoc 10 e)))
    (setq sel (dxf -1 e))
    (command "SCALE" sel "" "non" ins fact)
    ;(setq e (subst (cons 41 scl) (assoc 41 e) e))
    ;(setq e (subst (cons 42 scl) (assoc 42 e) e))
    ;(setq e (subst (cons 43 scl) (assoc 43 e) e))
    ;(entmod e)
    ;(entupd (ssname p l))
    (setq chm (1+ chm))
    (setq l (1+ l))
    )
    (command "UCS" "P")
    ))
    (princ "\n")
    (princ chm)
    (princ " Blocks Scaled.")
    (princ)
    )
    (princ)
     
    sdmadden, Feb 14, 2005
    #4
  5. z03656

    z03656 Guest

    I'm getting the following my command line.

    Command:
    BS
    Select Block:
    Cond-SEC-D block selected.
    Current scale factor is 96.0

    Scale Factor: 128
    no function definition: DXF
     
    z03656, Feb 14, 2005
    #5
  6. z03656

    sdmadden Guest

    I just tried it and it worked, what version of acad?
     
    sdmadden, Feb 15, 2005
    #6
  7. z03656

    andywatson Guest

    He needs the function for "dxf"...
    probably something like...

    (defun dxf (dxfcode ent / returnValue)
    (setq returnValue (cdr (assoc dxfcode (entget ent))))
    )
     
    andywatson, Feb 15, 2005
    #7
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.