.NET

Reply
Active Member
everts
Posts: 7
Registered: ‎08-30-2007
Message 1 of 7 (184 Views)

C# and AutoCAD 2009

184 Views, 6 Replies
10-22-2008 09:50 AM
I am using "AutoCAD Civil 3D Land Desktop Companion 2009", i wrote a simple program for Land Desktop 2006 using .NET framework 2.0 (VS2005) and I want to migrate it to this new version of CAD, but I am not able to use the program, I can not load the form, I changed the old references to acdbmgd and acdbmgd to the newer ones, but it does not work. Do I need to use the .NET Framework 3.0? Or do I have a problem with CommandMethod? Is it different to show a form with this new version? I am sorry about my english
*Tony Tanzillo
Message 2 of 7 (184 Views)

Re: C# and AutoCAD 2009

10-22-2008 09:55 AM in reply to: everts

There are some changes to the API between 2006 and later
releases,

which may be the cause of your problem. 

 

You would need to show what error messages you're getting in
order

for anyone to help you.


 

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000
through 2009

href="http://www.acadxtabs.com">http://www.acadxtabs.com

 



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
am using "AutoCAD Civil 3D Land Desktop Companion 2009", i wrote a simple
program for Land Desktop 2006 using .NET framework 2.0 (VS2005) and I want to
migrate it to this new version of CAD, but I am not able to use the program, I
can not load the form, I changed the old references to acdbmgd and acdbmgd to
the newer ones, but it does not work. Do I need to use the .NET Framework 3.0?
Or do I have a problem with CommandMethod? Is it different to show a form with
this new version? I am sorry about my english
Active Member
everts
Posts: 7
Registered: ‎08-30-2007
Message 3 of 7 (184 Views)

Re: C# and AutoCAD 2009

10-22-2008 10:43 AM in reply to: everts
When I execute the command "netload" to load my dll and try to execute my personalized command (sondeos in this case) CAD show the following message: "command sondeos not found"

using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.AutoCAD.Runtime;
using System.Windows.Forms;

namespace Sondeos2._0
{
public class Principal
{
[CommandMethod("sondeo")]
public void mostrarFrmSondeos()
{
Form1 myForm = new Form1();
myForm.Show();
}
}
}
*Joe Sutphin
Message 4 of 7 (184 Views)

Re: C# and AutoCAD 2009

10-22-2008 11:04 AM in reply to: everts

I notice that you typed "
face="Times New Roman" size=3>sondeos" twice in your message. However, the
command method does not have the "s" on the end of the name. Could it be this
simple?

 

Joe ...

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
When
I execute the command "netload" to load my dll and try to execute my
personalized command (sondeos in this case) CAD show the following message:
"command sondeos not found"

using System;
using
System.Collections.Generic;
using System.Text;
using
Autodesk.AutoCAD.Runtime;
using System.Windows.Forms;

namespace
Sondeos2._0
{
public class Principal
{

[CommandMethod("sondeo")]
public void mostrarFrmSondeos()
{

Form1 myForm = new Form1();
myForm.Show();
}
}

}
Active Member
everts
Posts: 7
Registered: ‎08-30-2007
Message 5 of 7 (184 Views)

Re: C# and AutoCAD 2009

10-22-2008 11:50 AM in reply to: everts
no, sorry, my mistake when typing the message, that is not the problem. I will install VS2008, just to check if the problem is the Framework version
Member
CougerAC
Posts: 4
Registered: ‎10-22-2008
Message 6 of 7 (184 Views)

Re: C# and AutoCAD 2009

10-22-2008 11:53 AM in reply to: everts
Make sure Copy Local on acdbmgd and acmgd is set to False.
Also, you shouldn't show your form by calling form.Show().
You need to use either:
Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog (form)
or
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog (form)

Also, check the Error List in Visual Studio and resolve any errors/warnings.
Finally, check your acad.exe.config file to ensure that you are not explicitly specifying a lower runtime than you are compiling for.

Good Luck,
C
*Tony Tanzillo
Message 7 of 7 (184 Views)

Re: C# and AutoCAD 2009

10-22-2008 11:57 AM in reply to: everts

This has nothing to do with the framework
version.

 

Things to check:

 

-   Using CommandClass attribute anywhere in

    the same assembly
size=2>requires that it be used

    on every class that implements
commands.

 

-  The assembly contains a class that implements

    IExtensionApplication,
size=2>whose Iinitialize() method

    is throwing an exception.

 

-  Running your code in the debugger, with
the

   'CopyLocal' property of references to
acmgd.dll

   or acdbmgd.dll set to True.  Set them
to false.


 

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000
through 2009

href="http://www.acadxtabs.com">http://www.acadxtabs.com

 


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
When
I execute the command "netload" to load my dll and try to execute my
personalized command (sondeos in this case) CAD show the following message:
"command sondeos not found"

using System;
using
System.Collections.Generic;
using System.Text;
using
Autodesk.AutoCAD.Runtime;
using System.Windows.Forms;

namespace
Sondeos2._0
{
public class Principal
{

[CommandMethod("sondeo")]
public void mostrarFrmSondeos()
{

Form1 myForm = new Form1();
myForm.Show();
}
}

}
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!