;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;幕匠LISP实验室;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;程序功能：标注对齐上  [备注：标注对齐上]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(DEFUN C:MJ131 (/ pt0 sset sslen pt2 elist pt10 pt11 pt13 pt14 ang 
                       newpt10 newpt11 newpt13 newpt14)
   (setq sset (ssget '((0 . "DIMENSION")))
        sslen (sslength sset))
   (setq pt0 (getpoint "\n如要对齐标注线请指示位置 <不修改>:"))
   (setq pt2 (getpoint "\n如要对齐引出线请指示位置 <不修改>:"))
   (while (> sslen 0)
       (setq elist (entget (ssname sset (setq sslen (1- sslen))))
              pt10 (cdr (assoc 10 elist))
              pt11 (cdr (assoc 11 elist))
              pt13 (cdr (assoc 13 elist))
              pt14 (cdr (assoc 14 elist))
        )
        (if (member '(100 . "AcDbRotatedDimension") elist)
             (setq ang (cdr (assoc 50 elist)))
	     (setq ang (angle pt13 pt14))
        )
        (if pt0
           (progn
	       (setq newpt10 (inters
	  	       pt0
                      (polar pt0 ang 100)
		       pt10
		       pt14
	               nil
	                    )
                     newpt11 (polar pt11 (angle pt14 pt10) (distance pt10 newpt10))
               )
              (setq elist (subst (cons 10 newpt10) (assoc 10 elist) elist)
                   elist (subst (cons 11 newpt11) (assoc 11 elist) elist)
               )             
              (entmod elist)
           )
;           (setq pt0 pt10)
         )
         (if pt2 (haha1314))
     )
  )
;--------------------------------------------------------------------------
 (defun haha1314()
     (setq newpt13 (inters
	  	       pt2
                       (polar pt2 ang 100)
		       pt13
		       (polar pt13 (angle pt14 pt10) 100)
	               nil
	            )
           newpt14 (inters
	  	       pt2
                       (polar pt2 ang 100)
		       pt14
		       (polar pt14 (angle pt14 pt10) 100)
	               nil
	            )
      )
      (setq elist (subst (cons 13 newpt13) (assoc 13 elist) elist)
            elist (subst (cons 14 newpt14) (assoc 14 elist) elist)
      )             
      (entmod elist)
 )
;==========================================================================