32 lines
1.1 KiB
PowerShell
32 lines
1.1 KiB
PowerShell
param(
|
|
[Parameter(Mandatory = $true)][string]$ExePath,
|
|
[Parameter(Mandatory = $true)][string]$StepPath,
|
|
[Parameter(Mandatory = $true)][string]$GlbPath,
|
|
[Parameter(Mandatory = $true)][string]$NodeNameMode,
|
|
[Parameter(Mandatory = $true)][string]$ExpectedNames
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
& $ExePath --stp $StepPath --glb $GlbPath --node-name-mode $NodeNameMode
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "STP2GLB failed with exit code $LASTEXITCODE"
|
|
}
|
|
|
|
$bytes = [System.IO.File]::ReadAllBytes($GlbPath)
|
|
if ($bytes.Length -lt 20) {
|
|
throw "GLB file is too small"
|
|
}
|
|
|
|
$jsonLength = [System.BitConverter]::ToUInt32($bytes, 12)
|
|
$jsonText = [System.Text.Encoding]::UTF8.GetString($bytes, 20, $jsonLength).Trim()
|
|
$document = $jsonText | ConvertFrom-Json
|
|
$actualNames = @($document.nodes | ForEach-Object { $_.name })
|
|
$expectedNameList = @($ExpectedNames -split '\|')
|
|
|
|
foreach ($expectedName in $expectedNameList) {
|
|
if ($actualNames -notcontains $expectedName) {
|
|
throw "Missing node name '$expectedName'. Actual names: $($actualNames -join ', ')"
|
|
}
|
|
}
|