Jump to content

Converting Lines To Polylines


MR MAN

Recommended Posts

  • Replies 37
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    12

  • bagulhodoido

    8

  • lpseifert

    4

  • ReMark

    3

type 'pedit' at the commnad line & selct the line. when it only line it will ask 'do you want to turn it inot one' say 'yes'

& than use join option to add other lines to it if required.

If you set up 'peditaccept' value to '1' it iwl supress that prompt & without asking will turn it into one (polyline).

Link to comment
Share on other sites

Just a quick one:

 

(defun c:pj (/ ss1)
   (setq varlist (list "cmdecho" "peditaccept")
     oldvars (mapcar 'getvar varlist)
   ) ;_  end setq
   (mapcar 'setvar varlist (list 0 1))
   (setq ss1 (ssget))
   (if    (> (sslength ss1) 1)
   (progn
       (vl-cmdf "_pedit" "_M" ss1 "" "J" "0" "")
       (princ (strcat "\n" (itoa (sslength ss1)) " Lines Converted. "))
   ) ;_  end progn
   (progn
       (vl-cmdf "_pedit" ss1 "")
       (princ (strcat "\n" (itoa (sslength ss1)) " Line Converted. "))
   ) ;_  end progn
   ) ;_  end if
   (mapcar 'setvar varlist oldvars)
   (princ)
) ;_  end defun

Link to comment
Share on other sites

I accounted for if the user only picks one entity also, and so two statements are needed instead of one... also, I have to set the variable values at start and end.

 

A minor update:

 

(defun c:pj (/ varlist oldvars ss1)
   (setq varlist (list "cmdecho" "peditaccept")
     oldvars (mapcar 'getvar varlist)
   ) ;_  end setq
   (mapcar 'setvar varlist (list 0 1))
   (setq ss1 (ssget '((0 . "LINE"))))
   (if    (> (sslength ss1) 1)
   (progn
       (vl-cmdf "_pedit" "_M" ss1 "" "J" "0" "")
       (princ (strcat "\n" (itoa (sslength ss1)) " Lines Converted. "))
   ) ;_  end progn
   (progn
       (vl-cmdf "_pedit" ss1 "")
       (princ (strcat "\n" (itoa (sslength ss1)) " Line Converted. "))
   ) ;_  end progn
   ) ;_  end if
   (mapcar 'setvar varlist oldvars)
   (princ)
) ;_  end defun

 

Forgot to localise some variables and added a filter list. :oops:

Link to comment
Share on other sites

That's a lot of code for such a straight-forward task. Couldn't it be accomplished with a one line macro? Just curious.

 

Almost... :-)

(if (zerop (getvar "PEDITACCEPT"))
 (command "._PEDIT" "_M" (ssget) "" "_Y" "")
 (command "._PEDIT" "_M" (ssget) "" "")	   
)

Link to comment
Share on other sites

Yes, that would work, although, with the multiple lines, you may want to add the "Join" in the pedit command if you want all the lines to be one polyline.

 

But remember to add a fuzz distance. :thumbsup:

Link to comment
Share on other sites

there is also mpedit

 

I'm not sure why MPEDIT is even still in ET.

PEDIT made it obsolete about 10 years ago when it was modified to accept multiple entities in r2000, maybe r2000i...

 

 

but doesn't allow for single ent...

 

How so? It works here on any number of entities, including one.

Link to comment
Share on other sites

How so? It works here on any number of entities, including one.

 

McSwain, you have my sincerest apologies. :)

 

I automatically assumed (to assume is to make an ASS of U & ME) that "PEDIT" "M", [Multiple] needs a selection of more than one entity... without even checking it out for myself... school-boy error.

Link to comment
Share on other sites

I am new to This Forum, But I think a better option would be to use BPOLY command, but ofcourse it is for a closed periphery... But on the other way round, u can trim tht end,

Link to comment
Share on other sites

Is there any way to just keep drawing a polyline you stopped for some reason? Like, from this specific grip I will keep drawing the polyline considering a new line will be added starting from that grip but still connected to the whole polyline itself.

Link to comment
Share on other sites

Yeah, almost it, the issue is that the new lines don't become part of the original polyline. Which end up doing the same as if I started a new polyline wih the regular pline command. (:

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...