script mistake

script mistake

mruPRQUJ
Advocate Advocate
1,950 Views
15 Replies
Message 1 of 16

script mistake

mruPRQUJ
Advocate
Advocate

Hi,

 

It looks like there are some mistakes in the below script. Could you please check it? The DWG was attached which was related to this script, thank you very much in advance. 🙂

 

-LAYER
S
$X-ANNO-REVC
M
$X-ANNO-REVC-NEW
C
220

R
$X-ANNO-REVC
$X-ANNO-REVC-HIDD
R
$X-ANNO-REVC-NEW
$X-ANNO-REVC
F
$X-ANNO-REVC-HIDD

 

0 Likes
Accepted solutions (1)
1,951 Views
15 Replies
Replies (15)
Message 2 of 16

pendean
Community Legend
Community Legend

It works fine here in your file: did you just forget to add enough <return> spaces at the end to finish/get out of -LAYER command? That's where it hangs

 

pendean_0-1692114727523.png

 

 

OR are you trying to do something more specific inside that layout's viewport but did not finish explaining it yet?

Message 3 of 16

mruPRQUJ
Advocate
Advocate

Hi, I am sorry to reply to you late as I am tied up with my work. Thank you very much for your quick response. Could you please advise me how many <return> spaces are needed at the end of the script? There are two now. What is the normal status in the command line? Please see the below for the current status in the command line, it was attached here as well.

mruPRQUJ_0-1692284352489.png

 

After added one more <return> spaces at the end, it is three now. Please see below for the new status in the command line, it was attached here as well.

 

mruPRQUJ_1-1692284856197.png

It looks like there are some mistakes. I wonder if you can provide some advice to me, thanks again. 🙂  

0 Likes
Message 4 of 16

Kent1Cooper
Consultant
Consultant

Your first command line history image tells you what the problem is, and it won't be solved by any number of Enters at the end.  You can't rename a Layer to a name of another Layer that already exists.  You probably need to include a check on whether the Layer exists, and if it does, merge the one you were trying to rename into the existing one.

Kent Cooper, AIA
Message 5 of 16

mruPRQUJ
Advocate
Advocate

Hi,

I have made some changes based on your advice, please see the new script below.

-LAYER
S
$X-ANNO-REVC
M
$X-ANNO-REVC-ELEC
C
220

R
$X-ANNO-REVC
$X-ANNO-REVC-HIDD
F
$X-ANNO-REVC-HIDD

It looks like the problem was not resolved, please see the command line history image below, thanks.

 

mruPRQUJ_0-1692296341633.png

 

0 Likes
Message 6 of 16

Kent1Cooper
Consultant
Consultant

Do you just need an additional Enter [blank line] at the end, to conclude the Layer command?  I don't see anything not happening, or error messages, so what is "not resolved," unless only that it leaves you still in the Layer command?  Did you hit Enter again to get it to show the little bit of Type a command that we see below?  Or did the Script do that?  If the latter, it looks finished -- what's "not resolved?"

 

It looks to me like there should also be a blank line for Enter after the 220, but in the image it looks like it has that [to use the current Layer for assigning that color] -- maybe it disappeared in Copy/Pasting the code.

Kent Cooper, AIA
0 Likes
Message 7 of 16

mruPRQUJ
Advocate
Advocate

I have added one more blank line at the end, please see command line history image below,

 

mruPRQUJ_1-1692298420398.png

Maybe there are some mistakes in the color section, thanks.

 

 

 

 

0 Likes
Message 8 of 16

Kent1Cooper
Consultant
Consultant

One too many Enters at the end.  One of them concluded the Layer command, and the extra one recalled the command [and left you in it].  Maybe you had the right number in the previous version but they disappeared in Copy/Pasting.

 

Aside from that, does it not do what you want?  Do the Layers come out as intended, with the color assigned and the right one current, etc.?  [There's still the risk of trying to Rename a Layer using the name of another existing one, but your image does not indicate that happening.]

 

EDIT:  As an aside, there's no point in the Set option at the beginning, when the next thing that happens is a Make option, which will leave the newly-Made Layer current, undoing what the Set option did [except perhaps that the Set option will turn the Layer on if it's off, but you can do that with an On option].

Kent Cooper, AIA
0 Likes
Message 9 of 16

mruPRQUJ
Advocate
Advocate

The problem is that the layer command can't be concluded. Maybe there is one mistake in the below,

 

mruPRQUJ_0-1692299321186.png

Layer color can be changed as expected.

 

0 Likes
Message 10 of 16

Kent1Cooper
Consultant
Consultant

Your image in Message 7 shows it concluded, where it goes back to the Command: prompt.  Then it's started up again, by what turns out to be an extra Enter, not too few of them.  I suggested adding one because I didn't see one in the posted code, and likewise in the color assignment part.  But it looks in the command-history image like they are there, and when you pasted the code into a Message, "the system" must have eliminated blank lines.

Kent Cooper, AIA
0 Likes
Message 11 of 16

Kent1Cooper
Consultant
Consultant

@mruPRQUJ wrote:

The problem is that the layer command can't be concluded. Maybe there is one mistake in the below,

mruPRQUJ_0-1692299321186.png

Layer color can be changed as expected.


Did you mean can't be changed?  [If it can be, what's the problem?]  It all looks normal to me.  An Enter that doesn't appear in your posted code is being fed in there, meaning "assign that color to the default Layer name in the <brackets>", which is always the current Layer.  Then it goes back to the main Layer prompt, where you go on to the Rename option, etc.

 

Is it really not changing the color of that Layer?

Kent Cooper, AIA
0 Likes
Message 12 of 16

mruPRQUJ
Advocate
Advocate

In message 6, there are two blank lines at the end. The layer command was not concluded. In massage 7, there are three blank lines at the end.  it's started up again. Maybe there are some mistakes in other area. 

Asking to enter name list of layer(s) for the color 220, is "enter" ok?

0 Likes
Message 13 of 16

Kent1Cooper
Consultant
Consultant

Try one blank line at the end, to simply conclude the Layer command, and not recall it.  If that doesn't work, attach your actual Script file, rather than pasting its contents into a Message, which apparently loses the blank lines.  You can .zip it if it won't let you attach a .scr file.

 

Yes, Enter at the Layer-name(s) prompt under the Color option will assign the color to what appears in the <pointy brackets> as the default [all AutoCAD commands use <that> for default offerings].  And for most options including Color, that default it offers will always be the current Layer [but for most, you can give it more than one, with comma separators, if you want].  [It won't offer the current Layer for quite all options, for example for the Freeze option, because the current Layer can't be Frozen, nor allow multiple Layer names for Set or Make, which obviously must be given only a single Layer.]

Kent Cooper, AIA
0 Likes
Message 14 of 16

mruPRQUJ
Advocate
Advocate

Hi,

 

I tried one line at the end. Please see the command line history image below,

mruPRQUJ_0-1692304695692.png

 Layer command was not concluded.

Also, please see attached the script and AutoCAD file, thanks a lot!

0 Likes
Message 15 of 16

Kent1Cooper
Consultant
Consultant
Accepted solution

It looks like what looks to us like two blank lines at the end are needed -- one of them is an Enter to finish the Layer command, resulting in the cursor being at what looks like a second one, but which contains nothing.  Try the attached, which worked for me.

Kent Cooper, AIA
0 Likes
Message 16 of 16

mruPRQUJ
Advocate
Advocate

Great job, many thanks.

0 Likes