明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2426|回复: 11

I need ur help

  [复制链接]
发表于 2004-5-27 09:34:00 | 显示全部楼层 |阅读模式
Hey, guys,


I need you guys' help!!!


How to develop an AutoLISP routine to finish this task.


there might be some duplicate entities (sometimes, more than two entities)        in some layers,        how to remove the "duplicated" entities to another new layer and leave only one entity in the original layer, any reply would be appreciated!!! (sorry I am writing in English)
发表于 2004-5-27 09:46:00 | 显示全部楼层
Actually Autocad has similar command---Overkill. This command can delete the duplicate entities. These are many topic about this issue in the forum. You can search it. Welcome.
 楼主| 发表于 2004-5-27 09:49:00 | 显示全部楼层
hey, buddy


thank u very much for ur reply, but my purpose is not to delete the duplicated entities, just cut them and paste them to a new layer.         have any idea about this?


       


thank u very much
发表于 2004-5-27 10:08:00 | 显示全部楼层
本帖最后由 作者 于 2004-5-27 10:38:16 编辑

This is a program about delete duplicated circle,pl,line,spline, block. Maybe you can get some hint from it. You can revise it to suit your need. (defun C:DUP (/ F1 SLE SA CA TA LA LB ENTA EA TYPA A1 A2 A3 A4 SC
LTEST TES
)
(setvar "cmdecho" 0)
(setq F1 NIL
F1 0
)

;; Start
(or :GCHOICE (setq :GCHOICE "Select"))
(initget "Select All")
;;; (setq SLE (getkword "\nSelect objects by <S>election set, <L>imits, or <E>ntire database: "))
(setq SLE
(getkword (strcat "\nType of selection [Select/All] <"
:GCHOICE
">: "
)
)
)
(if (not SLE)
(setq SLE :GCHOICE)
(setq :GCHOICE SLE)
)
(cond
((= SLE "Select") (setq SA (ssget)))
((= SLE "Limits")
(setq SA (ssget "c" (getvar "extmin") (getvar "extmax")))
)
((= SLE "All") (setq SA (ssget "X")))
) (if (and SA (= (type SA) 'PICKSET) (not (zerop (sslength SA))))
(progn
(setq CA 0
TA (sslength SA)
LA NIL
LB NIL
)
(while (< CA TA)
(setq ENTA (ssname SA CA)
EA (cdr (entget ENTA))
TYPA (cdr (assoc 0 EA))
)
;; (if (= typa "POLYLINE") (progn
;; (setq entb (entnext enta) ea (cdr (entget entb)))
;; ))

;; Updated for R14 & 2002
;; Start
(setq A1 (assoc 5 EA))
(setq A2 (cons 5 ""))
(setq EA (subst A2 A1 EA))
(if (wcmatch (getvar "ACADVER") "*15*")
(progn
(setq A3 (assoc 330 EA))
(setq A4 (cons 330 ""))
(setq EA (subst A4 A3 EA))
)
) (setq LA (cons ENTA LA)
LB (cons EA LB)
CA (+ CA 1)
)
)
(setq SC NIL
SC (ssadd)
LTEST LB
)
(setq CA 0)
(setq TES (car LTEST)
LTEST (cdr LTEST)
TA NIL
TA (length LTEST)
)
(while (/= TA 0)
(if (member TES LTEST)
(progn
(setq SC (ssadd (nth CA LA) SC))
(prompt "\nFound duplicate entity.")
(setq F1 (+ F1 1))
)
)
(setq CA (+ CA 1))
(setq TES (car LTEST)
LTEST (cdr LTEST)
TA (length LTEST)
)
)
(command "erase" SC "")
(redraw)
(prompt "\n")
(prin1 F1)
(prompt " duplicate entities erased.")
)
)
(princ)
)
(prompt
"\nType DUP to run. Delete duplicate entity routine."
)
(princ)
 楼主| 发表于 2004-5-27 10:24:00 | 显示全部楼层
Buddy(citykunan), could I have ur email address, hope i didn't offend u.
发表于 2004-5-27 11:06:00 | 显示全部楼层
,看不懂啊,该学习了,唉
发表于 2004-5-27 11:31:00 | 显示全部楼层
对不起飞版主,bmn2k3v6在美国可能系统不能输中文。(明经已经飘洋过海了) To bmn2k3v6: 其实你可以多问问明经的版主,他们都是一流的高手.
meflying为人热心,编成的思路很独特.
龙龙仔版主,水平很高,他在台湾,英语一定也不错.
alin贵宾,好像是香港的,英语很棒,经常用英语发帖.
他们一定会帮助你的. 咳,只有我lisp也不行,英语也不好,还需多多努力.
 楼主| 发表于 2004-5-27 11:34:00 | 显示全部楼层
meflying, which aspect u didn't understand, u r awesome, admire u a lot.
发表于 2004-5-27 13:17:00 | 显示全部楼层
bmn是要将同一个层上重叠(类似原点拷贝的结果)的两个实体中的一个改到其它层。 :)
发表于 2004-5-27 17:09:00 | 显示全部楼层
這是個好點子
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-6 02:37 , Processed in 0.212990 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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