FAQ: どうすれば、プロジェクトまたは図面ファイルのフォルダを現在のバージョンに再保存できますか?

前バージョンのプロジェクトまたは図面ファイルのフォルダを現在のバージョンに再保存するには、バッチ ファイルを使用します。

バッチ ファイルを使用して、前バージョンの AutoCAD Architecture 2023 toolsetで保存された図面ファイルを、現在のバージョンに自動的に再保存することができます。

バッチ ファイルを実行すると、前バージョンの図面を含むプロジェクトまたはフォルダの完全なコピーが作成されます。次に、その場所にあるすべての DWG、DWT、DWS ファイルが再帰的に検索され、スクリプト ファイルが生成されます。

そのスクリプト ファイルを実行すると、コピーされたそれぞれの DWG および DWT ファイルが開かれ、保存され、閉じられます。これにより、すべての DWG および DWT ファイルは、現在のバージョンに再保存されます。

スクリプトによって DWS ファイルのパスが表示されるので、手動で DWS ファイルを開き、それを現在のバージョンに保存する必要があります。

重要: バッチ ファイルおよびスクリプト ファイルを実行する前に、必ず、すべてのファイルのバックアップを作成してください。プロジェクトを新しい場所にコピーした場合は、バッチ ファイルを実行する前に、元のバージョンの AutoCAD Architecture 2023 toolsetを使用して、プロジェクトのパスを変更します。

バッチ ファイルを使用して、ファイルを現在のバージョンに読み込むには

    重要: 必ず、次の手順に従います。
  1. Microsoft の®[メモ帳]を起動します。
  2. 2 つの破線行の間のテキスト(バッチ ファイル)をコピーし、[メモ帳]に貼り付けます。
  3. promote.bat という名前でファイルを保存し、[メモ帳]を閉じます。
  4. Windows® のコマンド プロンプトで、次の構文を使用して promote.bat ファイルを実行します。
    promote.bat [projectName] [projectLocation] [scriptName] [promotionTarget] 
    Replace [projectName] with the name of the original folder containing the drawings to be imported to the current version. 
    Replace [projectLocation] with the path to the original folder entered as [projectName]. 
    Replace [scriptName] with the name of the script that will be generated. The root of the file name can be customized but the file extension must always be .scr. 
    Replace [promotionTarget] with a path and folder name of the location where the imported drawings must be copied.
    注: スペースを含む引数は、引用符で囲む必要があります。たとえば、前バージョンで保存された図面が R:¥CAD_Files¥Projects¥2010¥Hospital フォルダにあり、再保存ファイルを R:¥CAD_Files¥Projects¥2014¥Hospital フォルダに作成する場合は、次の構文を使用します。
    promote.bat Hospital R:\CAD_Files\Projects\2010\ promote.scr R:\CAD_Files\Projects\2014
  5. 完了すると、指定した名前のスクリプト ファイルが、promote.bat ファイルと同じフォルダに生成されます。そのスクリプト ファイルを実行すると、[promotionTarget]の場所にあるコピーされた各図面が、現在のバージョンに再保存されます。

バッチ ファイル

--------------------------------------------------------------------------------------------
@echo off
SETLOCAL
@rem promote.bat
@rem This script promotes a project to the current DWG format.
:Greeting
echo.
echo This script promotes a project to the current DWG format.
echo For best results, please run this script using administrator privileges in Windows.
echo.
PAUSE
:checkCmdArgs
if [%4] EQU [] goto :badArgCount
if [%3] EQU [] goto :badArgCount
if [%2] EQU [] goto :badArgCount
if [%1] EQU [] goto :badArgCount
if [%5] NEQ [] goto :badArgCount
set prjName=%1
set prjDir=%2
set scrName=%3
set targetDir=%4
goto :checkProject
:getProject
set /P prjName="What is the name of the project?: "
set /P prjDir="Where can it be found?: "
goto :checkProject
:checkProject
set prjNameEsc=%prjName:&=^&%
set firstChar=%prjName:~0,1%
if ^%firstChar% EQU ^" set prjName=%prjNameEsc:~1,-1%
set prjNameDisplay=%prjName:&=^^^&%
set prjDirEsc=%prjDir:&=^&%
set firstChar=%prjDir:~0,1%
if ^%firstChar% EQU ^" set prjDir=%prjDirEsc:~1,-1%
set prjDirDisplay=%prjDir:&=^^^&%
set project="%prjDir%\%prjName%"
if not exist %project% goto :noProject
if not defined scrName (goto :getScript) else (goto :checkScript)
:getScript
set /P scrName="Specify a name for the ACAD script: "
goto :checkScript
:checkScript
set scrNameEsc=%scrName:&=^&%
set firstChar=%scrName:~0,1%
if ^%firstChar% EQU ^" set scrName=%scrNameEsc:~1,-1%
set scrExt=%scrName:~-4%
if /I "%scrExt%" NEQ ".scr" set scrName=%scrName%.scr
set scrNameDisplay=%scrName:&=^^^&%
if exist "%scrName%" goto :scrFound
if not defined targetDir (goto :getTarget) else (goto :checkTarget)
:getTarget
set /P targetDir="Specify a directory to host the promoted project: "
goto :checkTarget
:checkTarget
set targetDirEsc=%targetDir:&=^&%
set firstChar=%targetDir:~0,1%
if ^%firstChar% EQU ^" set targetDir=%targetDirEsc:~1,-1%
set targetDirDisplay=%targetDir:&=^^^&%
set prjDest="%targetDir%\%prjName%"
if not exist "%targetDir%" (
md "%targetDir%"
echo.
echo Created target directory %targetDirDisplay%
goto :copyProject
) else (
if exist %prjDest% (goto :targetFound) else (goto :copyProject)
)
ENDLOCAL
exit /B
:badArgCount
echo.
echo This utility can be run as a single command with the following syntax:
echo.
echo promote.bat [projectName] [projectLocation] [scriptName] [promotionTarget].
echo.
goto :getProject
:noProject
echo.
echo You have specified a project %prjNameDisplay% in the directory %prjDirDisplay%.
echo This could not be found. Please try again.
echo.
goto :getProject
:badScrExt
echo.
echo Your Autocad script must have the extension ".scr" and you specified %scrNameDisplay%.
echo Please try again.
echo.
goto :getScript
:scrFound
echo.
echo An Autocad script with the name %scrNameDisplay% is already present in the working directory.
echo Delete this script or specify a different script name.
echo.
goto :getScript
:targetFound
echo.
echo A project with name %prjNameDisplay% was found in the target area %targetDirDisplay%.
echo Delete this project or specify another target area.
echo.
goto :getTarget
:copyProject
echo.
CLS
echo Copying project %prjNameDisplay%...
xcopy %project% %prjDest% /E /I /Q /H
attrib -A -R %prjDest% /D /S
echo Copied project %prjNameDisplay% to %prjDest%.
echo.
goto :genScript
:genScript
echo.
set count=0
@for /R %prjDest% %%i in (*.dwg) do (
set /a count+=1
echo _open "%%i">>"%scrName%"
echo _qsave>>"%scrName%"
echo _close>>"%scrName%"
)
echo Found %count% DWG files to be updated in the project %prjNameDisplay%.
set /a totalFiles=%count%
set count=0
@for /R %prjDest% %%i in (*.dwt) do (
set /a count+=1
echo _open "%%i">>"%scrName%"
echo _qsave>>"%scrName%"
echo _close>>"%scrName%"
)
echo Found %count% DWT files to be updated in the project %prjNameDisplay%.
echo.
set /a totalFiles=%totalFiles%+%count%
if %totalFiles% == 0 (
echo.
echo No DWG or DWT files were found in the project %prjName%!
echo There is nothing to promote.
echo.
echo Deleting the copy of %prjName% from %targetDir%.
echo The directory %targetDir% has been retained in case other folders or files are present.
echo.
RMDIR /Q/S %prjDest%
) else (
echo.
echo TO COMPLETE THE PROMOTION:
echo.
echo [1] Start ADT and make sure that a project is NOT currently active.
echo [2] Disable the previous version courtesy dialog using the AecFileOpenMessage command.
echo [3] Verify that the copy of the project located at %targetDirDisplay% has the same
echo file count as the original copy located at %prjDirDisplay%.
echo [4] Run the script %scrNameDisplay%.
@for /R %prjDest% %%i in (*.dws) do (
set /a foundDWS=1
goto :break
)
:break
if DEFINED foundDWS (
echo [5] Resave the following DWS file^(s^), making sure to preserve filenames.
echo ^(These cannot be promoted via a script as DWT and DWG files can.^)
echo.
@for /R %prjDest% %%i in (*.dws) do (
echo %%i
)
)
echo.
echo.
echo The project %prjNameDisplay% located in %targetDirDisplay% will then be promoted
echo to the current file format.
echo.
echo After this process is complete you may use this project
echo where it currently resides, or replace the old one with this new copy.
echo.
)
ENDLOCAL
exit /B
------------------------------------------------------------------------------------------------------

トラブルシューティング

このスクリプトの使用中、前バージョンの図面を開くときにダイアログ ボックスが表示されると、スクリプトは終了します。残りの図面の現在のバージョンへの再保存を続けるには:
  1. スクリプト ファイルを編集し、正常に再保存された最後の前バージョン図面までのすべての参照を削除します。
  2. 予期せずにダイアログ ボックスが表示された原因を突き止め、それが表示されないように必要な措置を講じます。
  3. 修正したスクリプト ファイルを実行します。残りのコピーされた図面も、現在のバージョンに再保存する必要があります。
その後、予期しないダイアログ ボックスの表示が原因でスクリプトが頻繁に停止する場合は、AutoCAD Architecture 2023 toolsetのコマンド ラインに AecFileOpenMessage と入力し、値を No に変更します。
重要: 再保存処理が完了したら、AecFileOpenMessage の値を Yes に戻します。