A Bafang BBS02 (for a friend’s upright bike) arrived with a deformed speed sensor nut:

It traveled halfway around the planet while trapped underneath the motor and, if it rode in the top layer or two of containers, the combination of pressure and heat would be irresistible.
The plastic was stiff and I couldn’t force the nut over the connector using as much force as seemed reasonable:

On the upside, the nut just compresses the silicone washer between the connector and the sensor to make a waterproof joint, so it need not have perfect threads or a uniform shape. Once the nut is in place, it will likely never be removed and should never bother anyone else.
Being unwilling to apply a hot-air gun near the cable, I decided to try slowly cold-forming the nut inside a mold:

The gap isn’t a kerf: the two halves meet to form a cylindrical pocket. The smaller holes fit a pair of brass tubes keeping the halves lined up while I arrange things:

A pair of swivel-pad clamps apply the pressure:

A few days of squashing made it round-er, whereupon I applied the clamp directly against the remaining high point with the other side cradled in the mold. It still doesn’t slide over the connector body, but I’m not in a rush.
Bafang tech support generously sent a speed sensor extension cable from which I can extract a good nut, which will require cutting and splicing the cable from the motor.
I’m still hoping gentle suasion will prevail.
The OpenSCAD source code tucks into the overall file producing various useful bits:
// Mold to reshape speed sensor nut
SensorNut = [0,14.4,13.0];
SensorMold = [SensorNut[OD] + 2*WallThick,SensorNut[OD] + 2*WallThick,SensorNut[LENGTH] + WallThick];
MoldSides = 20;
RodOD = 1.6;
module NutMoldBlock() {
difference() {
translate([0,0,SensorMold.z/2])
cube(SensorMold,center=true);
translate([0,0,WallThick])
rotate(180/MoldSides)
PolyCyl(SensorNut[OD],2*SensorNut[LENGTH],MoldSides);
translate([0,0,-Protrusion])
rotate(180/8)
PolyCyl(SpeedOD,2*SensorMold.z,8);
for (i=[-1,1])
translate([i*(SensorMold.x/2 - WallThick/2),SensorMold.y,SensorMold.z/2])
rotate([90,0,0])
PolyCyl(RodOD,2*SensorMold.y,6);
}
}
module NutMold() {
gap = 1.0;
for (j=[-1,1])
translate([0,j*gap,0])
intersection() {
translate([0,j*SensorMold.y,0])
cube(2*SensorMold,center=true);
NutMoldBlock();
}
}
… snippage …
if (Layout == "NutMold")
NutMold();

































