ktbjx Posted October 21, 2017 Share Posted October 21, 2017 i have a list here that exports XYZ Length Angle But now i want to export only the MidPoint of every Line, can someone Help Me? (defun c:LINEEXTRACTION ( / d e f i s spt ept) (if (and (setq s (ssget '((0 . "LINE")))) (setq f (getfiled "" "" "CSV" 1)) (setq d (open f "w")) ) (progn (write-line "Start X,Start Y,Start Z,End X,End Y, End Z,Group,Length,Angle" d) (repeat (setq i (sslength s)) (setq e (entget (ssname s (setq i (1- i)))) spt (cdr (assoc 10 e)) ept (cdr (assoc 11 e)) ) (write-line (LM:lst->str (append (mapcar 'rtos (cdr (assoc 10 e))) (mapcar 'rtos (cdr (assoc 11 e))) (if (and (setq e (member '(102 . "{ACAD_REACTORS") e)) (setq e (member '(102 . "{ACAD_REACTORS") (entget (setq x (cdr (assoc 330 e)))))) (setq e (cdr (assoc 3 (member (cons 350 x) (reverse (entget (cdr (assoc 330 e)))))))) ) (list e) ) ) "," ) d ) ) (close d) ) ) (prompt "DONE!") (princ) ) (defun LM:lst->str ( lst del ) (if (cdr lst) (strcat (car lst) del (LM:lst->str (cdr lst) del) "," (rtos (distance spt ept)) "," (angtos (angle spt ept)) ) (car lst) ) ) (princ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 21, 2017 Share Posted October 21, 2017 ktbjx no offence but you have all the answers in front of you, have a go at doing it, you have pt1 xyz pt2 xzy the 3d mid pt is just simple maths MidX=(pt1x+pt2x)/2 and so on. Big hint spt (cdr (assoc 10 e)) ept (cdr (assoc 11 e)) further delving x = car y=cadr z=caddr Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted October 23, 2017 Share Posted October 23, 2017 *line only not arc, point, etc.. (defun foo (e) (vlax-curve-getPointAtParam e (/ (vlax-curve-getEndParam e) 2.))) WCS Quote Link to comment Share on other sites More sharing options...
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.