rk25134 Posted January 6, 2014 Posted January 6, 2014 Creation of automate polyline between dimension lines test.dwg Quote
rk25134 Posted January 6, 2014 Author Posted January 6, 2014 need lisp for automatic creation of polyline Quote
Tharwat Posted January 6, 2014 Posted January 6, 2014 Hi . Are you after drawing a polyline on the left side hand coordinates of the selected dimensions ? Quote
ketxu Posted January 6, 2014 Posted January 6, 2014 Lack of Information : (defun c:pleasemoredetail() (command "pline" (foreach d (acet-ss-to-list (ssget '((0 . "DIMENSION")))) (command "_non" (acet-dxf 13 (entget d))) ) ) ) And keep having respect 4 forum ^^ http://www.cadtutor.net/forum/showthread.php?63344-Auto-Draw-Polyline/page3 Quote
rk25134 Posted January 6, 2014 Author Posted January 6, 2014 (edited) I need for right side Edited January 6, 2014 by rk25134 Quote
Tharwat Posted January 6, 2014 Posted January 6, 2014 I need for right side Try this ... (defun c:Test (/ leg ss l) ;; Tharwat 06. jan. 2014 ;; (defun leg (x e) (cdr (assoc x (entget e)))) (if (setq ss (ssget '((0 . "*DIMENSION")))) (progn ((lambda (i / sn a b) (while (setq sn (ssname ss (setq i (1+ i)))) (if (< (car (setq a (leg 13 sn))) (car (setq b (leg 14 sn)))) (setq l (cons b l)) (setq l (cons a l)) ) ) ) -1 ) (if (and l (> (length l) 1) (setq l (vl-sort l '(lambda (p q) (< (cadr p) (cadr q)))))) (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length l)) '(70 . 0) ) (mapcar (function (lambda (p) (cons 10 (list (car p) (cadr p))))) l) ) ) ) ) ) (princ) ) Quote
rk25134 Posted January 6, 2014 Author Posted January 6, 2014 thank you its working, please provide for left side also. Quote
Tharwat Posted January 6, 2014 Posted January 6, 2014 thank you its working, please change the below code to right side Just change the number 13 to 14 Quote
rk25134 Posted January 6, 2014 Author Posted January 6, 2014 After changing 13 to 14 I am getting incorrect way as please find the attached screenshot Quote
Tharwat Posted January 6, 2014 Posted January 6, 2014 After changing 13 to 14 I am getting incorrect way as please find the attached screenshot Did you try my routine ? Quote
rk25134 Posted January 6, 2014 Author Posted January 6, 2014 Yes your routine is working fine. need same for left side also. Quote
Tharwat Posted January 6, 2014 Posted January 6, 2014 Yes your routine is working fine. need same for left side also. Not a problem , here is a complete one to work on the two sides besides that one more option for both . Try it and let me know ... (defun c:Test (/ leg _LW ss lt rt k) ;; Tharwat 06. jan. 2014 ;; (defun leg (x e) (cdr (assoc x (entget e)))) (defun _LW (pts) (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length pts)) '(70 . 0) ) (mapcar (function (lambda (p) (cons 10 (list (car p) (cadr p))))) pts) ) ) ) (princ "\n Select Dimensions ...") (if (setq ss (ssget '((0 . "*DIMENSION")))) (progn ((lambda (i / sn a b) (while (setq sn (ssname ss (setq i (1+ i)))) (if (< (car (setq a (leg 13 sn))) (car (setq b (leg 14 sn)))) (setq rt (cons b rt) lt (cons a lt) ) (setq rt (cons a rt) lt (cons b lt) ) ) ) ) -1 ) (if (and (> (length lt) 1) (> (length rt) 1)) (if (progn (initget 6 "Left Right Both") (setq k (cond ((getkword (strcat "\n Specify a side [Left/Right/Both] < " (cond (*side*) ((setq *side* "Left")) ) " > :" ) ) ) (*side*) ) ) ) (cond ((eq k "Left") (mapcar '_LW (list (vl-sort lt '(lambda (p q) (< (cadr p) (cadr q))))))) ((eq k "Right") (mapcar '_LW (list (vl-sort rt '(lambda (p q) (< (cadr p) (cadr q))))))) (t (mapcar '_LW (list (vl-sort lt '(lambda (p q) (< (cadr p) (cadr q)))) (vl-sort rt '(lambda (p q) (< (cadr p) (cadr q)))) ) ) ) ) ) (princ "\n <!> You should select two dimensions at least <!> ") ) ) ) (princ) ) 1 Quote
pBe Posted January 6, 2014 Posted January 6, 2014 (edited) Like to think the actual drawing would be more complex than the one you posted rk25134 , would you be so kind to post a more realistic drawing sample. Edited January 6, 2014 by pBe Quote
Tharwat Posted January 6, 2014 Posted January 6, 2014 working fine Any another lisp Since it is working fine , what is the need to ask for another lisp ? Quote
rk25134 Posted January 6, 2014 Author Posted January 6, 2014 Please find the attached screenshot. I Used latest routine and enter right option from the lisp Quote
Tharwat Posted January 6, 2014 Posted January 6, 2014 I did work on your first attached drawing . Quote
Tharwat Posted January 6, 2014 Posted January 6, 2014 Let me know if you are careless about this thread anymore . 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.