Pushing Data

Pushing Data

Send modified beam design data back to Eriksson Beam using PushBeamDesignerAsync.

Basic Usage

// Pull first (required!)
var design = await client.PullBeamDesignerAsync("project");

// Make modifications
design.DesignCriteria.ProjectInformation.DesignerName = "Jane Doe";
design.DesignCriteria.ProjectInformation.Date = DateTime.Now;

// Push changes back
await client.PushBeamDesignerAsync("project", design);

Method Signature

public async Task PushBeamDesignerAsync(string beamProject, BeamDesign designer)

Parameters

ParameterTypeDescription
beamProjectstringProject identifier
designerBeamDesignModified design object

Project Identifier

ValueBehavior
""Uses single open project. Throws if multiple are open.
"ProjectName"Matches by file name without extension
@"C:\path\file.ebf"Matches by full file path

Critical: Always Pull First

Never create a BeamDesign directly. Push updates every field, including ones you didn’t set.

// WRONG - causes data loss!
var design = new BeamDesign();  // All fields have default values (0, empty, etc.)
design.DesignCriteria.ProjectInformation.DesignerName = "Jane";
await client.PushBeamDesignerAsync("project", design);
// Result: ALL data is overwritten with defaults!

// CORRECT - preserves existing data
var design = await client.PullBeamDesignerAsync("project");  // Gets current values
design.DesignCriteria.ProjectInformation.DesignerName = "Jane";
await client.PushBeamDesignerAsync("project", design);
// Result: Only DesignerName changes, everything else preserved

Critical: Batch Changes

Push operations are expensive. Always batch modifications:

// WRONG - slow, 4 separate pushes
design.Property1 = value1;
await client.PushBeamDesignerAsync("project", design);
design.Property2 = value2;
await client.PushBeamDesignerAsync("project", design);
design.Property3 = value3;
await client.PushBeamDesignerAsync("project", design);
design.Property4 = value4;
await client.PushBeamDesignerAsync("project", design);

// CORRECT - fast, single push
design.Property1 = value1;
design.Property2 = value2;
design.Property3 = value3;
design.Property4 = value4;
await client.PushBeamDesignerAsync("project", design);  // All at once

What Gets Updated

When you push, every field in the BeamDesign is sent to Eriksson Beam:

  • ConcreteExtents (entire section definition)
  • DesignCriteria (all settings, materials, load combinations)
  • StructuralModel (all loading, bearing, dapped ends)
  • Reinforcement (all prestress, rebar, transverse, WWR)

There is no way to push partial updates. The entire object is serialized and applied.

Server-Side Validation

Eriksson Beam validates pushed data:

  • Invalid values may be rejected
  • Out-of-range values may be clamped
  • Missing required data may cause errors
try
{
    await client.PushBeamDesignerAsync("project", design);
}
catch (ServerErrorException ex)
{
    if (ex.Response.ResponseCode == ResponseCode.InvalidRequest)
    {
        Console.WriteLine($"Validation failed: {ex.Response.ErrorMessage}");
    }
}

Error Handling

try
{
    await client.PushBeamDesignerAsync("project", design);
    Console.WriteLine("Push successful");
}
catch (ServerErrorException ex)
{
    // Server rejected the push
    Console.WriteLine($"Push failed: {ex.Response.ErrorMessage}");
    Console.WriteLine($"Response code: {ex.Response.ResponseCode}");
}
catch (ArgumentNullException ex)
{
    // Null beamProject or design parameter
    Console.WriteLine($"Invalid parameter: {ex.ParamName}");
}
catch (ErikssonBeamNotRunningException)
{
    // Connection lost during operation
    Console.WriteLine("Connection lost");
}
catch (OperationCanceledException)
{
    // Timeout exceeded
    Console.WriteLine("Operation timed out");
}

Common Validation Errors

ErrorCauseResolution
Project not foundInvalid project identifierCheck GetOpenBeamProjects() for valid names
Validation failureInvalid property valuesCheck error message for specific field
License errorInvalid/expired licenseVerify license key

Complete Example

using System;
using System.Threading.Tasks;
using ErikssonBeam.API.BeamClient;
using ErikssonBeam.API.BeamDesigner;

class UpdateProjectInfo
{
    static async Task UpdateDesignerInfo(
        ErikssonBeamClient client,
        string projectName,
        string designerName,
        string clientName)
    {
        Console.WriteLine($"Updating project '{projectName}'...");

        // 1. Pull current state
        var design = await client.PullBeamDesignerAsync(projectName);

        // 2. Display current values
        var info = design.DesignCriteria.ProjectInformation;
        Console.WriteLine($"  Current designer: {info.DesignerName}");
        Console.WriteLine($"  Current client: {info.ClientName}");

        // 3. Modify values
        info.DesignerName = designerName;
        info.ClientName = clientName;
        info.Date = DateTime.Now;

        // 4. Push changes
        try
        {
            await client.PushBeamDesignerAsync(projectName, design);
            Console.WriteLine("  Update successful!");
        }
        catch (ServerErrorException ex)
        {
            Console.WriteLine($"  Update failed: {ex.Response.ErrorMessage}");
        }
    }

    static async Task Main()
    {
        var launcherArgs = new ErikssonBeamLauncherArgs
        {
            LicenseKey = Environment.GetEnvironmentVariable("ERIKSSON_LICENSE_KEY"),
            ExecutablePath = @"C:\Program Files\Eriksson Software\Eriksson Beam\ErikssonBeam.exe",
            FilesToOpen = new[] { @"C:\Projects\MyBeam.ebf" },
            CloseErikssonBeamOnClientDisconnect = true
        };

        using var launcher = await ErikssonBeamLauncher.LaunchErikssonBeam(launcherArgs);

        await UpdateDesignerInfo(
            launcher.Client,
            "MyBeam",
            "Jane Doe",
            "ACME Corporation"
        );
    }
}

Modifying Different Section Types

When modifying ConcreteExtents, cast to the specific type:

var design = await client.PullBeamDesignerAsync("project");

switch (design.ConcreteExtents)
{
    case TBeam tBeam:
        tBeam.Length = 240;  // inches
        tBeam.Width = 48;
        break;

    case IBeam iBeam:
        iBeam.Length = 360;
        iBeam.Height = 36;
        break;

    // Handle other types...
}

await client.PushBeamDesignerAsync("project", design);

To change the section type entirely:

var design = await client.PullBeamDesignerAsync("project");

// Replace with a new section type
design.ConcreteExtents = new IBeam
{
    Length = 360,
    Height = 36,
    // Set all required properties...
};

await client.PushBeamDesignerAsync("project", design);

Performance Considerations

  • Push operations typically take 200-1000ms
  • The entire design is serialized and transmitted
  • Eriksson Beam UI updates after receiving push
  • Consider user experience if running many pushes

See Also

>