delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2012/07/11/19:14:09

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
Message-ID: <4FFE08B0.4060609@estechnical.co.uk>
Date: Thu, 12 Jul 2012 00:13:52 +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> <4FFDFD1F DOT 70704 AT estechnical DOT co DOT uk>
In-Reply-To: <4FFDFD1F.70704@estechnical.co.uk>
X-Authenticated-As: ed AT estechnical DOT co DOT uk
Reply-To: geda-user AT delorie DOT com

On 11/07/12 23:24, Ed Simmons wrote:
>> Surprising. But I suspect that you want a lowercase m in the format
>> to force mm output. Uppercase M tries to select automatically an
>> uIt 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
>

Sorry for the noise, I've figured it out. Dividing from the base unit 
and printing an integer works fine for my purposes.

    pcb_fprintf(fp, "3  : 230: 1: 3: 0:F 1X %iY %iA %iR %s %s %s\n",
            x/10000 , y/10000 , theta * 10, name, value, FRONT (element) 
== 1 ? "top" : "bot");

Thanks for your help, now I also realise there was no problem with mixed 
units, I was rolling over variables and other wonderful things.

Ed


- Raw text -


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