seveibar/pd-dual-stepper-controller
Bottom-side PCB silkscreen artwork consisting of embedded mirrored TS Circuit SVG logos, with via-clearance-aware lower-board placement.
- Version
- 0.1.0
- License
- unset
- Stars
- 0
scripts/RouteBoard.java
import app.freerouting.Freerouting;
import app.freerouting.settings.GlobalSettings;
import app.freerouting.core.*;
import app.freerouting.board.ItemIdentificationNumberGenerator;
import app.freerouting.interactive.HeadlessBoardManager;
import app.freerouting.interactive.RatsNest;
import app.freerouting.autoroute.BatchAutorouter;
import app.freerouting.management.RoutingJobSchedulerActionThread;
import java.nio.file.*;
public class RouteBoard {
public static void main(String[] args) throws Exception {
Freerouting.globalSettings=new GlobalSettings();
var job=new RoutingJob();
var manager=new HeadlessBoardManager(null,job);
try(var input=Files.newInputStream(Path.of(args[0]))) {manager.loadFromSpecctraDsn(input,null,new ItemIdentificationNumberGenerator());}
job.board=manager.get_routing_board();
job.routerSettings=new app.freerouting.settings.RouterSettings(job.board);
job.routerSettings.set_stop_pass_no(Integer.parseInt(args[2]));
job.thread=new RoutingJobSchedulerActionThread(job);
job.state=RoutingJobState.RUNNING;
System.out.println("Before routing: " + new RatsNest(job.board).incomplete_count()+" airwires");
new BatchAutorouter(job).runBatchLoop();
System.out.println("After routing: " + new RatsNest(job.board).incomplete_count()+" airwires");
for(var a:new RatsNest(job.board).get_airlines()) System.out.println("AIRWIRE " + a.net.name + " " + a.from_corner + " -> " + a.to_corner);
manager.update_routing_board(job.board);
try(var output=Files.newOutputStream(Path.of(args[1]+".dsn"))) { app.freerouting.designforms.specctra.DsnFile.write(manager,output,"dual-usb-pd-stepper",false); }
try(var output=Files.newOutputStream(Path.of(args[1]))) {
if(!manager.saveAsSpecctraSessionSes(output,"dual-usb-pd-stepper"))throw new Exception("SES export failed");
}
System.out.println("Saved " + Files.size(Path.of(args[1])) + " bytes");
System.exit(0);
}
}