明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2259|回复: 4

交点断开

[复制链接]
发表于 2004-4-3 12:15:00 | 显示全部楼层 |阅读模式
帮忙看看这个程序,能不能改成多次执行,回车后结束。 (defun c:text (/ osm oc ol pt1 ss len i entn a ct ra la)
(setq temperr *error*)
(setq *error* trap1)
(setq oc (getvar "cmdecho"))
(setq ol (getvar "clayer"))
(setq osm (getvar "osmode"))
(setvar "cmdecho" 0)
(setvar "osmode" 32)
(setq pt1 (getpoint "\n选择需断开的交点:"))
(if (null pt1) (alert "没发现交点!")
(progn
(setq ss (ssget "C" (list (- (car pt1) 1) (- (cadr pt1) 1)) (list (+ (car pt1) 1) (+ (cadr pt1) 1))))
(setq len (sslength ss))
(setq i 0)
(while (< i len)
(setq entn (ssname ss i))
(setq a (entget entn))
(if (or (= (cdr (assoc 0 a)) "LINE") (= (cdr (assoc 0 a)) "ARC")
(= (cdr (assoc 0 a)) "CIRCLE") (= (cdr (assoc 0 a)) "POLYLINE")
)
(progn
(setvar "osmode" 0)
(if (= (cdr (assoc 0 a)) "CIRCLE")
(progn
(setq ct (cdr (assoc 10 a)))
(setq ra (cdr (assoc 40 a)))
(setq la (cdr (assoc 8 a)))
(entdel entn)
(command "layer" "s" la "")
(command "arc" "c" ct pt1 (polar pt1 (angle pt1 ct) (* 2 ra)))
(command "arc" "c" ct (polar pt1 (angle pt1 ct) (* 2 ra)) pt1)
)
(command "break" (list entn pt1) "f" pt1 "@")
)
)
)
(setq i (+ i 1))
)
)
)
(setvar "osmode" osm)
(command "layer" "s" ol "")
(setvar "cmdecho" oc)
(princ)
)
发表于 2004-4-3 12:42:00 | 显示全部楼层
我把CIRCLE部分去掉了,你自己再添进去吧。。。 (defun c:test (/ osm pt1 ss i entn ty)
(setq temperr *error*)
(setq *error* trap1)
(setq osm (getvar "osmode"))
(setvar "cmdecho" 0)
(setvar "osmode" 32)

(while (setq pt1 (getpoint "\n选择需断开的交点:"))
(setq ss (ssget "C" pt1 pt1))
(setq i 0)
(while (< i (sslength ss))
(setq entn (ssname ss i))
(setq ty (cdr (assoc 0 (entget entn))))
(cond
((or (= ty "LINE") (= ty "POLYLINE") (= ty "ARC") (= ty "LWPOLYLINE") (= ty "SPLINE"))
(command "_.break" (list entn pt1) "f" pt1 "@")
)
)
(setq i (+ i 1))
)
)
(setvar "osmode" osm)
(princ)
)
发表于 2004-4-3 16:37:00 | 显示全部楼层
发表于 2011-12-22 12:50:54 | 显示全部楼层
可以框选吗
发表于 2024-2-13 19:41:57 | 显示全部楼层
没人来讨论吗,好期待出现好工具啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 23:01 , Processed in 0.162389 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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