Use the Advance Steel API and C# to create a Hello World program using the directions provided.
The Hello World walkthrough covers the following topics:
The first step in writing a C# program with Visual Studio is to choose a project type and create a new Class Library.
Project….
Properties
Build
Figure 1: Add New Project
Figure 2: Platform Target
A number of components make up the Advance Steel API. They are installed with Advance Steel and can be found in subdirectories of Advance Steel 2022 installation folder. The Advance Steel 2022 installation folder is stored in the 'BinPath' value of the HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R23.1\ACAD-3026 registry key. You need to add references to the following components in order to compile the project.
| Component | Description |
|
ASNetRuntime.dll |
Required to compile the Addon |
|
ASMgd.dll |
Main Advance Steel access |
|
ASCADLinkMgd.dll |
CAD - related objects access (database, object id, …) |
|
ASGeometryMgd.dll |
Advance Steel geometry - needed to interact with Advance Steel objects |
|
ASProfilesMgd.dll |
Advance Steel profiles database access |
|
ASModelerMgd.dll |
Advance Steel modeler access |
| ASObjectsMgd.dll | Main Advance Steel objects access |
To add references to the required components, follow these steps:
Figure 3: Set Copy Local to False for Advance Steel references
There are three main steps to adding code to an Advance Steel Addon:
A default class called Class1 should have been created with the new project.
|
Code Region: Implement IExtensionApplication |
using Autodesk.AdvanceSteel.Runtime;
namespace HelloWorld
{
public sealed class Plugin : IExtensionApplication
{
void IExtensionApplication.Initialize()
{
}
void IExtensionApplication.Terminate()
{
}
}
}
|
Implement Interface from the Intellisense menu to have code added for the IExtensionApplication methods Initialize() and Terminate().

Figure 4: Use Intellisense to implement the interface
|
Code Region: Create a command class |
using Autodesk.AdvanceSteel.CADAccess;
using Autodesk.AdvanceSteel.DocumentManagement;
using Autodesk.AdvanceSteel.Runtime;
using System.Windows.Forms;
namespace HelloWorld
{
public class TestClass
{
[CommandMethodAttribute("TEST_GROUP", "HelloWorld", "HelloWorld", CommandFlags.Modal)]
public void SayHelloWorld()
{
MessageBox.Show("Hello World!");
}
}
}
|
An Advance Steel addon must have a method with the CommandMethodAttribute as shown in the sample code above. The parameters for the CommandMethodAttribute are:
Note that the options for CommandFlags are the same as for the AutoCAD Managed .NET API and the full list of options can be found here.
An Advance Steel addon must include certain Informational Attribute directives. These belong in the AssemblyInfo.cs files.
|
Code Region: Add an ExtensionApplicationAttribute |
[assembly: ExtensionApplicationAttribute(typeof(HelloWorld.Plugin))] |
|
Code Region: Add a CommandClassAttribute |
[assembly: CommandClassAttribute(typeof(HelloWorld.TestClass))] |
After following these steps, the AssemblyInfo.cs file will look something like this:
|
Code Region: Sample AssemblyInfo.cs |
using Autodesk.AdvanceSteel.Runtime;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HelloWorld")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HelloWorld")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ExtensionApplicationAttribute(typeof(HelloWorld.Plugin))]
[assembly: CommandClassAttribute(typeof(HelloWorld.TestClass))]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("85900596-22ee-4873-bbd6-7f970d32b5af")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Third party addons will be loaded according to information read from a configuration xml, which should be placed in the Addons folder: The Addons folder has to be a direct subfolder of the Advance Steel install folder. If the Addons folder is not there it should be created. A sample configuration xml can be found below (see MyAddons.xml):
<?xml version="1.0" encoding="utf-8"?> <AddonsData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Addons> <Addon> <Name>HelloWorld</Name> <FullPath>C:\Samples\HelloWorld\HelloWorld\Bin\Debug\HelloWorld.dll</FullPath> </Addon> <Addon> <Name>MyAddon1</Name> <FullPath>C:Samples\MyAddon1.dll</FullPath> </Addon> <Addon> <Name>MyAddon2</Name> <FullPath>C:Samples\MyAddon1.dll</FullPath> </Addon> </Addons> </AddonsData>
This only needs to be done once per addon .dll. Any new commands added to the assembly designated by the " CommandMethodAttribute" attribute will be automatically recognized as a separate command that can be run when Advance Steel is loaded.
To run the addon command, start Advance Steel. Then simply type in the name of the command, in this case, HelloWorld, and hit enter.
If you need to debug your addon, you can follow these steps: