Someone mentioned that the output produced by the pstoedit pcb driver had the board size set to a size which was too big and also I noticed that the silk is sometimes off the board anyway. Attached is a diff against pstoedit-3.41 that sizes the board based on the postscript bounding box and it also offsets the silk so the silk starts at 0,0 and fills the board.

Mark, if you're listening and agree with this, would you care to submit it back to the pstoedit maintainer?

-Dan
--- drvpcb2.cpp.orig    2009-02-16 17:44:37.000000000 -0500
+++ drvpcb2.cpp 2009-02-16 18:11:10.000000000 -0500
@@ -30,4 +30,6 @@
 
 
+#define PCB_SILK_W 1000
+const float SCALE = (100000.0f/72.0f);
 
 drvPCB2::derivedConstructor(drvPCB2):
@@ -36,7 +38,4 @@
 {
 // driver specific initializations
-  outf << "PCB[\"\" 600000 500000]\n\n";
-  outf << "Grid[2000.00000000 0 0 0]\n\n";
-  outf << "Layer(10 \"silk\")\n(\n";
 }
 
@@ -55,6 +54,21 @@
 {
   //   outf << "#Neue Seite\n";
+  BBox mybox;
+  long int width_p01_mil, height_p01_mil;
+
+  mybox = getCurrentBBox();
+  
+  x_offset = -mybox.ll.x_ + 0.5*PCB_SILK_W/SCALE ;
+  y_offset = mybox.ur.y_ + 0.5*PCB_SILK_W/SCALE;
+
+  width_p01_mil  = (long int) ((mybox.ur.x_  - mybox.ll.x_) * SCALE + 
PCB_SILK_W);
+  height_p01_mil = (long int) ((mybox.ur.y_  - mybox.ll.y_) * SCALE + 
PCB_SILK_W);
+  
+
+  outf << "PCB[\"\" " << width_p01_mil << " " << height_p01_mil << "]\n\n";
+  outf << "Grid[2000.00000000 0 0 0]\n\n";
+  outf << "Layer(10 \"silk\")\n(\n";
+
 }
-const float SCALE = (100000.0f/72.0f);
 
 void drvPCB2::show_path()
@@ -67,8 +81,9 @@
                const Point & p = pathElement(n).getPoint(0);
                outf << "Line[";
-               outf << (int)(p1.x_*SCALE) << " " 
-                     << (int)(500000-p1.y_*SCALE) << " " 
-                     << (int)(p.x_*SCALE) << " " 
-                     << (int)(500000-p.y_*SCALE) << " 1000 2000 0x00000020]\n";
+               outf << (int)( (x_offset + p1.x_)*SCALE + 0.5) << " " 
+                     << (int)((y_offset - p1.y_)*SCALE + 0.5) << " " 
+                     << (int)((x_offset + p.x_)*SCALE + 0.5) << " " 
+                     << (int)((y_offset - p.y_)*SCALE + 0.5) << " " 
+                    << PCB_SILK_W << " 2000 0x00000020]\n";
        }
 }

_______________________________________________
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user

Reply via email to