LISP中,怎么在多边形端点上批量生成点
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
展开全部
;;;加载Active X功能
(vl-load-com)
(defun c:ccc (/ ss1 sslen num key pline pt ptdata ptnum)
(setq ss1 (ssget '((0 . "SPLINE,LWPOLYLINE,POLYLINE")))
sslen (sslength ss1)
num 0
)
(repeat sslen
(setq pline (ssname ss1 num)
ptnum (cdr (assoc 90 (entget pline)))
num (1+ num)
key 0
)
(repeat ptnum
(setq pt (vlax-curve-getPointAtParam pline key)
key (1+ key)
ptdata (append ptdata (list pt))
)
)
)
(setq ptdata (delsame ptdata)
key 0
)
(repeat (length ptdata)
(command "point" (nth key ptdata))
(setq key (1+ key))
)
(princ)
)
;;;删除重复
(defun delsame (data / len datadel itm datareturn num len)
(setq len (length data)
datadel data
)
(while len
(setq datareturn (append datareturn (list (nth 0 datadel)))
datadel (vl-remove-if-not
'(lambda (itm)
(/= itm (nth 0 datadel))
)
datadel
)
len (length datadel)
)
(if (= datadel nil) (setq len nil))
)
datareturn
)
(vl-load-com)
(defun c:ccc (/ ss1 sslen num key pline pt ptdata ptnum)
(setq ss1 (ssget '((0 . "SPLINE,LWPOLYLINE,POLYLINE")))
sslen (sslength ss1)
num 0
)
(repeat sslen
(setq pline (ssname ss1 num)
ptnum (cdr (assoc 90 (entget pline)))
num (1+ num)
key 0
)
(repeat ptnum
(setq pt (vlax-curve-getPointAtParam pline key)
key (1+ key)
ptdata (append ptdata (list pt))
)
)
)
(setq ptdata (delsame ptdata)
key 0
)
(repeat (length ptdata)
(command "point" (nth key ptdata))
(setq key (1+ key))
)
(princ)
)
;;;删除重复
(defun delsame (data / len datadel itm datareturn num len)
(setq len (length data)
datadel data
)
(while len
(setq datareturn (append datareturn (list (nth 0 datadel)))
datadel (vl-remove-if-not
'(lambda (itm)
(/= itm (nth 0 datadel))
)
datadel
)
len (length datadel)
)
(if (= datadel nil) (setq len nil))
)
datareturn
)
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询