Simplifying Polylines/Curve Fitting

Simplifying Polylines/Curve Fitting

johnfischerLSI
Contributor Contributor
3,252 Views
12 Replies
Message 1 of 13

Simplifying Polylines/Curve Fitting

johnfischerLSI
Contributor
Contributor

I'm looking to drastically reduce the number of segments/vertices automatically. I'm hoping there's a method to fit a curve to a series of segments, and maybe set an angle tolerance. The goal is to make these files more machine-path friendly. Example DWG attached. Any help would be great appreciated! 

0 Likes
3,253 Views
12 Replies
Replies (12)
Message 2 of 13

pendean
Community Legend
Community Legend
0 Likes
Message 3 of 13

Kent1Cooper
Consultant
Consultant

The article linked in @pendean 's Reply has a broken link to something in the Forums, which could possibly be my PLDIET.lsp routine [PLD command] -- if so, that is available >here<.  But one aspect of the OP's request that it will not do is to apply curvature across multiple segments.  It will keep existing arc segments if you choose that option, but only as they are.  It only removes vertices, leaving line segments between the adjacent vertices that it left in place.

 

[WEED mentioned in that article is the name of a routine that was, originally at least, only for "heavy" Polylines.  PLDIET was written to do pretty much the same with LWPolylines, with a few other improvements -- see the comments at the top of the file.]

Kent Cooper, AIA
0 Likes
Message 4 of 13

johnfischerLSI
Contributor
Contributor

I've tried using the PLDiet command, but it seems to just turn a series of segments into one long, straight segment. I'm hoping to achieve more of a "curve fitting" effect, if possible. If this is something PLDiet can do, please advise! I've attached a screenshot of an example I manually re-worked, I'm hoping to automate this process. 

johnfischerLSI_0-1715284958621.png

 

0 Likes
Message 5 of 13

marko_ribar
Advisor
Advisor

Here you have "dietlws.lsp" that may be what you are searching for...

https://www.theswamp.org/index.php?topic=59534.msg620732#msg620732 

 

HTH.

M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 6 of 13

johnfischerLSI
Contributor
Contributor

This is great! Is there any version of this that can allow you to select multiple polylines at once?

0 Likes
Message 7 of 13

marko_ribar
Advisor
Advisor

It did outer pretty well, but inner ones are trickier...

Here is your DWG...

 

 

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 8 of 13

johnfischerLSI
Contributor
Contributor

This is almost exactly what I need, do you think there's a way to automate it a bit more to allow for simultaneous pline selection?

0 Likes
Message 9 of 13

Kent1Cooper
Consultant
Consultant

@johnfischerLSI wrote:

.... If this is something PLDiet can do, .... 


No, it's not.  It only reduces quantity of vertices, but cannot change line segments to arc segments.

Kent Cooper, AIA
0 Likes
Message 10 of 13

Sea-Haven
Mentor
Mentor

There is curve best fit algorithms. CIV3D has one built in. But knowing if curve produced is within tolerance to points would be the problem. Least squares comes to mind. Looking for a lisp version.

 

Found this Curve Fitting Algorithm - Lisp — BricsCAD Forum (bricsys.com) go down to Sakko post a couple of possible solutions. The circle one did give something to start with. Can maybe break at start and end.

SeaHaven_0-1715307092147.png

 

0 Likes
Message 11 of 13

david.waight
Contributor
Contributor

@johnfischerLSI,

 

Could this be what you are looking for?

 

It isn't free and I haven't used it but it seems to be what you are looking for.

 

https://tcicorp.com/curvefit/

 

0 Likes
Message 12 of 13

marko_ribar
Advisor
Advisor

@johnfischerLSI 

I've updated my *.lsp in the link I provided and now it should work with multiple selection of LWPOLYLINE entities...

HTH.

M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 13 of 13

davidjnolan98
Community Visitor
Community Visitor

In AutoCAD, the PEDIT command allows you to streamline polylines by straightening segments between chosen start and end points. Additionally, tools and add-ons like Simplify Polyline can automate the vertex reduction process. Also you can use curve fitting tool, upload your data, perform curve fitting, and export a simplified version to import back into AutoCAD for further use.

0 Likes