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

Help starting out

12 REPLIES 12
Reply
Message 1 of 13
ryan
516 Views, 12 Replies

Help starting out

Hi all.

I've been programming in lisp for some time and thought I'd try out .NET. I'm having a little trouble at a grass-roots level though. I've found some tutes and set up Vis Studio accordingly though when I try to run a very simple program I'm getting errors. Can anyone tell me if the problem is in the code or somewhere in the setup?
I keem getting an acad error - no known command "helloworld".

Thanks in advance,

Ryan.

My code:

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.EditorInput

Public Class Class1

< CommandMethod("helloworld") > _
Public Sub helloworld()
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
ed.WriteMessage("Hello World")

End Sub

End Class
12 REPLIES 12
Message 2 of 13
Anonymous
in reply to: ryan

It is most likely caused by incompatible VS and Acad. Which version of VS
(or VB.NET) and which version of Acad are you using?

wrote in message news:5426763@discussion.autodesk.com...
Hi all.

I've been programming in lisp for some time and thought I'd try out .NET.
I'm having a little trouble at a grass-roots level though. I've found some
tutes and set up Vis Studio accordingly though when I try to run a very
simple program I'm getting errors. Can anyone tell me if the problem is in
the code or somewhere in the setup?
I keem getting an acad error - no known command "helloworld".

Thanks in advance,

Ryan.

My code:

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.EditorInput

Public Class Class1

< CommandMethod("helloworld") > _
Public Sub helloworld()
Dim ed As Editor =
Application.DocumentManager.MdiActiveDocument.Editor
ed.WriteMessage("Hello World")

End Sub

End Class
Message 3 of 13
ryan
in reply to: ryan

ACAD 2007 and VS2005.
Message 4 of 13
Chumplybum
in reply to: ryan

your code works fine for me...

are you loading the application into AutoCAD??? if not, the NETLOAD command loads assemblys into autocad
Message 5 of 13
ryan
in reply to: ryan

Thanks for the reply Mark.

Yeah, I'm using NETLOAD, but having no luck. Is there an alternative to netload for loading a .NET dll?

I assumed the code would work - it was basically cut-and-paste from a tute I was following. That's why I wondered if it was something wrong with the VS set-up. is there a way to check that it's all set up properly?
Message 6 of 13
Anonymous
in reply to: ryan

Is this during debugging? You need to set the 'copylocal'
property to false for acmgd.dll.

wrote in message news:5426763@discussion.autodesk.com...
Hi all.

I've been programming in lisp for some time and thought I'd try out .NET.
I'm having a little trouble at a grass-roots level though. I've found some
tutes and set up Vis Studio accordingly though when I try to run a very
simple program I'm getting errors. Can anyone tell me if the problem is in
the code or somewhere in the setup?
I keem getting an acad error - no known command "helloworld".

Thanks in advance,

Ryan.

My code:

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.EditorInput

Public Class Class1

< CommandMethod("helloworld") > _
Public Sub helloworld()
Dim ed As Editor =
Application.DocumentManager.MdiActiveDocument.Editor
ed.WriteMessage("Hello World")

End Sub

End Class
Message 7 of 13
ryan
in reply to: ryan

Thanks Paul.
Yes, during debugging. I didn't realise I needed to set 'copylocal' to false. Pardon my ignorance, but how would I do that?
Thanks,
Ryan.
Message 8 of 13
Anonymous
in reply to: ryan

Solution Explorer -> References -> Select 'acmgd.dll'
Properties -> 'Copy Loal' = False

wrote in message news:5427111@discussion.autodesk.com...
Thanks Paul.
Yes, during debugging. I didn't realise I needed to set 'copylocal' to
false. Pardon my ignorance, but how would I do that?
Thanks,
Ryan.
Message 9 of 13
ryan
in reply to: ryan

Nope. That's not the answer either. I'm still getting the "unknown command" error.
Any other ideas?
Message 10 of 13
gilseorin
in reply to: ryan

You should correct your problem by making a template file.
Get a source file provided by Autodesk comapany.
And then excute after setting debugger with acad.exe.
If the command working properly, you can make template file.
Then, the template file will be set all properly, but setting debugger with acad.exe. I hope, helped.
Message 11 of 13
Chumplybum
in reply to: ryan

if the error is in the debugging... i would first try it straight from AutoCAD (not thru the debugger in VS)... open up a session of AutoCAD and netload your dll file in, if it works here then your code is fine and it's probably a setting or 2 wrong in the debugging mode.

one thing with the debugging mode, is you have to set the 'working directory' to be the same as the acad.exe file your executing thru the debugger... if you go to the project properties -> debugging tab you'll find the 'working directory' there... put in the folder path to the acad.exe (for me its c:\program files\autocad 2006\)

HTH

cheers
mark
Message 12 of 13
Anonymous
in reply to: ryan

Hi,

This really works for me.
AutoCAD debugged with its own dll's, rather than having VS working with local copy of both acdbmgd.dll and acmgd.dll files let me now call my CommandMethods...

It also explain the reason why I were able to call them only in AutoCAD 2007 not in a debugging session of VS 2005.

I'm searching another reason explaining your problem...
Message 13 of 13
CAD4ME
in reply to: ryan

Hi

Just had the same problem and fixed with the suggestion from one of the earlier posts. Don't know if you overlooked it.

Goto the Project menu and click on ... Properties at the bottom. Then make sure that in the Debug tab you've got 'Start external program' selected and it points to your acad.exe file then make sure that the 'working directory' box points to the folder that holds acad.exe. Should work fine then through debug mode.

Cheers

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