delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2012/07/12/12:50:34

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type:x-gm-message-state;
bh=6xdzVd68d6h1WO4xJiHdGrJaBck85OZO2/Vp14Bwbek=;
b=kd0HOuTiMyQ3tK8za1OSBKRUYqNSq4oQ/UBWfrsstU8gAex7NjylQTRbFhENq++3Aw
8aK59/NQKMk04MijoJcvU9f6A3BNbdvCylMl8nst10FYZJT+EhBHGh1RpZcCkap3E0fs
Vb/WBxGEQEnl97skuNP7dddEwQsrwDtJ1MJdHlI6nF8ksXn/aoQ5/4y8mvEFDbLfVB+7
PqyGGJBQ+ZUq+71oluGGIMM7EDTWJX4AooRx3CcsO1YQOrYfR/lfsta7icD/GtmUiSEW
qL7PKscEekbi+hZuRTYb1JS1ia8PUhWc6WukdJwmD6UDKxpqjrAY2eJPIL1OdsR3YWyi
vkbg==
MIME-Version: 1.0
In-Reply-To: <4FFED530.70503@estechnical.co.uk>
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>
<20120712041809 DOT GA28342 AT malakian DOT lan>
<4FFED530 DOT 70503 AT estechnical DOT co DOT uk>
Date: Thu, 12 Jul 2012 09:50:22 -0700
Message-ID: <CAN0Jx-8asCy7ikiig0roN16wn0WACtY2DbZDc7D6xpujHW0gbQ@mail.gmail.com>
Subject: Re: [geda-user] pcb_(f)printf
From: Russell Dill <Russ DOT Dill AT asu DOT edu>
To: geda-user AT delorie DOT com
X-Gm-Message-State: ALoCoQlFlsl9RXPJJUDRM18d9DfAq1qmiX0dTOxQI6bnwVITrbyDk4mWU0BXtXcmR7WqRJ81Nk+4
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 6:46 AM, Ed Simmons <ed AT estechnical DOT co DOT uk> wrote:
> On 12/07/12 05:18, Andrew Poelstra wrote:
>>
>> 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, that's looking much better now. I did think it was a bit ugly to use
> the base unit, considering there's obviously been plenty of work to avoid
> using the base units directly.
>
> I'm now finding another issue... I've made a fiducial symbol and footprint,
> and I'm successfully identifying fiducial 1 in the exporter, then trying to
> get it's location to use as the bias offset for all the location data that
> is subsequently output.
>
> Using the same element loop and pin/pad loops to find the location of the
> fiducial seems to not work properly for me yet. I always get X axis location
> as 0, but Y looks as though it is working.
>
> This is what I have:
>
>   ELEMENT_LOOP (PCB->Data);
>   {
>
>       if (NSTRCMP ( NAMEONPCB_NAME (element), "FID1") == 0)
>       { // hooray! fiducial 1 has been found
>          pcb_fprintf (fp, "# Found fiducial 1\n");
>          int count = 0;
>
>           PAD_LOOP (element);
>           {
>             sumx += (pad->Point1.X + pad->Point2.X) / 2.0;
>             sumy += (pad->Point1.Y + pad->Point2.Y) / 2.0;
>             pcb_fprintf (fp, "# Sum X = %.2mm Sum y = %.2mm\n", sumx,sumy);
> //seems here that X is never getting a value other than 0
>             count++;

What type are sumx and sumy? I see you are dividing by 2.0 instead of
2, are they float?

>           }
>           END_LOOP;
>           pcb_fprintf (fp, "# Found %i pads\n", count);
>           if(count > 0 && count <= 2){ // the fiducial can have pads top and
> bottom!!
>             offsetX = sumx;
>             offsetY = sumy;
>           }
>
>       }
>
>   }
>   END_LOOP;
>
> Any bright ideas would be greatly appreciated.
>
> Thanks again.
> Ed

- Raw text -


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