Unknown command

Unknown command

Anonymous
Not applicable
1,132 Views
4 Replies
Message 1 of 5

Unknown command

Anonymous
Not applicable
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?
0 Likes
1,133 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
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?
0 Likes
Message 3 of 5

Anonymous
Not applicable
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...
0 Likes
Message 4 of 5

Anonymous
Not applicable

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...
0 Likes
Message 5 of 5

Anonymous
Not applicable
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...
0 Likes