# --- # Install Plugins from Package Manager # --- try { $yakPath = "C:\Program Files\Rhino 8\System\Yak.exe" $grasshopperPlugins = @( "Urbano2", "Pufferfish", "Caribou", "Clipper", "Conduit", "EleFront", "Heteroptera", "Hops", "human", "human-ui", "LunchBox", "metahopper", "OpenNest", "pancake", "PanelingTools", "ShapeDiver", "treeFrog", "TTToolbox", "VoxelTools", "Weaverbird" ) foreach ($plugin in $grasshopperPlugins) { Write-Host "Installing Grasshopper plugin: $plugin" & $yakPath install $plugin } } catch { Write-Host "An error occurred: $_" } # --- # Install Plugins not available through package management # --- $zipUrl = "https://docs.itau.uni-weimar.de/attachments/15" $destFolder = "$env:APPDATA\Grasshopper\Libraries" $zipFilePath = "$env:TEMP\sample.zip" try { # Download the zip file $ProgressPreference = 'SilentlyContinue' Write-Host "Downloading zip file from $zipUrl..." Invoke-WebRequest -Uri $zipUrl -OutFile $zipFilePath # Create destination folder if it doesn't exist if (-not (Test-Path -Path $destFolder)) { New-Item -Path $destFolder -ItemType Directory -Force } # Delete all contents in the destination folder Write-Host "Clearing contents of $destFolder..." Remove-Item -Path "$destFolder\*" -Recurse -Force # Extract the zip file to the destination folder Write-Host "Extracting zip file to $destFolder..." Expand-Archive -Path $zipFilePath -DestinationPath $destFolder -Force # Delete the zip file Write-Host "Deleting zip file..." Remove-Item -Path $zipFilePath -Force Write-Host "Script completed successfully." } catch { Write-Host "An error occurred: $_" } finally { # Ensure zip file is deleted even if an error occurs if (Test-Path -Path $zipFilePath) { Remove-Item -Path $zipFilePath -Force } }