Introducing a new AutoCAD programming language and library: .NETScript and AutoCAD.X

Mar26

Written by:3/26/2013 4:32 PM

What is .NETScript?

.NETScript is a new programming language for CAD software, which is C# with JavaScript syntax. The used library is AutoCAD.X that is an extension of AutoCAD .NET API, but simpler to use, one line of code to do any single task. Bring effortless application development for AutoCAD and RealDWG.

Why do we need .NETScript?

CAD developers will still use C# to write code, but the same code will work on both AutoCAD desktop and the web (http://www.netscriptcad.com/code-store). Since AutoCAD supports varieties of programming platforms, .NETScript is an alternative to DesignScript but still have the strength of .NET API and the cross-platform of JavaScript.

What is the difference between .NETScript and C#?

.NETScript is C# but make use of JavaScript syntax, so the same code will work on both AutoCAD and the web browser. Developers will write the same code for computer (Windows), tablet and mobile devices (iOS, Android,…).

What is the difference between .NETScript and JavaScript?

.NETScript looks similar to JavaScript but remove the strongly-typed limitation of JavaScript with object-oriented foundation. Therefore, the web compiler will parse .NETScript to native JavaScript to run on the web browser.

What is the difference between AutoCAD.X and AutoCAD .NET API?

.NETScript for AutoCAD uses AutoCAD.X which is an extension of AutoCAD .NET API, but the new API is short and simple with JavaScript oriented. Therefore, .NETScript is easy to use for both drafters and developers, for both CAD developers and JavaScript web developers.

How .NETScript compare to other CAD development languages?

.NETScript does not get developers off their familiar .NET languages, like DesignScript or JavaScript, faster than VBA and AutoLISP, drafter’s minded like AutoLISP, web minded like JavaScript. Developers can also use the independent AutoCAD.X library to reference into their .NET projects. Code less and work on many platforms is the target of .NETScript.

How does .NETScript support?

.NETScript plans to support many Autodesk products: AutoCAD (standard and vertical), Revit, Inventor, Maya, and Navisworks with their according extension libraries: AutoCAD.X, Revit.X, Inventor.X, Maya.X and Navisworks.X.

What is the base platform to run .NETScript?

.NETScript supports not only Autodesk products but also alternative software such as Bricscad and nanoCAD, which will use Teigha.X, an extension of Teigha.NET API.

NETScriptCAD.com is the website to download .NETScript for AutoCAD plugin, store and collaborate AutoCAD dynamic drawing and sample .NETScript code. The website has the online code editor for developers to write code and try out right the way on the web, without AutoCAD needed.

How is .NETScript different?

NETScriptCAD.com provides a scripting interface to execute the code directly on the web browser or send to the server (will be supported for massive cloud computing). The cool secret thing is developers can automate AutoCAD using the web browser. Code on the web can drive AutoCAD without ActiveX automation, use with the new command NETSERVER.

What is dynamic drawing?

Dynamic drawing is a normal DWG drawing that contains .NETScript code to do automation for this drawing. Like HTML page with JavaScript, DWG file is considered as HTML and stored .NETScript code is considered as JavaScript to drive this drawing.

To create a dynamic drawing, after loading .NETScript for AutoCAD plugin into AutoCAD, type NETSCRIPT command to show the code editor, type the code and hit Save (or Ctrl-S). Then this drawing will become dynamic. When this drawing is opened next time, run NETSCRIPT command again to see its stored code and then manually execute it. .NETScript does NOT allow automatic execution for binary security, no unexpected code allow to run without user permission.

New AutoCAD commands from .NETScript for AutoCAD:

NETSCRIPT: show the code editor (which supports intellisense and code completion) which is Basic Code Editor by default, users can switch to Advanced Code Editor (still in development).

NETRUN: run the given online URL of .NETScript file (.ns extension) or the given file location on local computer.

NETFORM: to be announced.

NETSHARE: to be announced.

> : this is a special command, to turn AutoCAD into command line code execution. For example, hit “>” key and Enter, then type code LineX.From(0, 0, 0).To(200, 100, 0) to draw a line. It is just simple as AutoLISP.

.NETScript uses suffix “X” for its classes, to allow AutoCAD.X to work together with the official AutoCAD .NET API. So developers can make use AutoCAD.X library for their .NET projects, no need to learn new languages.

.NETScript CAD now releases for technology preview, to receive feedback from developers. .NETScript for AutoCAD and AutoCAD.X library are still on beta testing and the AutoCAD.X API is still being updated and changed. For the latest software download, please get it from http://www.netscriptcad.com/download . For now, there is still no installation package, just unzip the downloading package and use NETLOAD to load the file NetScript.Acad.Plugin.dll in AutoCAD. The current build is used for AutoCAD 2013. I plan to build .NETScript for AutoCAD from 2009 version upward.

.NETScript CAD is still on development as my side home project (I am still working full-time now). I need to protect my ideas and tools. Autodesk or someone who tries to replicate my solutions needs to ask for my permission and copyright. I used to plan to introduce .NETScript on the time of AU 2012 but wait until now to make it more mature. So I hope Autodesk will protect ideas for developers and software vendors.