Share

SBD to Mathcad

The SBDAutomation-Mathcad solution demonstrates how to take output from Autodesk Structural Bridge Design automation and feed it as input into Mathcad® worksheet files. The worksheets can then use this input to perform additional calculations.

The provided examples utilize common code in the SBDAutomationLibrary library project and the specialized SBDMathcadLibrary for Mathcad integration.

SBD Mathcad Integration Library

Item Description
MathcadUtilities.cs Core utilities for Mathcad data extraction and writing.
SBDResultsExtensions.cs Extension methods for creating Mathcad matrices from SBD results.
MathcadData.cs Data structure for Mathcad variable definitions.
AnalysisDetails.cs Constants and definitions for analysis command types.
SCBeamBendingResults.cs Steel composite beam bending results definition.
SCBeamShearResults.cs Steel composite beam shear results definition.

SBD Mathcad Examples

Item Description
SBDEntry.cs Application entry point.
SBDMain.cs Main integration code for extracting and writing Mathcad data.

You will be substituting code in the SBDMain code file to suit your Mathcad integration tasks, but it is recommended that the units in the SBDMathcadLibrary project remain untouched as they contain the interface definitions for Mathcad data transfer. The library units may be updated in the future.

Overview

This integration example shows how to:

  1. Run SBD beam analysis via automation on a design beam
  2. Extract beam analysis results from the SBD output file
  3. Write data and results to Mathcad worksheets for further calculations
  4. Automatically recalculate Mathcad worksheets with updated SBD data

Mathcad Integration Workflow

Mathcad Integration Workflow

Mathcad Input Worksheet

Key Features

Automated Data Transfer

  • Extracts specific beam results from SBD JSON output
  • Writes variables directly to Mathcad worksheet files
  • Supports multiple analysis types (bending, shear, etc.)

Flexible Configuration

  • Choose which analysis types to extract
  • Select specific result parameters for export
  • Configure Mathcad input names, units, and descriptions
  • Support for multiple worksheet files in a single run

Steel Composite Beam Focus

The example specifically demonstrates integration for steel composite beam analysis for US AASHTO LRFD, including:

  • General beam input parameters
  • US LRFD 10th Edition specific calculations
  • Lateral-torsional buckling analysis (Method A, Appendix D 6.6.2)

Setup Requirements

Prerequisites

  • Mathcad Prime Version 11 or higher must be installed on your system (full not Express version)
  • Visual Studio 2022 Version 17.8 or higher with .NET 8
  • SBD Automation-Mathcad solution properly configured

Important Configuration Step

Before running the example, you must update the Mathcad automation DLL path:

  1. Open the SBDMathcadLibrary.csproj file
  2. Locate the Ptc.MathcadPrime.Automation reference
  3. Update the HintPath to match your Mathcad Prime installation directory
  4. Ensure the path points to your specific Mathcad Prime version
Note: To build the SBDAutomation-Mathcad solution in Visual Studio Code, the correct solution has to be chosen. Follow these steps:
  • In Explorer (Ctrl+Shift+E), right-click on SBDAutomation-Mathcad.sln, and select Open Solution
  • Expand the Solution Explorer panel in Explorer.
  • In the Solution Explorer, right-click on the SBDAutomation-Mathcad solution.
  • From the context menu that appears, select Build to initiate the build process.

How It Works

1. SBD Analysis Execution

The integration starts by running SBD automation for a JSON input file containing the design beam model. As an alternative, this design beam can be created using code similar to described in Example 2: Building a model from scratch:

// Load and parse the existing bridge model 
using (StreamReader r = new(config.Input))
{
    string jsonString = r.ReadToEnd();
    var model = Json.ToClass<Model>(jsonString);

    // Run SBD automation 
    if (Automate.RunSBD(model_file, config))
    {
        // Extract results and write to Mathcad
        ExtractVariablesAndWriteToMathcad();
    }
}

2. Results Extraction

The system extracts specific analysis results using type-safe methods:

// Extract bending results and create Mathcad matrices
var results = MathcadUtilities.ExtractResults<SCBeamBendingResults>(
    output,
    AnalysisDetails.LIVE_BENDING_COMMAND,
    SCBeamBendingResults.CreateFromValue,
    SBDResultsExtensions.CreateMathcadMatrices);

3. Mathcad Data Writing

Results are formatted and written to specified Mathcad worksheets:

// Write to Mathcad worksheets
MathcadUtilities.WriteMathcadVariables(results,
    config.MathcadWorksheetPath, MathcadWorksheets);

Supported Analysis Types

The integration framework supports adding other analysis types:

// Example: Adding shear analysis results
var shearResults = MathcadUtilities.ExtractResults<SCBeamShearResults>(
    output,
    AnalysisDetails.LIVE_SHEAR_COMMAND,
    SCBeamShearResults.CreateFromValue,
    SBDResultsExtensions.CreateMathcadMatrices);

Mathcad Worksheet Configuration

Default Worksheets

The example includes predefined worksheets for steel composite beam analysis:

  • input-beam-sc-bending: General beam input parameters
  • input-us-beam-sc-bending: US LRFD specific input data
  • us-beam-sc-bending-ltb-method-a: Lateral-torsional buckling calculations

Custom Matrix Creation

You can create specific inputs for targeted parameters:

var results = new Dictionary<string, MathcadData>();
MathcadUtilities.CreateMatrix(results, bendingResultsList, 
    r => r.SpanPosRatio, "poi", "", "Points of interest (span position ratios)");
MathcadUtilities.CreateMatrix(results, bendingResultsList, 
    r => r.WebDepth?.Value, "webDepth", "m", "Web depth");

Custom Values Creation

You can also add individual numeric, string, or boolean values to Mathcad worksheets:

// Add numeric variables with units and descriptions
MathcadUtilities.AddNumericVariable(results, "sampleForce", 123.4, "kN", "Sample force value");
MathcadUtilities.AddNumericVariable(results, "beamLength", 15.0, "m", "Total beam length");

// Add string variables for text data
MathcadUtilities.AddStringVariable(results, "limitState", parameters.LimitState, "", "Analysis limit state");
MathcadUtilities.AddStringVariable(results, "designCode", "AASHTO LRFD", "", "Design code used");

// Add boolean variables for flags and options
MathcadUtilities.AddBooleanVariable(results, "includeShrinkCreep", parameters.IncludeShrinkCreep, "", "Include shrinkage and creep effects");
MathcadUtilities.AddBooleanVariable(results, "includeTemperature", parameters.IncludeTemperature, "", "Include temperature effects");

Troubleshooting

  • Mathcad not found: Verify Mathcad Prime installation and DLL path
  • Worksheet path errors: Ensure mathcadWorksheetPath in config.json is correct
  • Missing results: Check that SBD automation completed successfully
  • Version compatibility: Ensure Mathcad Prime version matches DLL reference

Note: PTC®, Mathcad® and Mathcad Prime® are registered trademarks of PTC Inc.

Next topic: Troubleshooting

Was this information helpful?