Assigning failure criteria to HyperSizer Components and HyperX Zones that can be greatly accelerated via each respective Scripting API.
Failure Analyses are turned on and off in the Failure tab. In the Scripting API this done using Component.AnalysisSelections. The analysis selection class enables you to turn the Analyses on and off for limit and ultimate loads. Here you can also set the required margin of safety.
Note
A distinction is made in the API between Concept and Object Analyses. Concept Analyses pertain to the entire panel or beam. Object Analyses are local failure like strength or local buckling.
In the example below we are activating the skin local buckling for limit loads and setting a required margin of safety. After we have saved the changes to the Component, we apply the Component settings to an entire Assembly (for efficiency).
from hs_enums import *
def SetFailureAnalyses(component):
"""Modify an existing components failure analyses."""
selections = component.AnalysisSelections
selection = selections.GetObjectAnalysisSelection(ObjectParameter.opSpacingSpanBonded, HyperSizerAnalysis.hsaLocal_Buckling_SpacingSpanSkin_Biaxial)
selection.IsActiveLimit = True
selection.IsActiveUltimate = False
selection.RequiredMsLimit = -0.5 # Set LB at 50% of limit load.
# more modifications
component.Save()
# Apply to all components in an assembly (or display set).
selections.ApplyToAssembly("Upper Wing Skin")
Failure Modes are generally located inside of Analysis Properties, though they can be created standalone. Failure Criteria live inside Failure Modes.
Note
Saving the object is no longer necessary the way it was in HyperSizer.
import hyperx as hx
def SetFailureModeCriteria(hxApp: hx.Application, zone: hx.Zone):
"""Modify an existing failure mode and assign it to an existing analysis property. Then assign that analysis property to a zone."""
analysisProperty = hxApp.AnalysisProperties.CreateAnalysisProperty(hx.types.FamilyCategory.Panel, "My Analysis Property")
failureMode = hxApp.FailureModes.CreateFailureMode("Panel Buckling")
analysisProperty.AddFailureMode(failureMode.Id)
# Sets failure mode criteria
criterion = failureMode.Criteria.Get("Buckling, Energy Sol.")
criterion.IsEnabled = True
criterion.RequiredMargin = .5
criterion.LimitUltimate = hx.types.LimitUltimate.Limit
zone.AssignAnalysisProperty(analysisProperty.Id)