SAFeSTeR Posted October 9, 2013 Posted October 9, 2013 Just wondered if there is a way to reduce the number of vertex points in a polyline or 3d polyline and retain the basic shape but without having to redraw over the top it? Ideally, I would like any adjacent segments which are in the same direction as each other to become one segment. In my image you can see the number of points it has, the majority of which are not necessary for my needs (it was imported from a client's drawing). My desired linetype will also not show because of this. Any help appreciated. Quote
Tyke Posted October 9, 2013 Posted October 9, 2013 Do a search on de-densify, there has been a thread on that recently. I think ReMark had some useful advice on the matter. There was also a LISP routine that someone suggested. Quote
SLW210 Posted October 9, 2013 Posted October 9, 2013 I think you want to look for the term "Weeding". Quote
Barneel Posted October 9, 2013 Posted October 9, 2013 If you use the Command 'Pedit' -> Edit vertex -> Straighten, you can remove groups of vertices at once by clicking 'next' until you get to a vertex you want to keep and then select 'Go', and repeat. Unfortunately its not a quick fix, but it's faster than removing each vertex individually It's still a painful way of doing it though. I'll be interested to see if anyone knows of anything that is both efficient and accurate. Personally I would just draw a Spline over the top of it and get rid of the damn thing asap :s They're much better at accepting linetypes more consistently (because polylines restart the linetype at each vertex, splines don't). Hope this is... slightly helpful... Quote
eldon Posted October 9, 2013 Posted October 9, 2013 ...because polylines restart the linetype at each vertex.... I think that is wrong. You just have to set the Linetype Generation to "ON", and the position of the vertices is ignored Quote
Tyke Posted October 9, 2013 Posted October 9, 2013 If you use the Command 'Pedit' -> Edit vertex -> Straighten, you can remove groups of vertices at once by clicking 'next' until you get to a vertex you want to keep and then select 'Go', and repeat. Unfortunately its not a quick fix, but it's faster than removing each vertex individually It's still a painful way of doing it though. I'll be interested to see if anyone knows of anything that is both efficient and accurate. Personally I would just draw a Spline over the top of it and get rid of the damn thing asap :s They're much better at accepting linetypes more consistently (because polylines restart the linetype at each vertex, splines don't). Hope this is... slightly helpful... By definition when you remove vertices from a polyline you loose accuracy. There is a system variable called PLINEGEN that when set to 1 continues the line type style around the vertices. Quote
Barneel Posted October 9, 2013 Posted October 9, 2013 I think that is wrong. You just have to set the Linetype Generation to "ON", and the position of the vertices is ignored My world as I know it has just crumbled around me. Yes, if you remove vertices from a polyline it will become less accurate than the original. However in this case many of the vertices are likely to fall upon a (almost) common arc. Quote
eldon Posted October 9, 2013 Posted October 9, 2013 I think my original reply was typed a bit too quickly, and what I should have said is " the position of the vertices is ignored for the stopping and starting of the linetype dash pattern." Of course the vertices are still are there. Quote
SAFeSTeR Posted October 10, 2013 Author Posted October 10, 2013 Hi, Thanks for your replies, but so far nothing has worked. Do a search on de-densify, there has been a thread on that recently. I think ReMark had some useful advice on the matter. There was also a LISP routine that someone suggested. I searched 'de-densify' and 'densify' and the only topic I found was this one: Link which I don't think is the one you were referring too. Can you please provide a link? There are a couple of LISP routines on that thread, 'weed.lsp' and another 'purge-pline' found here (linked by Lee Mac). I tried both and here are my results. FYI, I am trying this on a 2DPolyline. Purge-Pline: Command: Simp-Pline loaded, type SPL to launch the function. Command: SPL Select les polylines to be treated or : Select objects: 0 found Select objects: 0 found, 0 total Select objects: 22 treated polyline(s). Command: I have no idea why it 'treated 22 polylines when I only tried 1, without success. I tried converting the polyline then tried the command again. Command: SPL Select les polylines to be treated or : Select objects: 1 found Select objects: 1 treated polyline(s). Command: This made no difference whatsoever, so I relaunched ACAD and tried the 'weed' LISP. Weed: Command: WEED Enter offset distance: 1 Enter leg length: 1 Delete original Polyline [Y/n]: n Select a PolyLine or Line: POLYLINE selected Checking polyline verticies... Weed Error: bad argument type: FILE nil Command: I tried a couple of more times with both smaller and larger values but got the same result. Again, I converted the polyline before more attempts. Command: WEED Enter offset distance: 1 Enter leg length: 1 Delete original Polyline [Y/n]: n Select a PolyLine or Line: That's not a LINE or POLYLINE, it's a LWPOLYLINE Select a PolyLine or Line: Nothing Selected Select a PolyLine or Line: *Cancel* Weed Error: Function cancelled Command: So, is there anything I'm missing or doing wrong or is there anything else I can try? I have attached the offending drawing in case someone can look at it. pline.dwg Thanks. Quote
eldon Posted October 10, 2013 Posted October 10, 2013 As one of the lisps has told you that the polyline is an LWPolyline, have you tried the command "ConvertPoly" Quote
Tyke Posted October 10, 2013 Posted October 10, 2013 You first have to understand that in AutoCAD there are three types of polylines, a 3D-Polyline, a 2D-Polyline and a LW-Polyline (or just polyline). The first one is obvious the 3D-Polyline has three coordinates for each verex. But a 2D-Polyline also has three coordinates for each vertex but the Z-coordinate must always have the same value, and not always zero, so that it is co-planar. But the LW-Polyline only has two coordinates for each vertex, an X and Y coordinate, and an elevation/height. Therefore the LW-Polyline does not produce as much data to be stored in the drawing and hence reduces the drawing size. To confuse matters even further a LW-Polyline is also known as an optimised polyline. LW-Polylines were introduced in AutoCAD R14 and since then when you use the polyline command LW-Polylines are produced. When dealing with programs (LISP, VBA, etc) that use or manipulate polylines the three types have to be dealt with completely differently, hence the comment "That's not a LINE or POLYLINE, it's a LWPOLYLINE". The LISP routine wasn't designed to work on LW-Polylines. Either the LISP routine, in this case, must be modified to accommodate LW-Polylines or the LW-Polyline must be converted to a 2D-Polyline. In AutoCAD there is an undocumented command that converts either to or from LW-Polylines and it is called CONVERTPOLY. There are two options presented when you excecute the command, should the polylines be converted to "thick" or "thin" !?!?! Not a very helpful prompt, but "thick" is a 2D-Polyline and "thin" is a LW-Polyline. Try converting the polylines to 2D-Polylines (thick) and the weed LISP again. I hope cleared things up and the LISP now works for you. Agh! eldon beat me to the draw again. Quote
SAFeSTeR Posted October 10, 2013 Author Posted October 10, 2013 I did explain that I converted the polyline and tried both lisps on both LW- and 2D polylines and showd results for both, but thanks anyway. Quote
SLW210 Posted October 10, 2013 Posted October 10, 2013 Give this one a try...PolyLine Diet Which Weed.lsp did you use, the one that is uploaded without the header which is the first one, or the one with the header intact in Code Tags further down? I used the Weed.lsp on my computer which has the header and it worked just fine on your drawing. WEEDED SLW.dwg Quote
SAFeSTeR Posted October 10, 2013 Author Posted October 10, 2013 Thanks SLW. I copy pasted the code to create a .lsp file, although I did look at the first one and I don't see what difference removing the header would make. After looking at your results I tried again and this time it worked . I pasted your line into my drawing and it's actually very good, it still needs a bit of tweaking but I will save time in the long run. Out of curiosity, what parameters did you use? Also tried that PLDiet, but that didn't work for me either... Thanks once again. Quote
SLW210 Posted October 10, 2013 Posted October 10, 2013 The last one I used 12 and 12 so I could check the difference. I didn't have a lot of time to play with it, I am sure those numbers could be worked with to improve the results. Quote
SAFeSTeR Posted October 10, 2013 Author Posted October 10, 2013 No that's fine, I don't want you to spend any more time on it. It just gives me a starting point, thanks. Quote
SLW210 Posted October 10, 2013 Posted October 10, 2013 After using CONVERTPOLY the PLDiet worked for me as well. Quote
SAFeSTeR Posted October 10, 2013 Author Posted October 10, 2013 I must be doing something wrong, probably the parameters I entered. Quote
controlsgirl Posted February 9, 2023 Posted February 9, 2023 Very late response but OVERKILL might be what you are looking for I tend to make the resolution larger so more things get combined at once. 1 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.