AutoCAD/Stretch command
Expert: Bill DeShawn - 12/4/2006
QuestionIn 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.
AnswerJosé: 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