The following table compares VBA functions with the similar VB.NET and C# functions and operators. The ActiveX library is indicated by “AutoCAD.Application” and the .NET Managed library equivalents are indicated by “Autodesk.AutoCAD” and the VB.NET or C# equivalents are listed as a function or operator.
Math Functions |
|
---|---|
ActiveX, VBA, or Visual Basic 6 |
VB.NET and C# equivalent (same unless noted) |
+ (addition operator) |
+ (addition operator) |
- (subtraction operator) |
- (subtraction operator) |
* (multiplication operator) |
* (multiplication operator) |
/ (division operator) |
/ (division operator) |
^ (exponentiation operator) |
^ (exponentiation operator) |
Abs function |
System.Math.Abs function |
Atn function |
System.Math.Atan function |
Cos function |
System.Math.Cos function |
Exp function |
System.Math.Exp function |
Log function |
System.Math.Log function |
Max function |
System.Math.Max function |
Min function |
System.Math.Min function |
Mod function |
|
Sin function |
System.Math.Sin function |
Sqr function |
System.Math.Sqrt function |
Conditional and Loop Statements |
|
---|---|
ActiveX, VBA, or Visual Basic 6 |
VB.NET and C# equivalent (same unless noted) |
Do Until… Loop statement |
|
Do While… Loop statement |
|
For Each...Next statement |
|
If… Then… Else...End If statement |
|
Select Case statement |
|
While… Wend statement |
|
Logic Statements |
|
---|---|
ActiveX, VBA, or Visual Basic 6 |
VB.NET and C# equivalent (same unless noted) |
= (equal to comparison operator) |
|
<> (not equal to comparison operator) |
|
< (less than comparison operator) |
< (less than comparison operator) |
<= (less than or equal to comparison operator) |
<= (less than or equal to comparison operator) |
> (greater than comparison operator) |
> (greater than comparison operator) |
>= (greater than or equal to comparison operator) |
>= (greater than or equal to comparison operator) |
And function |
|
Eqv operator |
Not provided, use other bitwise comparison methods instead |
Imp operator |
Not provided, use = comparison instead |
Is operator |
|
IsArray function |
|
IsNull function |
|
Like operator |
|
Not operator |
|
Or function |
|
Data Conversion Functions |
|
---|---|
ActiveX, VBA, or Visual Basic 6 |
VB.NET and C# equivalent (same unless noted) |
Asc function |
|
AutoCAD.Application.ActiveDocument. Utility.AngleToReal method |
Autodesk.AutoCAD.Runtime.Converter. StringToAngle method |
AutoCAD.Application.ActiveDocument. Utility.AngleToString method |
Autodesk.AutoCAD.Runtime.Converter. AngleToString method |
AutoCAD.Application.ActiveDocument. Utility.RealToString method |
Autodesk.AutoCAD.Runtime.Converter. DistanceToString function |
CDbl Function |
|
Chr function |
|
CInt Function |
|
Fix function |
|
Int function |
|
Str function |
|
StrConv function |
|
Basic String Manipulation Functions |
|
---|---|
ActiveX, VBA, or Visual Basic 6 |
VB.NET and C# equivalent (same unless noted) |
& operator (concatenate string) |
|
Len function |
|
Mid function |
|
Get Input from the AutoCAD Command Prompt Functions |
|
---|---|
ActiveX, VBA, or Visual Basic 6 |
VB.NET and C# equivalent (same unless noted) |
AutoCAD.Application.ActiveDocument. Utility.GetAngle method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. GetAngle function |
AutoCAD.Application.ActiveDocument. Utility.GetCorner method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. GetCorner function |
AutoCAD.Application.ActiveDocument. Utility.GetDistance method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. GetDistance function |
AutoCAD.Application.ActiveDocument. Utility.GetEntity method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. GetEntity function |
AutoCAD.Application.ActiveDocument. Utility.GetInteger method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. GetInteger function |
AutoCAD.Application.ActiveDocument. Utility.GetKeyword method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. GetKeyword function |
AutoCAD.Application.ActiveDocument. Utility.GetOrientation method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. GetAngle function |
AutoCAD.Application.ActiveDocument. Utility.GetPoint method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. GetPoint function |
AutoCAD.Application.ActiveDocument. Utility.GetReal method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. GetDouble function |
AutoCAD.Application.ActiveDocument. Utility.GetString method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. GetString function |
AutoCAD.Application.ActiveDocument. Utility.InitializeUserInput |
Autodesk.AutoCAD.EditorInput. PromptKeywordOptions |
Basic AutoCAD Application and Drawing Functions |
|
---|---|
ActiveX, VBA, or Visual Basic 6 |
VB.NET and C# equivalent (same unless noted) |
AutoCAD.Application.ActiveDocument. Utility.AngleFromXAxis method |
Autodesk.AutoCAD.Geometry.Point2d(point1). GetVectorTo(point2).Angle property |
AutoCAD.Application.ListARX method |
Autodesk.AutoCAD.Runtime.SystemObjects. DynamicLinker.GetLoadedModules function |
AutoCAD.Application.LoadARX method |
Autodesk.AutoCAD.Runtime.SystemObjects. DynamicLinker.LoadModule method |
AutoCAD.Application.UnloadARX method |
Autodesk.AutoCAD.Runtime.SystemObjects. DynamicLinker.UnloadModule method |
AutoCAD.Application. Documents.Close method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument. CloseAndDiscard method or Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument. CloseAndSave method |
AutoCAD.Application.ActiveDocument. SendCommand method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument. SendStringToExecute method |
AutoCAD.Application.ActiveDocument. Dictionaries.Add method |
|
AutoCAD.Application.ActiveDocument. Dictionaries.Item method |
|
AutoCAD.Application.ActiveDocument. ModelSpace property |
|
AutoCAD.Application.ActiveDocument. ModelSpace.Item method |
|
AutoCAD.Application.ActiveDocument. ModelSpace.Count property |
|
AutoCAD.Application.ActiveDocument. ModelSpace.Add<entityname> method |
|
AutoCAD.Application.ActiveDocument. ActiveSpace property |
|
AutoCAD.Application.ActiveDocument. PaperSpace property |
|
AutoCAD.Application.ActiveDocument. ActiveLayout property |
|
AutoCAD.Application.ActiveDocument. PurgeAll method |
HostApplicationServices.WorkingDatabase. Purge method |
AutoCAD.Application.GetVariable method |
Autodesk.AutoCAD.ApplicationServices.Application. GetSystemVariable function |
AutoCAD.Application.MenuBar property |
Autodesk.AutoCAD.ApplicationServices.Application. MenuBar property |
AutoCAD.Application.MenuGroup property |
Autodesk.AutoCAD.ApplicationServices.Application. MenuGroups property |
AutoCAD.Application.ActiveDocument. PickfirstSelectionSet property |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. SelectImplied function |
AutoCAD.Application.ActiveDocument. Utility.PolarPoint method |
Not provided, use the Point2d and Point3d classes from the Geometry namespace to calculate a new point |
AutoCAD.Application. Preferences property |
Autodesk.AutoCAD.ApplicationServices.Application. Preferences property |
AutoCAD.Application.ActiveDocument. Utility.Prompt method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. WriteMessage method |
AutoCAD.Application.Quit method |
Autodesk.AutoCAD.ApplicationServices.Application. Quit method |
AutoCAD.Application.ActiveDocument. SelectionSets.Add method |
Not needed/provided |
AutoCAD.Application.ActiveDocument. SelectionSets.SelectionSet.Item method |
Autodesk.AutoCAD.EditorInput.SelectionSet. selectionSet.Item(object) method |
AutoCAD.Application.ActiveDocument. SelectionSets.SelectionSet.Delete method |
Autodesk.AutoCAD.EditorInput.SelectionSet. selectionSet.Item(object).Delete method |
AutoCAD.Application.ActiveDocument. SelectionSets.SelectionSet.SelectOnScreen method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. GetSelection method |
AutoCAD.Application.ActiveDocument. SelectionSets.SelectionSet.Count property |
Autodesk.AutoCAD.EditorInput.SelectionSet. selectionSet.Count property |
AutoCAD.Application.ActiveDocument. SelectionSets.SelectionSet.SelectAtPoint method |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.Editor. SelectCrossingWindow method |
AutoCAD.Application.SetVariable method |
Autodesk.AutoCAD.ApplicationServices.Application. SetSystemVariable method |
AutoCAD.Application.ActiveDocument. Utility.TranslateCoordinates method |
Not provided, use the Matrix3d class from the Geometry namespace to translate points between different coordinate systems |
AutoCAD.Application.Version property |
Autodesk.AutoCAD.ApplicationServices.Application. Version property |
ThisDrawing |
Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument property and HostApplicationServices.WorkingDatabase property |
Basic VBA and Visual Basic 6 Functions and Statements |
|
---|---|
ActiveX, VBA, or Visual Basic 6 |
VB.NET and C# equivalent (same unless noted) |
AppActivate AutoCAD.Application.Caption function |
|
Dir function |
System.IO.Directory.Exists function |
Error object/method/properties |
|
Function and End Function keywords |
|
Input function |
|
LBound(arrayName) function |
|
Line Input function |
|
MsgBox function |
MessageBox.Show method |
object(n) syntax |
|
Open function |
System.IO.File.Open function |
ReDim statement |
|
Set statement |
Not needed/provided |
Shell function |
|
Sub and End Sub keywords |
|
TypeName function |
|
UBound(arrayName) function |
|