0 Members and 1 Guest are viewing this topic.
; pline co-ords example 2d or 3d; By Alan H June 2018(defun plinecords (/ xyz obj i co-ords); program starts here (setq co-ordsxy '()) (setq obj (vlax-ename->vla-object (car (entsel "\nPlease pick pline")))) (cond ((= (vla-get-ObjectName obj) "AcDbPolyline") (setq xyz 2)) ((= (vla-get-ObjectName obj) "AcDbLine") (setq xyz 1)) ((= (vla-get-ObjectName obj) "AcDb3dPolyline") (setq xyz 3)) ((alert "Object not supported\n\nPlease pick again")) ) (if (> xyz 1) (progn (setq co-ords (vlax-safearray->list (vlax-variant-value (vlax-get-property obj "Coordinates" ) ) ) ) ) ) (if (= xyz 1) (progn (setq xyz (vlax-safearray->list (vlax-variant-value (vla-get-startpoint obj)))) (setq co-ordsxy (cons xyz co-ordsxy)) (setq xyz (vlax-safearray->list (vlax-variant-value (vla-get-endpoint obj)))) (setq co-ordsxy (cons xyz co-ordsxy)) ) ) (if (= xyz 2) (progn (setq I 0) (repeat (/ (length co-ords) 2) (setq xyz (list (nth i co-ords) (nth (+ I 1) co-ords))) (setq co-ordsxy (cons xyz co-ordsxy)) (setq I (+ I 2)) ) ) ) (if (= xyz 3) (progn (setq I 0) (repeat (/ (length co-ords) 3) (setq xyz (list (nth i co-ords) (nth (+ I 1) co-ords) (nth (+ I 2) co-ords))) (setq co-ordsxy (cons xyz co-ordsxy)) (setq I (+ I 3)) ) ) ) (alert "co-ords are in variable co-ordsxy") (princ))(plinecords)(repeat (setq x (length co-ordsxy))(command "circle" (nth (setq x (- x 1)) co-ordsxy) 5))