Results#
![]() |
Result tables are in progress. In this dummy example we will demonstrate:
|
from dlubal.api import rfem
from math import inf
def define_structure() -> list:
"""Define and return a list of structural objects."""
return [
# Define material
rfem.structure_core.Material(
no=1,
name='S235',
),
# Define section
rfem.structure_core.Section(
no=1,
name='HE 300 A',
material=1,
),
# Define nodes
rfem.structure_core.Node(
no=1,
),
rfem.structure_core.Node(
no=2,
coordinate_1=6.0,
),
# Define line
rfem.structure_core.Line(
no=1,
definition_nodes=[1, 2],
),
# Define member
rfem.structure_core.Member(
no=1,
line=1,
section_start=1,
),
# Define nodal support at Node 1 (fully fixed)
rfem.types_for_nodes.NodalSupport(
no=1,
nodes=[1],
spring_x=inf,
spring_y=inf,
spring_z=inf,
rotational_restraint_x=inf,
rotational_restraint_y=inf,
rotational_restraint_z=inf,
),
]
def define_loading() -> list:
"""Define and return a list of loading objects."""
return [
# Static analysis settings
rfem.loading.StaticAnalysisSettings(
no=1,
analysis_type=rfem.loading.StaticAnalysisSettings.ANALYSIS_TYPE_GEOMETRICALLY_LINEAR,
),
# Define load cases
rfem.loading.LoadCase(
no=1,
static_analysis_settings=1,
),
rfem.loading.LoadCase(
no=2,
static_analysis_settings=1,
),
# Define nodal loads
rfem.loads.NodalLoad(
no=1,
load_case=1,
nodes=[2],
load_type=rfem.loads.NodalLoad.LOAD_TYPE_COMPONENTS,
components_force_y=5000, # Force in Y direction (N)
components_force_z=10000, # Force in Z direction (N)
),
rfem.loads.MemberLoad(
no=1,
load_case=2,
members=[1],
load_type=rfem.loads.MemberLoad.LOAD_TYPE_FORCE,
magnitude=10000,
),
# Define design situation
rfem.loading.DesignSituation(
no=1,
design_situation_type=rfem.loading.DesignSituation.DESIGN_SITUATION_TYPE_STR_PERMANENT_AND_TRANSIENT_6_10,
),
# Define load combination
rfem.loading.LoadCombination(
no=1,
name='CO1',
items=rfem.loading.LoadCombination.ItemsTable(
rows=[
rfem.loading.LoadCombination.ItemsRow(
load_case=1,
factor=1.35,
),
rfem.loading.LoadCombination.ItemsRow(
load_case=2,
factor=1.5,
)
]
),
design_situation=1,
)
]
with rfem.Application() as rfem_app:
rfem_app.create_model(name='cantilever')
rfem_app.delete_all_objects()
objects = define_structure() + define_loading()
rfem_app.create_object_list(objects)
rfem_app.calculate_all(skip_warnings=True)
# GetResults returns Table, which is just a convenience wrapper around a Pandas Dataframe,
# the Dataframe can be directly accessed as .data
df_int_forces = rfem_app.get_results(
results_id=rfem.results.RESULTS_ID_STATIC_ANALYSIS_MEMBER_INTERNAL_FORCES
).data
print(f"\nInternal Forces | All:")
print(df_int_forces)
# Filter results just for specific loading by Pandas DataFrame
loading_filter = rfem_app.get_object(
obj=rfem.loading.LoadCombination(no=1)
).name
df_int_forces_for_loading = df_int_forces[
df_int_forces['loading'] == loading_filter
]
print(f"\nInternal Forces | {loading_filter}:")
print(df_int_forces_for_loading)
# Find the maximum from all results for specific result value(=table column) by Pandas DataFrame
result_column = 'm_y'
df_row_max = df_int_forces.loc[
df_int_forces[result_column].abs().idxmax()
]
print(f"\nInternal Forces | Max '{result_column}' from All:")
print(f"▶ Value: {df_row_max[result_column]}")
print(f"▶ Location: {df_row_max['x']} [m]")
print(f"▶ Loading: {df_row_max['loading']}\n")