218
699
483
顶梁支柱
(command "_.explode" entlast "")
(defun C:TEST (/ st cen my mx z i) (setq ope (getvar "PEDITACCEPT")) (if (setq st (ssget '((0 . "LINE"))));_ get a selectio set (progn (setvar "PEDITACCEPT" 1) (command "_.pedit" "_M" st "" "_J" "20" "" );_join and fill the gaps (setvar "PEDITACCEPT" ope) ) ) ;_ (setq q (getvar 'qaflags)) (setvar 'qaflags 1) (command "_.explode" entlast "");_explode the converted polyline (setvar 'qaflags q) (setq i 0z 0 ) ;_find intesection and mark them (while (< i (- (sslength st) 1)) (while (< z (- (sslength st) 1)) (setq mx (ssname st i)) (setq my (ssname st (+ z 1))) (if (setq cen (findInters mx my))(progn (command "Circle" cen 8 "")) ) (setq z (1+ z)) ) ;_while (setq i (1+ i)) (setq z 0) ))(defun findInters (entA entB) (setq 1a (cdr (assoc 10 (entget entA)))) (setq 1b (cdr (assoc 11 (entget entA)))) (setq 2a (cdr (assoc 10 (entget entB)))) (setq 2b (cdr (assoc 11 (entget entB)))) (setq in (inters 1a 1b 2a 2b)))(defun c:jp (/ ope ss) (setq ope (getvar "PEDITACCEPT")) (if (setq ss (ssget '((0 . "ARC,*POLYLINE,LINE")))) (progn (setvar "PEDITACCEPT" 1) (command "_.pedit" "_M" ss "" "_J" "" "") ) ) (setvar "PEDITACCEPT" ope) (princ))
使用道具 举报
63
6297
6283
后起之秀
35
2471
2447
初露锋芒
(command "_.explode" [color=red]([/color]entlast[color=red])[/color] "")
32
2722
2666
5
1334
1410
限制会员
(defun plintav ( / intersobj1obj2 LM:Unique AT:GetVertices _reml member-fuzz add_vtx ss sslpl sshpl i ent n ent1 ss-ent1 k ent2 intpts intptsall pl plpts restintpts par ) (vl-load-com) (defun intersobj1obj2 ( obj1 obj2 / coords pt ptlst ) (if (eq (type obj1) 'ENAME) (setq obj1 (vlax-ename->vla-object obj1))) (if (eq (type obj2) 'ENAME) (setq obj2 (vlax-ename->vla-object obj2))) (setq coords (vl-catch-all-apply 'vlax-safearray->list (list (vl-catch-all-apply 'vlax-variant-value (list (vla-intersectwith obj1 obj2 AcExtendNone)))))) (if (vl-catch-all-error-p coords) (setq ptlst nil) (repeat (/ (length coords) 3) (setq pt (list (car coords) (cadr coords) (caddr coords))) (setq ptlst (cons pt ptlst)) (setq coords (cdddr coords)) ) ) ptlst ) (defun LM:Unique ( lst ) (if lst (cons (car lst) (LM:Unique (vl-remove (car lst) (cdr lst))))) ) (defun AT:GetVertices ( e / p l ) (LM:Unique (if e (if (eq (setq p (vlax-curve-getEndParam e)) (fix p)) (repeat (setq p (1+ (fix p))) (setq l (cons (vlax-curve-getPointAtParam e (setq p (1- p))) l)) ) (list (vlax-curve-getStartPoint e) (vlax-curve-getEndPoint e)) ) ) ) ) (defun _reml ( l1 l2 / a n ls ) (while (setq n nil a (car l2) ) (while (and l1 (null n)) (if (equal a (car l1) 1e- (setq l1 (cdr l1) n t ) (setq ls (append ls (list (car l1))) l1 (cdr l1) ) ) ) (setq l2 (cdr l2)) ) (append ls l1) ) (defun member-fuzz ( expr lst fuzz ) (while (and lst (not (equal (car lst) expr fuzz))) (setq lst (cdr lst)) ) lst ) (defun add_vtx ( obj add_pt ent_name / bulg ) (vla-addVertex obj (1+ (fix add_pt)) (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-vbdouble (cons 0 1)) (list (car (trans (vlax-curve-getpointatparam obj add_pt) 0 ent_name)) (cadr (trans (vlax-curve-getpointatparam obj add_pt) 0 ent_name)) ) ) ) ) (setq bulg (vla-GetBulge obj (fix add_pt))) (vla-SetBulge obj (fix add_pt) (/ (sin (/ (* 4 (atan bulg) (- add_pt (fix add_pt))) 4)) (cos (/ (* 4 (atan bulg) (- add_pt (fix add_pt))) 4)) ) ) (vla-SetBulge obj (1+ (fix add_pt)) (/ (sin (/ (* 4 (atan bulg) (- (1+ (fix add_pt)) add_pt)) 4)) (cos (/ (* 4 (atan bulg) (- (1+ (fix add_pt)) add_pt)) 4)) ) ) (vla-update obj) ) (setq ss (ssget "_I" '((0 . "*POLYLINE") (-4 . "<and") (-4 . "<not") (-4 . "&=") (70 . (-4 . "not>") (-4 . "<") (70 . 130) (-4 . "and>")))) (setq sslpl (ssadd) sshpl (ssadd)) (setq i -1) (while (setq ent (ssname ss (setq i (1+ i)))) (if (eq (cdr (assoc 0 (entget ent))) "LWPOLYLINE") (progn (entupd ent) (vla-update (vlax-ename->vla-object ent)) (ssadd ent sslpl) ) ) (if (eq (cdr (assoc 0 (entget ent))) "POLYLINE") (ssadd ent sshpl) ) ) (setq i -1) (while (setq ent (ssname sshpl (setq i (1+ i)))) (command "_.convertpoly" "l" ent "") (entupd ent) (vla-update (vlax-ename->vla-object ent)) (ssadd ent sslpl)