S3D Integration
You can automatically integrate your calculation pack with S3D, by writing a s3d_integration.js file. The purpose of this file is to extract data out of your model and analysis results, to run your calculations off. If your calc pack has a s3d_integration.js file and your calculate.js follows the standardised format, your solution will appear in the list in S3D:

From here, your model will be auto-integrated with the following UI:

Layout#
important
This file uses the UI format for S3D! So for instance, use s3d_model.elements not s3d_model.members!
Use this file to compile an array of inputs for your calculator, that can be then run in batches:
Helper Functions#
StructureHelpers.getDesignForces()#
Returns an array of design forces for each member. It will scan all load combos and determine the worst result for each member in both + and - directions.
Output:
tip
For members that are rigid links, getDesignForces will return no design forces.
StructureHelpers.getMemberLength()#
Returns the member's length, including if offsets are used
StructureHelpers.ezDesignForces()#
The ezDesignForces helper is an alternative to StructureHelpers.getDesignForces(). It returns the internal forces of each member about the geometric and principal axes of its section as drawn in section builder, per load combination and station, or aggregated (envelopes).
Options#
All options are optional. Unknown options and values throw an error.
| Option | Default | Accepts |
|---|---|---|
members | "all" | "all", or a list of member IDs, e.g. ["6", "8"]. With "all", members that cannot be processed (not in the model, a requested action missing in a load combination, a number of stations that changes) are skipped and listed with the reason in meta.skipped_members; a listed member throws instead. |
load_combinations | "user_defined" | A type ("user_defined", "load_case", "load_group"), "all" (all three types), an ID, a filter { type, criteria }, or a list of these (their union), e.g. ["user_defined", "15"] or [{ criteria: "serviceability" }, "load_case"]. In a filter, type and criteria each take a value or a list, and both must match. criteria is the load combination's criteria in the model ("strength", "serviceability", "other", or any other value the model uses); only user-defined load combinations have one. Envelopes cannot be selected: use aggregate. Incomplete load combinations selected by type or filter are skipped and listed in meta.skipped_load_combinations; an incomplete one listed by ID throws. |
axes | ["geometric", "principal"] | One or both. |
actions | ["axial", "bmd_y", "bmd_z", "sfd_y", "sfd_z", "torsion"] | Any of these six, plus the resultants "bmd_res" (√(bmd_y² + bmd_z²)) and "sfd_res" (√(sfd_y² + sfd_z²)). Any subset can be requested: rotating a moment or shear needs both of its components, so they are read from the results, but only the requested actions are returned. Resultants are computed at each station before any aggregation (so their envelope is the largest resultant, not the resultant of the envelopes), are never negative, and are the same about every axis. Useful for circular and other axisymmetric sections. |
aggregate | [] | Levels to replace by their max/min: any of "member", "load_combination", "station". "member" requires "station" (members have different stations). |
Result#
A model without load combinations is solved by S3D as one user-defined combination, "Default Load Combo", with ID 0 and no criteria: the default selection includes it, a { criteria } filter does not. Members without force results in the selected load combinations (e.g. rigid links) are not in data. Each leaf is [before, after]: the value just before and just after the station. They differ only at a discontinuity, e.g. under a point load. To read a value between two stations, interpolate from after at station i to before at station i + 1.
Aggregation#
Aggregated levels disappear from data (the order of the other levels is unchanged), and each leaf becomes { max, min, abs_max }:
max/min:{ value, capped, member, load_combination, station, side, concurrent }. The location keys say what governs: the member and load combination (only when those levels are aggregated), the station position and the side ("before"/"after").concurrentholds every requested action at that point.capped:max.cappedisMath.max(max.value, 0)andmin.cappedisMath.min(min.value, 0): the largest demand of each sign (tension and compression, sagging and hogging). It is 0 when there is none; the location keys still describevalue.abs_max: a copy ofmaxormin, whichever has the larger magnitude (maxon a tie), withoutcapped:{ value, signed, from, ...location, concurrent }, wherevalueis the magnitude,signedthe value with its sign andfromis"max"or"min".
aggregate | Path | Leaf |
|---|---|---|
[] | data["6"]["1"]["4"].geometric.bmd_z | [before, after] |
["station"] | data["6"]["1"].geometric.bmd_z | max / min: { value, capped, station, side, concurrent } |
["load_combination", "station"] | data["6"].geometric.bmd_z | Envelope: max / min: { value, capped, load_combination, station, side, concurrent } |
["member", "load_combination", "station"] | data.geometric.bmd_z | Governing member: as above, plus member |
["load_combination"] | data["6"]["4"].geometric.bmd_z | Envelope diagram: max / min: { value, capped, load_combination }, abs_max: { value, signed, from, load_combination }, every key a [before, after] pair |
Ties keep the first value found (members, load combinations and stations in ascending order, before then after).
Axes and sign conventions#
- Geometric axes: the axes of the section as drawn in section builder, before rotations and mirrors. Usually, this means the strong flexural axis is about the horizontal axis Z and the weak flexural axis is about the vertical axis Y. Section builder rotates a shape clockwise about its centroid first (as seen in section builder, z right, y up), then mirrors it; ezDesignForces undoes the mirrors first, then the rotation.
mirror_z(about the z-axis) flipssfd_yandbmd_z,mirror_yflipssfd_zandbmd_y, and a single mirror (not both) also flipstorsion. - Principal axes: the geometric axes rotated by
meta.members[id].principal_angle, so thatz_pis the principal axis closest to the geometric z-axis (whether it is the strong or the weak axis). The angle uses S3D'salphaconvention, clockwise as seen in section builder, in [-45, 45) degrees (-45 for equal angles, as S3D reports them): it is thealphasection builder shows for the shape drawn without rotation or mirrors. It is derived from the section'salpha, which S3D measures on the transformed section. For symmetric sections, principal and geometric axes are the same. - Only single-shape sections are un-transformed. Built-up sections (several shapes) are used as built, since each shape is rotated and mirrored about its own centroid. The hole of a hollow section (e.g. HSS from the database) is not a separate shape.
- Only members of type
normalandnormal_continuousare un-transformed and have principal axes. - Signs are S3D's:
axialis positive in compression,bmd_zis positive in sagging (y up), andsfd_yandtorsionare opposite to the right-hand rule. - Normal stresses from principal forces (matches S3D's
max_combined_normal_stress/min_combined_normal_stress): take the coordinatesz,yof the shape as drawn, relative to its centroid, and the principal anglea=principal_angle:z_p = z cos(a) - y sin(a),y_p = z sin(a) + y cos(a). Thensigma = N / A + bmd_z * y_p / I_zp + bmd_y * z_p / I_yp, with the principal forces and the second moments of area about those axes (I_zp= integral ofy_p^2,I_yp= integral ofz_p^2). Compression is positive, as in S3D. S3D's sectionIz/Iymay belong to the other axis, so computeI_zp/I_ypaboutz_p/y_p.
UnitHelpers.convert()#
Convert units from one system to another. This is very useful when trying to control the inputs coming into your calculation.js file. For instance, say someone is using a model that is in ft, but your calculator only works for mm, you can use UnitHelpers.convert( member_length , s3d_units.length, "mm"); to take it from whatever system the s3d_model is and translate that input to mm
Logger#
The global logger() function is available to add to the quick design logs
Warnings#
The global warn() function is available to notify users of warning when running calculations
Example#
Below is an example of a more advanced integration for aluminimum design. It takes in the s3d_model and results, in order to compile an array of inputs. It imports the member's length, section properties and design forces.
Formatting Results#
You can control the S3D Results table with the following options
| Key | Value |
|---|---|
s3d_symbol | The heading to show in the S3D Results table. |
s3d_info | The info tip to show in the S3D Results table. |
How to Test Code#
To test your code, first start by creating a Draft. Then take the UID of that draft and run the following code in your S3D console:
This will open up the module on the left panel and run your latest s3d_integration.js file on the server.