本帖最后由 chshsl 于 2017-8-9 11:17 编辑
经过2天的研究G大侠的代码及网盘函数库,复原了,所缺的几个函数,见大家都希望补全,现贴上。希望G大侠不要见怪。用法:1楼中的 辅助函数+8楼代码+本代码。- ;命令: (gxl-massoc 10 (entget (car (entsel "选择多段线:")))) 选择多段线:((35846.5 18949.5)
- ;(36264.4 18956.0) (36617.2 18954.3))
- ;
- (defun gxl-massoc ( d li / a ls )
- (setq ls '())
- (while (assoc d li)
- (progn
- (setq a (assoc d li))
- (setq ls (cons (list (cadr a) (caddr a)) ls))
- (setq li (xdlsp_list_remove li a))
- )
- )
- (reverse ls)
- )
- (defun xdlsp_list_remove (el val)
- (if (member val el)
- (append
- (reverse (cdr (member val (reverse el))))
- (cdr (member val el))
- )
- el
- )
- )
- ;输出50个空格
- ;(gxl-Str-Space 50) " "
- ;(gxl-Str-Space -1)
- (defun gxl-Str-Space ( d / a )
- (setq a "")
- (if (> d 0)
- (repeat d
- (setq a (strcat a " " ))
- )
- )
- a
- )
- ;删除表中重复项
- (defun gxl-ListDumpAtom( l1 / l2)
- (while(setq l2(cons(car l1)l2) l1(vl-remove(car l1)(cdr l1))))
- (reverse l2)
- )
- ;;主测试函数
- ;;;测试
- (defun c:mkpoly2 ()
- ;;(setundoerr)
- (princ "\n自动拓扑多边形测试!编制:Gu_xl 2010年8月")
- (princ "\n选择线段:")
- ;;;选择的线段必须已经做完打断预处理,请自行添加处理代码
- ;(if (not jd) (setq jd 0.00001))
- (setq jd 0.00001)
- (setq ss (ssget '((0 . "line,arc"))))
- (setq t1 (getvar "cdate"))
- (setq ssl (GXL-SEL-SS->LIST ss))
- (setq nod1 (gxl-ent->Nodes ssl jd))
- (setq coordlist (gxl-ent->Coordinates (car nod1)))
- (setq touplist (gxl-Toupu-LineList coordlist))
- (setq polylist (gxl-MakePolyList touplist coordlist (cadr nod1)))
- (setq polylist (gxl-dumpPolyTouPuList polylist))
- (setq n 1)
- (foreach poly polylist
- (setq enlist (mapcar '(lambda (x) (nth (1- (abs x)) ssl)) poly)
- enss (GXL-SEL-LIST->SS enlist)
- )
- (setq en (entlast))
- (command "copy" enss "" '(0 0 0) '(0 0 0))
- (setq enss (GXL-SEL-ENTNEXTALL en))
- (command "pedit" (ssname enss 0) "y" "j" enss "" "")
- (setq en (entlast))
- (gxl-CH_Ent en 62 1)
- (gxl-CH_Ent en 8 "多边形层")
- )
- (princ "\n总计 ")
- (GXL-SYS-TIMEOUT t1)
- (princ "\n共生成 ")
- (princ (length polylist))
- (princ " 个多边形!")
- ;(reerr)
- )
|