明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1189|回复: 8

[提问] 智能删除,关于误: 参数类型错误: 二维/三维点:

  [复制链接]
发表于 2020-5-6 23:22:19 | 显示全部楼层 |阅读模式

为了方便删除刚生成的对象(有时画了,又不想要),写了一个小程序,多数时候运行顺利,但有时候不行,会提示
错误: 参数类型错误: 二维/三维点: 1078
不知道是什么原因


(defun S删除(/ di dl il)
(setq il 1 di (cadr(grread 3)) dl (cadr(grread 3))) ;光标位置
(while (and il (< (distance di dl) (/(getvar"viewsize") 100)) )
(progn
(setq dl (cadr(grread 3)))
(if (member (car (grread t 15 0)) '(11 25) ) (progn (setq il nil) (diy) ) ) ;右键删除
) )
(defun diy()()(princ))
(setq di nil dl nil il nil)
(princ))





(defun c:13()
(defun diy()(command "erase" (entlast) "")(princ))
(setq ss (entlast))
(command "_dimlinear" "\\" "\\")
(while(=(getvar "cmdactive")1)(command"\\"))
(command "select" ss (entlast) "")
(if (> (sslength (ssget"p")) 1)
(progn (princ"\n 111") (S删除)
) )
(princ))



"觉得好,就打赏"
还没有人打赏,支持一下
 楼主| 发表于 2020-5-7 10:37:17 | 显示全部楼层
顶一下,这个通用性和可扩展性都很好的啊,希望路过的大师指点一下
 楼主| 发表于 2020-5-7 17:26:40 | 显示全部楼层
路过的大神帮看看是什么问题啦
发表于 2020-5-7 17:54:13 | 显示全部楼层
没看懂你写的是啥
有动图最好
发表于 2020-5-8 10:03:16 | 显示全部楼层
entlast 需要判断一下是否是你想要删除的东西
 楼主| 发表于 2020-5-8 22:49:59 | 显示全部楼层
问题应该是出在 while 中,就是不知道该怎么解决啊
(while (and il (< (distance di dl) (/(getvar"viewsize") 100)) )
(progn
(setq dl (cadr(grread 3)))
(if (member (car (grread t 15 0)) '(11 25) ) (progn (setq il nil) (diy) ) ) ;右键删除
) )
 楼主| 发表于 2020-5-8 22:53:28 | 显示全部楼层
jun353835273 发表于 2020-5-8 10:03
entlast 需要判断一下是否是你想要删除的东西

entlast 是在 diy 里定义的,可以换成任意啊,应该与之无关
(defun c:13()
(defun diy()(princ"\n 哈喽"))
(S删除)
(princ))
 楼主| 发表于 2020-5-8 22:57:26 | 显示全部楼层
taoyi0727 发表于 2020-5-7 17:54
没看懂你写的是啥
有动图最好

在 (while (and il (< (distance di dl) (/(getvar"viewsize") 100)) ) di dl 两点的距离小于屏幕高度的 1/100 的时候,按右键,运行 (diy)
发表于 2020-8-30 00:00:25 | 显示全部楼层
虽然有点不明白,,先顶起来再说,或许后面,,就懂了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-17 21:31 , Processed in 0.247662 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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