Professional Documents
Culture Documents
Help - Walkthrough - Hello World - Autodesk
Help - Walkthrough - Hello World - Autodesk
Help - Walkthrough - Hello World - Autodesk
Use the Advance Steel API and C# to create a Hello World program using the directions provided.
All operations and code in this section were created using Visual Studio 2017.
https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-A4DA627E-6680-4388-9C04-79F5F3D9D075 1/10
11/10/21, 4:29 PM Help | Walkthrough: Hello World | Autodesk
https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-A4DA627E-6680-4388-9C04-79F5F3D9D075 2/10
11/10/21, 4:29 PM Help | Walkthrough: Hello World | Autodesk
Add References
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 2021 installation folder. The Advance Steel 2021 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
1. If the Solution Explorer window is not open, select Solution Explorer from the View menu.
2. In the Solution Explorer, right-click References to display a context menu.
3. From the context menu, click Add Reference. The Reference Manager window appears.
4. In the Reference Manager window, click the Browse button. A window to select files appears.
5. Browse to the Advance Steel 2021 installation folder.
6. Click the Add button to select the dll and close the window.
7. The selected dll should now be listed in the Reference Manager with a checkmark next to it.
8. Repeat steps 4-8 until all components in the table above are added. Note that when selecting dlls to
add, multiple dlls may be selected at one time.
9. In the Reference Manager, click OK to close the window.
10. The selected components will now appear in the Solution Explorer under the References folder.
11. Select the newly added references and change their Copy Local property to False.
https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-A4DA627E-6680-4388-9C04-79F5F3D9D075 4/10
11/10/21, 4:29 PM Help | Walkthrough: Hello World | Autodesk
Since this example also uses a Windows MessageBox, you will need to add a reference to the
System.Windows.Forms assembly. To do this:
https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-A4DA627E-6680-4388-9C04-79F5F3D9D075 5/10
11/10/21, 4:29 PM Help | Walkthrough: Hello World | Autodesk
Add Code
There are three main steps to adding code to an Advance Steel Addon:
Implement IExtensionApplication
A default class called Class1 should have been created with the new project.
1. Right-click on Class1.cs in the Solution Explorer and select Rename from the context menu.
2. Rename the file Plugin.cs (and select 'Yes' when Visual Studio prompts you to perform a renaming in
your project of all references to the code element 'Class1') .
3. Replace the text in Plugin.cs with the sample code below.
using Autodesk.AdvanceSteel.Runtime;
namespace HelloWorld
void IExtensionApplication.Initialize()
void IExtensionApplication.Terminate()
Tip: The Visual Studio Intellisense feature can create a skeleton implementation of an interface for you,
adding stubs for all the required methods. When creating a class that implements IExtensionApplication as
in the example above, you can right-click on the IExtensionApplication text and select Implement Interface
Implement Interface from the Intellisense menu to have code added for the IExtensionApplication
methods Initialize() and Terminate().
https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-A4DA627E-6680-4388-9C04-79F5F3D9D075 6/10
11/10/21, 4:29 PM Help | Walkthrough: Hello World | Autodesk
using Autodesk.AdvanceSteel.CADAccess;
using Autodesk.AdvanceSteel.DocumentManagement;
using Autodesk.AdvanceSteel.Runtime;
using System.Windows.Forms;
namespace HelloWorld
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:
groupName - The name of the group to which the command will be added. If the group does not exist,
it will be created before the command is added.
globalName - The command name to add. This name represents the global or untranslated name.
localizedNameId - The command name to add. This name represents the local or translated name.
flags - Flags associated with the command.
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 (http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-F77E8FE0-8034-
4704-93BD-F717608F8223) .
An Advance Steel addon must include certain Informational Attribute directives. These belong in the
AssemblyInfo.cs files.
1. In the Solution Explorer, click on the Properties folder to expose the AssemblyInfo.cs file.
2. Open the AssemblyInfo.cs file. This file already contains some assembly attributes such as the title
and copyright.
3. Add a using statement at the top of the file for Autodesk.AdvanceSteel.Runtime.
https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-A4DA627E-6680-4388-9C04-79F5F3D9D075 7/10
11/10/21, 4:29 PM Help | Walkthrough: Hello World | Autodesk
[assembly: ExtensionApplicationAttribute(typeof(HelloWorld.Plugin))]
5. Add a new informational attribute directive called CommandClassAttribute as shown below. Note that
it takes as a parameter the type of the class which implements a command. This is required to be able
to register the command with Advance Steel.
[assembly: CommandClassAttribute(typeof(HelloWorld.TestClass))]
After following these steps, the AssemblyInfo.cs file will look something like this:
using Autodesk.AdvanceSteel.Runtime;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("HelloWorld")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HelloWorld")]
[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
[assembly: ComVisible(false)]
https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-A4DA627E-6680-4388-9C04-79F5F3D9D075 8/10
11/10/21, 4:29 PM Help | Walkthrough: Hello World | Autodesk
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("85900596-22ee-4873-bbd6-7f970d32b5af")]
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<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.
https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-A4DA627E-6680-4388-9C04-79F5F3D9D075 9/10
11/10/21, 4:29 PM Help | Walkthrough: Hello World | Autodesk
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:
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-
NonCommercial-ShareAlike 3.0 Unported License. Please see the Autodesk Creative Commons FAQ
for more information.
© 2021 Autodesk Inc. All rights reserved
https://help.autodesk.com/view/ADSTPR/2021/ENU/?guid=GUID-A4DA627E-6680-4388-9C04-79F5F3D9D075 10/10