AutoCAD/Stretch command

Advertisement


Question
In the past when I'm stretching acad objects and involve a hatch or block in my window, all object except hatch and block stretch to specified location. Why do blocks and hatch stay in original location (is there perhaps a system variable that controls this. please advise.

Answer
José:  You know your supposed to mention the version of AutoCAD your running.  

The stretch crossing window MUST catch the insertion point of the block or it will not move with everything else.  Hatches on the other hand have always been unreliable on a stretch even though they were "associative".  Sometimes they work and sometimes they don't.  I wrote a rehatch LISP routine for when the hatch messes up on a stretch or other editing command.  

(defun rherr (msg)
  (if msg (princ msg))
  (command "_.undo" "_end")
  (if olderr (setq *error* olderr))
  (if (= *error* rherr) (c:newerr))
  (princ)
)
(defun c:rh (/ ent elist layr colr lt)
  (command "_.undo" "_g")
  (setq olderr *error* *error* rherr)
  (command "snap" "off")
  (setq ent (entsel))
  (setq elist (entget (car ent)))
  (setq layr (cdr (assoc 8 elist)))
  (setq colr (cdr (assoc 62 elist)))
  (setq lt (cdr (assoc 6 elist)))
  (setvar "hpname" (cdr (assoc 2 elist)))
  (if (/= (getvar "hpname") "SOLID")
     (progn
        (setvar "hpang" (cdr (assoc 52 elist)))
        (setvar "hpscale" (cdr (assoc 41 elist)))
     )
  )
  (if (or (= (substr (getvar "hpname")1 2 ) "_U")(= (substr (getvar "hpname")1 1 ) "U"))
     (progn
        (if (= (cdr (assoc 78 elist)) 2) (setvar "hpdouble" 1))
        (if (= (cdr (assoc 78 elist)) 1) (setvar "hpdouble" 0))
        (setvar "hpspace" (cdr (assoc 41 elist)))
     )
  )
  (command "_.-layer" "s" layr "")
  (if (null colr)
     (setvar "cecolor" "256")
     (setvar "cecolor" (itoa (cdr (assoc 62 elist))))
  )
  (if (null lt)
     (setvar "celtype" "BYLAYER")
     (setvar "celtype" (cdr (assoc 6 elist)))
  )
  (if colr (alert (strcat "Entity colors are set to " (itoa colr) ".")))
  (if lt (alert (strcat "Entity linetypes are set to " lt ".")))
  (command "_.erase" (car ent) "")
  (command "-bhatch" (cadr ent) "")
  ;   (while (= (getvar "cmdactive") 1)(command pause))
  (setq *error* olderr)
  (command "_.undo" "_end")
  (princ)
)


Keep in touch
Bill DeShawn
http://my.sterling.net

AutoCAD

All Answers


Answers by Expert:


Ask Experts

Volunteer


Bill DeShawn

Expertise

I can address all 2-D questions and some 3-D questions. I do programming in AutoLISP if it doesn`t involve solid modeling. I can also address menu customization issues and can help you find answers to questions I can`t answer by taking your question directly to Autodesk via their newsgroups.

Experience

I used to do electronic and mechanical design for a flat panel monitor manufacturer, and now I do architectural drafting for an architect. I did and do AutoLISP and menu customization and take pride in making my lisp routines to do the work exactly the way the client likes them done.

Publications
I had a routine published in CADENCE magazine (no longer in publication and taken over by CADALYST). Some of my routines are published on my website at http://my.sterling.net/~bdeshawn

©2012 About.com, a part of The New York Times Company. All rights reserved.