break a line to N numbers of segments

break a line to N numbers of segments

Anonymous
Not applicable
4,556 Views
13 Replies
Message 1 of 14

break a line to N numbers of segments

Anonymous
Not applicable

Dear all,

 

                This is vykunta my question is here  How to convert my line to N number of segments line? 

0 Likes
Accepted solutions (1)
4,557 Views
13 Replies
Replies (13)
Message 2 of 14

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

there is no standard function for that within plain AutoCAD 2015, but if you have a vertical product like ACA, MEP, Civil 3D ... you might have such a functionality built in, in that case let's know what product you have.

The other option is to search the www. If my remembering is ok then there are exists some LISP's doing that.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 14

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

....How to convert my line to N number of segments line? 


You can use the SD command in the SubDivide.lsp file attached.  That will break it into segments that touch at their ends.

 

If you want it broken up into pieces with gaps between them, i.e. to look like a non-continuous linetype such as HIDDEN, use the BreakUp.lsp file attached.  The command names are BU- followed by the linetype name, such as BU-HIDDEN.  It's in progress -- read the comments at the top.  It won't let you specify the number of segments, but bases its breaking up on the linetype definition and the drawing's current linetype scale, so if you want a specific number of segments, you'll need to try it at different LTSCALE settings until the result is right.

Kent Cooper, AIA
Message 4 of 14

Kent1Cooper
Consultant
Consultant

Updated version of SubDivide.lsp that allows selection of multiple objects, all to be SubDivided in the same way.

Kent Cooper, AIA
Message 5 of 14

silvia_aldrighetti_1
Community Visitor
Community Visitor

Hello everyone, I have a question about the LISP SubDivide.

I noticed that the actual lengths of the segments it creates from the selected line are never of the length that I input with "M", but always slightly less. I was wondering if there is a way (or another LISP) that allows to create the various segments of the lenght I choose. I am still a beginner so I am not aware of anything similar.

 

Thanks!

Silvia

0 Likes
Message 6 of 14

Kent1Cooper
Consultant
Consultant

@silvia_aldrighetti_1 wrote:

.... the actual lengths of the segments it creates from the selected line are never of the length that I input with "M", but always slightly less. I was wondering if there is a way (or another LISP) that allows to create the various segments of the lenght I choose. ....


That's what the M stands for - Maximum, meaning "break this into the smallest number of equal-length pieces such that their length does not exceed the Maximum I specified."  It's a Maximum, not a fixed length.  Of course, they're not always slightly less, but will be whenever the overall length is not a clean multiple of the Maximum length specified.  And they could be more than slightly less, depending on the relationship of current length to Maximum.  [For instance, if you use it on a 10-unit-long object, and specify a Maximum segment length of 9 units, the result will be two pieces of only 5 units, because it has to do two pieces or the result would exceed the Maximum.]

 

It's designed for equal-length results.  If you want a specific length rather than a Maximum, except when the overall length is a clean multiple of that you will get all but one segment at that specific length, and one shorter, with how much shorter varying all over the map.  Is that what you want?  That could be done, but there's also the question of whether you would care at which end the shorter resulting segment falls.

Kent Cooper, AIA
0 Likes
Message 7 of 14

silvia_aldrighetti_1
Community Visitor
Community Visitor

Thanks for the quick reply!

Yes exactly, I would like to obtain a specific-length result and I don't really care at which end the shorter segment would be. Could it be possible?

 

Silvia 

0 Likes
Message 8 of 14

Kent1Cooper
Consultant
Consultant
Accepted solution

The attached MeasureBreak.lsp [a modification/simplification from SubDivide.lsp] with its MB command seems to do that in limited testing.  See the comments at the top of the file.

Kent Cooper, AIA
Message 9 of 14

silvia_aldrighetti_1
Community Visitor
Community Visitor

I checked it and it seems to work! Thank you really much for the help!

 

Silvia

0 Likes
Message 10 of 14

90491929
Explorer
Explorer

Thanks @Kent1Cooper,

 

I found an issue with this 3d polyline.

 

Is this meant to work with 3d polys? I see there's a *polyline in the ssget.

 

 

 

0 Likes
Message 11 of 14

Kent1Cooper
Consultant
Consultant

@90491929 wrote:

.... I found an issue with this 3d polyline.  Is this meant to work with 3d polys? I see there's a *polyline in the ssget.


What is your "issue"?  Assuming you're talking about the SD command in SubDivide.lsp, yes, it works with 3D Polylines.  See the comment at the top: "Works on anything that Break can be used on...."  I just tried it on yours, successfully.  [It's planar -- is there some reason for it to be a 3D Polyline instead of one of the 2D kinds?]  If it doesn't work for you, what happens instead?

 

The * is a wildcard standing for any character content [including nothing], in this case to allow both LWPOLYLINE and POLYLINE as entity types to be accepted.  [POLYLINE covers both 3D and "heavy" 2D varieties.]  It could have used just *LINE to cover LINE, POLYLINE, LWPOLYLINE and SPLINE all in one entry, but that would also allow XLINE and MLINE, which are not allowable [XLINE because they don't have length to divide, and MLINE because BREAK can't work on them].

Kent Cooper, AIA
0 Likes
Message 12 of 14

CAD7875
Participant
Participant

jumping on this thread as i was looking for something similar.... is there a lisp or command whereby you could set the distance between points along a line, but from the centre? i'll try and explain; if i wanted to set points at 1000mm, the middle 1000 line would be on the centre of the original line and then there would be 2 equal shorter distances at either end of the original line...

0 Likes
Message 13 of 14

Kent1Cooper
Consultant
Consultant

@CAD7875 wrote:

.... is there a lisp or command whereby you could set the distance between points along a line, but from the centre? i'll try and explain; if i wanted to set points at 1000mm, the middle 1000 line would be on the centre of the original line and then there would be 2 equal shorter distances at either end of the original line...


Try DivideMeasurePlus.lsp, >here<.  Its MEA+ command has an option to center the Points [or Blocks, or Line markers, or selected object(s)] on the path object(s).  It does have the one difference that depending on the relationship between spacing and object length, it will sometimes place a Point [or whatever] at the midpoint, rather than have the middle of a segment there.  It could probably be modified to always do it as you describe.  And it puts things -- it doesn't break the path object into pieces -- but again, it could be modified to do the latter.

Kent Cooper, AIA
Message 14 of 14

CAD7875
Participant
Participant

Works an absolute treat! thank you 🙂

0 Likes