Jump to content

HELP: How to continue a different command in a Macro script after user selection


vernonlee

Recommended Posts

I use this macro script to run a series of commands

 

The commands are:-

1) Zoom to a view location (run from a script)

2) Move objects to a fix distance (through a LISP) base on user selection

 

How do I continue this with an erase command?

 

This ia the macro script

 

^C^C^Cscript;[color=blue]ZoomToView[/color];^C^C[color=seagreen](load"D:/Office/AutoCAD/lsp/MoveFixDistance.lsp");MML[/color]; [color=red][b]How to continue an erase command?[/b][/color]

Thanks

Link to comment
Share on other sites

It sounds like your taking all the little bits of functions and joining them into a sequence of events that you having been asking for over a period of time.

 

Have 20 routines and use in combos as you desire.

 

I am only going to say again its time to learn to do it yourself and I am sorry I will not support you any more.

Link to comment
Share on other sites

First work out what you want the erase part of the macro to do, then it will be easy to stitch them together.

 

Do you want to erase something the macro selected earlier?

 

Erase;Previous;;

 

Do you want to Erase something that the user selects?

 

Erase;/

 

What have you tried? Something must have not worked for you to write to the forum. Put some specifics in about what is failing, or exactly how you want th erase to work. You'll get me benefit that way.

Link to comment
Share on other sites

First work out what you want the erase part of the macro to do, then it will be easy to stitch them together.

 

Do you want to erase something the macro selected earlier?

 

Erase;Previous;;

Do you want to Erase something that the user selects?

 

Erase;/

What have you tried? Something must have not worked for you to write to the forum. Put some specifics in about what is failing, or exactly how you want th erase to work. You'll get me benefit that way.

 

Hi YZ.. Thanks for the reply.

 

Apologies as I was not clear on my query.

I basically want to find out how to continue the next command in this following macro script.

 

The commands are:-

1) Zoom to a view location (run from a script)

2) Move objects to a fix distance (through a LISP) base on user selection

3) Erase command

4) END

Below shows the macro script, But I am not clear on the code to use to allow the COMMAND 3 (which is ERASE) to run immediately after COMMAND 2 is complete.

The thing is command 2 requires user's selection so after select & press enter, the erase command do not continue.

 

^C^C^Cscript;[color=blue]ZoomToView[/color];^C^C[color=seagreen](load"D:/Office/AutoCAD/lsp/MoveFixDistance.lsp");MML[/color];[color=red][b]<What to indicate to continue a next command?>[/b][color=black]ERASE;[/color][/color]

Prior to this post, I read before & experimented on adding the following for selection but but did not quite understand if it works or not.

 

\

\\

\\\

\\\\

Hope this give you a clearer picture of my query.

Link to comment
Share on other sites

It's probably very ovious, but what is MML?

 

A macro is just like the command line. So whatever you would type to go on to the next command is almost always just what you'd put into your macro.

 

Do you want the user to select different objects to erase? I assume you don't want to erase the objects you've just gone to the trouble of moving?

Link to comment
Share on other sites

It's probably very ovious, but what is MML?

 

A macro is just like the command line. So whatever you would type to go on to the next command is almost always just what you'd put into your macro.

 

Do you want the user to select different objects to erase? I assume you don't want to erase the objects you've just gone to the trouble of moving?

 

MML is just the command i use to run the LISP. It basically move a selected object to a fixed distance & direction that is indicated in the LISP.

 

BTW, when i mention I experimented on

\

\\

\\\

I am referring to the selection of COMMAND 2 & not the erase command.

 

As in

 

^C^C^Cscript;ZoomToView;^C^C(load"D:/Office/AutoCAD/lsp/MoveFixDistance.lsp");MML;[color=magenta][b]///[/b][/color]ERASE;

 

The erase command is at the end, so i need not use the selection command.

Link to comment
Share on other sites

I'm not any good with LISP, so take my comments with a grain of salt. It is possible I will miss the point here.

 

It looks to me as though you are wondering how many objects you want to select? Sometimes 1, sometimes more? And then how many "///" do you leave, each one representing a single pick with the mouse.

 

The tricky thing with the way you are doing it is that you need to know exactly how many mouse clicks you'll want every time you run the macro, and it will be the same.

 

This will continue to be a headache for you, and will limit the macro too much.

 

Maybe try, before running the lisp, the select command.

SELECT;\*lisp goes here;MML;*;Previous;;

 

Using the select command for some reason it will let you click once, or more than once, as many times as you like until you right click to ocnfirm the selection.

 

Without troubleshooting properly, I imagine it will look something like this:

 

^C^C^Cscript;ZoomToView;^C^CSelect;/(load"D:/Office/AutoCAD/lsp/MoveFixDistance.lsp");MML;[color=magenta][b]Previous;;[/b][/color]ERASE;

Link to comment
Share on other sites

I'm not any good with LISP, so take my comments with a grain of salt. It is possible I will miss the point here.

 

It looks to me as though you are wondering how many objects you want to select? Sometimes 1, sometimes more? And then how many "///" do you leave, each one representing a single pick with the mouse.

 

The tricky thing with the way you are doing it is that you need to know exactly how many mouse clicks you'll want every time you run the macro, and it will be the same.

 

This will continue to be a headache for you, and will limit the macro too much.

 

Maybe try, before running the lisp, the select command.

SELECT;\*lisp goes here;MML;*;Previous;;

Using the select command for some reason it will let you click once, or more than once, as many times as you like until you right click to ocnfirm the selection.

 

Without troubleshooting properly, I imagine it will look something like this:

 

^C^C^Cscript;ZoomToView;^C^CSelect;/(load"D:/Office/AutoCAD/lsp/MoveFixDistance.lsp");MML;[color=magenta][b]Previous;;[/b][/color]ERASE;

 

I see what you mean. I will give your suggestion a try.

 

Also , currently the selection is actually the same.

So does it mean every "\" refers to 1 selection? If so if I know I will have 5 selection I will need "\\\\\"? Is that correct?

 

Is there a code for window selection instead?

 

Thanks for your advise. :)

Link to comment
Share on other sites

Each / pause for user input represents one mouse click.

 

A window can be done with 2 "//".

 

Pick 5 can be done with 5 "/////".

 

But if you miss a single click or the window doesn't properly select them (which can happen even if only 10% of the time) then the macro won't wait for you it will plow ahead.

 

The difference is with SELECT command - it will instead wait until you right-click or enter before finishing the selection set. It is a safer way to code, and is more familiar with other ways default commands work.

 

I'd recommend

SELECT;/Move;Previous;;

Link to comment
Share on other sites

Each / pause for user input represents one mouse click.

 

A window can be done with 2 "//".

 

Pick 5 can be done with 5 "/////".

 

But if you miss a single click or the window doesn't properly select them (which can happen even if only 10% of the time) then the macro won't wait for you it will plow ahead.

 

The difference is with SELECT command - it will instead wait until you right-click or enter before finishing the selection set. It is a safer way to code, and is more familiar with other ways default commands work.

 

I'd recommend

SELECT;/Move;Previous;;

 

Roger. Thanks for the clarification.

 

*Sorry, those slashes should all be backslashes.

 

SELECT;\Move;Previous;;

 

Haha, No problem :)

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...