feat: Add NX study models and optimization histories
Includes all study folders with NX models for development: - bracket_stiffness_optimization (V1, V2, V3) - drone_gimbal_arm_optimization - simple_beam_optimization - uav_arm_optimization (V1, V2) - training_data_export_test - uav_arm_atomizerfield_test Contains .prt, .fem, .sim files and optimization databases. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
BIN
studies/bracket_stiffness_optimization/1_setup/model/Bracket.prt
Normal file
BIN
studies/bracket_stiffness_optimization/1_setup/model/Bracket.prt
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,91 @@
|
||||
"""
|
||||
NX Journal - Export Displacement Field for Bracket Stiffness Analysis
|
||||
=====================================================================
|
||||
|
||||
This journal exports the z-displacement field from a ResultProbe to a .fld file.
|
||||
|
||||
Usage:
|
||||
run_journal.exe export_displacement_field.py [sim_file_path]
|
||||
|
||||
If sim_file_path is not provided, uses Bracket_sim1.sim in the same directory.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import math
|
||||
from pathlib import Path
|
||||
import NXOpen
|
||||
import NXOpen.CAE
|
||||
import NXOpen.Fields
|
||||
|
||||
|
||||
def main(args):
|
||||
"""
|
||||
Export displacement field from NX simulation results.
|
||||
|
||||
Args:
|
||||
args: Command line arguments, optionally including sim file path
|
||||
|
||||
The ResultProbe should already be defined in the simulation file
|
||||
with z-displacement as the measured quantity.
|
||||
"""
|
||||
theSession = NXOpen.Session.GetSession()
|
||||
|
||||
# Determine sim file to open
|
||||
if len(args) > 0:
|
||||
sim_file = Path(args[0])
|
||||
else:
|
||||
# Default: Bracket_sim1.sim in same directory as this journal
|
||||
journal_dir = Path(__file__).parent
|
||||
sim_file = journal_dir / "Bracket_sim1.sim"
|
||||
|
||||
if not sim_file.exists():
|
||||
print(f"ERROR: Simulation file not found: {sim_file}")
|
||||
return 1
|
||||
|
||||
# Open the simulation file
|
||||
print(f"Opening simulation: {sim_file}")
|
||||
try:
|
||||
basePart1, partLoadStatus1 = theSession.Parts.OpenBaseDisplay(str(sim_file))
|
||||
partLoadStatus1.Dispose()
|
||||
except Exception as e:
|
||||
print(f"ERROR: Failed to open simulation: {e}")
|
||||
return 1
|
||||
|
||||
workSimPart = theSession.Parts.BaseWork
|
||||
if workSimPart is None:
|
||||
print("ERROR: No work part loaded after opening simulation.")
|
||||
return 1
|
||||
|
||||
# Get the FieldManager
|
||||
fieldManager = workSimPart.FindObject("FieldManager")
|
||||
if fieldManager is None:
|
||||
print("ERROR: FieldManager not found. Make sure simulation results are loaded.")
|
||||
return 1
|
||||
|
||||
# Find the ResultProbe (should be pre-configured for z-displacement)
|
||||
resultProbe = fieldManager.FindObject("ResultProbe")
|
||||
if resultProbe is None:
|
||||
print("ERROR: ResultProbe not found. Please create a ResultProbe for z-displacement.")
|
||||
return 1
|
||||
|
||||
# Prepare probe array for export
|
||||
probes = [NXOpen.CAE.ResultProbe.Null] * 1
|
||||
probes[0] = resultProbe
|
||||
|
||||
# Determine output file path (same directory as this journal)
|
||||
journal_dir = Path(__file__).parent
|
||||
output_file = journal_dir / "export_field_dz.fld"
|
||||
|
||||
# Export to field file
|
||||
print(f"Exporting displacement field to: {output_file}")
|
||||
theSession.ResultManager.ExportProbesToFieldFile(probes, str(output_file))
|
||||
|
||||
print(f"[OK] Successfully exported displacement field")
|
||||
print(f" Output: {output_file}")
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
exit_code = main(sys.argv[1:])
|
||||
sys.exit(exit_code)
|
||||
@@ -0,0 +1,48 @@
|
||||
FIELD: [ResultProbe] : [TABLE]
|
||||
FIELD LOCK STATE: [NO]
|
||||
DUPLICATE_VALUE_OPTION: [0]
|
||||
PARAMETERIZE INDEPENDENT DOMAIN: [NO]
|
||||
PERSIST INTERPOL: [NO]
|
||||
CREATE INTERPOLATOR: [NO]
|
||||
FALLBACK DEFAULT INTERPOLATOR: [YES]
|
||||
INTERPOL: [4]
|
||||
VALUES OUTSIDE: [2]
|
||||
REMOVE DELAUNAY SLIVERS: [NO]
|
||||
INDEP VAR: [step] : [] : [] : [0]
|
||||
BOUNDS: [0] : [YES] : [0] : [YES] : [27] : [0]
|
||||
INDEP VAR: [node_id] : [] : [] : [5]
|
||||
BOUNDS: [4] : [YES] : [427] : [YES] : [27] : [421]
|
||||
DEP VAR: [x] : [Length] : [mm] : [0]
|
||||
DESCRIPTION: ResultProbe
|
||||
DESCRIPTION: dz
|
||||
DESCRIPTION: 21-Nov-25
|
||||
DESCRIPTION: 14:07:36
|
||||
START DATA
|
||||
0, 421, -0.0912187546491623
|
||||
0, 422, -0.0915937945246696
|
||||
0, 423, -0.0910566821694374
|
||||
0, 424, -0.0910213589668274
|
||||
0, 425, -0.0954395830631256
|
||||
0, 426, -0.0922631919384003
|
||||
0, 427, -0.0933739989995956
|
||||
0, 4, -0.0993421748280525
|
||||
0, 8, -0.0993418246507645
|
||||
0, 14, -0.0910348445177078
|
||||
0, 11, -0.0910348743200302
|
||||
0, 155, -0.0916455313563347
|
||||
0, 156, -0.0912557020783424
|
||||
0, 157, -0.0910805985331535
|
||||
0, 158, -0.0910358726978302
|
||||
0, 159, -0.0954336747527122
|
||||
0, 160, -0.0934799686074257
|
||||
0, 161, -0.0923400744795799
|
||||
0, 131, -0.091023251414299
|
||||
0, 122, -0.0910806134343147
|
||||
0, 123, -0.091255709528923
|
||||
0, 124, -0.0910359025001526
|
||||
0, 125, -0.0954337492585182
|
||||
0, 126, -0.0923400297760963
|
||||
0, 127, -0.0916455239057541
|
||||
0, 128, -0.0934799015522003
|
||||
0, 58, -0.0995271652936935
|
||||
END DATA
|
||||
Reference in New Issue
Block a user