1028695446 发表于 2019-4-6 14:05:42

【源码】定距延长,优化版

;;我这个是在前面2个大师(ssyfeng & 琴剑江山_10184)的基础上,优化的,因为上2位没有注意用户体验,比如选点的时候直接按了空格,没有选到点,程序依然会让用户继续选第二个点,然后选物体,之后报错,这种交互体验极差的:P
;;定距延长,优化版
(defun c:y2 (/ D E N P0 P1 SS)
(setq d (getdist "\n延伸长度:"))
(while                (and
                                                      (if d (setq p0 (getpoint "\n框选对象第一对角点(会以此点做为延伸方向):")))
                                                      (if p0 (setq p1 (getcorner p0 "\n框选对象另一对角点:")))
                                                      (if (and p0 p1)(setq ss (ssget "c" p0 p1 '((0 . "LINE,ARC,ELLIPSE,*POLYLINE")))))
                                                )
                (progn
                        (command "lengthen" "de" d)
                        (repeat (setq n (sslength ss))
                              (command (list (setq e (ssname ss (setq n (1- n)))) p0))
                        )
                        (command "")
                )
                (setq p0 nil p1 nil ss nil)
)
(princ)
)


ninja37 发表于 2020-2-17 21:48:21

;;;         线段延长指定距离            ;;;
(defun c:E01 ()    (command"_lengthen""de" "0.1")    (princ))
(defun c:E011 ()    (command"_lengthen""de" "0.11")    (princ))
(defun c:E012 ()    (command"_lengthen""de" "0.12")    (princ))
(defun c:E013 ()    (command"_lengthen""de" "0.13")    (princ))
(defun c:E014 ()    (command"_lengthen""de" "0.14")    (princ))
(defun c:E015 ()    (command"_lengthen""de" "0.15")    (princ))
(defun c:E016 ()    (command"_lengthen""de" "0.16")    (princ))
(defun c:E017 ()    (command"_lengthen""de" "0.17")    (princ))
(defun c:E018 ()    (command"_lengthen""de" "0.18")    (princ))
(defun c:E019 ()    (command"_lengthen""de" "0.19")    (princ))
(defun c:E02 ()    (command"_lengthen""de" "0.2")    (princ))
(defun c:E03 ()    (command"_lengthen""de" "0.3")    (princ))
(defun c:E04 ()    (command"_lengthen""de" "0.4")    (princ))
(defun c:E05 ()    (command"_lengthen""de" "0.5")    (princ))
(defun c:E06 ()    (command"_lengthen""de" "0.6")    (princ))
(defun c:E07 ()    (command"_lengthen""de" "0.7")    (princ))
(defun c:E08 ()    (command"_lengthen""de" "0.8")    (princ))
(defun c:E09 ()    (command"_lengthen""de" "0.9")    (princ))
(defun c:E01 ()    (command"_lengthen""de" "0.1")    (princ))
(defun c:E1   ()    (command"_lengthen""de" "1")    (princ))
(defun c:E2   ()    (command"_lengthen""de" "2")    (princ))
(defun c:E3   ()    (command"_lengthen""de" "3")    (princ))
(defun c:E4   ()    (command"_lengthen""de" "4")    (princ))
(defun c:E5   ()    (command"_lengthen""de" "5")    (princ))
(defun c:E6   ()    (command"_lengthen""de" "6")    (princ))
(defun c:E7   ()    (command"_lengthen""de" "7")    (princ))
(defun c:E8   ()    (command"_lengthen""de" "8")    (princ))
(defun c:E9   ()    (command"_lengthen""de" "9")    (princ))
(defun c:E10   ()(command"_lengthen""de" "10")   (princ))
(defun c:E20   ()(command"_lengthen""de" "20")   (princ))
(defun c:E30   ()(command"_lengthen""de" "30")   (princ))
(defun c:E40   ()(command"_lengthen""de" "40")   (princ))
(defun c:E50   ()(command"_lengthen""de" "50")   (princ))
(defun c:E60   ()(command"_lengthen""de" "60")   (princ))
(defun c:E70   ()(command"_lengthen""de" "70")   (princ))
(defun c:E80   ()(command"_lengthen""de" "80")   (princ))
(defun c:E90   ()(command"_lengthen""de" "90")   (princ))
(defun c:E100 ()(command"_lengthen""de" "100") (princ))
;;;
(defun c:E-01 ()      (command"_lengthen""de" "-0.10")    (princ))
(defun c:E-011 ()    (command"_lengthen""de" "-0.11")    (princ))
(defun c:E-012 ()    (command"_lengthen""de" "-0.12")    (princ))
(defun c:E-013 ()    (command"_lengthen""de" "-0.13")    (princ))
(defun c:E-014 ()    (command"_lengthen""de" "-0.14")    (princ))
(defun c:E-015 ()    (command"_lengthen""de" "-0.15")    (princ))
(defun c:E-016 ()    (command"_lengthen""de" "-0.16")    (princ))
(defun c:E-017 ()    (command"_lengthen""de" "-0.17")    (princ))
(defun c:E-018 ()    (command"_lengthen""de" "-0.18")    (princ))
(defun c:E-019 ()    (command"_lengthen""de" "-0.19")    (princ))
(defun c:E-02 ()    (command"_lengthen""de" "-0.20")    (princ))
(defun c:E-03 ()    (command"_lengthen""de" "-0.30")    (princ))
(defun c:E-04 ()    (command"_lengthen""de" "-0.40")    (princ))
(defun c:E-05 ()    (command"_lengthen""de" "-0.50")    (princ))
(defun c:E-06 ()    (command"_lengthen""de" "-0.60")    (princ))
(defun c:E-07 ()    (command"_lengthen""de" "-0.70")    (princ))
(defun c:E-08 ()    (command"_lengthen""de" "-0.80")    (princ))
(defun c:E-09 ()    (command"_lengthen""de" "-0.90")    (princ))
(defun c:E-1   ()    (command"_lengthen""de" "-1")    (princ))
(defun c:E-2   ()    (command"_lengthen""de" "-2")    (princ))
(defun c:E-3   ()    (command"_lengthen""de" "-3")    (princ))
(defun c:E-4   ()    (command"_lengthen""de" "-4")    (princ))
(defun c:E-5   ()    (command"_lengthen""de" "-5")    (princ))
(defun c:E-6   ()    (command"_lengthen""de" "-6")    (princ))
(defun c:E-7   ()    (command"_lengthen""de" "-7")    (princ))
(defun c:E-8   ()    (command"_lengthen""de" "-8")    (princ))
(defun c:E-9   ()    (command"_lengthen""de" "-9")    (princ))
(defun c:E-10   ()(command"_lengthen""de" "10")   (princ))
(defun c:E-20   ()(command"_lengthen""de" "20")   (princ))
(defun c:E-30   ()(command"_lengthen""de" "30")   (princ))
(defun c:E-40   ()(command"_lengthen""de" "40")   (princ))
(defun c:E-50   ()(command"_lengthen""de" "50")   (princ))
(defun c:E-60   ()(command"_lengthen""de" "60")   (princ))
(defun c:E-70   ()(command"_lengthen""de" "70")   (princ))
(defun c:E-80   ()(command"_lengthen""de" "80")   (princ))
(defun c:E-90   ()(command"_lengthen""de" "90")   (princ))
(defun c:E-100 ()(command"_lengthen""de" "100") (princ))

1028695446 发表于 2019-12-16 17:08:59

yuping913 发表于 2019-4-10 14:03
求定距两端缩短的方法

你输入负数不就好了吗

李钊伟2012 发表于 2019-4-6 19:38:17

皮一下很开心。
学习楼主

ninja37 发表于 2019-4-10 05:56:19

看一下定距离延长用的很多

yuping913 发表于 2019-4-10 14:03:08

求定距两端缩短的方法

594826903 发表于 2019-12-16 15:59:19

支持一下!

594826903 发表于 2020-1-20 11:07:53

不错不错,感谢楼主!

zst1978 发表于 2020-2-17 21:28:20

谢谢刘鑫哥哥

yp9819 发表于 2020-5-15 18:17:12

谢谢楼主谢谢楼主
页: [1] 2
查看完整版本: 【源码】定距延长,优化版