run_central_mag_arc_scan.ps1 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. $ErrorActionPreference = 'Stop'
  2. $Host.UI.RawUI.WindowTitle = 'Motor-CAD Central Mag Arc Scan 90-110 EDeg'
  3. Set-Location -LiteralPath $PSScriptRoot
  4. $safeDir = $PSScriptRoot.Replace('\', '/')
  5. $null = git -c "safe.directory=$safeDir" rev-parse --verify HEAD 2>$null
  6. if ($LASTEXITCODE -ne 0) {
  7. throw 'No Git commit exists. Commit the scripts before running.'
  8. }
  9. $trackedChanges = git -c "safe.directory=$safeDir" status --porcelain --untracked-files=no
  10. if ($trackedChanges) {
  11. throw 'Tracked files have uncommitted changes. Commit them before running.'
  12. }
  13. $commit = git -c "safe.directory=$safeDir" rev-parse --short HEAD
  14. $logPath = Join-Path $PSScriptRoot 'results\central_mag_arc_console.log'
  15. New-Item -ItemType Directory -Force -Path (Split-Path -Parent $logPath) | Out-Null
  16. Write-Host 'Starting a separate, visible Motor-CAD instance.' -ForegroundColor Cyan
  17. Write-Host "Committed version: $commit" -ForegroundColor Cyan
  18. Write-Host 'Range 90-110 EDeg, step 1, 21 points; model defaults: 30 points and 840 airgap mesh.' -ForegroundColor Cyan
  19. Write-Host "Progress log: $logPath" -ForegroundColor Cyan
  20. $pythonExe = 'C:\Users\zhang\AppData\Local\Microsoft\WindowsApps\python.exe'
  21. & $pythonExe -u .\scan_central_mag_arc.py `
  22. --start 90 --stop 110 --step 1 `
  23. --torque-points 0 --airgap-mesh 0 `
  24. --new-instance --no-resume 2>&1 |
  25. Tee-Object -FilePath $logPath
  26. Write-Host ''
  27. Write-Host 'The scan process has ended. This window remains open for review.' -ForegroundColor Green