DRC misbehaves in a tight-fit scenario

Bug #1026337 reported by Dimitar Kovachev
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
KiCad
Confirmed
Undecided
Unassigned

Bug Description

The PCB setup: Two 60mil circular pads are placed 100mil apart, leaving 40mil of space between them. I'd like to place a 20mil track in there, with 10mil clearance (on each side). The numbers add up to an exact fit.

First, with realtime DRC enabled ("Preferences" -> "General" -> "DRC ON"), I'm in no way able to route the track, always getting a "Track near pad" error. On a 50mil grid, the track is drawn exactly in the center of the inter-pad space, so it should work.

With realtime DRC disabled, things look promising at first (see attached Test_KiCAD_DRC_Pass.brd). But if I add a couple of more segments to the track, far away from the pads, and DRC now fails again. (see Test_KiCAD_DRC_Err.brd). The track segment that lies between the pads has remained unchanged in any way, as can be seen by diff-ing the two .BRD files.

Version: 0.0.201207171919+3653~10~precise1

Tags: drc pcbnew
Revision history for this message
Dimitar Kovachev (d-kovachev) wrote :
Revision history for this message
Lorenzo Marcantonio (l-marcantonio) wrote : Re: [Bug 1026337] [NEW] DRC misbehaves in a tight-fit scenario

On Wed, Jul 18, 2012 at 09:32:08PM -0000, Dimitar Kovachev wrote:
> The PCB setup: Two 60mil circular pads are placed 100mil apart, leaving
> 40mil of space between them. I'd like to place a 20mil track in there,
> with 10mil clearance (on each side). The numbers add up to an exact fit.

Could be the same behaviour I've noticed with the nanometer build. For some yet unexplained reason (probably a slight rounding or something converging on the wrong side) it sometimes reject the 'equal' case. Numerics are ugly in these situations (like when you have 3D objects exactly overlapped).

As a workaround I set the clearance slightly lower (i.e. instead of 0.2 mm I used 0.1999 mm). If you work with a grid there should be no problem.

--
Lorenzo Marcantonio
Logos Srl

Revision history for this message
Thomas Eriksson (scrizt) wrote :

This is probably the same misbehaviour I've just started exploring. I'm attaching a partial fix. (Partial because it some what solved my test case but not completely.)

Anyway, function comment for pcbnew/drc_clearance_test_functions.cpp:DRC::checkMarginToCircle says that this function should have >= behaviour, but one of the tests uses > behaviour. I've corrected this and it improves DRC-correctness.

Revision history for this message
Thomas Eriksson (scrizt) wrote :

Okay so I've managed to solve the rest of my test case now and as expected it was more of the same, greater-than instead of greater-than-or-equal tests.

The change to checkMarginToCircle is trivial and easy to validate. The changes to checkLine needs code reviewing though, since checkLine is a complex hard-to-follow beast.

Also, I do not believe that these functions are used outside this file but I'm not familiar with this code base yet. I can imagine uses of checkLine that relies on the old behaviour. No such uses are present within this file though.

One function comment clearly stated greater-than behaviour but this is not what you'd expect from the DRC. Therefore both comment and behaviour was changed.

checkLine() is supposed to test if a line intersects a rectangle. With these changes trangency is no longer enough, this might become confusing if this function is used elsewhere.

The new patch includes the changes from the first patch.

Revision history for this message
xzcvczx (xzcvczx) wrote :

Can you still reproduce this issue?

Changed in kicad:
status: New → Incomplete
xzcvczx (xzcvczx)
Changed in kicad:
status: Incomplete → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.