[转帖]LISP模拟stretch一例
<p><a href="http://en.allexperts.com/q/AutoCAD-1029/2008/7/Scale-stretch-behavior.htm">http://en.allexperts.com/q/AutoCAD-1029/2008/7/Scale-stretch-behavior.htm</a></p><p></p><p>(defun mstrerr (msg)<br/> (if msg (princ msg))<br/> (command "_.undo" "_end")<br/> (if olderr (setq *error* olderr))<br/> (princ)<br/>)<br/><br/>(defun c:mstr (/ p1 p2 p3 p4 olderr)<br/> (command "_.undo" "_g")<br/> (setq olderr *error* *error* mstrerr)<br/> (setq p1 (getpoint "\nOne corner: "))<br/> (initget 32)<br/> (setq p2 (getcorner p1 "\nOther corner: "))<br/> (setq p3 (getpoint "\nStarting point: "))<br/> (initget 32)<br/> (setq p4 (getpoint p3 "\nEnding point: "))<br/> (command "_.stretch" "c" p1 p2 "" p3 p4)<br/> (setq resp (strcase (getstring "\nContinue or eXit? ")))<br/> (While (= resp "C")<br/> (setq p1 (getpoint "\nOne corner: "))<br/> (initget 32)<br/> (setq p2 (getcorner p1 "\nOther corner: "))<br/> (command "_.stretch" "c" p1 p2 "" p3 p4)<br/> (setq resp (strcase (getstring "\nContinue or eXit? ")))<br/> )<br/> (command "_.undo" "_end")<br/> (princ)<br/>)<br/></p>
页:
[1]