本帖最后由 嘒彼小星 于 2024-8-21 12:58 编辑
看看是不是这个意思的。- (defun c:tT(/ pt1 pt2 dis1_2 ang1_2 dia dep td 1_1 1_2 1_3 1_4 2_1 2_2 2_3 2_4);沉孔侧视图
- (command "UNDO" "BE")
- (setq pt1(getpoint "\n指定头部中点") pt2(getpoint pt1 "\n指定孔底中点"))
- (setq dis1_2(distance pt1 pt2) ang1_2(angle pt2 pt1))
- (setq dia(getdist "\n沉头直径D<默认12>") dep(getdist "\n沉头深度t<默认4>") td(getdist "\n通孔直径d<默认8>"))
- (if(<= dia 0)(setq dia 12))(if(<= dep 0)(setq dep 4))(if(<= td 0)(setq td 8))
- (if (> dis1_2 0)
- (progn
- (if (> dis1_2 dep)
- (progn
- (setq 1_1(polar pt1 (- ang1_2 (* pi 0.5)) (/ dia 2)));以下1234对应头部右上顶点起顺时针
- (setq 1_2(polar 1_1 (+ ang1_2 pi) dep))
- (setq 1_3(polar 1_2 (+ ang1_2 (* pi 0.5)) dia))
- (setq 1_4(polar 1_3 ang1_2 dep))
- (setq 2_1(polar pt2 (- ang1_2 (* pi 0.5)) (/ td 2)));以下1234对应底部右下顶点起逆时针
- (setq 2_2(polar 2_1 ang1_2 (- dis1_2 dep)))
- (setq 2_3(polar 2_2 (+ ang1_2 (* pi 0.5)) td))
- (setq 2_4(polar 2_3 (+ ang1_2 pi) (- dis1_2 dep)))
- (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 4) (cons 10 1_1) (cons 10 1_2)(cons 10 1_3)(cons 10 1_4)))
- (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 4) (cons 10 2_1) (cons 10 2_2)(cons 10 2_3)(cons 10 2_4)))
- )(progn (princ "\n重新输入沉头深度t或者重新指定顶点或底点"))
- )
- )(progn (princ "\n重新指定顶点或者底点"))
- )
- (command "UNDO" "E")
- (princ)
- )
|