kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #31148
Re: [FEATURE] Add keepout areas in footprints
JP,
Thanks for pointing out those errors. I have fixed the zone rotation bug
(patch attached to this email).
The undo/redo behaviour is odd, I have now noticed something related within
the module editor window.
If I make a change to a zone (add / remove / rotate / move / flip) then I
get a segfault.
/pcbnew/undo_redo.cpp(581): assert "Type() == aImage->Type()" failed in
> SwapData().
Orson has previously given me some (very much appreciated) pointers to get
me started on this feature. Perhaps either you or he have some further
insights?
Thanks,
Oliver
On Mon, Oct 16, 2017 at 7:16 PM, jp charras <jp.charras@xxxxxxxxxx> wrote:
> Le 14/10/2017 à 23:20, Oliver Walters a écrit :
> > Friendly bump - has anyone had a chance to look at this? :)
> >
> > Oliver
> >
> > On 12 Oct 2017 00:30, "Oliver Walters" <oliver.henry.walters@xxxxxxxxx
> > <mailto:oliver.henry.walters@xxxxxxxxx>> wrote:
> >
> > Attached is a patch set that allows addition of keepout zones to
> footprints (modules).
> >
> > When embedded inside a module, a keepout can be specified on a
> combination of:
> >
> > a) F.Cu
> > b) All internal copper layers
> > c) B.Cu
> >
> > The patch set is working pretty well, save / load is working and you
> can add / edit / delete
> > keepout areas within the module editor.
> >
> > I have also added a new layer shortcut string *.In.Cu to specify all
> internal layers within a
> > saved file.
> >
> > There are a few issues that I need some help sorting out.
> >
> > 1. Displaying zones only on internal layers.
> >
> > If you create a keepout zone but edit the layers such that is only
> on the internal copper
> > layers, then it will disappear in the module editor. This is because
> only F.Cu and B.Cu layers
> > are available in the module editor. I'm not sure how to display the
> zone in this case, and allow
> > the user to edit it once it has disappeared.
> >
> > 2. Editing zone in pcbnew
> >
> > Once a module is loaded into pcbnew, I want to be able to modify the
> zone properties. e.g.
> > disable for a certain internal layer, or adjust the outline of the
> zone. In the same way that
> > you can individually edit a pad once a module is added to a PCB.
> >
> > Strangely I had this working at one point but I can't work out what
> I changed to break it...
> >
> >
> > As far as I can tell, the DRC and zone cutouts are working well for
> keepout areas that are added
> > to a board via a footprint.
> >
> > Let me know if you see any crashes or mistakes, and if you can
> provide pointers for the two
> > outstanding items above.
> >
> > Thanks,
> >
> > Oliver
>
> Hi Oliver,
>
> I tested your patch, but I have found a few serious issues when editing a
> footprint with keepout
> zone on a board:
>
> - the rotation does not work (incorrect position of the keepout after
> rotation)
> - Undoing/redoing a move, rotation... is fully broken and creates multiple
> copies of the keepout,
> and I had a crash after playing with undo/redo.
>
> Thanks.
>
> --
> Jean-Pierre CHARRAS
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
From ae3a05df0224166c105ac197f1fbee9753c0d7c1 Mon Sep 17 00:00:00 2001
From: Oliver Walters <oliver.henry.walters@xxxxxxxxx>
Date: Mon, 16 Oct 2017 23:01:18 +1100
Subject: [PATCH 8/8] Fixed zone rotation bug
- Zone with MODULE as parent was rotating around its own center, rather than module center
---
pcbnew/class_module.cpp | 7 ++++---
pcbnew/class_module.h | 4 ++--
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp
index 684cc51..b5349dc 100644
--- a/pcbnew/class_module.cpp
+++ b/pcbnew/class_module.cpp
@@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
+ * Copyright (C) 2017 Oliver Walters, oliver.henry.walters at gmail.com
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@xxxxxxxxxxx>
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
@@ -247,7 +248,7 @@ void MODULE::ClearAllNets()
}
-void MODULE::DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
+void MODULE::DrawAnchor( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
int dim_ancre, GR_DRAWMODE draw_mode )
{
auto frame = (PCB_EDIT_FRAME*) panel->GetParent();
@@ -434,7 +435,7 @@ void MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
BOARD* brd = GetBoard();
// Draws footprint anchor
- DrawAncre( aPanel, aDC, aOffset, DIM_ANCRE_MODULE, aDrawMode );
+ DrawAnchor( aPanel, aDC, aOffset, DIM_ANCRE_MODULE, aDrawMode );
// Draw graphic items
if( brd->IsElementVisible( LAYER_MOD_REFERENCES ) )
@@ -1212,7 +1213,7 @@ void MODULE::SetOrientation( double newangle )
for( ZONE_CONTAINER* zone = m_Zones; zone; zone = zone->Next() )
{
- zone->Rotate( zone->GetCenter(), angleChange );
+ zone->Rotate( GetPosition(), angleChange );
}
CalculateBoundingBox();
diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h
index 286e953..c8e02f8 100644
--- a/pcbnew/class_module.h
+++ b/pcbnew/class_module.h
@@ -401,12 +401,12 @@ public:
GR_DRAWMODE draw_mode );
/**
- * Function DrawAncre
+ * Function DrawAnchor
* Draw the anchor cross (vertical)
* Must be done after the pads, because drawing the hole will erase overwrite
* every thing already drawn.
*/
- void DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC,
+ void DrawAnchor( EDA_DRAW_PANEL* panel, wxDC* DC,
const wxPoint& offset, int dim_ancre, GR_DRAWMODE draw_mode );
///> @copydoc EDA_ITEM::GetMsgPanelInfo
--
2.7.4
Follow ups
References