delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2012/07/11/18:24:59

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
Message-ID: <4FFDFD1F.70704@estechnical.co.uk>
Date: Wed, 11 Jul 2012 23:24:31 +0100
From: Ed Simmons <ed AT estechnical DOT co DOT uk>
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version: 1.0
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] pcb_(f)printf
References: <4FFDD696 DOT 3090509 AT estechnical DOT co DOT uk> <20120711211832 DOT GA9292 AT visitor2 DOT iram DOT es>
In-Reply-To: <20120711211832.GA9292@visitor2.iram.es>
X-Authenticated-As: ed AT estechnical DOT co DOT uk
Reply-To: geda-user AT delorie DOT com

On 11/07/12 22:18, Gabriel Paubert wrote:
> On Wed, Jul 11, 2012 at 08:40:06PM +0100, Ed Simmons wrote:
>> Hi Geda List,
>>
>> I'm writing my own geda HID (an exporter for pick and place) and
>> I've started out with the BOM exporter.
>>
>> Looking at the source for pcb_(f)printf it's not obvious how I'd go
>> about using this to output the data in the form I need, I'm looking
>> to output the centroid location data in hundredths of mm.
>>
>> Here's what I'm testing so far:
>>
>>     pcb_fprintf(fp, "3  : 230: 1: 3: 0:F 1X %.2mMY %.2mMA %gR %s %s %s\n",
>>             x , y, theta * 10, name, value, FRONT (element) == 1 ?
>> "top" : "bot");
>>
>> This seems to output mixed units, some in MM and some in Mils.
> Surprising. But I suspect that you want a lowercase m in the format
> to force mm output. Uppercase M tries to select automatically an
> unit in the metric family, as far as I understand.
Thanks - I think I'm understanding it bit better now - a break from the 
screen also helps!

>
>> Please ignore the fact I'm printing a half-line of garbage before
>> the data we're interested in, the pnp file format is weird and I
>> haven't completely deciphered it yet.
>>
>> The BOM exproter contains
>>
>>      pcb_fprintf (fp, "%m+%s,\"%s\",\"%s\",%.2mS,%.2mS,%g,%s\n",
>>               xy_unit->allow, name, descr, value, x, y,
>>               theta, FRONT (element) == 1 ? "top" : "bottom");
>>
>> I'm not folowing the use of the unit here - I fail to see how it
>> works, but it does, and I'm having trouble replicating this and
>> getting metric units in hundredths of mm.
> It works by passing the unit through the %m+ mechanism, which limits
> the choice of units of the following %.2mS (the bom exporter has
> options to chose the units).
>
> But if all you want is mm with 2 fractional digits, use %.2mm.
>
> 	Gabriel
Sorry - badly worded explanation on my part - I'm trying to output, for 
example 12mm as 1200, with no decimal places at all in the resulting 
output. However, just multiplying the X and Y data calculated as per the 
BOM code yields what looks like roll over of values, with some values 
being printed in negative. It seems like I should be adding a mode/extra 
units option to the pcb_printf, does this sound right?

Thanks,
Ed

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019