Results Axes System#
|
In this example we will demonstrate how to:
|
from dlubal.api import rfem, common
with rfem.Application() as rfem_app:
# --- Support Forces ---
# The direction of support forces can be defined in either the Local (default) or Global
# Coordinate System (CS). This choice affects how the support reactions are
# recalculated and aligned with the selected coordinate system for correct results.
# Get results
support_forces: common.Table = rfem_app.get_results(
results_type=rfem.results.ResultsType.STATIC_ANALYSIS_NODES_SUPPORT_FORCES,
support_coordinate_system=rfem.results.settings.CoordinateSystem.COORDINATE_SYSTEM_GLOBAL
)
print(f"\nSupport Forces:\n{support_forces.data}")
# Get result table
support_forces_table: common.Table = rfem_app.get_result_table(
table=rfem.results.ResultTable.STATIC_ANALYSIS_NODES_SUPPORT_FORCES_TABLE,
loading= rfem.ObjectId(
no=1,
object_type=rfem.OBJECT_TYPE_LOAD_CASE
),
support_coordinate_system=rfem.results.settings.CoordinateSystem.COORDINATE_SYSTEM_GLOBAL
)
print(f"\nSupport Forces Table:\n{support_forces_table.data}")
# --- Member Forces ---
# Member forces can be defined in either the Member Local XYZ (default)
# or the Principal Axes XUV coordinate system. This choice determines how
# the forces are calculated and aligned according to the respective axes
# system of the member's geometry.
# Get results
member_forces: common.Table = rfem_app.get_results(
results_type=rfem.results.ResultsType.STATIC_ANALYSIS_MEMBERS_INTERNAL_FORCES,
member_axes_system=rfem.results.settings.MEMBER_AXES_SYSTEM_PRINCIPAL_AXES_X_U_V,
)
print(f"\nMember Forces:\n{member_forces.data}")
# Get result table
member_forces_table: common.Table = rfem_app.get_result_table(
table=rfem.results.ResultTable.STATIC_ANALYSIS_MEMBERS_INTERNAL_FORCES_TABLE,
loading= rfem.ObjectId(
no=1,
object_type=rfem.OBJECT_TYPE_LOAD_CASE
),
member_axes_system=rfem.results.settings.MEMBER_AXES_SYSTEM_PRINCIPAL_AXES_X_U_V,
)
print(f"\nMember Forces Table:\n{member_forces_table.data}")
using Rfem = Dlubal.Api.Rfem;
using Common = Dlubal.Api.Common;
using Google.Protobuf;
static List<IMessage> DefineStructure()
{
return new List<IMessage>
{
new Rfem.StructureCore.Material { No = 1, Name = "S235" },
new Rfem.StructureCore.CrossSection { No = 1, Name = "HE 300 A", Material = 1 },
new Rfem.StructureCore.Node { No = 1 },
new Rfem.StructureCore.Node { No = 2, Coordinate1 = 6 },
new Rfem.StructureCore.Line { No = 1, Type = Rfem.StructureCore.Line.Types.Type.Polyline, DefinitionNodes = { 1, 2 } },
new Rfem.StructureCore.Member { No = 1, Type = Rfem.StructureCore.Member.Types.Type.Beam, Line = 1, CrossSectionStart = 1 },
new Rfem.TypesForNodes.NodalSupport
{
No = 1,
Nodes = { 1, 2 },
SpringX = double.PositiveInfinity,
SpringY = double.PositiveInfinity,
SpringZ = double.PositiveInfinity,
RotationalRestraintX = double.PositiveInfinity,
RotationalRestraintY = double.PositiveInfinity,
RotationalRestraintZ = double.PositiveInfinity
},
};
}
static List<IMessage> DefineLoading()
{
return new List<IMessage>
{
new Rfem.Loading.StaticAnalysisSettings { No = 1 },
new Rfem.Loading.LoadCase { No = 1, Name = "LC1", StaticAnalysisSettings = 1, SelfWeightActive = false },
new Rfem.Loads.MemberLoad
{
No = 1,
LoadCase = 1,
Members = { 1 },
LoadDistribution = Rfem.Loads.MemberLoad.Types.LoadDistribution.Uniform,
LoadType = Rfem.Loads.MemberLoad.Types.LoadType.Force,
LoadDirection = Rfem.Loads.MemberLoad.Types.LoadDirection.GlobalZOrUserDefinedWProjectedLength,
Magnitude = 10000,
}
};
}
ApplicationRfem? rfemApp = null;
try
{
rfemApp = new ApplicationRfem();
rfemApp.close_all_models(saveChanges: false);
rfemApp.create_model(name: "results_axes_system");
rfemApp.delete_all_objects();
rfemApp.create_object_list(DefineStructure());
rfemApp.create_object_list(DefineLoading());
rfemApp.calculate_all(skipWarnings: true);
Common.Table supportForces = rfemApp.get_results(
resultsType: Rfem.Results.ResultsType.StaticAnalysisNodesSupportForces,
supportCoordinateSystem: Rfem.Results.Settings.CoordinateSystem.Global
);
Console.WriteLine($"\nSupport Forces:\n{supportForces.Data}");
Common.Table supportForcesTable = rfemApp.get_result_table(
table: Rfem.Results.ResultTable.StaticAnalysisNodesSupportForcesTable,
loading: new Rfem.ObjectId
{
No = 1,
ObjectType = Rfem.ObjectType.LoadCase
},
supportCoordinateSystem: Rfem.Results.Settings.CoordinateSystem.Global
);
Console.WriteLine($"\nSupport Forces Table:\n{supportForcesTable.Data}");
Common.Table memberForces = rfemApp.get_results(
resultsType: Rfem.Results.ResultsType.StaticAnalysisMembersInternalForces,
memberAxesSystem: Rfem.Results.Settings.MemberAxesSystem.PrincipalAxesXUV
);
Console.WriteLine($"\nMember Forces:\n{memberForces.Data}");
Common.Table memberForcesTable = rfemApp.get_result_table(
table: Rfem.Results.ResultTable.StaticAnalysisMembersInternalForcesTable,
loading: new Rfem.ObjectId
{
No = 1,
ObjectType = Rfem.ObjectType.LoadCase
},
memberAxesSystem: Rfem.Results.Settings.MemberAxesSystem.PrincipalAxesXUV
);
Console.WriteLine($"\nMember Forces Table:\n{memberForcesTable.Data}");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
finally
{
if (rfemApp != null) rfemApp.close_connection();
}