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

Unknown command

4 REPLIES 4
Reply
Message 1 of 5
sepich4567
766 Views, 4 Replies

Unknown command

My program compiles with 0 errors and 0 warnings however when I load with netload and run AutoCAD tells me "unknown command" What is the problem?
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: sepich4567

Try making the Create function static (Shared in VB).

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

wrote in message news:4925522@discussion.autodesk.com...
My program compiles with 0 errors and 0 warnings however when I load with netload and run AutoCAD tells me "unknown command" What is the problem?
Message 3 of 5
Anonymous
in reply to: sepich4567

You also may need to make it a SUB. I don't believe you can call a FUNCTION
since function implies a return value. Change it to this and it'll work:

Public Class EmployeeObject
_
Public Shared Sub Create()

-- Mike
___________________________
Mike Tuersley
___________________________
the trick is to realize that there is no spoon...
Message 4 of 5
Anonymous
in reply to: sepich4567


Mike,

 

Function is OK. Here's a piece of code that
works:

 


face="Courier New">Imports
color=#000000>
System.Runtime.InteropServices


face="Courier New" color=#0000ff size=2>Imports

face="Courier New" color=#000000> Autodesk.AutoCAD.Runtime

 

Public
size=2>
Class
DemoClass


size=2>Implements

Autodesk.AutoCAD.Runtime.IExtensionApplication

 


size=2>Public

size=2>Sub
Initialize()
size=2>Implements

Autodesk.AutoCAD.Runtime.IExtensionApplication.Initialize


size=2>Autodesk.AutoCAD.ApplicationServices.CommandLinePrompts.Message(vbNewLine
+ _


size=2>"DEMO Class successfully loaded..." +
vbNewLine)


size=2>End

size=2>Sub


size=2>
 


size=2>Public

size=2>Sub
Terminate()
size=2>Implements

Autodesk.AutoCAD.Runtime.IExtensionApplication.Terminate


size=2>End

size=2>Sub

 


size=2><Autodesk.AutoCAD.Runtime.CommandMethod("DEMO1")>
_


size=2>Public

size=2>Function
Demo1()

...


color=#0000ff size=2>End

color=#0000ff size=2>Function


face="Courier New">End
size=2>

size=2>Class

 

Sepich, you need to
load resulting DLL via AutoCAD's NETLOAD command. Also try to keep a DLL at
location found in AutoCAD's Search/Support Path (or create a new
one).

 

Regards,

Maksim Sestic

 

 

You also may need to make it a
SUB. I don't believe you can call a FUNCTION
since function implies a return
value. Change it to this and it'll work:

Public Class
EmployeeObject
<CommandMethod("create")> _
Public Shared Sub
Create()

-- Mike
___________________________
Mike
Tuersley
___________________________
the trick is to realize that there is
no spoon...
Message 5 of 5
Anonymous
in reply to: sepich4567

Thanks Maksim. I knew that would work but I'm not sure if it does if you
remove your Initialize sub. Easy enough to test, I just haven't had much
time to play lately 😉

-- Mike
___________________________
Mike Tuersley
___________________________
the trick is to realize that there is no spoon...

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