Troubles running layer renaming script through accoreconsole

Troubles running layer renaming script through accoreconsole

Anonymous
Not applicable
1,514 Views
8 Replies
Message 1 of 9

Troubles running layer renaming script through accoreconsole

Anonymous
Not applicable

I am running a .bat file that runs a layer renaming script through multiple .dwg files. The script works fine in acad.exe, but within accoreconsole, the program states it cannot find the layer.  as show below.

accore.PNG

 

 

The batch file is written as follows:

 

FOR %%f IN (H:\test\Constructs\*.dwg) DO START C:\"Program Files"\Autodesk\"AutoCAD 2017"\accoreconsole.exe %%f /s H:\test\Constructs\test.scr /l en-US

 

The script reads as follows :

 

 

_-rename
LA
Q-MACH-NMBR Q-MACH-LABL

 

 

I've checked numerous times, the names of the labels are correct. Is this an issue with system variables/settings within autocad/accoreconsole.

 

Thanks

 

 

0 Likes
1,515 Views
8 Replies
Replies (8)
Message 2 of 9

doglips
Advocate
Advocate

I've always found Core to be hit or miss. You may want to use the acad.exe instead

0 Likes
Message 3 of 9

cadffm
Consultant
Consultant

There is normaly no Problem. Are you really sure that these are the right dwg-files?

Thats the only possible solution (sorry).

 

Change your Script to:

;--------------------------------------------

_-layer

?

*

 

_-rename
LA
Q-MACH-NMBR Q-MACH-LABL

;--------------------------------------------

 

command Layer Option "?" display all Layers

Sebastian

0 Likes
Message 4 of 9

cadffm
Consultant
Consultant

Or there is a codepage problem, that possible to.

Sebastian

0 Likes
Message 5 of 9

cadffm
Consultant
Consultant

The Script is fine, your *.bat is wrong (open not files you want)

 

 

FOR %%f in ("H:\test\Constructs\*.dwg") do "C:\Program Files\Autodesk\AutoCAD 2017\accoreconsole.exe" /i "%%f"  /s "H:\test\Constructs\test.scr" /l en-US

 

Check for "" and attached parameter /i

 

My Test-scr:

 

;========================

; set logfilepath for debugging and controle
LOGFILEPATH H:\test\Constructs\
; set logfile on for debugging and controle
LOGFILEON
; display file folder for debugging and controle
DWGPREFIX
; display file name for debugging and controle
DWGNAME
; display all Layers for debugging and controle
_-layer
?
*

; Start rename!
_-rename
LA
Q-MACH-NMBR Q-MACH-LABL
;========SCR END=======

 

But your Script crashs if command _-rename try to rename an non existing Layer!

You can create a Layer (if not exist) first

_-Layer

_new

Q-MACH-NMBR

 

_-rename
LA
Q-MACH-NMBR Q-MACH-LABL

 

But your Script crashs if command _-rename try oldname to existing Layername!

You can use command LAYMRG.. ,

 

But  the best way is: A real clean customize program (lsp vba .net ..)

Use /s "MyScript.scr" only for load your programs

 

; ======== My personal /s "MyAccStartUp.scr ==========

LOGFILEON
LOGFILEPATH "C:/TEMP/ACC/"
(load "c:\\TEMP\\ACC\\core-startup.lsp")

 

Logfile for controle, load my standard .lsp file (for accoreconsole working)

All other things I do behind this

Accoreconsole starts from Shellcommand from whatever (acad,excel,outlook),

a *.bat file like your example I use sometimes too for testing or for Explorer-context menu

Sebastian

Message 6 of 9

Anonymous
Not applicable

This appears to work, my .dwgs have .log files appear under them. Although, the .dwgs do not have the changes saved to them, and withing the .log, it is claimed that the .dwgs are read only, even though they are not open anywhere else. Do you know what could cause this?

0 Likes
Message 7 of 9

cadffm
Consultant
Consultant

"Although, the .dwgs do not have the changes saved to them,"

In your and my Script, there aren´t any SAVE-Statement, or?

(good for testing, but changes nothing. Last Line in Script should be:

_QSAVE

 

 

"and withing the .log, it is claimed that the .dwgs are read only, even though they are not open anywhere else. Do you know what could cause this?"

Re-start computer , try it again, I´m sure it works well.

 

Sebastian

0 Likes
Message 8 of 9

ambrosl
Autodesk
Autodesk

@Anonymous wrote:

 

 

The batch file is written as follows:

 

FOR %%f IN (H:\test\Constructs\*.dwg) DO START C:\"Program Files"\Autodesk\"AutoCAD 2017"\accoreconsole.exe %%f /s H:\test\Constructs\test.scr /l en-US

 

The script reads as follows :

 

 

_-rename
LA
Q-MACH-NMBR Q-MACH-LABL

 

 

I've checked numerous times, the names of the labels are correct. Is this an issue with system variables/settings within autocad/accoreconsole.

 

Thanks

 

 



I see part of the conversation moved away from the original problem, but this might help with your original question.

Layer names can have a space, so you should place the new layer name on a separate line and make sure there is a blank line at the end of the script.

Also, be sure to save the changes after the script is done which someone else has pointed out to commit the changes to the file.


Lee Ambrosius
Senior Principal Content Experience Designer
For additional help, check out the AutoCAD Developer Documentation
0 Likes
Message 9 of 9

ambrosl
Autodesk
Autodesk

@ambrosl wrote:


I see part of the conversation moved away from the original problem, but this might help with your original question.

Layer names can have a space, so you should place the new layer name on a separate line and make sure there is a blank line at the end of the script.

Also, be sure to save the changes after the script is done which someone else has pointed out to commit the changes to the file.

As was pointed out to me, make sure that layer names with spaces are wrapped in "" marks (ie. "My Layer") along with most text that has a space contained in it when used in a script.



Lee Ambrosius
Senior Principal Content Experience Designer
For additional help, check out the AutoCAD Developer Documentation
0 Likes