Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations JAE on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

C# SAP2000 API v26.2.0 - Load Patterns Not Appearing in "Load Pattern Definitions" Table Despite Being Created

keremsari

Civil/Environmental
Joined
Jun 27, 2025
Messages
1
Hello Forum Members,

I am developing an application using C# with SAP2000 API v26.2.0 and I've encountered a problem with creating Load Patterns that should normally be very simple, but which I haven't been able to solve. I would greatly appreciate any assistance you can provide.

Problem Description:When I create a new SAP2000 project programmatically via the API and add new Load Patterns using the mySapModel.LoadPatterns.Add() method, these Load Patterns successfully appear under the "Define > Load Patterns..." menu in the SAP2000 interface. However, these newly added Load Patterns are not listed in the "Model Definition > Load Pattern Definitions > Table: Load Pattern Definitions" table, which is accessed via "Display > Show Tables...". Only the default "DEAD" load pattern remains visible.

My Observations:

  • The load patterns are correctly listed in the "Define > Load Patterns..." window (please see the attached screenshot). This indicates that the API call was successful and the load patterns were added to the model.
  • However, the "Load Pattern Definitions" table (please see the attached screenshot) does not display the newly added load patterns like "LIVE", "EX", etc.
  • Even after running mySapModel.Analyze.RunAnalysis() via the API, the situation does not change; the Load Patterns still do not appear in the "Load Pattern Definitions" table.
  • I also tried the mySapModel.View.RefreshView() command, but this did not update the "Load Pattern Definitions" table either.
  • When I call the mySapModel.DatabaseTables.GetTableForDisplay("Load Pattern Definitions", ...) method via the API, the returned data also contains only the "DEAD" load pattern; my added ones are not retrieved. This suggests that the issue is not just related to the interface, but there might be an inconsistency in the internal data that the API reflects to the tables.
  • Even after running the application, saving the model (File > Save), and then reopening it, the Load Patterns do not become visible in the "Load Pattern Definitions" table, although they still appear under the "Define" tab. This leads me to believe that the data actually exists within the model, but it's not being correctly reflected to the tables by the API, or a triggering mechanism is missing.
Code Used (Summary):
using SAP2000v1;
namespace ConsoleApp1
{
class Program
{
static int ret = 0;
static void Main(string[] args)
{
cHelper helper = new Helper();
cOAPI api = helper.CreateObjectProgID("CSI.SAP2000.API.SapObject");
ret = api.ApplicationStart(eUnits.N_mm_C, true);
cSapModel model = api.SapModel;
model.File.NewBlank();

ret = model.LoadPatterns.Add("LIVE", eLoadPatternType.Live, 0, false);
if (ret != 0)
{
Console.WriteLine("Live:" + ret);
}

ret = model.LoadPatterns.Add("EX", eLoadPatternType.Quake, 0, true);
if (ret != 0)
{
Console.WriteLine("Ex;" + ret);
}
model.View.RefreshView();
}
}
}


My Question:How can I ensure that the Load Patterns added via LoadPatterns.Add() through the API immediately, or via a programmatic call, become visible in the "Load Pattern Definitions" table? Is this a known behavior of the API, or am I overlooking an update or synchronization method?

Thank you in advance for your assistance.

Sincerely,
1751052107082.png1751052136700.png
 

Part and Inventory Search

Sponsor

Back
Top