Being new to .NET development, I'm curious to know how others handle common, simple commands that are typically written in AutoLISP / Visual LISP and loaded via acaddoc.lsp as opposed to a single netload call during acad.lsp?
LISP Example:
(defun c:Q ()
(princ "\rMBUTTONPAN = ")
(if (= 1 (getvar 'mbuttonpan))
(setvar 'mbuttonpan 0)
(setvar 'mbuttonpan 1)))
.NET Example:
<CommandMethod("Q")> _
Public Sub Q()
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
If Application.GetSystemVariable("mbuttonpan") = 1 Then
Application.SetSystemVariable("mbuttonpan", 0)
ed.WriteMessage(vbLf & "MBUTTONPAN: OFF ")
Else
Application.SetSystemVariable("mbuttonpan", 1)
ed.WriteMessage(vbLf & "MBUTTONPAN: ON ")
End If
End Sub
Do you leave your code in LISP and load for each drawing, or do you recommend bringing everything over to a .NET project (C#, or VB), and netload once with acad.lsp (or registry?) and be done with it throughout your entire session?
I'm doing a lot of tutorials. While not practical for all circumstances, at least from a learning standpoint, I think it might be helpful for me to undertake the process of "figuring out" how to write the code for each of my routines in .NET. Obviously concepts like transactions, etc. are new to me. Afterall, I'm the author of the plethora of LISP code to begin with.
I'm interested in your feedback, and any suggestions you might have for project organization (separate, or grouped CommandMethods under one class), and also in how you go about demand loading (registry?), etc.
I hope that I have been specific enough in my questions, if not please let me know.
I am using Visual Studio 2010 Express, with Land Desktop 2009, and Civil 3D 2011, focused more on migrating to C3D from LDC.