Author Topic: Cannot Launch CADmep from Visual Studio to Debug  (Read 175 times)

0 Members and 1 Guest are viewing this topic.

Offline jaysomlamTopic starter

  • Full Member
  • ***
  • Posts: 142
  • Country: us
  • Gender: Male
Cannot Launch CADmep from Visual Studio to Debug
« on: Oct 10, 2018, 02:47:34 PM »
Somehow I find that I cannot debug a program in a step-by-step fashion if I directly launch CADmep from Visual Studio.  What I mean is that if I specify CADmep like this in Project-Properties --> Debug --> Start external program:
   C:\Program Files\Autodesk\Fabrication 2018\CADmep\CADmepLauncher.exe
And then I put a breakpoint in the source code, I find that Visual Studio doesn't pause at the breakpoint.

Currently I have found a workaround, that is to specify acad.exe in Project Properties --> Debug --> Start external program, like this:
   C:\Program Files\Autodesk\AutoCAD 2018\acad.exe
And then I open a DWG file that has Fabrication objects in it.  This will trigger CADmep to be launched.  And then I find that Visual Studio will be able to pause at the breakpoint.

I don't know why I have this problem when I launch CADmep directly.  As mentioned above, I have found a workaround.  Therefore, this is not a show-stopper.  I am just hoping that someone can tell me an easy fix.

By the way, I use Visual Studio 2012, Fabrication 2018, CADmep 2018, and .NET 4.5.2.  And there is only one version of CADmep in my computer.  My computer has Windows 10.

Please let me know if there is a fix to this problem.  Thanks.

Jaysom

Offline cadbob

  • Premier Member
  • *****
  • Posts: 2533
  • Country: us
  • Gender: Male
    • Sheet Metal Workers International
Re: Cannot Launch CADmep from Visual Studio to Debug
« Reply #1 on: Oct 10, 2018, 06:14:53 PM »
What are you trying to accomplish by debugging?
Debugging usually goes hand in hand with other things.
Live like you golf. Don't forget to follow through

Offline jaysomlamTopic starter

  • Full Member
  • ***
  • Posts: 142
  • Country: us
  • Gender: Male
Re: Cannot Launch CADmep from Visual Studio to Debug
« Reply #2 on: Oct 10, 2018, 07:38:43 PM »
What I mean "debugging" is to be able to step through the program.  Then I can observer if it follows the logic that I think it is supposed to.  This is the primary purpose.  Programming using AutoCAD .NET and Fabrication API is new to me.  Therefore, being able to step through the program to observe its behavior is important.

And I also will have a chance to browse through all the properties of a variable to see what it has and doesn't have, and to see if it has the values that I have expected.  But this is secondary because I could have used something similar to printf() to display the value.

Jaysom

Offline Darren Young

  • Premier Member
  • *****
  • Posts: 1426
  • Country: us
  • Gender: Male
    • Hermancon Company LLP
Re: Cannot Launch CADmep from Visual Studio to Debug
« Reply #3 on: Oct 10, 2018, 07:55:03 PM »
Just config VS to reference ACAD.EXE and specify the "/ld" switch along with the path to the CADmep ARX file.

/ld = "Load DLL" and the CADmep ARX is just a DLL with another name.

I've never used the launcher.

Offline jaysomlamTopic starter

  • Full Member
  • ***
  • Posts: 142
  • Country: us
  • Gender: Male
Re: Cannot Launch CADmep from Visual Studio to Debug
« Reply #4 on: Oct 11, 2018, 01:24:28 PM »
Thanks Darren Young for the solution of this problem.

I follow your advice and add these to the Debug section of the Project Properties:

In "Start external program", I leave it as this:
   C:\Program Files\Autodesk\AutoCAD 2018\acad.exe

In "Command line Arguments", I add this:
   /ld "C:\Program Files\Autodesk\Fabrication 2018\CADmep\CADmep22.arx"
Note to people who have the same problem: The double quotes are required.

Now when I launch the program in Debug mode using Visual Studio, I see that CADmep is automatically launched.  And when I open a drawing that doesn't have any Fabrication object in it, CADmep is still there.  And Visual Studio pauses at where I have placed a breakpoint.  Great!  This also means that I don't need to open a drawing that has Fabrication objects in order to trigger the launch of CADmep.

Jaysom