churchntj,
以下要求在系统上安装Express Tools。
多段线用作选择点的围栏。
- (defun c:joinpt (/ a b en1 en2 enl1 enl2 flt lst1 lst2 p)
- ;;*************************************************************************;
- ;; getfencesel by ymg ;
- ;; ;
- ;; Arguments: en, Linear Entity Name (Polylines, Arc, Ellipse etc.) ;
- ;; flt, A valid Entity filer Ex: '((0 . "3DFACE")) or nil ;
- ;; ;
- ;; Returns: A Selection Set of Entities touching the selecting entity. ;
- ;; ;
- ;; Requires: Express Tools ;
- ;;*************************************************************************;
- (defun getfencesel (en flt / fe px ss)
- (acet-ss-zoom-extents (setq ss (ssadd en)))
- (setq px (* 0.75 (acet-geom-pixel-unit))
- fe (acet-list-remove-adjacent-dups (acet-geom-object-point-list en (/ px 2.0)))
- ss (if flt (ssget "_F" fe flt) (ssget "_F" fe))
- )
- )
- ;;*************************************************************************;
- ;; mk_lwp by Alan J Thompson ;
- ;; Argument: pl, A list of points (2d or 3d) ;
- ;; Create an LWPolyline at Elevation 0, on Current Layer. ;
- ;; Return: Polyline Object ;
- ;;*************************************************************************;
- (defun mk_lwp (pl)
- (vlax-ename->vla-object
- (entmakex
- (append (list '(0 . "LWPOLYLINE")
- '(100 . "AcDbEntity")
- '(100 . "AcDbPolyline")
- (cons 90 (length pl))
- '(70 . 0)
- )
- (mapcar '(lambda (p) (cons 10 (trans (list (car p) (cadr p)) 1 0))) pl)
- )
- )
- )
- )
- (setq en1 (car (entsel "\nSelect First Polyline: "))
- en2 (car (entsel "\nSelect Second Polyline: "))
- flt '((0 . "POINT"))
- enl1 (acet-ss-to-list (getfencesel en1 flt))
- enl2 (acet-ss-to-list (getfencesel en2 flt))
-
- )
- (setq lst1 nil lst2 nil)
- (foreach e enl1
- (setq lst1 (cons (cdr (assoc 10 (entget e))) lst1))
- )
- (foreach e enl2
- (setq lst2 (cons (cdr (assoc 10 (entget e))) lst2))
- )
- (mapcar '(lambda (a b) (mk_lwp (list a b))) lst1 lst2)
- (princ)
- )
在AlanJT例程的帮助下,点与LWpolyline连接
|