明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4154|回复: 16

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

  [复制链接]
发表于 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)
)


"觉得好,就打赏"
还没有人打赏,支持一下
发表于 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))
回复 支持 1 反对 0

使用道具 举报

 楼主| 发表于 2019-12-16 17:08:59 | 显示全部楼层
yuping913 发表于 2019-4-10 14:03
求定距两端缩短的方法

你输入负数不就好了吗
发表于 2019-4-6 19:38:17 | 显示全部楼层
皮一下很开心。
学习楼主
发表于 2019-4-10 05:56:19 来自手机 | 显示全部楼层
看一下  定距离延长用的很多
发表于 2019-4-10 14:03:08 | 显示全部楼层
求定距两端缩短的方法
发表于 2020-1-20 11:07:53 | 显示全部楼层
不错不错,感谢楼主!
发表于 2020-2-17 21:28:20 | 显示全部楼层
谢谢刘鑫哥哥
发表于 2020-5-15 18:17:12 | 显示全部楼层
谢谢楼主谢谢楼主
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 06:38 , Processed in 0.166863 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表