Grrr Posted January 13, 2017 Posted January 13, 2017 No problem, Joe! Once I was also confused as you are - No idea what to do when I had some list, and was used to separate items only with setq function. Thankfully the other guys who replied here helped me to get this far. Quote
BIGAL Posted January 13, 2017 Posted January 13, 2017 This may be usefull for a similar task makes the vertices a single list of x,y or x,y,z for 3d plines a simple length check determines 2d or 3d. (123.45 678.90 234.56 789.0) 2x2d points ; pline co-ords example ; By Alan H (defun getcoords (ent) (vlax-safearray->list (vlax-variant-value (vlax-get-property (setq obj (vlax-ename->vla-object ent)) "Coordinates" ) ) ) ) (defun co-ords2xy () ; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z (setq len (length co-ords)) (if (= (vla-get-ObjectName obj) "AcDb3dPolyline") (progn (setq numb (/ len 3)) (setq odd "yes") ) (progn (setq numb (/ len 2)) ; even and odd check required (setq odd "no") ) ) (setq I 0) (repeat numb (if (/= odd "yes") (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) )) (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) )) ) (setq co-ordsxy (cons xy co-ordsxy)) (if (= odd "yes") (setq I (+ I 3)) (setq I (+ I 2)) ) ) ) ; program starts here (setq co-ords (getcoords (car (entsel "\nplease pick pline")))) (co-ords2xy) ; list of 2d or 3d points making pline ; list is co-ordsxy Quote
drafter_joe Posted January 19, 2017 Author Posted January 19, 2017 (edited) Thanks for your contribution, BIGAL! This is something I will probably come back to and have a use for it. Joe Edited January 20, 2017 by drafter_joe Moved question to a new thread. 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.