You bring up a good question and that functionality should probably be part of RapidWright. I've written a small bit of code that should be able to extract the PIPs of just a single connection based on the sink pin. It works by creating a map from end nodes to their PIPs such that if you search backwards from a sink pin's node, you can follow the PIPs (hops) back to the source:
package com.xilinx.rapidwright.examples;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.xilinx.rapidwright.design.Design;
import com.xilinx.rapidwright.design.SitePinInst;
import com.xilinx.rapidwright.device.Node;
import com.xilinx.rapidwright.device.PIP;
public class GetConnectionPIPs {
public static List<PIP> getConnectionPIPs(SitePinInst sinkPin) {
Map<Node, PIP> reverseNodeToPIPMap = new HashMap<>();
for(PIP p : sinkPin.getNet().getPIPs()) {
reverseNodeToPIPMap.put(p.getEndNode(), p);
}
Node sinkNode = sinkPin.getConnectedNode();
Node srcNode = sinkPin.getNet().getSource().getConnectedNode();
Node curr = sinkNode;
List<PIP> path = new ArrayList<>();
while(!curr.equals(srcNode)) {
PIP pip = reverseNodeToPIPMap.get(curr);
path.add(pip);
curr = pip.getStartNode();
}
return path;
}
public static void main(String[] args) {
// Download example DCP from:
Design d = Design.readCheckpoint("pblock0.dcp");
Net n = d.getNet("your_program/DOADO[2]");
System.out.println(getConnectionPIPs(n.getSinkPins().get(0)));
}
}
Ultimately, RapidWright stores routing (inter-site routing - from site pin to site pin) in nets as a list of PIPs. They are not separated out by sink pins. There could be potential for an alternate representation more like Vivado's node tree, but we have not begun that development.