Community
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Converting multiple lines/arcs to Polylines via Right-Click

Converting multiple lines/arcs to Polylines via Right-Click

I often find myself needing to convert lines and arcs to Polylines. My preferred method is to select, right-click, and choose convert to Polyline. This option disappears when multiple objects are selected. Being able to convert multiple selected lines and arcs to Polylines via right-click menu would eliminate the need to process the command for each object. 

16 Comments
rkmcswain
Mentor
You can do this now with a bit of customization. Use the lisp code sample below to define a function, then edit the CUI to call the function from your shortcut menu.

(defun matp ( / b)
  (setq b (last (ssgetfirst)))
  (if b
    (if (zerop (getvar "peditaccept"))
       (vl-cmdf "._pedit" "_M" b "" "_Y" "")
       (vl-cmdf "._pedit" "_M" b "")
    )
  )    
)
troma
Mentor

Or just type commands on the keyboard.

One time, set your sysvar PEDITACCEPT to 1. (This is saved on your machine, not in the drawing.)

Then, type the command PEDIT or just PE for short.

AllenJessup
Mentor

Add JOIN to the right click menu. Select the entities, rt-click, select Join.

 

Use the CUI to customize the rt-clk. Open the CUI and find Shortcut Menus and expand it. Expand "Context menu for edit mode". I added mine to the "Basic Modity Tools" but you can put it wherever you like. In the Command List find Join. Make sure it's the ACAD Join and not the Civil Join. Drag it from the Command List to where you want it in the shortcut menu.

 

Edit 1: And - of course - I pointed to the Civil Join in the image below. Looks 2 down from where I pointed to see the ADAD Join.

 

Edit 2: Actually that join will work. It's the 2 above that won't work (for joining arcs and lines anyway). Could they add a few more joins?

 

join.png

jeffl
Advocate

Following the previous comment, I've just added the polyline edit command to the "basic modify tools" section of the default shortcut menu.  With peditaccept=1 set, that seems to work.  Just  right click & select "Polyline Edit", pick M for multiple and select the lines/arc to convert.rightclick.jpg

AllenJessup
Mentor

@jeffl That's fine. I used Join because it's quicker for just joining entities.

jeffl
Advocate

That's cool Allen, but the original post just wanted to convert multiple objects to polylines.

AllenJessup
Mentor

Interesting. I suppose when I read the OP I thought of it in terms of my own workflow. Now when I read it again I see that there is no mention of joining into one polyline. So you adding PEdit would fit better. However it won't work with pickfirst. To have it work with selecting the entities first you'd have to use the MPEdit command. That would also eliminate the need to pick M.

 

Edit: There seems to be a problem with MPedit. When used after selecting objects it will throw an error of "invalid option keywork" after entering Y for yes. Also PEditAccept doesn't suppress the convert y/n prompt.

jeffl
Advocate

You're right, can't select the objects first.  I found MPedit works if you select the entities individually, but not in a crossing window.  Strange.  I can't find the MPEdit option in the cui list however.

AllenJessup
Mentor

OK. Here's my final cut at this.

 

Create a new command and add this as the Macro- _.pedit M P;;;  Note the 3 semicolons to provide 3 Enters.

 

Then add it to the rt_click menu as above. This works with multiple lines and arcs and requires no user input after selecting the command as long as PEDITACCEPT is 1.

 

c2p.png

 

 

 

 

qnologi
Advisor

As we all know....

 

By definition:

 

Polyline:

An object composed of one or more connected line segments or circular arcs treated as a single object. Also called pline.

 

I would interpret the OP, as having many facets and merit.

 

I do think, it would be much faster and simpler to have the ability to click on a multitude of "Lines and Arcs" or "Polylines" for that matter, all at one time, granted they all have a "zero" elev. and be able to then "Convert these all to a "Joined" Polyline, in "one" command.

 

None of which has been demonstrated. Smiley Very Happy

AllenJessup
Mentor

Isn't that what the Join command does. Or am I misinterpreting what you're asking for?

qnologi
Advisor

I guess I was thinking of clicking on "Lines, Arcs, or even Polylines" once, which AutoCAD won't let you do, because it is already a Polyline, and then right click and use the Convert to a Joined Polyline, thus skipping the step of telling AutoCAD that you intend to use the Join command.

 

I know it only saves one extra step, or possibly even two, but when you're trying to get stuff done, well...

AllenJessup
Mentor

I have a collection of lines, arcs and polylines on screen. I select them all with a crossing window. I rt-click and select the Join command I have added to my rt-click menu. All of the entities that can be joined are joined into polylines.

rkmcswain
Mentor

@qnologi - For reference, see post 2. Replace the code with this.

 

(defun matp ( / b)
  (setq b (last (ssgetfirst)))
  (if b
    (if (zerop (getvar "peditaccept"))
       (vl-cmdf "._pedit" "_M" b "" "_Y" "_J" "0.01" "")
       (vl-cmdf "._pedit" "_M" b "_J" "0.01" "")
    )
  )    
)

Adjust the fuzz distance as needed (the 0.01 part) or you could farm it out as a variable maintained somewhere else.

qnologi
Advisor

Sorry Allen,

 

I see it now.

 

Remember, I've only been doing this for 20yrs.

 

I have a lot to learn.

 

Thank you. Smiley Surprised

Tjfuentes89
Participant

It's extremely interesting to see all of the many ways each person interprets my post, and comes up with a relative solution!

 

One of the main reasons I suggested this is because we sometimes receive linework from a client or other party that is comprised only of arcs and lines. The only reason I would prefer to exclude the JOIN command from the solution is because in cases of multiple lines or arcs having common endpoints, it may not always join the lines in the way I would like them to. 

 

My current solution is Pedit>Multiple>Width=0. This has worked really well for me, but I feel that the option to convert to polyline should not disappear from the quick menu when multiple features are selected, and perform just as it does for a single feature. 

 

I consider it an optimization of an already useful command, so I'm hoping it gets some votes!

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

Submit Idea  

Answer Day

Rail Community


 

Autodesk Design & Make Report