Author Topic: Bad change in AutoCAD 2016  (Read 5046 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Bad change in AutoCAD 2016
« on: April 06, 2015, 08:35:34 AM »
AutoCAD version changes working directory, as I see... AutoCAD 2009-2015 don't do this.

My BAT and SCR files use relative paths into own code, therefore now (in AutoCAD 2016) they can't find necessary resources: scr, arg and dwg files, because working directory now is not the same where BAT-file is located.

I can't use absolute paths because often I use remote machines (i.e. the output paths are not the local directories). If I try to calculate a full path, then it will have somethin like that: \\CompName\DirName\etc. I can't write such paths into my BAT abd SCR files, because they are located on the remote machine and don't know such paths.

For example, it works fine for AutoCAD 2015:
Code: [Select]
call "C:\Program Files\Autodesk\AutoCAD 2015\accoreconsole.exe" /s "..\NUnit\startup-2015.scr" /p "..\NUnit\acad_2015_and_newer_NUnit_testing_profile.arg"

But for AutoCAD 2016 it doesn't work:
Code: [Select]
call "C:\Program Files\Autodesk\AutoCAD 2016\accoreconsole.exe" /s "..\NUnit\startup-2016.scr" /p "..\NUnit\acad_2015_and_newer_NUnit_testing_profile.arg"

AutoCAD 2016 output:
Quote
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\developer>cd C:\public\Debug\extensions\acad-extensions\ExtensionSample
.UnitTests\run-tests

C:\public\Debug\extensions\acad-extensions\ExtensionSample.UnitTests\run-tests>r
un-tests-in-autocad-2016-NUnit.bat

C:\public\Debug\extensions\acad-extensions\ExtensionSample.UnitTests\run-tests>c
all "C:\Program Files\Autodesk\AutoCAD 2016\accoreconsole.exe" /s "..\NUnit\star
tup-2016.scr" /p "..\NUnit\acad_2015_and_newer_NUnit_testing_profile.arg"
Redirect stdout (file: C:\Users\DEVELO~1\AppData\Local\Temp\accc8722).
AutoCAD Core Engine Console - Copyright Autodesk, Inc 2009-2013.
Regenerating model.



Command:
Command:
"startup-2016.scr": Can't find file.


Command:
Command: _quit

Command:
C:\public\Debug\extensions\acad-extensions\ExtensionSample.UnitTests\run-tests>

Thus my unit tests work fine for AutoCAD 2009-2015, but don't work for AutoCAD 2016.

I can get current directory of the BAT file: %~dp0, but what about the SCR-file (its code loads a managed DLL with the unit tests)? My BAT and SCR files are generated by msbuild.

Anybody has an idea for fixing of this?
« Last Edit: April 06, 2015, 09:02:09 AM by Andrey Bushman »

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Bad change in AutoCAD 2016
« Reply #1 on: April 06, 2015, 09:05:05 AM »
Hm... I found a decision: SCR file must to be genereted by a BAT file, instead of msbuild (as I did it earlier). At this case it can write absolute paths for SCR file commands.
« Last Edit: April 06, 2015, 09:10:46 AM by Andrey Bushman »

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Bad change in AutoCAD 2016
« Reply #2 on: June 12, 2015, 12:55:54 PM »
Andrey thanks for this.

I copied "call "C:\Program Files\Autodesk\AutoCAD 2016\accoreconsole.exe" /s "..\NUnit\startup-2016.scr" /p "..\NUnit\acad_2015_and_newer_NUnit_testing_profile.arg" (adjusted it for me) and saved it as a .bat file. It now says "Invalid filename" , is there something else I need?

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Bad change in AutoCAD 2016
« Reply #3 on: June 12, 2015, 03:06:41 PM »
You are to use absolute paths instead of relative ones, as I wrote in my previous message. Thus you are to use %~dp0 in your BAT files, i.e. "%~dp0..\NUnit\startup-2015.scr" instead of "..\NUnit\startup-2015.scr"

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Bad change in AutoCAD 2016
« Reply #4 on: June 12, 2015, 04:37:20 PM »
Hi,

Did you try setting the LEGACYCODESEARCH sysvar to 1 ?
Speaking English as a French Frog

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Bad change in AutoCAD 2016
« Reply #5 on: June 12, 2015, 04:41:18 PM »
Thanks, unfortunately I have never made a bat file before

call "C:\Program Files\Autodesk\AutoCAD 2016\accoreconsole.exe" /s "C:\Users\me\Documents\Visual Studio 2012\Projects\GetThangs15.scr"

Above is the full path.  So is this all I need? I put  it in notepad and saved it as .bat
this is my .cproj.user
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <StartAction>Program</StartAction>
    <StartProgram>C:\Program Files\Autodesk\AutoCAD 2015\acad.exe</StartProgram>
    <StartWorkingDirectory>C:\Users\me\Documents\Visual Studio 2012\Projects\</StartWorkingDirectory>
    <StartArguments>/p "Lex2015" /nologo /b "C:\Users\bwalmsley\Documents\Visual Studio 2012\Projects\GetThangs15.scr"</StartArguments>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
    <StartWorkingDirectory>C:\Users\me\Documents\Visual Studio 2012\Projects\</StartWorkingDirectory>
    <StartArguments>/p "Lex2016" /nologo /b "C:\Users\me\Documents\Visual Studio 2012\Projects\5GetThangs15.scr"</StartArguments>
  </PropertyGroup>
  <PropertyGroup>
    <ProjectView>ShowAllFiles</ProjectView>
  </PropertyGroup>
</Project>

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Bad change in AutoCAD 2016
« Reply #6 on: June 12, 2015, 04:44:52 PM »
MCI Gile,  I've been pulling my hair out. Tx

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Bad change in AutoCAD 2016
« Reply #7 on: June 15, 2015, 03:23:46 AM »
Bryco, I don't understand your last message. Is your problem solved?
This is a sample of my BAT file:

Code: [Select]
echo _NETLOAD "%~dp0..\NUnit\ant_ut.R20.1.dll" _QUIT Y > "%~dp0..\NUnit\startup-2016.scr"
call "C:\Program Files\Autodesk\AutoCAD 2016\acad.exe" /b "%~dp0..\NUnit\startup-2016.scr" /p "%~dp0..\NUnit\acad_2015_and_newer_NUnit_testing_profile.arg" /nologo
IF "%1" == "" call "%~dp0..\NUnit\NUnitOrange.exe" "%~dp0..\reports\xml-reports\ant_ut.R20.1-NUnit.xml" "%~dp0..\reports\ant_ut.R20.1.html"

This BAT file was generated by msbuild.exe according the settings of my CSPROJ file.

Quote from: Bryco
this is my .cproj.user
I don't use such files for C# projects of my AutoCAD .NET extensions.
« Last Edit: June 15, 2015, 07:46:34 AM by Andrey Bushman »

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Bad change in AutoCAD 2016
« Reply #8 on: June 16, 2015, 03:44:26 PM »
Tx Andrey, it is solved  but tx for the bat file info, I will try it