针对你的图纸,还可以这样写- (defun c:Rt90 (/ ss ssl oldos e sp ep mp el)
- (if (setq ss (ssget '((8 . "尺寸线及标注符号")
- (0 . "*POLYLINE")
- (90 . 2)
- (-4 . "<not")
- (62 . 2)
- (-4 . "not>")
- )
- )
- )
- (progn
- (setq ssl (sslength ss)
- oldos (getvar "osmode")
- ) (setvar "osmode" 0)
- (while (> ssl 0)
- (setq e (ssname ss (setq ssl (1- ssl)))
- el (entget e)
- sp (cdr (assoc 10 el))
- ep (cdr (assoc 10 (reverse el)))
- mp (mapcar '(lambda (x) (/ x 2)) (mapcar '+ sp ep))
- )
- (command ".rotate" e "" mp "90")
- )
- (setvar "osmode" oldos)
- )
- )
- (princ)
- )
|