minhphuong_humg Posted October 23, 2017 Posted October 23, 2017 Hi, everybody. Please help me lisp Select polyline and autonumber Attribute with circle 7.5. Thank you very much. File attach: G ATT.dwg Quote
BIGAL Posted October 24, 2017 Posted October 24, 2017 There are lots of get the vertices of a pline routine here is one. It makes a list of all the points in order just add the circle and text option. Did you search for "Number Pline vertices" should exist would then be easy to add the circle bit. ; pline co-ords example ; By Alan H (defun getcoords (ent) (vlax-safearray->list (vlax-variant-value (vlax-get-property (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)) (setq numb (/ len 2)) ; even and odd check required (setq I 0) (repeat numb (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) )) ; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) )) (setq co-ordsxy (cons xy co-ordsxy)) (setq I (+ I 2)) ) ) ; program starts here (setq co-ords (getcoords (car (entsel "\nplease pick pline")))) (co-ords2xy) ; list of 2d points making pline (princ co-ordsxy) add this bit for circle I will let you work out text (repeat (setq x (length co-ordsxy)) (command "circle" (nth (setq x (- x 1)) co-ordsxy) 7.5) ) Quote
minhphuong_humg Posted October 24, 2017 Author Posted October 24, 2017 There are lots of get the vertices of a pline routine here is one. It makes a list of all the points in order just add the circle and text option. Did you search for "Number Pline vertices" should exist would then be easy to add the circle bit. ; pline co-ords example ; By Alan H (defun getcoords (ent) (vlax-safearray->list (vlax-variant-value (vlax-get-property (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)) (setq numb (/ len 2)) ; even and odd check required (setq I 0) (repeat numb (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) )) ; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) )) (setq co-ordsxy (cons xy co-ordsxy)) (setq I (+ I 2)) ) ) ; program starts here (setq co-ords (getcoords (car (entsel "\nplease pick pline")))) (co-ords2xy) ; list of 2d points making pline (princ co-ordsxy) add this bit for circle I will let you work out text (repeat (setq x (length co-ordsxy)) (command "circle" (nth (setq x (- x 1)) co-ordsxy) 7.5) ) ; pline co-ords example ; By Alan H (defun getcoords (ent) (vlax-safearray->list (vlax-variant-value (vlax-get-property (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)) (setq numb (/ len 2)) ; even and odd check required (setq I 0) (repeat (setq x (length co-ordsxy)) (command "circle" (nth (setq x (- x 1)) co-ordsxy) 7.5) ) (repeat numb (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) )) ; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) )) (setq co-ordsxy (cons xy co-ordsxy)) (setq I (+ I 2)) ) ) ; program starts here (setq co-ords (getcoords (car (entsel "\nplease pick pline")))) (co-ords2xy) ; list of 2d points making pline (princ co-ordsxy) I edited the same. Thanks BIGAL. Result image attach: 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.