hi all
i am new to vb.net (always used vba enabler but wanted to make the change to vb.net )
i am using this tutorial from autodesk but is for an older version of autocad 2010
and i am using autocad 2014 and objectarx2014
http://usa.autodesk.com/adsk/servlet/index?id=770215&siteID=123112
and i searched this site for some answers and when i build it i dont get any errors but when i load it into autocad
and use the myroutine i get an error and the application doesnt function
Imports System
Imports Autodesk.AutoCAD
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common
Imports Autodesk.AutoCAD.ApplicationServices.DocumentExtension
Public Class AdskCommands
Public ReadOnly Property ThisDrawing() As AcadDocument
Get
Return Application.DocumentManager.MdiActiveDocument.GetAcadDocument()
End Get
End Property
<Autodesk.AutoCAD.Runtime.CommandMethod("myroutine")> _
Public Sub myRoutine()
ThisDrawing.Utility.Prompt("Hello World from .NET")
End Sub
End Class
i added all the references and put all local copy to false
anyone a idea what i do wrong?
Imports Autodesk.AutoCAD.ApplicationServices.DocumentExtension
That namespace was added in 2013 or maybe later, but fairly certain it was after 2010.
That is for VBA here is turtorial for VB.NET
http://usa.autodesk.com/adsk/servlet/index?id=18162650&siteID=123112
Its starts off with a topic thats considered advanced.
If you plan on using COM objects and nothing wrong at all with using them if they provide all you need, but would not waste time learning .NET environment just to use them. On the hand if your wanting to learn for AutoCAD and many other areas it i used for then look at .NET developers guide.
Earliest they have is 2012
using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Runtime; namespace HelloWorld { public class AdskCommands { [CommandMethod("Hello")] public void HelloWorld() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; ed.WriteMessage("Hello World from .NET (C#)"); } } }
hi _gile
thx for the advice maybe u are right
and will give C# a try
but i was write in the past programs in vba for autocad and vb.net for revit seemed like the right option
thanks again
I totally agree with Gilles, if free of choice go for C#. More samples and the preferred language of Microsoft as you can see in PowerShell. It's the successor for the DOS shell, build in Windows 7, 8 2008 etc. It understand DOS, Linux commands AND C#'s Net framework. And above all it's NOT Case Sensitive. To my opinion that's the biggest bump you have to take coming from VB(A).
@SENL1362 wrote:
And above all it's NOT Case Sensitive.
Maybe I misunderstood what you were trying to say but I belive that the above is an incorrect statement. C# is a case sensitive language. A variable with the name of "total" is not the same as a variable with the name of "Total" or "toTal". They are seperate and distinctive variable names in C#. This makes it a case sensitive language.
Hello Keith,
What i was trying to say is that c# is case sensitive, but PowerShell is not, and still be able to use c# like language.
See the sample below, the PowerShell variable $Window is the same as $window set to a static instance of a .NET class
Now i need less attension to "syntax" and can focus more on the real problems.