Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change line to polyline

8 REPLIES 8
Reply
Message 1 of 9
ToddC
580 Views, 8 Replies

Change line to polyline

Does anybody know a better way to do this? I haven't written the code but it would look like:
Pick line to change
Get startpoint and endpoint of line
Store startpoint and endpoint
Delete line
Draw pline from startpoint to end point
Would this be the best way to do this? If so, how do you retrieve the start x, y ,z and delta x, y, z from entity?

Thanks much
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: ToddC

What's wrong with using the PEDIT command? "ToddC" wrote in message news:26406052.1079712413371.JavaMail.jive@jiveforum2.autodesk.com... > Does anybody know a better way to do this? I haven't written the code but it would look like: > Pick line to change > Get startpoint and endpoint of line > Store startpoint and endpoint > Delete line > Draw pline from startpoint to end point > Would this be the best way to do this? If so, how do you retrieve the start x, y ,z and delta x, y, z from entity? > > Thanks much
Message 3 of 9
Anonymous
in reply to: ToddC

try this (DEFUN C:L2P() ;Globally converts all lines into polylines. (setvar "CMDECHO" 0) (Setq SS1 (ssget "X" '((-4 . "") ) ) ) (if (not ss1) (alert "Drawing Contains No Lines") (progn (setq n (sslength ss1) ssnew (ssadd) ) (prompt"\n") (Setq COUNT 0) (setq SMEMBER (SSNAME SS1 COUNT)) (While SMEMBER (prompt "\r Lines Remaining to Alter: ") (princ n ) (prompt". ") (command "change" smember "" "p" "c" "m" "") (command "PEDIT" SMEMBER "Y" "X") (ssadd (entlast) ssnew) (setq COUNT (+ 1 COUNT)) (setq SMEMBER (SSNAME SS1 COUNT)) (setq n (- n 1)) ) (setvar "CMDECHO" 1) (prompt"\n ") (princ "\rPreparing to Change Entity Colors to BYLAYER ...") (princ "\nPress Any Key to Continue ...");Pressing Escape Cancels Function (getstring) (command "change" ssnew "" "p" "c" "bylayer" "") ; (command "regen") ) ; end of progn ) ; end of if (princ) ); end of defun Tim "ToddC" wrote in message news:26406052.1079712413371.JavaMail.jive@jiveforum2.autodesk.com... > Does anybody know a better way to do this? I haven't written the code but it would look like: > Pick line to change > Get startpoint and endpoint of line > Store startpoint and endpoint > Delete line > Draw pline from startpoint to end point > Would this be the best way to do this? If so, how do you retrieve the start x, y ,z and delta x, y, z from entity? > > Thanks much
Message 4 of 9
Anonymous
in reply to: ToddC

So simple to use Pedit
Message 5 of 9
Anonymous
in reply to: ToddC

I'm just curious as to why one would want to do this. Don't polylines take more memory? They contain not only the usual endpoints, layer, color, linetype & ltscale, and all that information, but also width information (even if it's zero), and potentially different z-coordinates for all endpoints rather than one global elevation relative to the coordinate system. If you would do it in order to join adjacent ones into longer polylines (whether to save memory in many cases, or to be able to select a bunch with one pick), well, you can do that without turning them into polylines first. And I know of at least one actual limitation: you can't use Lengthen's DYnamic option on a polyline, as you can on a line. I can't think of any reason why an individual line segment would be better off being a polyline, unless you want to have the ends at different z-coordinates, but certainly you wouldn't change every line in a drawing for that. Is there some other reason for doing this that I'm not thinking of? Kent Cooper, AIA "Tim" wrote... > try this > > (DEFUN C:L2P() ;Globally converts all lines into polylines.
Message 6 of 9
ToddC
in reply to: ToddC

I'm sorry for the stupid question. I had no idea about the pedit command. Thanks alot for your help.

Todd
Message 7 of 9
Anonymous
in reply to: ToddC

> I'm just curious as to why one would want to do this. Don't polylines take more memory? I think the difference would be negligible. It would be easy to test. You seem to have your lines and polylines backwards. All lines have 3 dimensional endpoints, though if you don't specify a z coordinate, it defaults to the current "elevation" setting. Polyline vertices have only x and y coordinates, with a fixed z elevation for the whole thing. Only a 3Dpoly has variable z coordinates.
Message 8 of 9
Anonymous
in reply to: ToddC

Kent A drawing with lines will be slightly smaller in size compared to one with polylines, BUT, if you use polylines to represent objects, you might have 10 polylines in one drawing, but 100 lines in another drawing showing the same information. Now, the polyline drawing is smaller insize compared to the line drawing. One or two reasons for using polylines. First, I don't think civil types could live with out plines. Second, if you are drawing the center line of a wall, pipe, road, duct, etc. If you use plines, then you can offset either direction and you instantly have cleaned up connected corners. Try that with line and you will be filleting multiple lines over and over. Third, you can fillet plines very simply over any number of corners, with lines you must select lines over and over and over. Those are just a few reasons to use plines. I don't use plines to show width except in very special circumstances, letting the CTB's and STB's do that instead. As for Dynamic Lengthen, well with a very simple customize tool button I align my ucs with the pline, grip stretch, pick again to go back to WCS. HTH Kent Elrod "Kent Cooper, AIA" wrote in message news:405b2a36$1_1@newsprd01... > I'm just curious as to why one would want to do this. Don't polylines take > more memory? They contain not only the usual endpoints, layer, color, > linetype & ltscale, and all that information, but also width information > (even if it's zero), and potentially different z-coordinates for all > endpoints rather than one global elevation relative to the coordinate > system. > > If you would do it in order to join adjacent ones into longer polylines > (whether to save memory in many cases, or to be able to select a bunch with > one pick), well, you can do that without turning them into polylines first. > And I know of at least one actual limitation: you can't use Lengthen's > DYnamic option on a polyline, as you can on a line. I can't think of any > reason why an individual line segment would be better off being a polyline, > unless you want to have the ends at different z-coordinates, but certainly > you wouldn't change every line in a drawing for that. Is there some other > reason for doing this that I'm not thinking of? > > Kent Cooper, AIA > "Tim" wrote... > > try this > > > > (DEFUN C:L2P() ;Globally converts all lines into polylines. > >
Message 9 of 9
Anonymous
in reply to: ToddC

Other Kent (not that many of us around): All of your reasons are valid for MULTI-segment polylines, and I use them all the time for the same purposes. I just can't figure out why you would want to change ALL the Lines in a drawing to SINGLE-segment Polylines. Maybe to give them all widths, but I find color-based plotting lineweights much better, because even zoomed out to the point where you couldn't possibly see small differences in Pline widths, you can clearly see different colors to give you a feel for which lines will come out lighter and heavier. Kent Cooper, AIA "Kent Elrod" wrote ... > Kent > One or two reasons for using polylines. First, I don't think civil types > could live with out plines. Second, if you are drawing the center line of a > wall, pipe, road, duct, etc. If you use plines, then you can offset either > direction and you instantly have cleaned up connected corners. Try that > with line and you will be filleting multiple lines over and over. Third, > you can fillet plines very simply over any number of corners, with lines you > must select lines over and over and over. > > Those are just a few reasons to use plines. > Kent Elrod

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost