Commit Graph

261 Commits

Author SHA1 Message Date
qu1ck ec94439df4 Footprints swig API: access shown text in fields 2023-06-29 20:36:27 +00:00
Mike Williams a24c55affe PCB Fields: fix up python, API
Remove SetFields from both symbol and footprint, it doesn't handle
mandatory fields and is unlikely to ever be safe.
2023-06-20 18:34:52 +00:00
Mike Williams 85c633eb00 QA: PCB Fields bug fixes 2023-06-20 18:34:52 +00:00
jean-pierre charras 9a47b34499 Replace PAD_SHAPE::RECT by PAD_SHAPE::RECTANGLE to avoid a collision NAME with a windows header on MSYS2, creating many compil warnings. No actual code change. 2023-06-02 12:18:24 +02:00
Seth Hillbrand aacf8f50bf Remove unneeded headers from pcbnew_scripting_helpers.h 2023-05-31 15:54:46 -07:00
jean-pierre charras 8fc70d577f better QFNWizard. 2023-04-23 17:34:21 +02:00
Marek Roszko 9f64c7f354 Load custom drawing sheets for pcb cli
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14171
2023-04-20 23:17:52 -04:00
jean-pierre charras 1406341d2d Fix a few doxygen errors (no actual code change) 2023-04-19 16:20:24 +02:00
Marek Roszko ea077bc34d Banish ignore.h to core 2023-04-18 22:44:04 -04:00
qu1ck 9b58f50c68 Add usable PCB_GROUP::GetItems() swig wrapper 2023-04-17 15:41:49 +00:00
jean-pierre charras 725c2fd661 footprint wizards: fix for my previous commit 50502c4 2023-04-16 17:16:54 +02:00
jean-pierre charras 50502c450f footprint wizards: fixes and enhancements 2023-04-16 17:03:32 +02:00
Jeff Young 521aa5b5ae Update DRC exclusions model to match terminology.
DRC exclusions were originally written following the C++
pragma model (ie: allow this violation here).  However, the
"exclusion" terminology we used in the GUI suggests a model
model where the exclusions go away when the violation no
longer exists.

Fixes https://gitlab.com/kicad/code/kicad/issues/14351
2023-04-15 12:18:41 +01:00
jean-pierre charras 27ebba6b33 Python and footprint wizard: fix issues and update to be compatible
with recent changes in Kicad code.
2023-04-15 10:30:33 +02:00
Salvador E. Tropea d5c0bf3d0e Load the global fp-lib-table before running the Python DRC
Without this we get parity errors for all the KiCad footprints

(cherry picked from commit e5087ca3db)
2023-04-14 12:09:48 -04:00
Ian McInerney 5d0b5e16ff Remove python-based board_item duplicate method
This method shadows the C++ method, and doesn't properly handle updating
the duplicated object's KIID to be unique.

Also add tests to ensure the KIIDs are unique after duplication.

Fixes https://gitlab.com/kicad/code/kicad/issues/14460
2023-04-12 16:05:56 +01:00
Jeff Young bbd6c80507 Collapse FP_* down into their PCB_* equivalents. 2023-03-31 22:57:46 +01:00
Jeff Young a0adb59437 Update dimension units when opening PCBs in CLI.
Fixes https://gitlab.com/kicad/code/kicad/issues/14170
2023-03-13 20:26:11 +00:00
qu1ck 88062c5fc3 Add vector3 to swig
Fixes regression in 7.0 making fp 3d model offsets not accessible in
python

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14179
2023-03-05 15:59:22 -08:00
qu1ck 733978dfd0 Fix swig mappings for PCB_BITMAP 2023-02-26 09:24:06 +00:00
mitxela 734d3667a8 Helper function to allow net.GetNetClassName() 2023-02-25 13:14:55 +00:00
mitxela 716328e511 Fix python GetAllNetClasses 2023-02-25 13:14:55 +00:00
jean-pierre charras bb62c21abc python wizard: fix compatibility with current code 2023-02-25 11:06:01 +01:00
qu1ck 9f10c142c4 Sync pcbnew selection with selected items after plugin is run 2023-02-16 02:29:06 +00:00
Jon Evans 6948a0bebd Expose new netclass storage to SWIG
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13337
2023-02-11 09:50:24 -05:00
Marek Roszko 0ff32d20cd wxS more things 2023-01-22 09:41:42 -05:00
Seth Hillbrand 1d223d1439 Safely load python plugins
Catch potential exceptions when doing the initial python plugin load

Fixes https://gitlab.com/kicad/code/kicad/issues/12231
2023-01-17 12:56:15 -08:00
qu1ck f153ff8453 Add GetCurrentSelection() python scripting helper 2023-01-10 16:39:48 +00:00
jean-pierre charras ae8bbcad32 PadArray.py: ensure parameters used to create a VECTOR2I are ints.
Fixes #13430
https://gitlab.com/kicad/code/kicad/issues/13430
2023-01-08 09:10:13 +01:00
qu1ck 7dfa100ff0 Correctly refresh the board after action plugin run and maintain
selection
2023-01-05 14:05:15 -08:00
Seth Hillbrand 98d55ce82f Avoid rebuilding with each commit
We shouldn't include the kicad_build_info.h outside of the wrapper
build_info.h.  Also adds an error directive to prevent re-introduction
of define dependencies
2023-01-04 11:32:15 -08:00
Jan Mrázek f601c87cea Export UNITS_PROVIDE into SWIG 2022-12-19 17:30:37 +00:00
jean-pierre charras abff7975f1 Python scripting: fix some issues when trying to create a DRC Report:
- avoid aborting the DRC report on a .dru issue without any error message.
- ensure the list of layer names is up to date (contains both canonical
and user layers names, that can be used in DRC tests.
Fixes #11410
https://gitlab.com/kicad/code/kicad/issues/11410
2022-12-19 12:39:20 +01:00
jean-pierre charras 6c73fe05e9 python scripting: better fix for commit 5a79821 (fix crash due to a null pointer):
Try to use a better error message for severity.
Fixes #13160
https://gitlab.com/kicad/code/kicad/issues/13160
2022-12-18 18:31:19 +01:00
Jan Mrázek 90fb315113 Add missing text alignment types to SWIG export
Fixes https://gitlab.com/kicad/code/kicad/issues/13174
2022-12-16 18:55:21 +00:00
Jan Mrázek e699c25d98 Add operators for the SWIG wrapper of EDA_ANGLE 2022-12-16 18:55:21 +00:00
Jan Mrázek 66c2462c7e Eliminate angle as double in SWIG wrapper
Fixes https://gitlab.com/kicad/code/kicad/issues/13171
2022-12-16 18:55:21 +00:00
jean-pierre charras 5a7982161d python scripting: fix crash due to a null pointer use.
Fixes #13160
https://gitlab.com/kicad/code/kicad/issues/13160
2022-12-15 14:27:29 +01:00
Yang sheng aff5245041 Fix enum class DRILL_MARKS no export to python 2022-12-09 18:07:58 +00:00
qu1ck 25688eb75e Include plotprint_opts.h in swig 2022-12-07 04:02:59 +00:00
Jeff Young 97fd99ec99 Re-resolve netclasses after assigning netclass to pattern.
Fixes https://gitlab.com/kicad/code/kicad/issues/12965
2022-11-22 14:54:08 +00:00
Marek Roszko cd30da179a Round out the cli with position file export 2022-11-07 19:53:35 -05:00
Jeff Young 64a6fc0fd4 Push UNITS_PROVIDER down into a low-level mixin.
This allows us to also construct cheap UNIT_PROVIDERs for specific
tasks when necessary.
2022-09-19 17:10:59 +01:00
jean-pierre charras 97963a2bba Better after base_units.cpp changes in python stuff.
Move an include to kicad.i
2022-09-17 11:21:48 +02:00
jean-pierre charras 71bb7d63d9 Fix isses after base_units.cpp changes. 2022-09-17 10:56:56 +02:00
Marek Roszko 1e0eca0916 Eyeball swig fix after the units changes 2022-09-16 22:31:52 -04:00
Marek Roszko 3d5913c825 Remove convert_to_biu.h, merge contents to base_units.h 2022-09-16 21:09:28 -04:00
Marek Roszko 7a5829f8d6 Move IU2Mils 2022-09-16 21:09:27 -04:00
Marek Roszko e6ed275c25 Repoint IU_PER_MILS 2022-09-16 21:09:26 -04:00
Mark Roszko b00178adb3 Nuke base_units from orbit 2022-09-16 04:38:10 +00:00
Jeff Young 77c79b6f6a Apply searchArea architecture to courtyard functions. 2022-08-28 21:20:03 +01:00
Jeff Young f99761e5bd entirelyInsideArea() prototype. 2022-08-26 13:22:57 +01:00
Seth Hillbrand e4bb1560c5 Set locale in python save routine
Fixes https://gitlab.com/kicad/code/kicad/issues/11006

(cherry picked from commit c3496d61eb)
2022-08-23 09:53:18 -07:00
Seth Hillbrand af34835fdf Restore removed data
Functions and definitions used in Python scripting should not be
removed.  Comments in header files should never be removed (only
updated/corrected)
2022-08-20 08:40:08 -07:00
Jeff Young 8b0efa8ac4 A bit of cleanup from last commit. 2022-08-20 11:14:44 +01:00
Jeff Young aa2ad3b44c Move KICAD_T[] to std::initializer_list<KICAD_T>. 2022-08-20 10:28:11 +01:00
Jeff Young 1f347582f8 Introduce new marker type so we can track DRC errors on the drawing sheet.
Fixes https://gitlab.com/kicad/code/kicad/issues/12221
2022-08-15 18:03:03 +01:00
Jeff Young a9536b5de9 CHANGED netclass assignments now done via canvas or via patterns. 2022-08-14 22:56:29 +01:00
jean-pierre charras 4d48376eae Fix some warnings detected by PVS-STUDIO (not used vars) 2022-07-26 16:00:14 +02:00
Mike Williams 3669cb4673 PCB Editor: Add User Background Images 2022-07-14 11:23:23 +00:00
luz paz af6ba1a16e Fix typos in pcbnew sub-directory
Found via `codespell -q 3 -S *.po,./thirdparty,./Documentation/changelogs -L aactual,acount,aline,alocation,alog,anormal,anumber,aother,apoints,aparent,aray,ba,busses,dout,einstance,leaded,modul,ontext,ot,overide,serie,te,,tesselate,tesselator,tht`
2022-06-30 09:39:45 -04:00
Seth Hillbrand 802745398a Python add param to change UUIDs on fp load
By default, we load all footprints with a new UUID set to allow them to
be added to the board as unique objects.  But when editing footprints,
we want to maintain the same UUID.

Fixes https://gitlab.com/kicad/code/kicad/issues/11870
2022-06-29 12:10:24 -07:00
Seth Hillbrand f1a054e6af Correct SWIG call for board design settings
Use the backend call rather than rely on the naming of internal
variables

Fixes https://gitlab.com/kicad/code/kicad/issues/11924

(cherry picked from commit 9cebea5f11)
2022-06-28 14:03:43 -07:00
Seth Hillbrand 8418fe12d8 Allow board saves without modifying project files
Without the project files, certain settings will not be saved by this
python call.  This defaults to false (current behavior) but setting the
`aSkipSettings` to true will revert to v5 behavior

Fixes https://gitlab.com/kicad/code/kicad/issues/11323
2022-06-24 15:28:56 -07:00
jean-pierre charras 6679decc8d Fix syntax issues in footprint wizards
Fixes #11867
https://gitlab.com/kicad/code/kicad/issues/11867
2022-06-20 20:31:18 +02:00
Jeff Young 97b0005780 More caching for DRC.
Also fixes a bug where some physical clearance tests would be run even
if the clearance was 0 (or if the rule was set to IGNORE).
2022-06-17 23:58:31 +01:00
qu1ck 13bece06cf Fix swig wrapper for footprint 3d models 2022-06-03 17:35:40 +00:00
jean-pierre charras e54ba87895 fix FootprintWizardBase.py compatibility with recent code. 2022-05-20 12:58:07 +02:00
jean-pierre charras 0177613ad3 footprint wizard touch_slider_wizard.py: fix compatibility with current code. 2022-04-27 10:03:38 +02:00
Frank Zeeman b3a319b77e Append True to Python 3 AddPrimitivePoly() call
Fixes https://gitlab.com/kicad/code/kicad/issues/11012
2022-03-18 20:00:32 +00:00
jean-pierre charras 54c9e36556 Python, board.i: fix incorrect order of an include.
The result was ignoring PCB_SHAPE in pcb_text.i.
2022-03-18 14:19:14 +01:00
jean-pierre charras e37bb2e0c3 swig: disable a few warnings generated by pcb_shape.i, math.i and version.i 2022-03-09 17:29:29 +01:00
Jon Evans cb6d6d7ef4 Settings: allow multiple project access from Python standalone
We can't handle this in the UI, but we can externally, so allow
it for Python scripting and eventually we'll use this in the UI
also...

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10540

(cherry picked from commit 1394509734)
2022-03-05 13:04:19 -05:00
jean-pierre charras 69453964b4 pcbnew_scripting_helpers: fix a potential crash when running a script outside kicad.
BOARD* LoadBoard( wxString& aFileName, IO_MGR::PCB_FILE_T aFormat ) crashes if a
old project file (*.pro) exists and the *.kicad_pro file doses not exists.
The crash happens when trying to convert the old config outside kicad.
2022-03-05 18:26:33 +01:00
Jeff Young bc51c89c90 Reconcile zone-auto-fill with undo. 2022-02-25 13:05:49 +00:00
Greg Davill 429c311ec3 action_plugin: Remove duplicated entry in UndoList 2022-02-24 18:31:16 +00:00
qu1ck b53b68c686 Fix double loading plugins and sys.path entires multiplying 2022-02-17 17:41:52 +00:00
qu1ck a041492736 SWIG mappings for all shapes 2022-02-16 20:58:52 +00:00
木 王 261b1df47f fix-npth 2022-02-10 10:06:59 +00:00
Jeff Young b2e3f03222 More wide-string declarations. 2022-02-05 22:03:04 +00:00
Seth Hillbrand 917845cf00 Ensure we can version scripting properly
Adds Version() and FullVersion() calls to support reporting version to
scripts and scripting window

Fixes https://gitlab.com/kicad/code/kicad/issues/10079

(cherry picked from commit 0a13f15a9d)
2022-02-03 15:59:10 -08:00
jean-pierre charras a970acd0bc Fix some issues related to new textboxes and python:
- Fix duplicate class names returned by GetClass().
- replace MTEXT name (in GetClass) by better name (FP_TEXT, FP_TEXTBOX...)
- Add missing Cast_to_PCB_TEXTBOX and Cast_to_FP_TEXTBOX
2022-02-03 13:55:37 +01:00
jean-pierre charras 901a9387e9 Fix python fp wizards according to last kicad code changes, especially EDA_ANGLE 2022-01-28 19:33:51 +01:00
Jeff Young 9b661aea10 EDA_ANGLE for plotters.
Also fixes a compile error in the PNS Playground.
2022-01-16 01:19:45 +00:00
qu1ck 33a4c9b08e FOOTPRINT::GetProperty() swig extension 2022-01-13 21:08:52 +00:00
Seth Hillbrand 4f874057ab DRC scripting: load project from board if possible
s_SettingsManager is not always initialized when the WriteDRCReport is
run.  We should first attempt to extract the project from the actual
board being checked.  Failing that, we fall back to the static settings manager and then exit if we don't have a project associated.

Fixes https://gitlab.com/kicad/code/kicad/issues/10221

(cherry picked from commit 78e737b9d8)
2022-01-06 11:51:05 -08:00
Marek Roszko cc5003a919 Update python for the pad wxSize switch 2022-01-04 23:28:06 -05:00
Seth Hillbrand e6b5cb3a5c Fix missing FOOTPRINT cast in swig
Fixes https://gitlab.com/kicad/code/kicad/issues/10236

(cherry picked from commit ca8cf14dff)
2022-01-04 11:09:51 -08:00
jean-pierre charras 5879227ee2 Update footprint wizards after changes wxPoint->VECTOR2I 2022-01-03 11:43:15 +01:00
qu1ck 356cddd474 Template for vector<VECTOR2I> in swig 2022-01-02 21:33:58 +00:00
Marek Roszko c4c56de708 Neurotically update position wxPoint usages 2022-01-01 11:55:51 -05:00
Jacob Mealey 987a6e125b fix in pcbnew/python/swig/units.i ... added error handling
Added error handling in unit conversions for the pcbnew python bindings.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10081
2021-12-28 07:09:27 +00:00
Jeff Young ab583a32f9 Better layer handling for DRC markers.
Fixes https://gitlab.com/kicad/code/kicad/issues/10126
2021-12-26 15:06:12 +00:00
Jeff Young 5f37c2b247 Custom rule severities.
ADDED severity token to custom rule syntax.  Each rule can now define
its own severity.

Fixes https://gitlab.com/kicad/code/kicad/issues/6148
2021-12-24 15:42:22 +00:00
Jeff Young d28714167c All the preferences, all the time.
Fixes https://gitlab.com/kicad/code/kicad/issues/7877

Fixes https://gitlab.com/kicad/code/kicad/issues/5153
2021-12-24 13:08:44 +00:00
Jon Evans 63f67b7e5b Fix loading netclasses from legacy boards via Python 2021-12-07 18:55:08 -05:00
jean-pierre charras c186d1f319 Force refresh AUI manager after reloading python scripts.
Because the tools in the Htoolbar can have changed, the AUI manager need refresh.
2021-12-03 09:30:24 +01:00
jean-pierre charras 01eebd0b9d Do not call callLoadPlugins() every time a SCRIPTING_TOOL is created.
(i.e. from board editor and from fp editor)
Once is enough.
Once plugins are loaded, calling LoadPlugins() from fpeditor disable plugins
in board editor
Fixes #9846
https://gitlab.com/kicad/code/kicad/issues/9846
2021-12-03 08:12:06 +01:00
Jeff Young ba6ae4fa9b Kicad has many plugins. This one is for the pcb. 2021-11-25 12:56:46 +00:00
Seth Hillbrand 7529eb1812 SWIG out connected item vector for use
Fixes https://gitlab.com/kicad/code/kicad/issues/8566
2021-11-19 13:39:06 -08:00