← Docs indexAMS Add-Ins Developer Guide

API 2.8 — This guide targets AMS API 2.8 (current build).

AMS Add-Ins Developer Guide

This guide is for people who want to write their own AMS add-in from scratch. You don't need to know the internals of AMS to follow it. Every function in this guide exists in the AMSPRO source code, and each one names the file it comes from. Anything I could not verify is marked (unverified).

Sources: AMS\AMSPRO\Core\ (IAddIn.cs, IAddInV2.cs, AddInAttribute.cs, AddInManager.cs, AddInSupport.cs, AMSAPI*.cs, IAMS*Api.cs) and AMS\AMSPRO\Form1.cs, as of 13.10.2026.

Contents

  1. What an add-in is, and prerequisites
  2. Creating the project step by step
  3. Entry point: IAddIn, IAddInV2, [AddIn]
  4. Build and deployment: how AMS discovers, loads and lists an add-in
  5. Complete API reference
  6. Model data structure: reading and writing
  7. Analysis and results
  8. UI and dialogs
  9. Debugging, logging, versioning, distribution
  10. Full examples
  11. Troubleshooting and FAQ

1. What an add-in is, and prerequisites

An add-in is a .NET DLL that you put in the Plugins folder next to AMSPRO.exe. When AMS starts, it scans that folder for classes that carry the [AddIn] attribute and implement IAddIn, and adds a command for each one to the Add-ins menu. When the user clicks the command, AMS calls your Execute(). From there you can read and change the model and open your own windows.

The add-in talks to AMS through a single AMSAPI object, which implements several interfaces:

Interface Provides Since API
IAddIn basic add-in contract 1.x
IAMSApi joints, frames, sections, supports, selection, events, undo, messages 2.0
IAddInV2, IAddInContext, IAddInSettings, IAddInLocalized context, settings, localized texts 2.0
IAMSModelingApi slabs/walls (shells), groups, stories 2.1
IAMSReinforcementApi, IAMSArchitectureApi rebar, architectural walls, doors/windows, roofs, stairs 2.2 (railings, shear walls 2.3)
IAMSLoadsApi load patterns, combinations, shell/frame loads 2.4–2.5
IAMSResultsApi analysis frame forces, material strengths 2.6
IAMSSectionApi section profile geometry 2.7
IAMSLoadQueryApi, IAMSFrameEditApi reading joint/frame loads, frame rotation angle 2.8

AMS build status (checked 13.10.2026): - All of these interfaces, including IAMSLoadQueryApi and IAMSFrameEditApi, are present in the two local development builds on this machine: AMS\AMSPRO\bin\Debug\AMSPRO.exe (13.10.2026) and bin\Release\AMSPRO.exe (12.10.2026). I checked this by inspecting the types inside the executable. - (unverified) I could not confirm which of them ship in the public build (24.8.1) or in 26.9.1. Every local build reports file version 4.2.1.0, which does not tell you the public version. Always check for an interface at runtime (section 5.0). - Important: in the current code AMSAPI.ApiVersion = "2.8" but AMSAPI.CurrentApiVersion = new Version(2, 7) (AMSAPI.cs line 17, AMSAPI.V2.cs line 15). AMS compares MinApiVersion against CurrentApiVersion, so MinApiVersion = "2.8" gets your add-in refused. Use "2.7" or lower and test for IAMSLoadQueryApi with as.

Prerequisites

Item Value Source
IDE Visual Studio 2022 (any edition, Community is fine) with the .NET desktop development workload the existing developer guide uses VS2022 MSBuild
Framework .NET Framework 4.8 (not .NET 6/8) TowerGenerator.csproj: TargetFrameworkVersion v4.8
C# 7.3 LangVersion 7.3
Platform AnyCPU
Main reference AMSPRO.exe itself (it contains AMSPRO.IAddIn, AMSPRO.AMSAPI and the rest). There is no separate API DLL Directory.Build.props
Optional Newtonsoft.Json.dll from the AMS folder
.NET references System, System.Core, System.Drawing, System.Windows.Forms

Where AMSPRO.exe lives on the development machine: - C:\Dev\AMS\AMSPRO\bin\Debug\AMSPRO.exe - C:\Dev\AMS\AMSPRO\bin\Release\AMSPRO.exe - For end users it is the AMS install folder, for example C:\Program Files\AMS\AMSPRO.exe (unverified, it depends on the installer).

Golden rule: set Copy Local = False on every AMS reference.


2. Creating the project step by step

2.1 In Visual Studio

  1. Start Visual Studio 2022 and choose Create a new project.
  2. Type Class Library in the search box and pick Class Library (.NET Framework) for C#. The plain "Class Library" template targets modern .NET and will not work.
  3. Click Next. On the Configure your new project screen, set Project name (e.g. HelloAms), Location, and Framework = .NET Framework 4.8.
  4. Click Create, then delete or rename Class1.cs.
  5. In Solution Explorer, right-click References and choose Add Reference…: - On the Browse page, click Browse… and select AMSPRO.exe. If you don't see it, change the file filter to All files. - On the Assemblies > Framework page, tick System.Drawing and System.Windows.Forms. - Click OK.
  6. Select the AMSPRO reference and, in the Properties window (F4), set Copy Local = False.
  7. Open the project Properties: - Application: Output type = Class Library, Target framework = .NET Framework 4.8. An Assembly name like MyCompany.AddIns.HelloAms is a good choice. - Build: Platform target = Any CPU. - Debug: see section 9.

2.2 Ready-made project file

Instead of the steps above, you can write the project file yourself. This is the classic format that the existing AMS add-ins use:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <OutputType>Library</OutputType>
    <RootNamespace>HelloAms</RootNamespace>
    <AssemblyName>MyCompany.AddIns.HelloAms</AssemblyName>
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    <LangVersion>7.3</LangVersion>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>full</DebugType>
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <!-- change this to your AMSPRO.exe path -->
    <AmsExePath Condition="'$(AmsExePath)' == ''">C:\Dev\AMS\AMSPRO\bin\Debug\AMSPRO.exe</AmsExePath>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="AMSPRO">
      <HintPath>$(AmsExePath)</HintPath>
      <Private>False</Private>   <!-- = Copy Local False -->
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="HelloAddIn.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

To build from the command line:

"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" HelloAms.csproj /p:Configuration=Release /p:AmsExePath=C:\path\to\AMSPRO.exe

3. Entry point

3.1 IAddIn (required): Core\IAddIn.cs, API 1.x

Member Type Meaning
Name string menu text. Must be unique: if two add-ins share a name, only the first loads
Description, Version, Author string
Icon System.Drawing.Image optional, may be null
void Initialize(AMSAPI api) called once on load; keep api
void Execute() user clicked the menu command
void Shutdown() AMS closing or Reload add-ins; close your windows here

void OnLoaded(IAddInContext context) is called right after Initialize. bool CanExecute() returns false to block the run.

3.3 IAddInContext

Member Type Meaning
Api IAMSApi the API as an interface (mockable)
Host AMSAPI concrete object, needed for ShowDock, ShowDialog and MainForm
Settings IAddInSettings %APPDATA%\AMS\AddIns\<Id>\settings.json
AddInFolder string folder of your DLL
DataFolder string writable per-add-in folder under %APPDATA%\AMS\AddIns
HostApiVersion Version
Log(message, level = Info) log line prefixed with your add-in name

3.4 IAddInSettings (IAddInV2.cs, implemented in AddInSupport.cs)

FilePath · Get<T>(key, defaultValue) · TryGet<T> · Set<T> · Contains · Remove · Save() · Reload(). Values are stored as JSON (Newtonsoft.Json), and AMS also saves them on shutdown.

int n = ctx.Settings.Get("LastCount", 10);
ctx.Settings.Set("LastCount", 25);
ctx.Settings.Save();

3.5 [AddIn]: Core\AddInAttribute.cs

Without this attribute AMS never sees the class.

Property Type Meaning
Name (ctor) string menu text
Description string tooltip
Version, Author string
Category string sub-menu under Add-ins
MinApiVersion string, e.g. "2.0" refuse loading on older hosts; leave empty for any version. Do not use "2.8" (see section 1)
Id string stable id for the settings folder; defaults to the type's full name
Order int sort order inside the category, lower first, default 0

3.6 IAddInLocalized (optional)

public AddInDisplayInfo GetDisplayInfo(AmsLanguage language)
{
    if (language == AmsLanguage.Arabic)  return new AddInDisplayInfo { Name = "مرحباً AMS", Description = "مثال", Category = "أمثلة" };
    if (language == AmsLanguage.Russian) return new AddInDisplayInfo { Name = "Привет, AMS", Description = "Пример", Category = "Примеры" };
    return new AddInDisplayInfo { Name = "Hello AMS", Description = "Example", Category = "Examples" };
}

AMS calls this after loading and again whenever the language changes. IAddIn.Name stays the stable identity.

3.7 What AMS checks (AddInManager.LoadAddInType)

  1. The class has [AddIn].
  2. It implements IAddIn, otherwise the state is Failed.
  3. It is not abstract and has a public parameterless constructor (AMS creates it with Activator.CreateInstance).
  4. MinApiVersion is not newer than CurrentApiVersion, otherwise the state is Incompatible.
  5. Name is not empty and not a duplicate.
  6. Initialize and OnLoaded do not throw. If either does, AMS calls Shutdown and records Failed.

4. Build and deployment

4.1 Where the DLL goes

4.2 Load sequence (Form1.cs lines 40–42)

  1. new AddInManager(this), then LoadAllAddIns().
  2. For each DLL: Assembly.LoadFrom, GetTypes(), then find the types that carry [AddIn].
  3. Create an instance, call Initialize(api), then OnLoaded(context) (V2), then GetDisplayInfo if it exists.
  4. Everything is logged to Plugins\ams-addin.log (Form1.cs line 175) and to the AMS log window.
  5. Each DLL loads inside its own try/catch, so one broken add-in never blocks the others.

4.3 Menu

4.4 Reloading while you develop

Reload add-ins calls Shutdown() on every add-in and scans again. DLLs that were loaded before are re-read from bytes, so the file is not locked and you can rebuild while AMS is running. The old assembly stays in memory, though, so restart AMS after changing a shared dependency.


5. Complete API reference

5.0 General rules

var loads = ctx.Api as IAMSLoadsApi;        // null on hosts older than 2.4
if (loads == null) { ctx.Api.ShowMessage("This add-in needs a newer AMS (API 2.4)."); return; }

5.1 Version: AMSAPI.cs, AMSAPI.V2.cs

Member Type Note
AMSAPI.ApiVersion const string = "2.8" compiled into your DLL, so don't use it to detect the host
AMSAPI.CurrentApiVersion static Version = 2.7 this is the value compared with MinApiVersion
ApiVersionInfo Version API version of the running host (since 2.0)

5.2 IAMSApi: counts and queries (Core\IAMSApi.cs, implemented in AMSAPI.cs and AMSAPI.V2.cs), API 2.0

Member Returns Description
JointCount, FrameCount, ShellCount, SectionCount int model sizes
TryGetJointData(int index, out JointData data) bool single joint; false if missing
TryGetFrameData(int index, out FrameData data) bool single frame
GetJointList() / GetFrameList() IReadOnlyList<…> snapshot of all elements
GetSectionList() IReadOnlyList<SectionInfo>
SectionExists(int sectionIndex) bool
GetLoadPatterns() IReadOnlyList<LoadPatternInfo>
GetGroupNames() IReadOnlyList<string>
GetBoundingBox() BoundingBox3D IsEmpty when there are no joints
FindJoint(x, y, z, tolerance = 0.01) int joint index or 0
GetSelectedJoints(), GetSelectedFrames() IReadOnlyList<int> user selection
SetSelection(IEnumerable<int> joints, IEnumerable<int> frames), ClearSelection() void
foreach (int f in api.GetSelectedFrames())
{
    FrameData fd;
    if (api.TryGetFrameData(f, out fd))
        api.Log($"Frame {f}: {fd.StartJoint}->{fd.EndJoint}, L={fd.Length:0.###}, sec={fd.Section}");
}

5.3 IAMSApi: creation and editing, API 2.0

Member Returns Exceptions / notes
AddJoint(x, y, z, tolerance = 0.01, applyStoryRestraints = true) int (new or existing joint) ArgumentOutOfRangeException if tolerance < 0 or NaN; ArgumentException if a value is not finite
AddFrame(int jointI, int jointJ, int section, double rotateAngle = 0) int frame index, or 0 if rejected (zero length, I == J) IndexOutOfRangeException (joint), ArgumentOutOfRangeException (section). Angle in degrees
AddBeam(x1,y1,z1, x2,y2,z2, int section, double rotateAngel = 0) int API 1.x, creates joints automatically. The rotateAngel spelling is kept on purpose for compatibility. Note: when nothing is created it returns the current frame count, not 0
AddFrames(IEnumerable<FrameRequest>, CancellationToken = default, Action<int,int> progress = null) BatchResult one UI call; ArgumentNullException on null
AddBeams(IEnumerable<BeamRequest>, …) BatchResult batch by coordinates
SetSupport(int jointIndex, SupportType) void Free, Fixed, Pinned, Roller
SetJointRestraints(index, fixX, fixY, fixZ, fixRx, fixRy, fixRz) void 1 = restrained, 0 = free; IndexOutOfRangeException
SetJointForce(int index, int patternIndex, double fx, double fy, double fz) void 0-based pattern, global axes, model force units. sign: global axes, positive fz = up (+Z), so downward loads are negative (verified in Analysis Forms\AnalysisModel.cs: the mass source converts loads with JointMass -= pz/g)
SetFrameSection(int index, int sectionIndex) void
CleanModel() void erases all geometry (sections, materials and loads remain) and raises ModelCleared

BatchResult: Requested, Created, Skipped, Failed, Cancelled, FrameIndices, Errors, Success. FrameRequest(jointI, jointJ, section, rotateAngle = 0) · BeamRequest(x1,y1,z1,x2,y2,z2, section, rotateAngle = 0).

var reqs = new List<FrameRequest> { new FrameRequest(a, b, 1), new FrameRequest(b, c, 1, 90) };
BatchResult r = api.AddFrames(reqs);
if (!r.Success) api.Log(string.Join("\n", r.Errors), LogLevel.Warning);

5.4 IAMSApi: events, undo and services, API 2.0

Member Description
event ModelChanged, event ModelCleared raised on the UI thread (ModelChanged is coalesced)
IDisposable BeginUpdate() suspends notifications until disposed
IAMSTransaction BeginTransaction(string name) one undo step on Commit(). There is no rollback: without Commit the changes stay, no undo step is recorded, and AMS only logs a warning. Members: Name, IsCommitted, UndoSnapshotCreated, Commit(), Dispose()
Log(message, LogLevel level = Info) LogLevel: Info, Warning, Error, Debug
BeginProgress, UpdateProgress(int percent 0..100, status), EndProgress wait indicator
IProgressScope BeginProgressScope(status, allowCancel = true) Token, IsCancellationRequested, Report, Cancel, ThrowIfCancellationRequested (throws OperationCanceledException)
RefreshView() redraws the plan and 3D views
ShowMessage(message, title = "AMS", icon = Information), bool ShowConfirm(message, title = "Confirm")
IsUiThread, Invoke, InvokeAsync run code on the UI thread
GetSettings(addInId), GetAddInDataFolder(addInId)
CurrentLanguage (English=0, Arabic=1, Russian=2), CurrentCulture, IsRightToLeft, event LanguageChanged

5.5 AMSAPI-only members: AMSAPI.cs

Member Description
Form MainForm AMS main window, used as the owner of your windows
DialogResult ShowDialog(Form) modal dialog owned by AMS
void ShowDock(Form) modeless window owned by AMS (floating, not a docked panel)
GetJoints(), GetJoint(i), TryGetJoint, GetJointCoordinates(i) → (x,y,z), SetJointCoordinates(i,x,y,z), CommitJoint(i) legacy joint access
GetFrames(), GetFrame(i), TryGetFrame, SetFrameSelected(i, 0/1), SetFrameJoints(i, j1, j2), CommitFrame(i) legacy frame access
GetShells(), GetShell(i), TryGetShell, SetShellSelected, SetShellSection, CommitShell shells
SectionData GetSection(i) (throws IndexOutOfRangeException), TryGetSection Area, I2, I3, J, D, BF, TF, TW, Material, modifiers
GetStructuralModel(), SyncStructuralModelToLegacy(), ImportLegacyIntoStructuralModel() direct access to the internal model. Advanced and discouraged: the types are internal and may change

5.6 IAMSModelingApi (2.1): IAMSModelingApi.cs, implemented in AMSAPI.Modeling.cs

Member Description
SlabSectionCount, WallSectionCount, GetSlabSections(), GetWallSections() ShellSectionInfo: Index, Name, MaterialIndex, Thickness
int AddShell(IReadOnlyList<int> joints, ShellKind kind, int section) Slab=1/Wall=2. Returns the shell index or 0. Throws ArgumentException (fewer than 3 joints, or a slab not on one level), IndexOutOfRangeException, or ArgumentOutOfRangeException
AddShells(IEnumerable<ShellRequest>, token, progress) ShellBatchResult
AddShellUniformLoad(shell, loadPattern, value) gravity direction, positive = downward, force/area; 1-based pattern
EnsureGroup(name), AddToGroup(group, frames, shells) at most 19 groups per element
GetStories() → StoryInfo(Index, Name, Height, Elevation); SetStories(baseElevation, IReadOnlyList<StoryDefinition>)

5.7 IAMSLoadsApi (2.4–2.5): AMSAPI.Loads.cs

Member Description
LoadPatternCount, LoadCombinationCount
int EnsureLoadPattern(name, type, selfWeight = 0) creates or updates the pattern and a matching linear static case; returns a 1-based index; ArgumentException on an empty name. type is free text and empty becomes "Other". The analysis recognises these exact, case-sensitive values: "Dead", "Live", "Reducible Live", "Wind", "Settlement", "Seismic" (AMSAPI.Loads.cs, AnalysisModel.cs)
GetLoadCombinations() → LoadCombinationInfo(Index, Name, Type, Factors[Name, Scale])
int EnsureLoadCombination(name, type, factors) creates or replaces
AddShellUniformLoad(shell, pattern, value, ShellLoadDirectionKind) Local1=0, Local2=1, Local3=2, GlobalX=3, GlobalY=4, Gravity=5
int ClearShellLoadsForPattern(pattern)
AddFrameUniformLoad(frame, pattern, valueForcePerLength, direction) 2.5
int ClearFrameLoadsForPattern(pattern) 2.5

5.8 IAMSResultsApi (2.6): AMSAPI.Results.cs

See section 7.

5.9 IAMSSectionApi (2.7): AMSAPI.Sections.cs

bool TryGetSectionProfile(int sectionIndex, out SectionProfileInfo profile) returns the outer polygon (OuterPolygon of Y,Z points about the centroid, in model length units) plus Depth, Width, Tw, Tf, OuterDiameter, Designation, TypeName.

5.10 IAMSLoadQueryApi and IAMSFrameEditApi (2.8): AMSAPI.LoadQuery.cs

These are present in both local builds (Debug 13.10, Release 12.10). (unverified) whether they are in the public build. Test for them with as; do not set MinApiVersion = "2.8".

Member Description
bool TryGetJointLoad(joint, loadPattern, out JointLoadInfo) global Fx..Mz, the same way the analysis assembles them; 1-based pattern
IReadOnlyList<FrameLoadInfo> GetFrameLoads(frame, loadPattern) Kind, IsMoment, Direction, Uniform, Value1/2, Distance1/2; IndexOutOfRangeException
double GetFrameRotateAngle(frame) degrees
void SetFrameRotateAngle(frame, angleDeg) recomputes the local axes; analysis results become stale

5.11 IAMSReinforcementApi, IAMSArchitectureApi (2.2–2.3)

Rebar: BeamRebarCount, GetBeamRebar, SetBeamRebar, AddBeamRebar, DeleteBeamRebar, the same set for columns, GetStairRebar/SetStairRebar, and Export/ImportBeamRebarJson / …ColumnRebarJson. Shear walls (2.3): ShearWallPierCount, Get/Set/Add/DeleteShearWallPierRebar, GetShearWallPierRebars, Get/SetShearWallDesignSettings, SyncShearWallRebarFromDesigner, PushShearWallRebarToDesignerEdits, Export/ImportShearWallPierRebarJson. Architecture: walls (ArchWallSectionCount, ArchWallCount, GetArchWallSections, SetArchWallSection, GetArchWall(s), AddArchWall(points, section, inversed=0), UpdateArchWall, DeleteArchWall); doors, windows and openings (AddDoor(wall, type, offsetAlong, sillHeight=0, swingSide=0, swingOut=0), AddWindow(…, sillHeight=-1), AddOpening, plus Update…, Delete…, …Types, Set…Type); roofs; stairs; railings (2.3). The authoritative field lists are in IAMSReinforcementApi.cs and IAMSArchitectureApi.cs. (unverified) I have not run a tested example against these interfaces.


6. Model data structure

Entity Read Write Fields
Joints GetJointList, TryGetJointData AddJoint, SetSupport, SetJointRestraints, SetJointCoordinates Index, X, Y, Z, FixX..FixRz, IsSelected, IsRestrained
Frames GetFrameList, TryGetFrameData AddFrame(s), AddBeam(s), SetFrameSection, SetFrameRotateAngle Index, StartJoint, EndJoint, Section, RotateAngle, Length, IsSelected
Shells ShellCount, GetShell(i) AddShell(s)
Sections GetSectionList, GetSection, TryGetSectionProfile no API to create frame sections; define them in AMS Index, Name, MaterialIndex, Area, I22, I33, TorsionalConstant
Materials TryGetSectionMaterial none Fy, Fu, E, IsSteel, Name (if Fu is undefined, AMS returns Fy × 1.5)
Load patterns GetLoadPatterns EnsureLoadPattern
Joint loads TryGetJointLoad (2.8) SetJointForce (0-based)
Frame loads GetFrameLoads (2.8) AddFrameUniformLoad, ClearFrameLoadsForPattern
Shell loads none AddShellUniformLoad
Load cases GetAnalysisCases (2.6) created automatically by EnsureLoadPattern
Combinations GetLoadCombinations EnsureLoadCombination
Groups, stories GetGroupNames, GetStories EnsureGroup, AddToGroup, SetStories

Deleting: the API has no call that deletes a single joint or frame. There is only CleanModel(), which erases all geometry, plus the delete calls for rebar and architectural objects.


7. Analysis and results

8. UI and dialogs

9. Debugging, logging, versioning, distribution

9.1 Debugging

A. Start from VS: in Project Properties, open Debug, choose Start external program and select AMSPRO.exe. Deploy the DLL to Plugins (9.2), then press F5. B. Attach: start AMS, then in VS choose Debug > Attach to Process…, select AMSPRO.exe, set Attach to = Managed (.NET Framework 4.x) and click Attach. Put the .pdb next to the DLL, or breakpoints won't bind.

9.2 Copy after build

<Target Name="DeployToAms" AfterTargets="Build">
  <PropertyGroup><AmsPlugins>$([System.IO.Path]::GetDirectoryName('$(AmsExePath)'))\Plugins\HelloAms\</AmsPlugins></PropertyGroup>
  <MakeDir Directories="$(AmsPlugins)" />
  <Copy SourceFiles="$(TargetPath);$(TargetDir)$(TargetName).pdb" DestinationFolder="$(AmsPlugins)" ContinueOnError="true" />
</Target>

Then use Add-ins > Reload add-ins.

9.3 Logging

api.Log and ctx.Log write to the AMS log window and to <AMS>\Plugins\ams-addin.log. When something goes wrong, open Add-ins > Add-in report.

9.4 Versioning

Keep [AddIn].Version and IAddIn.Version in sync. Set MinApiVersion to the lowest version you need ("2.0" for the basics, "2.6" for results) and test for optional interfaces with as. AMS rule: a minor version means additions, a major version means breaking changes.

9.5 Distribution

Ship a folder (or zip) containing HelloAms\<your>.dll and your private DLLs, and tell users to copy it to <AMS folder>\Plugins\ and restart AMS. Do not ship AMSPRO.exe or Newtonsoft.Json.dll.


10. Full examples

10.1 "Hello AMS": the smallest working add-in

HelloAddIn.cs:

using System;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using AMSPRO;

namespace HelloAms
{
    [AddIn("Hello AMS",
        Description = "Shows a short summary of the open model",
        Version = "1.0.0",
        Author = "Your name",
        Category = "Examples",
        MinApiVersion = "2.0",
        Id = "MyCompany.HelloAms")]
    public sealed class HelloAddIn : IAddInV2
    {
        private AMSAPI host;
        private IAddInContext ctx;

        public string Name { get { return "Hello AMS"; } }
        public string Description { get { return "Shows a short summary of the open model"; } }
        public string Version { get { return "1.0.0"; } }
        public string Author { get { return "Your name"; } }
        public Image Icon { get { return null; } }

        public void Initialize(AMSAPI api) { host = api; }
        public void OnLoaded(IAddInContext context) { ctx = context; }
        public bool CanExecute() { return host != null; }

        public void Execute()
        {
            IAMSApi api = ctx != null ? ctx.Api : host;
            BoundingBox3D box = api.GetBoundingBox();

            var sb = new StringBuilder();
            sb.AppendLine("Joints:   " + api.JointCount);
            sb.AppendLine("Frames:   " + api.FrameCount);
            sb.AppendLine("Shells:   " + api.ShellCount);
            sb.AppendLine("Sections: " + api.SectionCount);
            if (!box.IsEmpty)
                sb.AppendLine(string.Format("Size: {0:0.##} x {1:0.##} x {2:0.##}", box.SizeX, box.SizeY, box.SizeZ));
            sb.AppendLine("Selected frames: " + api.GetSelectedFrames().Count);
            sb.AppendLine("Host API: " + api.ApiVersionInfo);

            api.Log("Hello AMS ran", LogLevel.Info);
            api.ShowMessage(sb.ToString(), "Hello AMS");
        }

        public void Shutdown() { }
    }
}

Build it, copy the DLL to <AMS>\Plugins\HelloAms\, start AMS and choose Add-ins > Examples > Hello AMS.

Examples 10.2–10.4 are Execute() bodies. Put them in a class like the one in 10.1, and use MinApiVersion = "2.6" for 10.3 and 10.4. All four were compiled against the current bin\Debug\AMSPRO.exe and run in a simulated host (13.10.2026). The projects are in ADD INS\docs\examples\.

10.2 Create a model: portal frame with supports and loads

public void Execute()
{
    IAMSApi api = ctx.Api;
    if (!api.SectionExists(1)) { api.ShowMessage("Define section 1 in AMS first."); return; }

    using (IAMSTransaction tx = api.BeginTransaction("Portal frame"))
    {
        int a = api.AddJoint(0, 0, 0);
        int b = api.AddJoint(0, 0, 4);
        int c = api.AddJoint(6, 0, 4);
        int d = api.AddJoint(6, 0, 0);

        BatchResult r = api.AddFrames(new[]
        {
            new FrameRequest(a, b, 1),
            new FrameRequest(b, c, 1),
            new FrameRequest(c, d, 1)
        });

        api.SetSupport(a, SupportType.Fixed);
        api.SetSupport(d, SupportType.Fixed);

        var loads = api as IAMSLoadsApi;                 // API 2.4+
        if (loads != null)
        {
            int live = loads.EnsureLoadPattern("LIVE", "Live");   // 1-based
            api.SetJointForce(b, live - 1, 10000, 0, 0);          // careful: 0-based here
            foreach (int f in r.FrameIndices)
                loads.AddFrameUniformLoad(f, live, 2000, ShellLoadDirectionKind.Gravity);
        }
        tx.Commit();                                     // one undo step
    }
    api.RefreshView();
}

"Live" is one of the types the analysis recognises. Gravity in AddFrameUniformLoad uses the same direction code as Assign > Frame loads (5), so a positive value behaves the same as typing it in that dialog. (not numerically verified) I did not run a real analysis. Try this on a copy of a model.

10.3 Read results

var res = ctx.Api as IAMSResultsApi;          // API 2.6+
if (res == null || !res.HasFrameAnalysisResults) { ctx.Api.ShowMessage("Run the analysis first."); return; }
var cases = res.GetAnalysisCases();
if (cases.Count == 0) { ctx.Api.ShowMessage("No analysis cases."); return; }
AnalysisCaseInfo first = cases[0];
FrameForceInfo i, j;
if (res.TryGetFrameEndForces(1, first.OutputCaseIndex, out i, out j))
    ctx.Api.ShowMessage($"Frame 1, {first.Name}: P(I)={i.AxialP:0.##}  M3(I)={i.MomentM3:0.##}  M3(J)={j.MomentM3:0.##}");

10.4 Export a CSV table

var api = ctx.Api;
var res = api as IAMSResultsApi;
string path = System.IO.Path.Combine(ctx.DataFolder, "frames.csv");
var sb = new System.Text.StringBuilder("Frame,I,J,Section,Length,Angle,Case,P_I,M3_I,M3_J\n");
var inv = System.Globalization.CultureInfo.InvariantCulture;
var cases = res != null && res.HasFrameAnalysisResults ? res.GetAnalysisCases() : new List<AnalysisCaseInfo>();
foreach (FrameData f in api.GetFrameList())
{
    if (cases.Count == 0) { sb.AppendLine(string.Format(inv, "{0},{1},{2},{3},{4:0.###},{5:0.#},,,,", f.Index, f.StartJoint, f.EndJoint, f.Section, f.Length, f.RotateAngle)); continue; }
    foreach (var c in cases)
    {
        FrameForceInfo a, b;
        if (!res.TryGetFrameEndForces(f.Index, c.OutputCaseIndex, out a, out b)) continue;
        sb.AppendLine(string.Format(inv, "{0},{1},{2},{3},{4:0.###},{5:0.#},{6},{7:0.###},{8:0.###},{9:0.###}",
            f.Index, f.StartJoint, f.EndJoint, f.Section, f.Length, f.RotateAngle, c.Name, a.AxialP, a.MomentM3, b.MomentM3));
    }
}
System.IO.File.WriteAllText(path, sb.ToString(), new System.Text.UTF8Encoding(true));
api.ShowMessage("Saved: " + path);

(Add using System.Collections.Generic;.)


11. Troubleshooting and FAQ

Symptom Cause / fix
Add-in missing from the menu Check Add-in report and Plugins\ams-addin.log. The class must be public, carry [AddIn], implement IAddIn and have a parameterless constructor. The DLL must be in Plugins or one sub-folder level below it
refused: it requires API x MinApiVersion is newer than the host. This happens even with "2.8" on the current build, so lower it
does not implement IAddIn the interface is missing, or a second AMSPRO.exe was copied next to your DLL (Copy Local = True). Delete it
Type load errors / FileNotFoundException a dependency is missing, or the project targets modern .NET instead of 4.8
MissingMethodException you built against a newer AMSPRO.exe than the one running the add-in. Build against the oldest host you target, or test with as
Duplicate add-in name rename the add-in
Joint 0 does not exist indexes are 1-based
Load lands on the wrong pattern SetJointForce is 0-based; everything else is 1-based
AMS freezes a long loop on the UI thread. Use batches and BeginProgressScope
Undo reverts only one element use BeginTransaction + Commit()
Rebuilt DLL not picked up use Reload add-ins, and restart AMS for shared dependencies
Breakpoints don't hit copy the .pdb and attach as Managed (.NET Framework 4.x)

FAQ. VB.NET? Any .NET Framework 4.8 language works; all the examples here are C#. Run analysis? No. Create sections or materials? There is no API for that yet. Where do I store data? In ctx.Settings, in ctx.DataFolder, or in a file next to the project file that the user chooses.

⬇ Download example projects (ZIP)