samifox Posted May 24, 2016 Posted May 24, 2016 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? Quote
ReMark Posted May 24, 2016 Posted May 24, 2016 (edited) 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 May 24, 2016 by ReMark Quote
samifox Posted May 24, 2016 Author Posted May 24, 2016 Wouldn't the LAYFRZ command be a better option? layfrz wont let me window select objects Quote
ReMark Posted May 24, 2016 Posted May 24, 2016 OK. But you are trying to create a macro not a script right? Quote
samifox Posted May 24, 2016 Author Posted May 24, 2016 OK. But you are trying to create a macro not a script right? i was thinking its the same its in the macro field of the tool palatte Quote
ReMark Posted May 24, 2016 Posted May 24, 2016 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." Quote
ReMark Posted May 24, 2016 Posted May 24, 2016 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. Quote
tombu Posted May 24, 2016 Posted May 24, 2016 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. Quote
ReMark Posted May 24, 2016 Posted May 24, 2016 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. Quote
samifox Posted May 24, 2016 Author Posted May 24, 2016 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. Quote
ReMark Posted May 24, 2016 Posted May 24, 2016 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? Quote
tombu Posted May 24, 2016 Posted May 24, 2016 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. Quote
ReMark Posted May 24, 2016 Posted May 24, 2016 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;*;; Quote
samifox Posted May 24, 2016 Author Posted May 24, 2016 put it simple Command: -layer LO (enter)(enter) works great Macro : ^C^C- -layer LO (space)(space)not working Quote
ReMark Posted May 24, 2016 Posted May 24, 2016 (edited) 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... Locks all layers except the current one. Edited May 24, 2016 by ReMark Quote
samifox Posted May 24, 2016 Author Posted May 24, 2016 isolate will lock unselected layers while i need to do the opposite Quote
tombu Posted May 24, 2016 Posted May 24, 2016 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 Quote
ReMark Posted May 24, 2016 Posted May 24, 2016 ^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. Quote
samifox Posted May 24, 2016 Author Posted May 24, 2016 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. Quote
tombu Posted May 24, 2016 Posted May 24, 2016 Tested this macro on selected lines: ^C^C^Pqaflags 1 -layer LOck;;P;;;qaflags 0 and it will lock the layers of preselected objects. Quote
Recommended Posts
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.