Sizes/Analyzes the assembly. The type of Sizing/Analysis used is dependent on the AnalysisMode of the Assembly.
def ExecuteSizingAndAnalysis(assembly):
"""Size/Analyze an assembly."""
# Set the analysis mode
amDetailedSizing = 3
assembly.AnalysisMode = amDetailedSizing
assembly.Save()
# Size and Analyze
is_success = assembly.Size()
Sizing and Analysis are each distinct operations in HyperX.
Sizing is used to find the optimum cross-section, dimensions, and Material system that minimizes weight and meets failure and manufacturing criteria. Analysis is used to assess the margin of safety values for a single design.
Sizing and Analysis inputs are treated separately from one another even though they can be defined on the same Design Property.
import hyperx as hx
def ExecuteSizingAndAnalysis(project: hx.Project):
"""Size/Analyze multiple zones."""
zoneIds = list(project.Sets.Get("My Set").Zones.Ids)
# Sizing
sizingStatus = project.SizeZones(zoneIds)
# Check if Sizing was successful
if sizingStatus.Success:
print("Sizing Succeeded")
else:
print(f"Sizing Failed: {sizingStatus.Message}")
# Analysis
analysisStatus = project.AnalyzeZones(zoneIds)
# Check if Analysis was successful
if analysisStatus.Success:
print("Analysis Succeeded")
else:
print(f"Analysis Failed: {analysisStatus.Message}")