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

Macro to Convert Lines to Polylines

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
terrametrix
1616 Views, 10 Replies

Macro to Convert Lines to Polylines

I'm having difficulty with a creating a macro for a command to convert lines to polylines using the PEDIT command.

So far I'm trying to use ^C^C_PEDIT;M;\;; but I can't get it to close the PEDIT command. It just stops at the list of edits. I've tried to use a ^C at the end to close the command but to no avail.

Using AutoCAD 2013.

Any help will be greatly appreciated!

Thank you,
Tim

10 REPLIES 10
Message 2 of 11
FSJ_Mo
in reply to: terrametrix

I think you just need to add one more semi-colon at the end of your macro.

Message 3 of 11
terrametrix
in reply to: terrametrix

Just tried adding the third semicolon and it still won't close the command. I keep getting stuck at the "Enter an option" portion of the command.

Thanks for the reply though.

Message 4 of 11
FSJ_Mo
in reply to: terrametrix

Try changing the peditaccept variable to one first (and then you should only need the two semi-colons)

Message 5 of 11
terrametrix
in reply to: terrametrix

Yep, setting PEDITACCEPT to "1" was one of the first things I did yesterday when I was having trouble. Still stuck at the "Enter an option" portion of the command.

Thanks again for the reply.

Message 6 of 11
FSJ_Mo
in reply to: terrametrix

It works here on C3D 2012. sorry I couldn't be more help

Message 7 of 11
hmsilva
in reply to: terrametrix

Something like this perhaps.

 

^C^C_peditaccept;1;_select;_auto;\_Pedit;_m;_p;;;

 

HTH

Henrique

EESignature

Message 8 of 11
terrametrix
in reply to: terrametrix

That did it!!! Many thanks to everyone that replied. I'm still confused as to why my original macro syntax didn't work but at least I have a working command.

 

Thanks again,

Tim

Message 9 of 11
hmsilva
in reply to: terrametrix

You're welcome, Tim
Glad I could help

Henrique

EESignature

Message 10 of 11
Lee_Mac
in reply to: terrametrix


@terrametrix wrote:


So far I'm trying to use ^C^C_PEDIT;M;\;; but I can't get it to close the PEDIT command. It just stops at the list of edits. I've tried to use a ^C at the end to close the command but to no avail.

Using AutoCAD 2013.


Since you are using a full version of CAD, you could also use LISP, e.g.:

 

(defun c:pj ( / c p s )
    (if (setq s (ssget "_:L" '((0 . "LINE,ARC,LWPOLYLINE"))))
        (progn
            (setq p (getvar 'peditaccept)
                  c (getvar 'cmdecho)
            )
            (setvar 'peditaccept 1)
            (setvar 'cmdecho 0)
            (command "_.pedit" "_M" s "" "_J" "" "")
            (setvar 'cmdecho c)
            (setvar 'peditaccept p)
        )
    )
    (princ)
)

 

LISP allows for more error trapping, and also defines a command which may be repeated rather than clicking a button for every use.

Message 11 of 11
Kent1Cooper
in reply to: Lee_Mac


@Lee_Mac wrote:

...
Since you are using a full version of CAD, you could also use LISP, e.g.:
...
    (if (setq s (ssget "_:L" '((0 . "LINE,ARC,LWPOLYLINE"))))
...
(command "_.pedit" "_M" s "" "_J" "" "") ...

 ....


Without [conforming to the OP's original macro that only converts Lines separately] the Join option:


            (command "_.pedit" "_M" s "" "")

 

in which case there's no need to include Polylines in the selection set filter [they don't need conversion], and they should also consider whether or not they want Arcs.

Kent Cooper, AIA

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

Post to forums  

Autodesk Design & Make Report

”Boost