chore: Project cleanup and Canvas UX improvements (Phase 7-9)
## Cleanup (v0.5.0) - Delete 102+ orphaned MCP session temp files - Remove build artifacts (htmlcov, dist, __pycache__) - Archive superseded plan docs (RALPH_LOOP V2/V3, CANVAS V3, etc.) - Move debug/analysis scripts from tests/ to tools/analysis/ - Archive redundant NX journals to archive/nx_journals/ - Archive monolithic PROTOCOL.md to docs/archive/ - Update .gitignore with missing patterns - Clean old study files (optimization_log_old.txt, run_optimization_old.py) ## Canvas UX (Phases 7-9) - Phase 7: Resizable panels with localStorage persistence - Left sidebar: 200-400px, Right panel: 280-600px - New useResizablePanel hook and ResizeHandle component - Phase 8: Enable all palette items - All 8 node types now draggable - Singleton logic for model/solver/algorithm/surrogate - Phase 9: Solver configuration - Add SolverEngine type (nxnastran, mscnastran, python, etc.) - Add NastranSolutionType (SOL101-SOL200) - Engine/solution dropdowns in config panel - Python script path support ## Documentation - Update CHANGELOG.md with recent versions - Update docs/00_INDEX.md - Create examples/README.md - Add docs/plans/CANVAS_UX_IMPROVEMENTS.md
This commit is contained in:
96
archive/nx_journals/extract_expressions_standalone.py
Normal file
96
archive/nx_journals/extract_expressions_standalone.py
Normal file
@@ -0,0 +1,96 @@
|
||||
"""
|
||||
Standalone expression extractor - opens part and extracts all expressions
|
||||
Run with: ugraf.exe -run extract_expressions_standalone.py
|
||||
"""
|
||||
import NXOpen
|
||||
import os
|
||||
import json
|
||||
|
||||
def main():
|
||||
session = NXOpen.Session.GetSession()
|
||||
|
||||
part_path = r"C:\Users\antoi\Atomizer\studies\m1_mirror_cost_reduction\1_setup\model\M1_Blank.prt"
|
||||
output_json = r"C:\Users\antoi\Atomizer\_expressions_output.json"
|
||||
output_txt = r"C:\Users\antoi\Atomizer\_expressions_output.txt"
|
||||
|
||||
results = {'expressions': [], 'success': False, 'part': part_path}
|
||||
output_lines = []
|
||||
|
||||
try:
|
||||
# Set load options
|
||||
working_dir = os.path.dirname(part_path)
|
||||
session.Parts.LoadOptions.ComponentLoadMethod = NXOpen.LoadOptions.LoadMethod.FromDirectory
|
||||
session.Parts.LoadOptions.SetSearchDirectories([working_dir], [True])
|
||||
|
||||
# Open the part
|
||||
output_lines.append(f"Opening: {part_path}")
|
||||
basePart, loadStatus = session.Parts.OpenActiveDisplay(
|
||||
part_path,
|
||||
NXOpen.DisplayPartOption.AllowAdditional
|
||||
)
|
||||
loadStatus.Dispose()
|
||||
|
||||
workPart = session.Parts.Work
|
||||
output_lines.append(f"Loaded: {workPart.Name}")
|
||||
output_lines.append("")
|
||||
output_lines.append("=" * 60)
|
||||
output_lines.append("EXPRESSIONS IN M1_Blank.prt")
|
||||
output_lines.append("=" * 60)
|
||||
|
||||
# Extract expressions
|
||||
for expr in workPart.Expressions:
|
||||
try:
|
||||
name = expr.Name
|
||||
|
||||
# Skip internal expressions (p0, p1, p123, etc.)
|
||||
if name.startswith('p') and len(name) > 1:
|
||||
rest = name[1:]
|
||||
# Check if rest is numeric (possibly with dots for decimals)
|
||||
if rest.replace('.', '').replace('_', '').isdigit():
|
||||
continue
|
||||
|
||||
value = expr.Value
|
||||
units = expr.Units.Name if expr.Units else ''
|
||||
rhs = expr.RightHandSide if hasattr(expr, 'RightHandSide') else ''
|
||||
|
||||
results['expressions'].append({
|
||||
'name': name,
|
||||
'value': value,
|
||||
'units': units,
|
||||
'formula': rhs
|
||||
})
|
||||
|
||||
units_str = f" [{units}]" if units else ""
|
||||
output_lines.append(f"{name}: {value}{units_str}")
|
||||
|
||||
except Exception as e:
|
||||
output_lines.append(f"Error reading expression: {e}")
|
||||
|
||||
results['success'] = True
|
||||
results['count'] = len(results['expressions'])
|
||||
output_lines.append("")
|
||||
output_lines.append(f"Total user expressions: {results['count']}")
|
||||
|
||||
except Exception as e:
|
||||
import traceback
|
||||
results['error'] = str(e)
|
||||
results['traceback'] = traceback.format_exc()
|
||||
output_lines.append(f"ERROR: {e}")
|
||||
output_lines.append(traceback.format_exc())
|
||||
|
||||
# Write outputs
|
||||
with open(output_json, 'w') as f:
|
||||
json.dump(results, f, indent=2)
|
||||
|
||||
with open(output_txt, 'w') as f:
|
||||
f.write('\n'.join(output_lines))
|
||||
|
||||
# Exit NX
|
||||
try:
|
||||
session.Parts.Work.Close(NXOpen.BasePart.CloseWholeTree.FalseValue,
|
||||
NXOpen.BasePart.CloseModified.CloseModified, None)
|
||||
except:
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
55
archive/nx_journals/list_expressions_simple.py
Normal file
55
archive/nx_journals/list_expressions_simple.py
Normal file
@@ -0,0 +1,55 @@
|
||||
"""Simple expression lister - writes to file regardless of print issues"""
|
||||
import NXOpen
|
||||
import os
|
||||
import json
|
||||
|
||||
session = NXOpen.Session.GetSession()
|
||||
output_lines = []
|
||||
results = {'expressions': [], 'success': False}
|
||||
|
||||
try:
|
||||
# Get all open parts and find M1_Blank
|
||||
for part in session.Parts:
|
||||
part_name = part.Name if hasattr(part, 'Name') else str(part)
|
||||
if 'M1_Blank' in part_name and '_fem' not in part_name.lower() and '_i' not in part_name.lower():
|
||||
output_lines.append(f"Found part: {part_name}")
|
||||
|
||||
for expr in part.Expressions:
|
||||
try:
|
||||
name = expr.Name
|
||||
# Skip internal expressions (p0, p1, etc.)
|
||||
if name.startswith('p') and len(name) > 1:
|
||||
rest = name[1:].replace('.', '').replace('_', '')
|
||||
if rest.isdigit():
|
||||
continue
|
||||
|
||||
value = expr.Value
|
||||
units = expr.Units.Name if expr.Units else ''
|
||||
rhs = expr.RightHandSide if hasattr(expr, 'RightHandSide') else ''
|
||||
|
||||
results['expressions'].append({
|
||||
'name': name,
|
||||
'value': value,
|
||||
'units': units,
|
||||
'rhs': rhs
|
||||
})
|
||||
output_lines.append(f"{name}: {value} {units}")
|
||||
except:
|
||||
pass
|
||||
|
||||
results['success'] = True
|
||||
break
|
||||
|
||||
except Exception as e:
|
||||
output_lines.append(f"Error: {str(e)}")
|
||||
results['error'] = str(e)
|
||||
|
||||
# Write to file
|
||||
output_path = r"C:\Users\antoi\Atomizer\_expressions_output.json"
|
||||
with open(output_path, 'w') as f:
|
||||
json.dump(results, f, indent=2)
|
||||
|
||||
# Also write text version
|
||||
text_path = r"C:\Users\antoi\Atomizer\_expressions_output.txt"
|
||||
with open(text_path, 'w') as f:
|
||||
f.write('\n'.join(output_lines))
|
||||
11
archive/nx_journals/test_write.py
Normal file
11
archive/nx_journals/test_write.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""Simple test - just write a file"""
|
||||
with open(r"C:\Users\antoi\Atomizer\_test_output.txt", 'w') as f:
|
||||
f.write("Journal executed successfully!\n")
|
||||
|
||||
try:
|
||||
import NXOpen
|
||||
f.write("NXOpen imported OK\n")
|
||||
session = NXOpen.Session.GetSession()
|
||||
f.write(f"Session: {session}\n")
|
||||
except Exception as e:
|
||||
f.write(f"NXOpen error: {e}\n")
|
||||
Reference in New Issue
Block a user