📄 mill-outlines.ulp
字号:
dlgCell(7, 0) dlgLabel("&Via drill");
dlgCell(7, 1) dlgRealEdit(DrillVia, 0.1, 10);
dlgCell(7, 2) dlgLabel("mm");
dlgCell(7, 4) dlgPushButton("Via info"){
info = showpic[6];
infotext = "Via drill diameter.";
}
dlgCell(8, 0) dlgLabel("&Hole drill");
dlgCell(8, 1) dlgRealEdit(DrillHole, 0.1, 10);
dlgCell(8, 2) dlgLabel("mm");
dlgCell(8, 4) dlgPushButton("Hole info"){
info = showpic[7];
infotext = "Hole drill diameter.";
}
dlgCell(9, 0) dlgLabel("Dist. &Copper/Dim");
dlgCell(9, 1) dlgRealEdit(Distance_Copper_Dimension, 0.0, 20);
dlgCell(9, 2) dlgLabel("mm");
dlgCell(9, 4) dlgPushButton("Distance info") {
info = showpic[10];
infotext = infotext = DRCinfo + usage +
"<br><img src=\"mill-outlines-drc-info.bmp\">";
}
dlgCell(10, 0) dlgLabel("Mill Board/D&im");
dlgCell(10, 1) dlgRealEdit(DimensionMillTool, 0.0, 5);
dlgCell(10, 2) dlgLabel("mm");
dlgCell(10, 3) dlgLabel(" (0 = OFF)");
dlgCell(10, 4) dlgPushButton("Dimension info") {
info = showpic[16];
if (DimensionMillTool) {
infotext = "<nobr>Mill diameter for cut out.<br>Set value 0 for switch <b>OFF</b> this function.</nobr>";
}
else {
infotext = "<nobr>Mill diameter for cut out.<br>Set value for switch <b>ON</b> this function.</nobr>";
}
}
dlgCell(11, 0) dlgLabel("Holder spac&ing");
dlgCell(11, 1) dlgRealEdit(Holder_Spacing, 1.0, 500);
dlgCell(11, 2) dlgLabel("mm");
dlgCell(11, 4) dlgPushButton("Spacing info") {
info = showpic[15];
infotext = "This value determins the minimum length of a edge where a spacer will be set.<p>" +
"Spacers will be set on vertical & horizontal and in HPGL-Format only.<p>" +
"The width of the spacer depends on the diameter of tool#2.";
}
}
dlgVBoxLayout dlgSpacing (400); // high of Cell
dlgStretch(0);
dlgVBoxLayout {
dlgStretch(0);
dlgLabel(info, 1);
dlgStretch(0);
dlgLabel(infotext, 1);
dlgStretch(1);
}
dlgStretch(1);
}
dlgStretch(1);
dlgHBoxLayout {
dlgStretch(0);
dlgLabel("Mill fil&e");
dlgStretch(0);
dlgStringEdit(File);
dlgStretch(0);
dlgPushButton("&Browse") {
string fn = dlgFileSave("Save Outlines file", File);
if (fn) {
File = fn;
FileName = fn;
info = showpic[1];
}
}
dlgStretch(0);
}
dlgHBoxLayout {
dlgStretch(0);
dlgLabel(DrillLabel);
dlgStretch(0);
dlgStringEdit(DrFile);
dlgStretch(0);
dlgPushButton(DrBrowse) {
string fd = dlgFileSave("Save Drill file", DrFile);
if (fd) {
DrFile = fd;
DrillFile = fd;
info = showpic[3];
}
}
dlgStretch(0);
}
dlgStretch(1);
dlgHBoxLayout dlgSpacing(600);
dlgHBoxLayout {
dlgStretch(0);
dlgPushButton("+OK") {
if (!SelectedDevice) Error("No device selected!", "Please select a device.");
else {
int fault = 0;
real distanceDimension = DimensionMillTool / 2 - Distance_Copper_Dimension;
if (DimensionMillTool) { // **** if used ? ****
if (distanceDimension < 0) {
string d;
sprintf(d, "%.3f", distanceDimension * -1);
fault = dlgMessageBox("<qt><nobr>The value for Copper/Dimension "
"is greater than the mill tool (free pouring) diameter.<p>"
"Check/change Distance Copper/Dimension in Design Rules <b>DRC</b><p>"
"or accept a distance of " + d +
"mm to board dimension.</nobr></qt>",
"Accept", "Cancel");
}
}
if (SelectedDevice != devHPGL && onlydrill) {
Error("only drill (HPGL)", "used without HPGL device");
fault = 1;
}
if (!MillToolOutl) {
Error("Illegal diameter: 0", "The <i>Isolate diameter</i> must be greater than zero.");
fault = 1;
}
if (!fault) {
FileName = File;
if (test) output(filesetext(B.name, "-cmd.txt"), "at");
DrillFile = DrFile;
sprintf(lOutl, "%d", SelectedLayer + 100);
if (mir) Mirror = -1;
dlgAccept();
}
}
}
dlgStretch(0);
dlgPushButton("-Cancel") { dlgReject(); exit(1); }
dlgStretch(1);
}
};
}
Device = DeviceNames[SelectedDevice];
Layer = strtol(Layers[SelectedLayer]);
fileerror();
output(FileName, "wt"); // creat new file
if (fileerror()) exit (1);
output(filesetext(B.name, "_display$tmp-.scr"), "wt") {
printf("DISPLAY NONE 17 ");
board(B) {
B.layers(L) {
if (L.visible) printf("%d ",L.number);
}
}
switch (SelectedDevice) {
case devScript:
printf(" %d", Layer + 100);
printf(";\n");
break;
case devHPGL:
output(filesetext(FileName,".pli"), "wt") {
printf("# Plot info generated by %s\n# from %s\n# at %s\n# Used tools\n", argv[0], B.name, t2string(time()) );
}
break;
}
}
toolFiles(); // generate Rack and Wheel file
generateTruePolygonOutlines(); // generate the true Dimension outline as polygon.
}
}
// *** pass runs ****
setMillOffset(); // get info of special package if placed
if (InPassDimensionPoly) {
GenerateOutlines(); // for milling isolate
}
if (InPass2) {
board(B) {
real x1 = u2mm(B.area.x1) - MillToolFree/4 , y1 = u2mm(B.area.y1) - MillToolFree/2 ;
output(FileName, "at") {
DeviceInit(Contour);
switch (SelectedDevice) {
case devScript:
scriptHeader();
output(DrillFile, "wt") {
DeviceInit(PadDrill);
WriteDrills();
}
break;
case devHPGL:
if (generatedrills) WriteDrills();
break;
}
printf("%s", WriteOutlines(OutlinesSignalName)); // the isolated contour
}
if (MillToolFree < 0) MillToolFree = 0.2;
real overlapfree = MillToolFree * OverlapRubOut / 100;
real overlapoutl = MillToolOutl * OverlapOutlPercent / 100;
string Cmd;
sprintf(Cmd, "CHANGE WIDTH %.3f (%.4f %.4f);\n"
"CHANGE ISOLATE %.3f (%.4f %.4f);\n"
"RATSNEST;\n",
MillToolFree - overlapfree, x1, y1,
MillToolOutl + ( (overlapfree / 2 ) - overlapoutl), x1, y1 );
Cmd += RUN_pass(PassPour);
if (test) output(filesetext(B.name, "-cmd.txt"), "at") printf("%s", Cmd);
if (test) viewtest(Cmd);
exit (Cmd);
}
}
if (InPassPour) {
board(B) {
output(FileName, "at") {
if (SelectedDevice == devScript) printf("# 2. isolate\n");
printf("%s", WriteOutlines( OutlinesSignalName)) ;
switch (SelectedDevice) {
case devScript:
output(DrillFile, "at") {
WriteHoles();
}
break;
case devHPGL:
if(generatedrills) WriteHoles();
break;
default:
DeviceEnd();
break;
}
}
real x1 = u2mm(B.area.x1) - MillToolFree/4, y1 = u2mm(B.area.y1) - MillToolFree/2;
real x2 = u2mm(B.area.x2) + MillToolFree/4, y2 = u2mm(B.area.y2) + MillToolFree/2;
string Cmd;
string millout;
sprintf(Cmd, "DISPLAY NONE 17 %d;\nDELETE ", Layer); // Delete Outline Polygon
string deloutline[];
int n = strsplit(deloutline, trueOutline_coordinate, ' ');
string s;
for (int x = 0; x < n-6; x++) { // true polygon coorinates
sprintf(s, "%s ", deloutline[x]);
Cmd += s;
}
Cmd += ";\n";
// make virtual Net for Normal Polygon Orphen OFF
Cmd += "SET WIRE_BEND 2;\n";
sprintf(millout, "VIA '%s' (%.4f %.4f);\n", OutlineMillSignal, x1 - Distance_Copper_Dimension, y1 - Distance_Copper_Dimension);
Cmd += millout;
real distanceDimension = DimensionMillTool / 2 - Distance_Copper_Dimension;
if (distanceDimension < 0) {
distanceDimension = 0.001;
}
// Width = MillFree-Diameter/2 minus "Distance Copper/Dimension"
sprintf(millout, "CHANGE ISOLATE 0;\n");
Cmd += millout;
sprintf(millout, "CHANGE ORPHANS OFF;\n");
Cmd += millout;
Cmd += "SET WIRE_BEND 0;\n";
real dimensionwidth = DimensionMillTool - 2*distanceDimension;
if (dimensionwidth < 0) dimensionwidth = 0.1;
sprintf(millout, "POLyGON '%s' %.3f (%.4f %.4f) (%.4f %.4f) (%.4f %.4f);\nRATSNEST;\n", OutlineMillSignal, dimensionwidth,
x1 - DimensionMillTool - Distance_Copper_Dimension,
y1 - DimensionMillTool - Distance_Copper_Dimension,
x2 + DimensionMillTool + Distance_Copper_Dimension,
y2 + DimensionMillTool + Distance_Copper_Dimension,
x1 - DimensionMillTool - Distance_Copper_Dimension,
y1 - DimensionMillTool - Distance_Copper_Dimension);
Cmd += millout;
Cmd += RUN_pass(PassOutmill);
if (test) output(filesetext(B.name, "-cmd.txt"), "at") printf("%s", Cmd);
if (test) viewtest(Cmd);
exit (Cmd);
}
}
if (InPassOutmill) {
board(B) {
string Cmd;
real x1 = u2mm(B.area.x1) - DimensionMillTool/4, y1 = u2mm(B.area.y1) - MillToolFree/2,
x2 = u2mm(B.area.x2) + DimensionMillTool/4, y2 = u2mm(B.area.y2) + MillToolFree/2;
// delete Virtual Polygon and VIA
sprintf(Cmd, "DELETE (%.4f %.4f) (%.4f %.4f) (%.4f %.4f);\n",
x1, y1, x2, y2, x1, y1 );
output(FileName, "at") {
if (SelectedDevice == devScript) printf("# milling dimension\n");
printf("%s", WriteOutlines( OutlineMillSignal)) ;
}
switch (SelectedDevice) {
case devScript:
Cmd += "SCRIPT '" + FileName + "';\n"; // execute script
Cmd += "SCRIPT '" + filesetext(B.name, "_display$tmp-.scr") + "';\n";
break;
case devHPGL:
Cmd += "script '" + filesetext(B.name, "_display$tmp-.scr") + "';\n";
break;
}
if (test) output(filesetext(B.name, "-cmd.txt"), "at") printf("%s", Cmd);
Cmd += "GRID LAST;\nSET UNDO_LOG ON;\nSET OPTIMIZING ON;\nWIN;\n";
switch (SelectedDevice) {
case devScript:
break;
case devHPGL:
if (test) showHPGLinfo();
break;
}
// if (test) showRackFile();
if (test) viewtest(Cmd);
exit (Cmd);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -