Jump to content

Recommended Posts

Posted

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

Posted

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.

 

 

Posted
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.

Posted
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)
)

 

Posted
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 

 

Posted

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)
)

)

 

Posted

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

Posted (edited)

Why not

 

(FOREACH POLY  ALL-POLY-LIST

(repeat (setq x (sslength ALL-POLY-SS))
(setq E (ssname ss (setq x (- x 1))))

 

Edited by BIGAL
Posted

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. 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...