0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PowerShellでDesignSpark PCBのガーバーファイルをリネームする

Posted at

elecrowやFusion PCBなどの安いPCBサービスで基板を作るとき、DesignSparkの出力のガーバーファイルはリネームする必要があります。

DesignSparkPCB 8.0でのデフォルトの出力は以下のようなります
(プロジェクト名がtestの場合)

test - Bottom Copper.gbr -> test.GBL
test - Bottom Silkscreen.gbr -> test.GBO
test - Bottom Copper (Resist).gbr -> test.GBS
test - Drill Data - [Through Hole].drl -> test.TXT
test - Top Copper -> test.GTL
test - Top Silkscreen.gbr -> test.GTO
test - Top Copper (Resist).gbr -> test.GTS

変更が面倒で間違えやすいのでリネームするPowerShellを作りました
以下のコードをガーバーファイルのあるフォルダでPowerShellで実行すればリネームされます

ls | ForEach-Object {
    
    if($_ -match " \- Drill Data.*"){
	$_ | Rename-Item -NewName {$_.Name -replace " \- Drill Data.*",".txt"}
    }elseif($_ -match " \- Bottom Copper \(Resist\).*"){
        $_ | Rename-Item -NewName {$_.Name -replace " \- Bottom Copper \(Resist\).*",".GBS"}
    }elseif($_ -match " \- Bottom Copper.*"){
        $_ | Rename-Item -NewName {$_.Name -replace " \- Bottom Copper.*",".GBL"}
    }elseif($_ -match " \- Bottom Silkscreen.*"){
        $_ | Rename-Item -NewName {$_.Name -replace " \- Bottom Silkscreen.*",".GBO"}
    }elseif($_ -match " \- Top Copper \(Resist\).*"){
        $_ | Rename-Item -NewName {$_.Name -replace " \- Top Copper \(Resist\).*",".GTS"}
    }elseif($_ -match " \- Top Copper.*"){
        $_ | Rename-Item -NewName {$_.Name -replace " \- Top Copper.*",".GTL"}
    }elseif($_ -match " \- Top Silkscreen.*"){
        $_ | Rename-Item -NewName {$_.Name -replace " \- Top Silkscreen.*",".GTO"}
    }
}
0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?