tomoivana Posted February 21, 2011 Posted February 21, 2011 I have lines with x,y coordinate, but i havent z coordinate. On the same work i have points with same x,y coordinate, and that points have z coordinate. I want merge that points with lines, and then i will have lines with z coordinate. Any body have some lisp script for that, thx Quote
Lee Mac Posted February 21, 2011 Posted February 21, 2011 If I understand you correctly: (defun c:PointMerge ( / ss i e pt zl ) (vl-load-com) (if (setq ss (ssget "_:L" '((0 . "LINE,POINT")))) (progn (repeat (setq i (sslength ss)) (if (eq "POINT" (cdr (assoc 0 (entget (setq e (ssname ss (setq i (1- i)))))))) (progn (setq zl (cons (cdr (assoc 10 (entget e))) zl)) (ssdel e ss) ) ) ) (repeat (setq i (sslength ss)) (setq e (entget (ssname ss (setq i (1- i))))) (foreach x '(10 11) (setq pt (cdr (assoc x e)) pt (list (car pt) (cadr pt))) (if (setq pt (car (vl-member-if (function (lambda ( x ) (equal (list (car x) (cadr x)) pt 1e- ) ) zl ) ) ) (setq e (subst (cons x pt) (assoc x e) e)) ) ) (entmod e) ) ) ) (princ) ) EDIT: What's up with the code formatting? Quote
Lee Mac Posted February 21, 2011 Posted February 21, 2011 What is going on with the formatting? Is it my browser/vlide settings or do your posts give the same result? Quote
alanjt Posted February 21, 2011 Posted February 21, 2011 Is it my browser/vlide settings or do your posts give the same result? I can see formatting codes within a quote, I don't have access to any of the options (code brackets, bold, formatting, etc.) and I can't use macros such as Ctrl+B. Quote
alanjt Posted February 21, 2011 Posted February 21, 2011 (if (setq ss (ssget "_:L" '((0 . "LINE,POINT")))) Quote
Lee Mac Posted February 21, 2011 Posted February 21, 2011 Reformatted my code: (defun c:PointMerge ( / ss i e pt zl ) (vl-load-com) (if (setq ss (ssget "_:L" '((0 . "LINE,POINT")))) (progn (repeat (setq i (sslength ss)) (if (eq "POINT" (cdr (assoc 0 (entget (setq e (ssname ss (setq i (1- i)))))))) (progn (setq zl (cons (cdr (assoc 10 (entget e))) zl)) (ssdel e ss) ) ) ) (repeat (setq i (sslength ss)) (setq e (entget (ssname ss (setq i (1- i))))) (foreach x '(10 11) (setq pt (cdr (assoc x e)) pt (list (car pt) (cadr pt))) (if (setq pt (car (vl-member-if (function (lambda ( x ) (equal (list (car x) (cadr x)) pt 1e- ) ) zl ) ) ) (setq e (subst (cons x pt) (assoc x e) e)) ) ) (entmod e) ) ) ) (princ) ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.