;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;幕匠LISP实验室;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;程序功能：标注对齐下  [备注：标注对齐下]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(DEFUN C:MJ132 (/ SS PT1 PT2 ON L1 DIM I DIMENT ENT PT10 PT13 PT14)
  (setvar "cmdecho" 0)
  (command "undo" "be")
  (while (= SS NIL) (setq SS (ssget '((0 . "DIMENSION")))))
  (if (setq PT1 (getpoint "指定线形标注对齐的直线第一点:<选择直线>"))
	(setq PT2 (getpoint PT1 "    第二点:"))
	(while (= ON NIL)
	  (if (setq ENT (entsel "\n选择标注对齐的直线"))
		(setq ON (assoc '0 (setq L1 (entget (car ENT))))))
	  (if (= ON '(0 . "LINE"))
		(setq PT1 (cdr (assoc '10 L1))
			  PT2 (cdr (assoc '11 L1)))
		(setq ON NIL))))
  (setq I 0)
  (while (setq DIM (ssname SS I))
	(setq DIMENT (entget DIM))
	(setq PT10 (trans (cdr (assoc '10 DIMENT)) 0 1)
		  PT13 (trans (cdr (assoc '13 DIMENT)) 0 1)
		  PT14 (trans (cdr (assoc '14 DIMENT)) 0 1))
	(setq DIMENT
		   (entmod
			 (subst	(cons 13
						  (trans (inters PT1
										 PT2
										 PT13
										 (polar PT13 (angle PT10 PT14) (distance PT10 PT14))
										 NIL)
								 1
								 0))
					(assoc 13 DIMENT)
					DIMENT)))
	(entmod (subst (cons 14 (trans (inters PT1 PT2 PT10 PT14 NIL) 1 0)) (assoc 14 DIMENT) DIMENT))
	(entupd DIM)
	(setq I (1+ I)))
  (command ".line" "" "")
  (command "undo" "e")
  (princ (strcat "\n程序结束.共给更改了" (itoa I) "个标注."))
  (princ))
(princ "\n命令DAG---对齐线性标注.\n"))