pmadhwal7 Posted July 15, 2020 Posted July 15, 2020 Dear All how to break multiple line at define interval like i want to break attached DWG all polyline at every 50m interval, and if go with manual way it will take many time so Is there any way by which I can select all the Polylines and break them at a time of 50 meters? break line.dwg Quote
BIGAL Posted July 16, 2020 Posted July 16, 2020 Yes ! Using vlax-curve-getpointatdist do it twice 2 pts 50 and 50 + x Do you want a new pline each time so make 2 3 4 5 etc, with common end points. I am sure its already done do a google. Quote
pmadhwal7 Posted July 16, 2020 Author Posted July 16, 2020 4 hours ago, BIGAL said: Yes ! Using vlax-curve-getpointatdist do it twice 2 pts 50 and 50 + x Do you want a new pline each time so make 2 3 4 5 etc, with common end points. I am sure its already done do a google. first thing is i have no idea about vlax-curve-getpointatdist, and no i don't need new pline every time just break those line at 50m interval that's it. Quote
ronjonp Posted July 16, 2020 Posted July 16, 2020 9 hours ago, pmadhwal7 said: first thing is i have no idea about vlax-curve-getpointatdist, .... Do a little reading Here's a simple start: (if (and (setq e (car (entsel "\nPick a polyline: "))) (= 'list (type (setq p (vl-catch-all-apply 'vlax-curve-getpointatdist (list e 50.))))) ) (vl-cmdf "_.break" e p p) ) Quote
devitg Posted July 18, 2020 Posted July 18, 2020 On 7/16/2020 at 1:56 AM, pmadhwal7 said: first thing is i have no idea about vlax-curve-getpointatdist, and no i don't need new pline every time just break those line at 50m interval that's it. When you break a PLINE , or line , or whatever line like enty , you get 2 new one . and so all line long Quote
devitg Posted July 18, 2020 Posted July 18, 2020 give it a try added to Ronjonp start (defun C:brk () (if (and (setq e (car (entsel "\nPick a polyline: "))) (setq e-LENGTH (vla-get-Length (vlax-ename->vla-object e))) (setq div (fix (/ e-LENGTH 50))) (= 'list (type (setq p (vl-catch-all-apply 'vlax-curve-getpointatdist (list e 50.))))) ) (vl-cmdf "_.break" e p p) ) (repeat (1- div) (setq e (entlast)) (= 'list (type (setq p (vl-catch-all-apply 'vlax-curve-getpointatdist (list e 50.))))) (vl-cmdf "_.break" e p p) ) ) Quote
devitg Posted July 18, 2020 Posted July 18, 2020 To break all polys (DEFUN C:BRK (/ ALL-POLY-LIST ALL-POLY-SS DIV E E-LENGTH P) (SETQ ALL-POLY-SS (SSGET "X" '((0 . "LWPOLYLINE")))) (SETQ ALL-POLY-LIST (VL-REMOVE-IF-NOT '(LAMBDA (X) (= (TYPE X) 'ENAME)) (MAPCAR 'CADR (SSNAMEX ALL-POLY-SS)))) ;;; (setq poly (car all-poly-list)) (FOREACH POLY ALL-POLY-LIST (IF (AND (SETQ E POLY) (SETQ E-LENGTH (VLA-GET-LENGTH (VLAX-ENAME->VLA-OBJECT E))) (SETQ DIV (FIX (/ E-LENGTH 50))) (= 'LIST (TYPE (SETQ P (VL-CATCH-ALL-APPLY 'VLAX-CURVE-GETPOINTATDIST (LIST E 50.))))) ) ; end And (VL-CMDF "_.break" E P P) ) ; end if (REPEAT (1- DIV) (SETQ E (ENTLAST)) (= 'LIST (TYPE (SETQ P (VL-CATCH-ALL-APPLY 'VLAX-CURVE-GETPOINTATDIST (LIST E 50.))))) (VL-CMDF "_.break" E P P) ) ) ;end foreach ) all breaked line.dwg Quote
BIGAL Posted July 18, 2020 Posted July 18, 2020 (edited) Why not (FOREACH POLY ALL-POLY-LIST (repeat (setq x (sslength ALL-POLY-SS)) (setq E (ssname ss (setq x (- x 1)))) Edited July 18, 2020 by BIGAL Quote
Jonathan Handojo Posted July 19, 2020 Posted July 19, 2020 Guys... Harsh lesson I learned the hard way, when using (command) or (vl-cmdf) that involves getting a point from user, if your snaps isn't off, you'll get unexpected results. Make sure snaps is off before executing commands. 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.