Dec 18, 2011
Find a point in a polyline which is closest to a latlng. Is to kind of loop through all the points in the polyline and find the distance between them and the given point, however this is inefficient because the points on the polyline can potentially be large. Interpolate more vertices between every pair of vertices on the polyline, even.
I have to intersect polylines 'POLYLINE' and 'LWPOLINE' with a line and get all the angles of all segments of the polyline that are intersected.
To do this I used a loop that monitors all the vertices of each polyline to find the two vertices of the polyline segment that intersects the line. Unfortunately, these polylines have thousands of vertices and the processing done in this way takes too long.
With the vlax-curve-getClosestPointTo I could very quickly find the vertex of the polyline closest to that intersected with the line, but I need to find the other vertex of the polyline segment to determine the angle of this.
Another question: is there a quick function that returns the exact point of intersection of two curves (e.g. A line and a polyline, or a line and a circle?
To do this I used a loop that monitors all the vertices of each polyline to find the two vertices of the polyline segment that intersects the line. Unfortunately, these polylines have thousands of vertices and the processing done in this way takes too long.
With the vlax-curve-getClosestPointTo I could very quickly find the vertex of the polyline closest to that intersected with the line, but I need to find the other vertex of the polyline segment to determine the angle of this.
Another question: is there a quick function that returns the exact point of intersection of two curves (e.g. A line and a polyline, or a line and a circle?
I have a polyline (lines only) which has about 500 points in it. I would like to reduce the number of points in it. How can I do it in AutoCAD? (or may be some other application)?
P.S. Polylines were made of splines converted into set of lines. But the level of detail is too high I want to decrease it.
DmitriyDmitriy
6 Answers
This LISP script does the job. Create an LSP file and add it to AutoCAD, then use PLD command to run it.
DmitriyDmitriy
I wrote a utility call Reduce that does this. It is a compiled Autolisp fas file, which is run like a normal lsp file. You can download it here https://www.theswamp.org/index.php?topic=27724.0.
LernerLerner
The lisp routine may be the best deal for you, but I use the overkill command to remove points from polylines (when the command is active, go to settings). It is an express tool that is usually used to remove duplicate lines but it works to optimize polylines. The one thing you need to be careful of is when your polyline has a width. Overkill will usually kill widths.
Cheers.
Ben JonesBen Jones
I have had this problem to and I usually just explode the polyline, then do an overkill and then join the remaining lines. I have 2014 LT so lisp routines wouldn't work for me. It was the only way that I could do it.
cdguy2121cdguy2121
If you have rhino, 'SimplifyCrv' works pretty well. Not sure how it functions, but I had a similar problem, and this command was able to lower the number of control points in a polyline beyond commands that come loaded with autoCAD.
HarryHarry
Please see image here:
This is a very good utility for PLine to reduce file size. But in above case, if 2 green points was deleted, the PLine become sharp (not tangent). Please consider about it.
thuanthuan