;;说明:多段线顶点更新
;;参数:dxflst:多段线全部组码表
;;参数:ptlst:新点坐标表
;;返回:更新后的组码表
(defun updatePolyline(dxflst newptlst / a b newdxflst)
(while (and (setq a (car dxflst)) (setq b (car newptlst)))
(if (= (car a) 10)
(setq
newdxflst (cons (cons 10 b) newdxflst)
newptlst (cdr newptlst)
)
(setq newdxflst b)
)
(setq dxflst (cdr dxflst))
)
(reverse newdxflst)
)
;;说明:多段线顶点更新
;;参数:dxflst:多段线全部组码表
;;参数:newptlst:新顶点坐标表
;;参数:ptidxlst:顶点索引表,从1开始
;;参数:isupdata:T:索引更新;nil:排除索引更新
;;返回:更新后的组码表
(defun updatePolyline1(dxflst newptlst ptidxlst isupdata / a b i newdxflst)
(setq i 1 newdxflst '())
(while (and (setq a (car dxflst)) (setq b (car newptlst)))
(if (= (car a) 10)
(setq
newdxflst (if isupdata
(if (vl-position i ptidxlst)
(cons (cons 10 b) newdxflst)
(cons a newdxflst)
)
(if (vl-position i ptidxlst)
(cons a newdxflst)
(cons (cons 10 b) newdxflst)
)
)
newptlst (cdr newptlst)
i (1+ i)
)
(setq newdxflst (cons a newdxflst))
)
(setq dxflst (cdr dxflst))
)
(reverse newdxflst)
)
(defun updatePolyline2(dxflst n pt / i newdxflst a )
(setq i 1 newdxflst '())
(while(setq a (car dxflst))
(if (= (car a) 10)
(progn
(if (= i n) (setq a (cons 10 pt)))
(setq i (1+ i))
)
)
(setq newdxflst (cons a newdxflst))
(setq dxflst (cdr dxflst))
)
(reverse newdxflst)
)
(defun updatePolyline3(dxflst p1 p2 p3 / i newdxflst a )
(setq i 1 newdxflst '())
(while(setq a (car dxflst))
(if (= (car a) 10)
(progn
(cond
((= i 1) (setq a (cons 10 p1)))
((= i 2) (setq a (cons 10 p2)))
((= i 3) (setq a (cons 10 p3)))
)
(setq i (1+ i))
)
)
(setq newdxflst (cons a newdxflst))
(setq dxflst (cdr dxflst))
)
(reverse newdxflst)
)