.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Debugging using COM interop

8 REPLIES 8
Reply
Message 1 of 9
sgrya1
590 Views, 8 Replies

Debugging using COM interop

I am used VBA/VB6 so using COM interop helps me for now until they dump it which I heard was the plan? 

Is there a way to debug .net apps live as I did with VBA?

Seems to work with instructions but not for requests.

For example .net doesn't know to pause when I request a input from AutoCAD. eg.

sset.Select(5, , , , )

 

Building a dll, loading it into AutoCAD then not quite knowing what is going on is painful and very time consuming.

8 REPLIES 8
Message 2 of 9
arcticad
in reply to: sgrya1

If you start the application from within visual studio you can debug line by line. You just need to set the startup application to acad.exe and netload the command from the copy that loads.

 

I don't believe they are discontinuing autocad.interop that would be a bit catastropic.

They are discontinuing VBA (I'm told) in 2012. Altho that may change.

---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 3 of 9
sgrya1
in reply to: sgrya1

Thanks for your reply!

I have a few apps written and compiled in VB6 dlls. Will they survive any change by Autodesk? 

 

I guess my gripe with .Net is waiting for a new instance of AutoCAD then NETLOADing  the app.

Almost makes me want to build it in VBA then convert it to .Net.

 

 

 

.

 

 

Message 4 of 9
sgrya1
in reply to: sgrya1

Just realized that I can debug sent commands directly to the active instance from Visual Studio without the dll and temporarily generate responces to requests.

It’s only drawing requests that need  the dll to be created.

Makes things quicker.

Message 5 of 9
kdub_nz
in reply to: sgrya1

blockquote :Almost makes me want to build it in VBA then convert it to .Net \\ Just for interest : How do you convert your VBA to VB.NET ??

// Called Kerry in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect.

class keyThumper<T> : Lazy<T>;      another  Swamper

Message 6 of 9
sgrya1
in reply to: sgrya1

VBA to VB.Net just needs a few adjustments so copy and paste. No need anymore though.

It's just the debugging of requests needs building the dll, netloading it and running the command and a process I could do without.

Message 7 of 9
arcticad
in reply to: sgrya1

 


@sgrya1 wrote:

Just realized that I can debug sent commands directly to the active instance from Visual Studio without the dll and temporarily generate responces to requests.

It’s only drawing requests that need  the dll to be created.

Makes things quicker.


 Can you explain what you mean and how you are sending commands? 

 

---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 8 of 9
sgrya1
in reply to: sgrya1

I’ve just realised that I only need to build the debug dll once and not each time I want to debug.

 

I call commands using the CommandMethod

 

    <CommandMethod("qqq")> _
    Sub Run()
        Acadapp = GetObject(, "AutoCAD.Application")
        ThisDrawing = Acadapp.ActiveDocument
        sp(0) = (0) : sp(1) = 0
        ep(0) = (10) : ep(1) = 10
        objline = ThisDrawing.ModelSpace.AddLine(sp, ep)
    End Sub

I can edit in debug mode but occasionally get fatal exceptions or more often the code just needs to be stopped and restarted. In which case the debug instance of AutoCAD is closed and needs to be restarted when I press play. I just seem to spend a lot of time waiting for AutoCAD to load and Netloading.

 

If I disable Acad.exe as the start up debug app then all sent commands go straight to the active instance so I can easily and quickly debug these.

It’s just the drawing requests that need Acad.exe set as the startup debug application.

Message 9 of 9
sgrya1
in reply to: sgrya1

Seems I've been playing with the same project under different environments.

 

One is a Windows Forms Application which sends commands straight to the currently active instance of AutoCAD

The other a Class Library. Does the same thing but needs a new instance of AutoCAD and Netloading the dll.

 

Good thing is that I can flick from one type to the other by changing the app type, startup object and debug mode.

Windows Form App can start off a blank form kicking off a subroutine.

 

Sorry for the confusion.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost