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

polyline join macro

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
allywhite666
2408 Views, 8 Replies

polyline join macro

Hello I am trying to create a macro that will join some polylines with different elevations.

The routine I use is

 

pedit>

M (multiple)>

J (join)

0 (fuzz distance)

 

this usually joins the lines

So I tried using this macro

^C^C_pedit;m;j;0;;

 

I am not experienced with macro's, what am I doing wrong?

 

 

 

8 REPLIES 8
Message 2 of 9
Kent1Cooper
in reply to: allywhite666


@allywhite666 wrote:

Hello I am trying to create a macro that will join some polylines with different elevations.

The routine I use is

 

pedit>

M (multiple)>

J (join)

0 (fuzz distance)

 

this usually joins the lines

So I tried using this macro

^C^C_pedit;m;j;0;;

 

I am not experienced with macro's, what am I doing wrong?


You need to have something in there for object selection:

 

^C^C_pedit;m;\j;0;;

Kent Cooper, AIA
Message 3 of 9
allywhite666
in reply to: Kent1Cooper

Hello Kent,

 

I added the \ but this gives the same result as the original.

 

This is what it does

it runs pedit and I can select the lines but it stops at the options where I want it to join and I have to enter J, I want it to automatically enter J and keep going.

 

Message 4 of 9
Kent1Cooper
in reply to: allywhite666

A possibility -- is your PEDITACCEPT System Variable set to 1?  If not, there can be an additional prompt in the command.

Kent Cooper, AIA
Message 5 of 9
hmsilva
in reply to: allywhite666

 Hi Alli,

in addition to Kent1Cooper advices, you can use something like this:

^C^C_PEDITACCEPT;1;_pedit;m;\\;j;0;;

The '\' in a macro, means one pause, the above macro only allows to select two objects by pick, or multiple objects by one window/crossing.

 

Another way will be to add an asterisk at the macro beginning

*^C^C_PEDITACCEPT;1;_pedit;m;\\;j;0;;

the '*'in a macro, will repeat the macro until the user select another command or press escape.

 

Please note that you only need to set PEDITACCEPT once, so it may be preferable to add to your 'acaddoc.lsp' a text line with

(setvar 'PEDITACCEPT 1)

If you are not on LT, you possibly should think in a AutoLISP routine,
e.g.

(defun c:MyPedit (/ paccept ss)
  (if (setq ss (ssget "_:L"))
    (progn
      (setq paccept (getvar 'PEDITACCEPT))
      (setvar 'PEDITACCEPT 1)
      (command "_.pedit" "_M" ss "" "_J" 0.0 "")
      (setvar 'PEDITACCEPT paccept)
    )
  )
  (princ)
)

Save the file as "YourLispFileName.lsp" in one Support File Search Path, and in the macro just something like

(if (not c:MyPedit)(load "YourLispFileName"));MyPedit;

 

Hope that helps
Henrique

EESignature

Message 6 of 9
Kent1Cooper
in reply to: hmsilva


@hmsilva wrote:

....

^C^C_PEDITACCEPT;1;_pedit;m;\\;j;0;;

The '\' in a macro, means one pause, the above macro only allows to select two objects by pick, or multiple objects by one window/crossing.

....


Correct -- I was getting my selection options mixed up.  There is a way, which I had in mind but didn't get right, to use only one backslash for the User to select any number of objects, including windows [crossing or otherwise], removals, etc.  It is by way of the SELECT command [which will let you play around with all selection options under the force of one backslash] and then use the Previous option for the Selection inside the PEDIT command:

 

^C^C_.SELECT \_.PEDIT _M _P ;J 0 ;

 

[Also include forcing PEDITACCEPT first if you need to, add the asterisk for automatic repetition if you like, etc.]

Kent Cooper, AIA
Message 7 of 9
hmsilva
in reply to: Kent1Cooper


@Kent1Cooper wrote:
^C^C_.SELECT \_.PEDIT _M _P ;J 0 ;

Nice!

 

Henrique

EESignature

Message 8 of 9
allywhite666
in reply to: allywhite666

Thank you both for your help, the command

 

^C^C_.SELECT \_.PEDIT _M _P ;J 0 ;

 

is what I wanted to achieve, great work Kent.

Message 9 of 9

Although it has been some time since this question has seen any action I am in a similar situation so I figured I would give it a shot as the information that comes from it may help other folks in a similar situation:

 

I would like to incorporate a JOIN polyline operation on the right-click shortcut EDIT Menu.

 

Setup:

-Objects already selected

-Pedt Accept sysvar already set to 1

 

Right Click >> Select PJoin (defined macro)

 

In the CUI Shortcut,>> Edit Menu I have tried 

^C^C_.SELECT \_.PEDIT _M _P ;J 0 ;  Along with many variations but I cannot get the process to work

properly.   

 

The goal is to have the objects selected >> Toggle the P Join Operation and have it perform the operation with a default predefined fuzz distance of say .001

 

If someone has the time could you offer some guidance on this?

Thanks in Advance

-Tim C.

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report