anupmadhu Posted August 22, 2015 Posted August 22, 2015 Please give lisp which can convert any closed LWPOLYLINE to Ziz Zag lines as shown in the attached file (The enclosed are should remain the same. (we are into landscape design most of the ground cover are notified by these lines ) http://www.dropbox.com/s/zs8mcpgtr662pfy/PL%20_004.dwg?dl=0 Quote
BIGAL Posted August 22, 2015 Posted August 22, 2015 Search for zigzag linetype it is out there you can create a pline from 1st principles lots of little segments with all sorts of patterns. Just a suggestion cut your dwg down a very simple example would have been ok I just did not download 7.8MB even a screen grab. ZIGZAG is a out of box linetype ! LINETYPE last entry should be ZIGZAG Quote
anupmadhu Posted August 23, 2015 Author Posted August 23, 2015 Search for zigzag linetype it is out there you can create a pline from 1st principles lots of little segments with all sorts of patterns. Just a suggestion cut your dwg down a very simple example would have been ok I just did not download 7.8MB even a screen grab. ZIGZAG is a out of box linetype ! LINETYPE last entry should be ZIGZAG Sir, The line type won't serve purpose as i have tried this & there should be no change in the area included within the LWpolyline I have include screen shots for better understanding but its required to open drawing to understand its full properties (sorry for the size) https://www.dropbox.com/s/0xo26ytciypwab3/demo.dwg?dl=0 Quote
BIGAL Posted August 23, 2015 Posted August 23, 2015 I am guessing a bit but made this using EXPRESS make shape, make linetype. A good example Quote
anupmadhu Posted August 23, 2015 Author Posted August 23, 2015 Good awsme , do you mind me sending the .lin file Quote
anupmadhu Posted August 23, 2015 Author Posted August 23, 2015 I am guessing a bit but made this using EXPRESS make shape, make linetype. A good example [ATTACH=CONFIG]55329[/ATTACH] I tried, but is coming dot dot can you send me the .lin file if don't mind Quote
eldon Posted August 23, 2015 Posted August 23, 2015 If you WBlock out the relevant detail, you can get your files very much smaller. Your ground cover area lines are polylines, and every zig inwards subtracts from the area. I took one of your shapes, and you can see the area of yours, and the area of the bounding shape. If you want the area to be of the whole area, you should use linetypes. If you have a lisp, every zig-zag will subtract from your area. The zigs are not at even spacing at the moment, but lisp and linetypes will probably give even spacing. Quote
anupmadhu Posted August 23, 2015 Author Posted August 23, 2015 If you WBlock out the relevant detail, you can get your files very much smaller. Your ground cover area lines are polylines, and every zig inwards subtracts from the area. I took one of your shapes, and you can see the area of yours, and the area of the bounding shape. If you want the area to be of the whole area, you should use linetypes. If you have a lisp, every zig-zag will subtract from your area. The zigs are not at even spacing at the moment, but lisp and linetypes will probably give even spacing. Sir, The area difference can be ignored, is there any suitable lisp to covert poly line to zig zag. Even if the zig zag are not evenly spaced it doesn't matters Quote
ymg3 Posted August 23, 2015 Posted August 23, 2015 There is ZigZag v1.0 by Joe Burke. Might do what you are after. p.s. Could not open your drawing, your version of Acad is too recent for me. Quote
anupmadhu Posted August 24, 2015 Author Posted August 24, 2015 There is ZigZag v1.0 by Joe Burke. Might do what you are after. p.s. Could not open your drawing, your version of Acad is too recent for me. Sir Autocad 2007 version is here with attached pls have a look https://www.dropbox.com/s/xsanykzv2msb7s6/demo1.dwg?dl=0 Quote
eldon Posted August 24, 2015 Posted August 24, 2015 And here is a r2000 version with only the relevant entities, and small enough not to need Dropbox. PL_004-small.dwg Quote
Stefan BMR Posted August 24, 2015 Posted August 24, 2015 Please give lisp which can convert any closed LWPOLYLINE to Ziz Zag lines as shown in the attached file (The enclosed are should remain the same. (we are into landscape design most of the ground cover are notified by these lines ) http://www.dropbox.com/s/zs8mcpgtr662pfy/PL%20_004.dwg?dl=0 Hi anupmadhu. Please try this lisp. It works only with LWPOLYLINES on WCS. The selection filter will NOT ignore bulged or open polylines, but I wouldn't try on those type of polys. (defun c:test ( / *error* acDoc l2p 2d clockwise-p a b c d e i p q r ss w) (vl-load-com) (or *zigdist* (setq *zigdist* 10.0)) (setq acDoc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark acDoc) (defun *error* (msg) (and msg (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*EXIT*")) (princ (strcat "\nError: " msg)) ) (vla-endundomark acDoc) (princ) ) (defun l2p (l) (if l (cons (list (car l) (cadr l)) (l2p (cddr l))) ) ) (defun 2d (p) (list (car p) (cadr p))) (defun clockwise-p (e / p1 p2 p a b f1 f2) (vla-getboundingbox e 'p1 'p2) (setq p (vlax-curve-getparamatpoint e (vlax-curve-getclosestpointtoprojection e (mapcar '- (vlax-safearray->list p1) '(1 1 0)) '(1 0 0) ) ) a (vlax-curve-getstartparam e) b (vlax-curve-getendparam e) f1 (vlax-curve-getfirstderiv e (+ a (rem (+ p 0.1) (- b a)))) f2 (vlax-curve-getfirstderiv e (+ a (rem (+ (- p 0.1) (- b a)) (- b a))) ) ) (> (* (car f1) (cadr f2)) (* (car f2) (cadr f1)) ) ) (if (and (setq ss (ssget ":L" '((0 . "LWPOLYLINE") (210 0.0 0.0 1.0) (38 . 0.0)))) (or (and (setq d (getdist (strcat "\Specify zig-zag distance <" (if *zigdist* (rtos *zigdist*) "") ">: "))) (setq d (abs d)) ) (setq d *zigdist*) ) ) (repeat (setq i (sslength ss)) (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))) p (l2p (vlax-get e 'coordinates)) a (/ d 2.0) b (vla-get-length e) w (* 0.1 d) r nil q (clockwise-p e) ) (while (<= a b) (setq c (vlax-curve-getpointatdist e (- a w))) (while (and p (<= (vlax-curve-getdistatpoint e (car p)) (- a w))) (setq r (cons (car p) r) p (cdr p) ) ) (setq r (cons (2d c) r) r (cons (2d (polar c (- (angle '(0.0 0.0) (vlax-curve-getfirstderiv e (vlax-curve-getparamatpoint e c))) (/ pi 2.0)) (if q w (- w)))) r) r (cons (2d (vlax-curve-getpointatdist e a)) r) ) (setq a (+ a d)) ) (vlax-put e 'coordinates (apply 'append (reverse r))) ) ) (setq *zigdist* d) (vla-endundomark acDoc) (princ) ) Quote
anupmadhu Posted August 24, 2015 Author Posted August 24, 2015 Hi anupmadhu.Please try this lisp. It works only with LWPOLYLINES on WCS. The selection filter will NOT ignore bulged or open polylines, but I wouldn't try on those type of polys. (defun c:test ( / *error* acDoc l2p 2d clockwise-p a b c d e i p q r ss w) (vl-load-com) (or *zigdist* (setq *zigdist* 10.0)) (setq acDoc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark acDoc) (defun *error* (msg) (and msg (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*EXIT*")) (princ (strcat "\nError: " msg)) ) (vla-endundomark acDoc) (princ) ) (defun l2p (l) (if l (cons (list (car l) (cadr l)) (l2p (cddr l))) ) ) (defun 2d (p) (list (car p) (cadr p))) (defun clockwise-p (e / p1 p2 p a b f1 f2) (vla-getboundingbox e 'p1 'p2) (setq p (vlax-curve-getparamatpoint e (vlax-curve-getclosestpointtoprojection e (mapcar '- (vlax-safearray->list p1) '(1 1 0)) '(1 0 0) ) ) a (vlax-curve-getstartparam e) b (vlax-curve-getendparam e) f1 (vlax-curve-getfirstderiv e (+ a (rem (+ p 0.1) (- b a)))) f2 (vlax-curve-getfirstderiv e (+ a (rem (+ (- p 0.1) (- b a)) (- b a))) ) ) (> (* (car f1) (cadr f2)) (* (car f2) (cadr f1)) ) ) (if (and (setq ss (ssget ":L" '((0 . "LWPOLYLINE") (210 0.0 0.0 1.0) (38 . 0.0)))) (or (and (setq d (getdist (strcat "\Specify zig-zag distance <" (if *zigdist* (rtos *zigdist*) "") ">: "))) (setq d (abs d)) ) (setq d *zigdist*) ) ) (repeat (setq i (sslength ss)) (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))) p (l2p (vlax-get e 'coordinates)) a (/ d 2.0) b (vla-get-length e) w (* 0.1 d) r nil q (clockwise-p e) ) (while (<= a b) (setq c (vlax-curve-getpointatdist e (- a w))) (while (and p (<= (vlax-curve-getdistatpoint e (car p)) (- a w))) (setq r (cons (car p) r) p (cdr p) ) ) (setq r (cons (2d c) r) r (cons (2d (polar c (- (angle '(0.0 0.0) (vlax-curve-getfirstderiv e (vlax-curve-getparamatpoint e c))) (/ pi 2.0)) (if q w (- w)))) r) r (cons (2d (vlax-curve-getpointatdist e a)) r) ) (setq a (+ a d)) ) (vlax-put e 'coordinates (apply 'append (reverse r))) ) ) (setq *zigdist* d) (vla-endundomark acDoc) (princ) ) Thanks stefan works great , U saved our time a lot Quote
BIGAL Posted August 25, 2015 Posted August 25, 2015 Just as a matter of interest this took about 1 minute to make from your drawing using express tools. zigzag.zip 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.