mfiko Posted February 22, 2019 Posted February 22, 2019 Hi, all I need ur help. I found code in internet to draw polyline between blocks as attachment but not working properly, can any one adjust the code thanks for cooperation (defun c:connect (/ ss i e plist p nextpt plist-sorted rtn pp) (while (or (prompt "\nSelect blocks or circles...") (not (setq ss (ssget '((0 . "INSERT,CIRCLE"))))) ) (prompt "\nEmpty sel. set...") ) (repeat (setq i (sslength ss)) (setq e (ssname ss (setq i (1- i)))) (setq plist (cons (cdr (assoc 10 (entget e))) plist)) ) (setq p (getpoint "\nPick or specify start point - use osnap cen or ins : " ) ) (defun nextpt (p plist / car-sort pp) (defun car-sort (l f / removenth r k) (defun removenth (l n / k) (setq k -1) (vl-remove-if '(lambda (x) (= (setq k (1+ k)) n)) l) ) (setq k -1) (vl-some '(lambda (a) (setq k (1+ k)) (if (vl-every '(lambda (x) (apply f (list a x))) (removenth l k) ) (setq r a) ) ) l ) r ) (setq plist (vl-remove-if '(lambda (x) (equal x p 1e-3)) plist)) (setq pp (car-sort plist '(lambda (a b) (<= (distance p a) (distance p b))) ) ) (list pp plist) ) (if p (progn (while (cadr plist) (setq plist-sorted (cons p plist-sorted)) (setq rtn (nextpt p plist)) (setq pp (car rtn) plist (cadr rtn) ) (setq p pp) ) (setq plist-sorted (cons (car plist) plist-sorted)) (setq plist-sorted (reverse plist-sorted)) (entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length plist-sorted)) (cons 70 (if (= 1 (getvar 'plinegen)) 128 0 ) ) '(38 . 0.0) ) (mapcar '(lambda (p) (cons 10 p)) plist-sorted) (list '(210 0.0 0.0 1.0)) ) ) ) ) (princ) ) Power wiring.dwg Quote
mostafa badran Posted February 24, 2019 Posted February 24, 2019 Hi, maybe this help. https://www.theswamp.org/index.php?topic=49892.0 1 Quote
mfiko Posted February 26, 2019 Author Posted February 26, 2019 Thanks mostafa for kindly reply he is good start for me, put I need it in polyline connection and with angle. I believe is some one help me to do this task. Quote
BIGAL Posted February 26, 2019 Posted February 26, 2019 (edited) Your asking for a custom routine, adding the angle lines is doable, so is squaring the corner, I notice a fillet as well. You need a square on X or Y option probably a pick, pick method. A solution may be pick1st pick 2nd this implies use Y as the offset control, so when pick 4th block as per image it knows to square line. For me a custom routine ie chargeable, I can just see lots of add this, add this. The reason I am saying to pay is you probably have more things you want done getting someone to help customise in simple terms is seconds v's minutes, just look at your hour charge rate, you would quickly recover the cost. You can move the pline cnr now using the .X & .Y method of osnap. Pick pline corner & drag up. type .Y pick block on right, need xz pick block on left, pline is now square. Edited February 26, 2019 by BIGAL 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.