Dear All,
I need to run the WEED routine on several files to clean them up. Within each file, there are 100 plus polylines and at the moment I have to individually select each polyline and use the WEED command.
Does anyone know how I can select all polylines within a drawing and apply WEED routine?
Or is it relatively simple to write in a Select ALL function at the start of the code? Though this would be beyond my capabilities!
Many thanks
Ben Daykin
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
And if the result need more then a minute, please share your log[F2] that we
can see your setting/input.
from start PLD to the End (after the PLD run)
Sebastian
Type PLD to put PolyLine(s) on a Diet.
Command: PLD
Error: bad argument type
Command: '_PMTHIST
Command: PLD
Error: bad argument type
The above is the log. Looks like 2019 code isn't working for me. When I type PLD this error of "Bad Argument" is been thrown. The code from 2009 and 2013 was working well on other drawings. Please refer to the attached PLD lisps
If you (only now) say now that you do not work with AutoCAD, then I would be angry
What is the correect productname and version?
Command: ABOUT will show the informations (in Autodesk products).
Sebastian
I work on Intellicad. Sorry to make you angry! I just needed a routine which made a crooked curve smooth. Pldiet helped for a while till this drawing showed up.
@Anonymous schrieb:
2013 was working well on other drawings.
Ok, let's talk about the 2013 version.
Again: Please start the (2013) PLD in your posted test2.dwg,
and tell us your settings.
For example:
Command: PLD
Maximum distance between non-collinear vertices to straighten: 0.25
Maximum change in direction to straighten <10>: 10
Retain or Straighten arc segments [R/S] <R>: R
<Attachment 'test2_RE1-afterPLD2013.dwg>
Used Product: Q.70.0.0 AutoCAD 2020.1
EDIT-------------
>"I work on Intellicad."
That's very important and you should give that information in all your posts.. (in Autodesk forums. In Intellicad forum it isn't so important, lol)
Sebastian
----LOG------------------------------------
Command: PEDIT
Select polyline to edit or [Multiple]:
The entity selected is not a polyline. Turn it into one? [Yes/No] <Y> Y
Enter an option [Edit vertices/Close/Decurve/Fit/Join/Linetype-mode/Reverse/Spline/Taper/Width/Undo/eXit] <eXit>: J
Select entities or [FILter/Qselect]:
Opposite corner:
Entities in set: 656
Select entities or [FILter/Qselect]:
656 objects converted to 1 polyline
Enter an option [Edit vertices/Close/Decurve/Fit/Join/Linetype-mode/Reverse/Spline/Taper/Width/Undo/eXit] <eXit>: S
Enter an option [Edit vertices/Close/Decurve/Fit/Join/Linetype-mode/Reverse/Spline/Taper/Width/Undo/eXit] <eXit>:
Cancel
Command:
Command:
Cancel
Command:
Command:
Cancel
Command: EXPLODE
Select entities to explode [FILter/Qselect]:
Entities in set: 1
Select entities to explode [FILter/Qselect]:
1 found
Command: PEDIT
Select polyline to edit or [Multiple]:
The entity selected is not a polyline. Turn it into one? [Yes/No] <Y> Y
Enter an option [Edit vertices/Close/Decurve/Fit/Join/Linetype-mode/Reverse/Spline/Taper/Width/Undo/eXit] <eXit>: J
Select entities or [FILter/Qselect]:
Opposite corner:
Entities in set: 5232
Select entities or [FILter/Qselect]:
5232 objects converted to 1 polyline
Enter an option [Edit vertices/Close/Decurve/Fit/Join/Linetype-mode/Reverse/Spline/Taper/Width/Undo/eXit] <eXit>:
Cancel
Command: PLD
Maximum distance between non-collinear vertices to straighten: 20
Maximum change in direction to straighten <10>: 7
Retain or Straighten arc segments [R/S] <R>: r
Select LWPolylines to put on a diet, or press Enter to select all:
Select entities or [FILter/Qselect]: '_PMTHIST
--------------------------------------------------------------------------------------
Okay I will explain you my problem from start.
1.Firstly the line in drawing is the surface of the rim of a wheel. There's a scanner which hits laser at the surface of the wheel from center of the wheel to its edge.This scanner produces the X-Y coordinates.I have a program which take this X-Y coordinates and convert them into a dxf drawing.The program simply draws the line between two X-Y coordinate.
2. I take that line from drawing and make it smooth by this process. First I convert the line in poly-line. Then I make it spline (PEDIT->SPLINE). Then I explode it. This explode command increases the points on the lines. Like you can see in log. Initially points were 656 after exploding and they became 5232 . I again join these points and convert them in polyline. Use PLD->20->7->R and then I make it spline. This whole long process gives me a smooth curve. This smooth curve helps CNC machine to cut the surface of wheel accurately. If there are small bulges in the drawing,It affects its finishing.
I use ProgeCad 2019 Professional powered by IntelliCAD.
For reference I have attached basic raw drawing I get after converting that coordinate data into drawing. Later I process this drawing by above method.
My only goal here is to make that line smooth without any minor bulge in it and the process to make it should be also be easy such as any non Cad user could do that.
Your (intelli) Programm writes totally wrong data values into the DXF, this DXF is not valid, it is corrupt..
Multiple objects with the same reference name (all? Lines with Handle=55) .
Thats nothing to do with the PLD Question, but i am out.
Ask the intellcad community for a solution (the PLD works fine in AutoCAD).
Sebastian
I wonder why it worked nicely with other drawings? Pld command works well with attached raw drawing even it is produced in manner. In the attached drawing object reference name is also same. (handle=55)
Anyway thanks for your response and time.
@Anonymous wrote:
.... Please can you share the lastest pldiet lisp?
[EDIT -- didn't notice there was another page of Messages after the one this is in Reply to, but anyway....]
It's at the link in Message 17. But I'm not sure anything that's different about it from previous versions will have any effect on this problem, which is likely because of the 5000+ vertices. The routine works on the list of coordinates, which for a LWPolyline of that length would be a list containing 10,000+ numbers! [Wouldn't that bog you down? Just opening the drawing took a while for me.] But my Acad2019 reduced it to 60 vertices in about 5 seconds, giving it a maximum distance to straighten of arbitrarily 4 units, and using the default 15-degree maximum change in direction to straighten.
But if your computer can't handle that, you could try PolyLineEveryOther.lsp with its PLEO command, available >here<. It does it differently -- it ignores lengths of segments and degrees of change in direction, and just draws one using every other vertex of the original. It's faster than PLD, but depending on the configuration, it may do things like cut off corners you'd rather it didn't. But for each run, the Polyline goes down to half as many vertices as before. Run that repeatedly on your Polyline until it gets down to a reasonable number of vertices.
Hey! Didn't expect a reply from a God lisp programmer like you! Thanks for the response! I read many of your threads and I'm stuck on this problem from 2 weeks.
So I used your PLEO command lisp don't know what went wrong with it. See the log
------------------------------
656 objects converted to 1 polyline
Enter an option [Edit vertices/Close/Decurve/Fit/Join/Linetype-mode/Reverse/Spline/Taper/Width/Undo/eXit] <eXit>:
Cancel
Command: PLEO
To simplify Polylines,
Select entities or [FILter/Qselect]:
Entities in set: 1
Select entities or [FILter/Qselect]:
Unable to recognize entry. Please try again.
Error: bad argument type
Error: Invalid input. Please try again.
Specify next point or [Arc/Distance/Follow/Halfwidth/Width]:
Error: Invalid input. Please try again.
Specify next point or [Arc/Distance/Follow/Halfwidth/Width]:
Error: Invalid input. Please try again.
Specify next point or [Arc/Distance/Follow/Halfwidth/Width]:
Snap to END of:
Specify next point or [Arc/Distance/Follow/Halfwidth/Width]: _.undo
Error: Invalid input. Please try again.
Specify next point or [Arc/Distance/Follow/Halfwidth/Width]:
Specify next point or [Arc/Distance/Follow/Halfwidth/Width]: _end
Snap to END of:
Cancel
----------------------------------
Please refer to the attached drawing.
This is the original shape of the drawing(Image) :https://i.ibb.co/dL5f6V3/Shape-Of-Line.jpg
If you zoom the drawing you'll see such bumps and uneven lines on the drawing: https://i.ibb.co/dsTx66K/Bumps.jpg
I just want to remove this bumps and make line polyline smooth. I also want to make the process easy so that user can get it.
Directly using PLD command on the raw line isn't helping me me to smooth it correctly. So as you read the previous thread where my process to obtain smooth curve was to PEDIT->JOIN->SPLINE->EXPLODE->PEDIT->JOIN->PLD->10->7->PEDIT->SPLINE.
I couldn't give the splined line to PLD,it threw error 0 lines simplified.It only accepted pedit->join polyline. Initially there are 652 lines and when I use PLD on it,it worked nicely.(Actually it works well up to 3000+ points in IntelliCAD,It takes time but it works.I haven't tested 4000 range). I have no idea about lisp programming,I'm C/C++ developer.
The Pldiet lisp of your is the solution for my problem but unfortunately InetlliCad couldnt handle after some extent.
[Are you running this in an overlay program? I see options that I don't have in "vanilla" Acad2019, and that are not mentioned in Help for Acad2020.]
The _undo and _end entries can only be coming from the (pleoreset) sub-routine, at the end. Why those are showing in the command-line history, and not the things being fed in that are called invalid, I don't know, but it's hard to diagnose without seeing what those are. But maybe it doesn't matter, given the "Unable to recognize entry. Please try again." message, after which what the code supplies could only be expected to be inappropriate for what's expected. That's a message I don't recall seeing before, so I'm not sure what in PLEO could be causing it.
I got this message trying to open the .dxf file:
Specified handle 55 already in use on line 1220.
Invalid or incomplete DXF input -- drawing discarded.
@cadffm schrieb:
Your (intelli) Programm writes totalhttps://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/weed-autolisp-selecting-all-polyline... ly wrong data values into the DXF, this DXF is not valid, it is corrupt..
Multiple objects with the same reference name (all? Lines with Handle=55) .
Thats nothing to do with the PLD Question, but i am out.
Ask the intellcad community for a solution (the PLD works fine in AutoCAD).
🤔
Sebastian
I can solve that handle issue. The same drawing I uploaded is working in my Intellicad. Anyway,I have attached a dxf file that may open and this is the link to the dwg file of it.http://s000.tinyupload.com/?file_id=03927996902031364364
I have also recorded a video for further clearance of the issue on link:
https://drive.google.com/open?id=1D6kDUDn_yn0c0MC7s5-H5B0DLUd7XtN3
To check the lisp compatibility of Intellicad you can check http://help.caddit.net/progecad.php?kb=IDR_LISP_B100
I hope this information helps you
I was able to open that, but it's all Lines, so what's to test? But I do notice that when PEDIT joined, it comes out at 3 Polylines, not one, and that there are 5 Lines of zero length at the top end. When joined into a Polyline, that results in some coincident vertices and zero-length segments, which can be the source of problems any time the direction of a Polyline segment is in question -- the "angle" between the ends of a zero-length segment always comes out to zero degrees, and that may cause unintended results when compared to an adjacent longer-than-zero-length segment.
Sir,
I had great hopes from pldiet.lsp but unfortunately it isn't working properly in Intellcad for large data. Can you suggest me any method or routine to make that polyline smooth?
Therotically, if a program approximates the points from which smooth curve is obtained and discard other points. It can help
@Anonymous wrote:
.... Can you suggest me any method or routine to make that polyline smooth? ....
Temporarily break the Polyline into more than one piece, use PLD or PLEO on each of those, and join them back together? Look for other such extra-vertices-reduction routines on the web?
Yes, breaking the poyline and using pld part by part is working for me but in some drawings it is not able to join the divided polylines back again in single polyline.
Because of making spline and then exploding the intial 654 vertices later become 5232 vertices. If only I could manage to explode it in specific limitation my problem would have been solved. I have checked for the other rohtines on web pld was the best! Anyway I'll search again!
I found this on IntelliCad forum
"However, as long as your code doesn't have any of the Visual LISP functions (vl-, vla- or vlax-), it should work in IntelliCAD. You may have to make some minor changes because some commands may have different syntaxes or some LISP functions (few) are partially supported or not supported at all by IntelliCAD. You can find a LISP compatibility info in the Developers Reference (in IntelliCAD Help file)."
Maybe due to this issue it isn't working well with IntelliCad
Can't find what you're looking for? Ask the community or share your knowledge.