;;画底孔
(defun c:drwhole (/ ang	cur d ep fg j k	l1 l2 la mpt p1	p2 p3 plst sp ss
		  ucsp1)
  (or (and
	(setq ep (entsel "\n选孔的直线1："))
	(setq l2 (car (entsel "\n选孔的直线2：")))
      )
      (fsxm-silenceexit)
  )
  (setq l1 (car ep))
  (setq cur (trans (cadr ep) 1 0))
  (setq sp (vlax-curve-getStartPoint l1))
  (setq ep (vlax-curve-getEndPoint l1))
  (setq	plst
	 (vl-sort (list sp ep)
		  '(lambda (a b) (< (distance a cur) (distance b cur)))
	 )
  )
  (setq ang (+ pi (apply 'angle plst)))
  (setq p1 (car plst))
  (setq ucsp1 (trans p1 0 1))
  (setq ss (ssget "C" ucsp1 ucsp1 '((0 . "L*ine"))))
  (setq p2 (vlax-curve-getclosestpointto l2 p1 t))
  (setq mpt (fsxm-midpt p1 p2))
  (setq j 118)				;角度
  (setq fg (* (* 0.5 (- 180 j)) (/ pi 180)))
  (setq k (/ (sin fg) (cos fg)))
  (setq d (* (distance p1 mpt) k))
  (setq p3 (polar mpt ang d))
  (setq la (entlast))
  (vla-StartUndoMark *doc*)
  (entmake (list '(0 . "line") (cons 10 p3) (cons 11 p1)))
  (entmake (list '(0 . "line") (cons 10 p3) (cons 11 p2)))
  (if (< (sslength ss) 2)
    (entmake (list '(0 . "line") (cons 10 p1) (cons 11 p2)))
  )
  (command ".matchprop" l1 (fsxm-newselection la) "")
  (vla-EndUndoMark *doc*)
  (princ)
)