Jump to content

commands in scripts behave different


Recommended Posts

hi

 

im trying to create a button in the tool palatte to excute a script to freez all selected objects

 

^C^C-layer lo 

 

when typing its ok but as a script it doesnt excute the order.

 

any idea?

Link to comment
Share on other sites

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • ReMark

    12

  • samifox

    7

  • tombu

    6

  • steven-g

    1

Top Posters In This Topic

Posted Images

It doesn't look like you are trying to run a script. It looks like you are trying to execute a command. Do you know what a script is?

 

Wouldn't you be better off using the LAYFRZ command (which already exists)?

Edited by ReMark
Link to comment
Share on other sites

OK. But you are trying to create a macro not a script right?

 

i was thinking its the same :oops:

 

its in the macro field of the tool palatte

Link to comment
Share on other sites

Macros are not the same as scripts. From the AutoDesk Knowledge Network...

 

"A script is a text file with command or a script call on each line.

 

You create script files outside the program using a text editor text editor that saves in ASCII format (for example, Notepad on Windows or TextEdit on Mac OS). The file extension must be .scr.

Each line of a script contains a command, and each blank space in a script is significant because it is like pressing Enter or the Spacebar. You must be familiar with the sequence of prompts for a command to provide an appropriate sequence of responses in a script."

Link to comment
Share on other sites

Come to think of it from the looks of the macro in your first post it appears you want to lock layers not freeze layers. There is a difference between the two.

Link to comment
Share on other sites

hi

 

im trying to create a button in the tool palatte to excute a script to freez all selected objects

 

^C^C-layer lo 

 

when typing its ok but as a script it doesnt excute the order.

 

any idea?

 

Since you cannot freeze the current layer and it's not good practice to freeze layer 0 anyway I'd make layer 0 current first with a macro like:

-layer Set 0 Freeze 

The big advantage to using LAYFRZ is that it lists each layer it freezes giving you the chance to undo freezing one layer at a time or after exiting the command you can undo freezing the last group of layers frozen with the command.

Link to comment
Share on other sites

Once again the OP says one thing in one place and something else in another.

 

He uses the work freeze in his sentence but clearly writes LO in the macro. No matter which one he wants to use he seems to be implying he cannot create a window around the objects he is interested in freezing/locking the layers of.

Link to comment
Share on other sites

ok..sorry things got a bit messy

 

first' i ment lock and not freeze, sorry,

 

second, macro and script excutes just the same, the script excute everithing between the spaces and also the macro.

Link to comment
Share on other sites

While they may execute the same they are not written the same which accounts for one of the differences between the two.

 

Are you familiar with the use of special characters in a macro like the underscore, semicolon, asterisk, and backslash?

Link to comment
Share on other sites

hi

 

Trying to create a button in the tool palatte to excute a script to lock all selected object layers

 

^C^C-layer lo 

 

when typing its ok but as a script it doesn't execute the order.

 

any idea?

 

On the command line notice that the highlighted "LO" in "LOck" is capitalized for a reason. Try:

^C^C-layer LO 

or

^C^C-layer LOck 

As you can select options for the -Layer command many ways including picking them with the mouse on the command line or from the option list I just have the macro

^C^C-layer 

which comes in handy.

Link to comment
Share on other sites

I doubt that "lo" actually has to be in caps in a macro as typing it in lower case letters does work at the command line.

 

For example, the macro below, for freezing all layers except the current one, works just fine using the lower case "f" for freeze.

 

^c^c_layer;f;*;;

Link to comment
Share on other sites

put it simple

 

Command: -layer LO (enter)(enter) works great

Macro : ^C^C- -layer LO (space)(space)not working

Link to comment
Share on other sites

That's correct. There are some commands that fail to work inside a command function like they do at the command line. I have no idea why that may be.

 

Why don't you just use the Layer Isolate command?

 

Or this lisp routine by forum member Stefan BMR...

 

LockAllLayers.JPG

 

Locks all layers except the current one.

Edited by ReMark
Link to comment
Share on other sites

put it simple

 

Command: -layer LO (enter)(enter) works great

Macro : ^C^C- -layer LO (space)(space)not working

 

Try removing the ^C^C which is probably canceling the selection. Sorry I haven't tested any of these, just speculating!

-layer LOck

Link to comment
Share on other sites

^C^C cancels any currently running command. I doubt it would cancel the ability to using a window as an option when the user is prompted to select objects.

Link to comment
Share on other sites

Try removing the ^C^C which is probably canceling the selection. Sorry I haven't tested any of these, just speculating!

-layer LOck

 

no its not. typing in the commandline is not the same like excutuing the same in the macro,

autocad thinks

-layer LOck

is terminated after the macro ends while its not.

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