.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Command not starting in debug
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I am writing a program in vb.net.
I have a command.
<CommandMethod("att2att")> _
Public Sub att2att()
Dim ed As Editor
ed = Autodesk.AutoCAD.ApplicationServices.Application.D
ed.WriteMessage(String.Format("{0} commande: att2att, maintenant disponible...", System.Environment.NewLine))
Dim start As New FileSelect
start.ShowDialog()
End Sub
In the debug mode, the att2att is not recognize.
If I compile, netload and call the command, it works. Why is the command not recognize in debug mode?
Re : Command not starting in debug
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Salut,
Si ça fonctionne avec NETLOAD c'est probablement que le problème ne vient pas du code mais de ce qui est automatiquement exécuté au lancement du débogage.
Si rien n'a été explicitement fait pour que la dll soit chargée au démarrage d'AutoCAD (un script par exemple), elle ne sera pas automatiquement chargée (c'est le cas avec les AutoCAD .NET Wizards).
Tu trouveras sur Augifr un tuto pour créer des modèles AutoCAD pour Visual Studio avec une méthode de chargement automatique de la dll via un script :
http://augifr.ning.com/group/augi-france-developer
Re: Command not starting in debug
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Try compile your project as follows:
#region "Imports" '' your imports here #End Region <Assembly: Autodesk.AutoCAD.Runtime.CommandClass(GetType(MyProjectName.MyClass))> Namespace MyProjectName Public Class MyClass <CommandMethod("att2att")> _ Public Sub att2att() ' wrap your code in try-catch block Try Dim ed As Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.D ocumentManager.MdiActiveDocument.Editor ed.WriteMessage(String.Format("{0} commande: att2att, maintenant disponible...", System.Environment.NewLine)) Dim start As New FileSelect start.ShowDialog() Catch ex as System.Exception Msgbox(ex.message & vblf & ex.stacktrace) Finally ' do nothing or add informative message end Try End Sub end class End Namespace
C6309D9E0751D165D0934D0621DFF27919
Re: Command not starting in debug
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Well, the problem is that in the debug, I do the netload but the att2att commande doesn't show. If I compile then run autocad and then netload the same dll, the att2att command is available...
I really wish I could use the debugger... it will save me so much time. Thanks all for the help!
That is kind of strange! I change my code as:
#Region " Imports "
Imports System.IO
Imports Autodesk.AutoCAD.Interop
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
'Imports Autodesk.AutoCAD.PlottingServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Geometry
#End Region
<Assembly: Autodesk.AutoCAD.Runtime.CommandClass(GetType(UpdC
Namespace UpdCart
Public Class Commandes
<CommandMethod("att2att")> _
Public Sub att2att()
Try
Dim ed As Editor
ed = Autodesk.AutoCAD.ApplicationServices.Application.D
ed.WriteMessage(String.Format("{0} commande: att2att, maintenant disponible...", System.Environment.NewLine))
Dim start As New FileSelect
start.ShowDialog()
Catch ex As System.Exception
MessageBox.Show(ex.ToString, "System Exception")
End Try
End Sub
End Class
End Namespace
Re: Command not starting in debug
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hello Patrick,
Are you referring to debugging by attaching to an running instance of AutoCAD to debug the .Net Plug-in ?
If so, “Attach to Process” for debugging a .Net plugin is not recommended and the suggested way to debug a .Net plugin is to set AutoCAD as the external program and use F5.
The reason for it is due to the use of fibers in AutoCAD which is being removed in the newer releases of AutoCAD.
Hopefully this will not be a limitation in a future release of AutoCAD.
You may try "Attach to Process" after setting the "NEXTFIBERWORLD" to 0 to disable the fibers in AutoCAD but it has some drawbacks such as the ribbon not responding. I havent tried this though.
Balaji
Developer Technical Services
Autodesk Developer Network
