📄 mill-outlines.ulp
字号:
// pen_assign += t;
sprintf(t, "<tr><td>HoleDrill:</td><td>PEN %d</td><td>%.1f mm</td><tr>\n", HoleDrill, DrillHole);
pen_assign += t;
sprintf(t, "<tr><td>Mill outline (Dimension):</td><td>PEN %d</td><td>%.1f mm</td><tr>\n", DimensionLine, DimensionMillTool);
pen_assign += t;
pen_assign += "</table>";
dlgLabel(pen_assign);
dlgHBoxLayout {
dlgStretch(0);
dlgPushButton("OK") dlgAccept();
dlgStretch(1);
}
};
return;
}
void selectDevice(void) {
File = filesetext(FileName, DeviceExt[SelectedDevice]);
if (SelectedDevice != devHPGL) {
info = showpic[12 + SelectedDevice];
DrFile = filesetext(DrillFile, DrillExt[SelectedDevice]);
DrillLabel = "D&rill file";
DrBrowse = "Bro&wse";
}
else {
info = showpic[12 + SelectedDevice];
DrFile ="";
DrillLabel = "D&rill file";
DrBrowse = "Bro&wse";
}
return;
}
void setMillOffset(void) {
board(B) {
path = filedir(B.name);
B.elements(E) {
if (E.package.name == ref_pac) {
ref_offsetX[ref_cnto] = E.x;
ref_offsetY[ref_cnto] = E.y;
ref_cnto++;
E.package.circles(C) {
if (C.layer == 45) {
ref_offsetX[ref_cnto] = C.x;
ref_offsetY[ref_cnto] = C.y;
ref_cnto++;
}
}
if(ref_offsetX[1] > ref_offsetX[2]) { // if first X > second X then swap
ref_offsetX[3] = ref_offsetX[2];
ref_offsetX[2] = ref_offsetX[1];
ref_offsetX[1] = ref_offsetX[3];
}
if (ref_cnto == 3) {
ref_null_offsetX = ref_offsetX[0] * -1;
ref_null_offsetY = ref_offsetY[0] * -1;
if (Mirror == -1) {
mirr_offsetx = (ref_offsetX[2] + ref_offsetX[1] + ref_null_offsetX) * -1;
}
else {
mirr_offsetx = ref_null_offsetX;
}
}
else {
ref_cnto = 0; // more then 2 circles can't use as reference
if (dlgMessageBox("The reference Hole-Package contains more then 2 Holes\n" +
"generate outlines without reference-offset", "accept", "break") != 0) exit(0);
}
}
}
}
return;
}
void setblowinfo(void) {
if (MillToolFree) {
if (millfreeyes) { // 14.05.2002 alf
info = showpic[18];
infotext = "<nobr>Tool diameter for Blow-Up/Rub-Out<br>If value set to <b>0</b>, <b>no</b> Blow-Up (second isolate)<br>and Rub-Out (free milling) is generated.</nobr>";
}
else {
info = showpic[20];
infotext = "<nobr>Rub-Out is off!<br>Tool diameter for sec. isolate<br>If value set, Blow-Up (second isolate) is generated.</nobr>";
}
}
else {
if(millfreeyes) {
info = showpic[19];
infotext = "<nobr>You must set value to Blow-Up.</nobr>";
}
else {
info = showpic[19];
infotext = "<nobr>No blow up and Rub-Out is generated while value is set to 0.</nobr>";
} // 14.05.2002 alf
}
return;
}
//
// Main program:
//
// get Command-Line parameter if use RUN
if (argv[1]) {
Device = argv[1];
if (argv[2]) {
MillToolOutl = strtod(argv[2]);
if (MillToolOutl <= 0)
Fatal("Illegal diameter for milling tool #1: " + argv[2], "The <i>diameter</i> must be greater than zero.");
MillToolIsolate = strtod(argv[3]);
MillToolFree = strtod(argv[4]);
if (argv[4]) {
Layer = strtol(argv[5]);
sprintf(lOutl, "outmil%d", Layer);
if (Layer < 0 || Layer > 16)
Fatal("Illegal layer: " + argv[5], "The <i>layer</i> must be one of 1..16 or 0 to use the current layer.");
if (argv[6]) {
FileName = argv[6];
DrillFile = argv[7];
}
Mirror = strtod(argv[9]);
if (Mirror == 0)
Fatal("Illegal mirror value: " + argv[9], "The <i> mirror</i> must be -1 or 1.");
DrillPad = strtod(argv[10]);
if (DrillPad <= 0)
Fatal("Illegal diameter for Pad drill tool: " + argv[10], "The <i>diameter</i> must be greater than zero.");
DrillVia = strtod(argv[11]);
if (DrillVia <= 0)
Fatal("Illegal diameter for Via drill tool: " + argv[11], "The <i>diameter</i> must be greater than zero.");
DrillHole = strtod(argv[12]);
if (DrillHole <= 0)
Fatal("Illegal diameter for Hole drill tool: " + argv[12], "The <i>diameter</i> must be greater than zero.");
OverlapOutlPercent = strtol(argv[13]);
OverlapRubOut = strtol(argv[14]);
Distance_Copper_Dimension = strtod(argv[15]);
DimensionMillTool = strtod(argv[16]);
millfreeyes = strtol(argv[17]);
Holder_Spacing = strtod(argv[18]);
onlydrill = strtol(argv[19]);
generatedrills = strtol(argv[20]);
trueOutline_coordinate = (argv[21]);
}
}
}
if (!FileName) board(B) FileName = filesetext(B.name, DefaultSuffix);
if (!DrillFile) board(B) DrillFile = filesetext(B.name, DrlDefaultSuffix);
if (Device) {
ValueInit();
int n;
while (DeviceNames[n]) { // upper case
if (strupr(DeviceNames[n]) == strupr(Device)) {
SelectedDevice = n;
break;
}
n++;
}
if (!SelectedDevice)
Fatal("Illegal device: " + Device, "Please select one of the known devices.");
}
if (argv[8] == PassDimensionPoly) InPassDimensionPoly = argv[8]; // generate true outlines
if (argv[8] == Pass2) InPass2 = argv[8];
if (argv[8] == PassPour) InPassPour = argv[8];
if (argv[8] == PassOutmill) InPassOutmill = argv[8];
// *** run passes ***
if ( !InPass2 && !InPassPour && !InPassOutmill && !InPassDimensionPoly) {
showpic[0] = "<img src=\"mill-outlines-eagle.bmp\">";
showpic[1] = "<img src=\"mill-outlines-free.bmp\">";
showpic[2] = "<img src=\"mill-outlines-ovrlpfp.bmp\">";
showpic[3] = "<img src=\"mill-outlines-pour.bmp\">";
showpic[4] = "<img src=\"mill-outlines-ovrlppp.bmp\">";
showpic[5] = "<img src=\"mill-outlines-drill.bmp\">";
showpic[6] = "<img src=\"mill-outlines-via.bmp\">";
showpic[7] = "<img src=\"mill-outlines-hole.bmp\">";
showpic[8] = "<img src=\"mill-outlines-top.bmp\">";
showpic[9] = "<img src=\"mill-outlines-bott.bmp\">";
showpic[10] = "<img src=\"mill-outlines-coppdim.bmp\">";
showpic[11] = "<img src=\"mill-outlines-nomir.bmp\">";
showpic[12] = "<img src=\"mill-outlines-mirror.bmp\">";
showpic[13] = "<img src=\"mill-outlines-script.bmp\">";
showpic[14] = "<img src=\"mill-outlines-hpgl.bmp\">";
showpic[15] = "<img src=\"mill-outlines-spacing.bmp\">";
showpic[16] = "<img src=\"mill-outlines-mildimension.bmp\">";
showpic[17] = "<img src=\"mill-outlines-null_reference.bmp\">";
showpic[18] = "<img src=\"mill-outlines-isol-pour.bmp\">";
showpic[19] = "<img src=\"mill-outlines-no-blowup.bmp\">";
showpic[20] = "<img src=\"mill-outlines-sec-isolate.bmp\">";
info = showpic[10];
infotext = DRCinfo + usage + "<br><img src=\"mill-outlines-drc-info.bmp\">";
string Layers[];
int SelectedLayer = -1;
int ForceDialog = (!Device || !MillToolOutl);
board(B) {
B.signals(S) {
if (S.name == OutlinesSignalName)
Fatal("There is already a signal named " + OutlinesSignalName + " in this board!", "Please make sure that there is no such signal in this board.");
}
int n;
B.layers(L) {
if (L.number <= 16 && L.visible) {
if (Layer == L.number) SelectedLayer = n;
sprintf(Layers[n++], "%d %s", L.number, L.name);
}
}
if (n == 0) Fatal("No signal layer active!", "Please activate the signal layer to generate outlines for.");
if (!Layer) {
if (n > 1) ForceDialog = 1;
SelectedLayer = 0;
}
if (SelectedLayer < 0) {
string s;
sprintf(s, "%d", Layer);
Fatal("Invalid layer: " + s, "The <i>layer</i> was not found or is not active.");
}
if (ForceDialog) {
SelectedDevice = defaultdevice;
File = FileName;
DrFile = DrillFile;
DrillLabel = "D&rill file";
selectDevice();
int mir = 0;
dlgDialog(Version) {
dlgHBoxLayout {
dlgGridLayout {
dlgCell(0, 0) dlgLabel("&Device");
dlgCell(0, 1) dlgComboBox(DeviceNames, SelectedDevice) {
if (SelectedDevice) selectDevice();
else {
File = "";
DrFile = "";
}
infotext = "";
}
dlgCell(0, 3) dlgCheckBox("onl&y drills (HPGL)", onlydrill) {
if (onlydrill) {
generatedrills = 1;
infotext = "<nobr>Generate only drill file if HPGL selected.</nobr>";
}
else {
infotext = "";
}
}
dlgCell(0, 4) dlgPushButton("Pen &Assignment") { penAssign(); };
dlgCell(1, 0) dlgLabel("&Layer");
dlgCell(1, 1) dlgComboBox(Layers, SelectedLayer) {
if (SelectedLayer == 0) info = showpic[8];
if (SelectedLayer == 1) info = showpic[9];
infotext = "";
}
dlgCell(1, 3) dlgCheckBox("&Mirror", mir) {
if (mir) {
info = showpic[12];
infotext = "<nobr>Milling BOTTOM side (set mirror).</nobr>";
Mirror = -1.0;
}
else {
info = showpic[11];
infotext = "<nobr>Milling TOP side.</nobr>";
Mirror = 1.0;
}
}
dlgCell(1, 4) dlgPushButton("Refere&nce") {
info = showpic[17];
infotext = infoREFERENCE;
setZerroReference();
}
dlgCell(2, 0) dlgLabel("tool#&1 Isolate");
dlgCell(2, 1) dlgRealEdit(MillToolOutl, 0.1, 10);
dlgCell(2, 2) dlgLabel("mm");
dlgCell(2, 4) dlgPushButton("Isolate info") {
info = showpic[1];infotext = "<nobr>Tool diameter for isolate.</nobr>";
}
dlgCell(3, 0) dlgLabel("&Overlap\nisolate/blow-up");
dlgCell(3, 1) dlgIntEdit(OverlapOutlPercent, 0, 99);
dlgCell(3, 2) dlgLabel("%");
dlgCell(3, 4) dlgPushButton("Overlap info") {
info = showpic[2];
infotext = "<nobr>Overlap isolate - blow up in percent %.</nobr>";
}
dlgCell(4, 0) dlgLabel("tool#&2 blow-up");
dlgCell(4, 1) dlgRealEdit(MillToolFree, 0.0, 10);
dlgCell(4, 2) dlgLabel("mm");
dlgCell(4, 3) dlgCheckBox("Rub ou&t", millfreeyes) setblowinfo();
dlgCell(4, 4) dlgPushButton("Blow up/Rub out info") {
info = showpic[18];
setblowinfo();
}
dlgCell(5, 0) dlgLabel("Overlap rub-o&ut");
dlgCell(5, 1) dlgIntEdit(OverlapRubOut, 0, 99);
dlgCell(5, 2) dlgLabel("%");
dlgCell(5, 4) dlgPushButton("Overlap info") {
info = showpic[4];
infotext = "Overlap rub-out diameter in percent %.";
}
dlgCell(6, 0) dlgLabel("&Pad drill");
dlgCell(6, 1) dlgRealEdit(DrillPad, 0.1, 10);
dlgCell(6, 2) dlgLabel("mm");
dlgCell(6, 3) dlgCheckBox("Gen. drills", generatedrills) {
if (generatedrills) {
infotext = "<nobr>Generate drill data.</nobr>";
}
else {
infotext = "<nobr>Drills (PAD, VIA, HOLE) are disabled.<br>";
}
}
dlgCell(6, 4) dlgPushButton("Pad info") { info = showpic[5]; infotext = "Pad drill diameter"; };
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -