kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #07235
Re: Modules position file: no mm support
On 12/04/2011 05:51 PM, Fabio Varesano wrote:
> Hi everyone,
>
> I'm looking into generating a module position file for a board I'm
> getting into production. I need a module position file in mm.
>
> It seems that, no matters how the units are set in KiCAD, the module
> position file always gets generated in Inches.
>
> So, I went into the code to see what was happening there and, in
> gen_modules_placefile.cpp I found the following line commented:
>
> if(IF_DRILL_METRIC) conv_unit = 0.000254; /* unites = mm */
>
> I didn't tried yet, but it really seems that by uncommenting that line
> mm support would be possible.
>
> So, the question is: Does anyone know why that line is commented?
> Shouldn't we just uncomment it?
>
> Thanks,
>
> Fabio
No, only because IF_DRILL_METRIC is not defined.
But try the attached patch:
1) apply it.
2) edit line 37 of the patched file to #if 0.
3) close the door and open the windows.
Compile and test.
=== modified file 'pcbnew/gen_modules_placefile.cpp'
--- pcbnew/gen_modules_placefile.cpp 2011-11-24 17:32:51 +0000
+++ pcbnew/gen_modules_placefile.cpp 2011-12-05 02:44:03 +0000
@@ -33,6 +33,12 @@
};
+#if 1
+static const double conv_unit = 0.0001; // units = INCHES
+#else
+static const double conv_unit = 0.000254; // units = mm
+#endif
+
static wxPoint File_Place_Offset; /* Offset coordinates for generated file. */
static void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile );
@@ -87,11 +93,6 @@
FILE* fpBack = 0;
bool switchedLocale = false;
- /* Calculate conversion scales. */
- double conv_unit = 0.0001; /* unites = INCHES */
-
-// if(IF_DRILL_METRIC) conv_unit = 0.000254; /* unites = mm */
-
File_Place_Offset = m_Auxiliary_Axis_Position;
/* Calculating the number of useful modules (CMS attribute, not VIRTUAL) */
@@ -319,7 +320,6 @@
*/
void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
{
- double conv_unit;
MODULE* Module;
D_PAD* pad;
char line[1024];
@@ -328,10 +328,6 @@
FILE* rptfile;
wxPoint module_pos;
- conv_unit = 0.0001; /* unites = INCHES */
-
-// if(IF_DRILL_METRIC) conv_unit = 0.000254; /* unites = mm */
-
File_Place_Offset = wxPoint( 0, 0 );
wxString boardFilePath = ( (wxFileName) GetScreen()->GetFileName()).GetPath();
@@ -512,12 +508,10 @@
*/
void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
{
- double conv_unit, ux0, uy0, dx, dy;
+ double ux0, uy0, dx, dy;
double radius, width;
char line[1024];
- conv_unit = 0.0001; /* units = INCHES */
-
ux0 = PtDrawSegment->m_Start.x * conv_unit;
uy0 = PtDrawSegment->m_Start.y * conv_unit;
References