delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2012/07/12/00:25:09

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
Date: Wed, 11 Jul 2012 21:18:09 -0700
From: Andrew Poelstra <asp11 AT sfu DOT ca>
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] pcb_(f)printf
Message-ID: <20120712041809.GA28342@malakian.lan>
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>
<4FFE08B0 DOT 4060609 AT estechnical DOT co DOT uk>
MIME-Version: 1.0
In-Reply-To: <4FFE08B0.4060609@estechnical.co.uk>
User-Agent: Mutt/1.5.20 (2009-12-10)
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, Jul 12, 2012 at 12:13:52AM +0100, Ed Simmons wrote:
> 
> 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");
>

Please don't use base units -- %i won't work on 64-bit systems, and
isn't guaranteed to work on any systems in the future. Instead use
the %mn specifier to output coordinates as nanometers. (Then you can
use /10000 as you have.)
 
> Thanks for your help, now I also realise there was no problem with
> mixed units, I was rolling over variables and other wonderful
> things.
>
 

-- 
Andrew Poelstra
Email: asp11 at sfu.ca OR apoelstra at wpsoftware.net
Web:   http://www.wpsoftware.net/andrew
"You shouldn't trust every quote you read on the Internet." -- Socrates

- Raw text -


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