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:
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,72 @@
|
||||
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] : [51] : [0]
|
||||
INDEP VAR: [node_id] : [] : [] : [5]
|
||||
BOUNDS: [3] : [YES] : [669] : [YES] : [51] : [655]
|
||||
DEP VAR: [x] : [Length] : [mm] : [0]
|
||||
DESCRIPTION: ResultProbe
|
||||
DESCRIPTION: dz
|
||||
DESCRIPTION: 21-Nov-25
|
||||
DESCRIPTION: 15:27:24
|
||||
START DATA
|
||||
0, 655, -0.0374058224260807
|
||||
0, 656, -0.038049004971981
|
||||
0, 657, -0.0369194410741329
|
||||
0, 658, -0.0365256853401661
|
||||
0, 659, -0.0362277515232563
|
||||
0, 660, -0.0421693958342075
|
||||
0, 661, -0.038899153470993
|
||||
0, 662, -0.040073998272419
|
||||
0, 663, -0.0356613844633102
|
||||
0, 664, -0.0356574058532715
|
||||
0, 665, -0.0358434692025185
|
||||
0, 666, -0.0357435494661331
|
||||
0, 667, -0.0360030345618725
|
||||
0, 668, -0.0356605499982834
|
||||
0, 669, -0.0356847979128361
|
||||
0, 3, -0.0459242127835751
|
||||
0, 6, -0.0459244512021542
|
||||
0, 14, -0.0356661044061184
|
||||
0, 11, -0.0356660187244415
|
||||
0, 128, -0.0374444201588631
|
||||
0, 129, -0.0381020344793797
|
||||
0, 130, -0.0369499586522579
|
||||
0, 131, -0.0365508943796158
|
||||
0, 132, -0.0362492613494396
|
||||
0, 133, -0.0389753989875317
|
||||
0, 134, -0.040153156965971
|
||||
0, 135, -0.0421142838895321
|
||||
0, 136, -0.0356643460690975
|
||||
0, 137, -0.0356617495417595
|
||||
0, 138, -0.0356673523783684
|
||||
0, 139, -0.0360213443636894
|
||||
0, 140, -0.0358589664101601
|
||||
0, 141, -0.0357562974095345
|
||||
0, 142, -0.0356945171952248
|
||||
0, 59, -0.0461513064801693
|
||||
0, 169, -0.0374445840716362
|
||||
0, 170, -0.0381022356450558
|
||||
0, 171, -0.0369501039385796
|
||||
0, 172, -0.0365510284900665
|
||||
0, 173, -0.0362493842840195
|
||||
0, 174, -0.0421144664287567
|
||||
0, 175, -0.040153443813324
|
||||
0, 176, -0.038975652307272
|
||||
0, 177, -0.0356644317507744
|
||||
0, 178, -0.0356618389487267
|
||||
0, 179, -0.0358590744435787
|
||||
0, 180, -0.0357564017176628
|
||||
0, 181, -0.0360214598476887
|
||||
0, 182, -0.0356946140527725
|
||||
0, 183, -0.0356674455106258
|
||||
0, 145, -0.0356633476912975
|
||||
END DATA
|
||||
Reference in New Issue
Block a user