Show wire gauge in the bom and project explorer

This commit is contained in:
Bane Stojkovic
2022-12-14 22:15:40 +01:00
parent d5d0ec56cf
commit 7a186d0d49
10 changed files with 47 additions and 47 deletions
Binary file not shown.
@@ -27,7 +27,7 @@ public enum AWG {
@Override
public String toString() {
return "#" + name().replace("_", "") + " (" + String.format("%1$,.2f", diameterIn() * 25.4) + "mm / " + String.format("%1$,.5f", diameterIn()) + "in)";
return "#" + name().replace("_", "") + " / " + String.format("%1$,.2f", diameterIn() * 25.4) + "mm";
}
public double diameterIn() {
@@ -41,7 +41,7 @@ import org.diylc.utils.Constants;
instanceNamePrefix = "W", description = "Flexible wire with two control points", zOrder = IDIYComponent.WIRING,
flexibleZOrder = true, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
transformer = SimpleComponentTransformer.class, enableCache = false)
public class HookupWire extends AbstractCurvedComponent<Void> implements IContinuity {
public class HookupWire extends AbstractCurvedComponent<AWG> implements IContinuity {
private static final long serialVersionUID = 1L;
@@ -117,22 +117,14 @@ public class HookupWire extends AbstractCurvedComponent<Void> implements IContin
}
@EditableProperty(name = "AWG")
public AWG getGauge() {
public AWG getValue() {
return gauge;
}
public void setGauge(AWG gauge) {
public void setValue(AWG gauge) {
this.gauge = gauge;
}
@Override
public Void getValue() {
return null;
}
@Override
public void setValue(Void value) {}
@EditableProperty(name = "Stripe")
public boolean getStriped() {
return striped;
@@ -80,7 +80,7 @@ public class FlexibleLeadsEditor implements IProjectEditor {
// create leads
HookupWire w1 = new HookupWire();
getInstantiationManager().fillWithDefaultProperties(w1, null);
w1.setGauge(AWG._26);
w1.setValue(AWG._26);
w1.setLeadColor(leaded.getLeadColor());
// w1.setPointCount(PointCount.THREE);
w1.setControlPoint(p1, 0);
@@ -93,7 +93,7 @@ public class FlexibleLeadsEditor implements IProjectEditor {
HookupWire w2 = new HookupWire();
getInstantiationManager().fillWithDefaultProperties(w2, null);
w2.setGauge(AWG._26);
w2.setValue(AWG._26);
w2.setLeadColor(leaded.getLeadColor());
// w2.setPointCount(PointCount.THREE);
w2.setControlPoint(p2, 0);
@@ -134,9 +134,9 @@ public class FlexibleLeadsEditor implements IProjectEditor {
getInstantiationManager().fillWithDefaultProperties(w, null);
// make the leads thicker for TO220 and TO126
if (c instanceof TransistorTO220 || c instanceof TransistorTO126)
w.setGauge(AWG._24);
w.setValue(AWG._24);
else
w.setGauge(AWG._26);
w.setValue(AWG._26);
w.setLeadColor(AbstractTransistorPackage.METAL_COLOR);
w.setPointCount(PointCount.THREE);
w.setControlPoint(p0, 0);
@@ -244,7 +244,7 @@ public class FlexibleLeadsEditor implements IProjectEditor {
tx = AffineTransform.getRotateInstance(c.getOrientation().toRadians(), p0.getX(), p0.getY());
HookupWire w = new HookupWire();
w.setGauge(AWG._24);
w.setValue(AWG._24);
getInstantiationManager().fillWithDefaultProperties(w, null);
for (int j = 0; j < w.getControlPointCount(); j++) {
Point2D p = new Point2D.Double((int)(p0.getX() + dx * j), (int)(p0.getY() + dy * j));
@@ -439,29 +439,29 @@ public class V2FileParser implements IOldFileParser {
}
num = num * 2 + 8;
if (num == 8)
hw.setGauge(AWG._8);
hw.setValue(AWG._8);
else if (num == 10)
hw.setGauge(AWG._10);
hw.setValue(AWG._10);
else if (num == 12)
hw.setGauge(AWG._12);
hw.setValue(AWG._12);
else if (num == 14)
hw.setGauge(AWG._14);
hw.setValue(AWG._14);
else if (num == 16)
hw.setGauge(AWG._16);
hw.setValue(AWG._16);
else if (num == 18)
hw.setGauge(AWG._18);
hw.setValue(AWG._18);
else if (num == 20)
hw.setGauge(AWG._20);
hw.setValue(AWG._20);
else if (num == 22)
hw.setGauge(AWG._22);
hw.setValue(AWG._22);
else if (num == 24)
hw.setGauge(AWG._24);
hw.setValue(AWG._24);
else if (num == 26)
hw.setGauge(AWG._26);
hw.setValue(AWG._26);
else if (num == 28)
hw.setGauge(AWG._28);
hw.setValue(AWG._28);
else if (num == 30)
hw.setGauge(AWG._30);
hw.setValue(AWG._30);
hw.setLeadColor(cl);
hw.setControlPoint(tacke.get(0), 0);
hw.setControlPoint(tacke.get(1), 1);