Commit Graph

283 Commits

Author SHA1 Message Date
Jeff Young 48082e3234 Improve debugability of 3D file resolver failures.
Fixes https://gitlab.com/kicad/code/kicad/issues/7670
2021-09-14 12:28:17 +01:00
Marek Roszko ebda02255c Fix step pcb coloring 2021-09-13 21:18:22 -04:00
Marek Roszko 4f861e084d Give the board boards unique names in STEP exports 2021-09-12 17:43:26 -04:00
Marek Roszko c84619cd7f Undo APIEXPORT thats not required
I was doing a dll before a static and well. Our unit test system isnt setup to handle DLLs at all. Ugh
2021-09-11 23:08:33 -04:00
Marek Roszko 74fd23f573 Add (off by default) build option to link kicad2step directly into pcbnew
Because debugging it separately is annoying.
2021-09-11 22:56:16 -04:00
Marek Roszko f42505b422 Expand the board in the step export to an assembly always 2021-09-11 22:56:16 -04:00
Jeff Young 61ef431c56 Apply fixes from Kicad2Step filename resolver back to Kicad. 2021-09-09 11:17:21 +01:00
Jeff Young 0e96ac4d7b Improve logic and error reporting of Kicad2Step file resolver. 2021-09-08 15:29:41 +01:00
Simon Schaak 58dceb143f kicad2step: fix "ignore virtual components" option
There isn't a "virtual" attribute any more, virtual components are now
saved without the "smd" and "through_hole" attributes.
2021-09-07 19:10:21 +00:00
Seth Hillbrand 7312bb4584 Fix compile error 2021-09-06 07:02:10 -07:00
Jeff Young c861fadc31 Make 3D path resolvers agnostic about alias syntax.
Some code seems to think it's :alias:path while other code thinks it's
alias:path.  This commit updates both the Kicad2Step resolver and the
KiCad internal resolver to be agnostic.

In 7.0 we should probably get rid of aliases entirely.  But that's a
story for another day....

Fixes https://gitlab.com/kicad/code/kicad/issues/9002
2021-09-06 14:26:24 +01:00
Jeff Young 6960ac04d4 Cleanup & formatting. 2021-09-04 18:10:25 +01:00
jean-pierre charras 47d5682b14 kicad2step: fix compatibility with wxWidgets 3.0
(commit 4670309 uses 2 functions existing only in 3.1.x)
2021-08-27 19:02:55 +02:00
jean-pierre charras 4670309ec1 kicad2step: fix broken handing of UTF8 filenames.
the conversion between UTF8 std::strings and wxString were missing in some places.
3D model: fix management of file having double ext .stp.gz
Fixes #9038
https://gitlab.com/kicad/code/kicad/issues/9038
2021-08-27 16:58:23 +02:00
Jeff Young 4736578793 Fix long-standing typo. 2021-08-14 13:16:11 +01:00
Jeff Young 507b386c79 Rationalize STEP file warnings
1) Use consistent terminology and formatting
2) Capitalize STEP
3) Don't double-report errors in MessageBox and REPORTER

Fixes https://gitlab.com/kicad/code/kicad/issues/7670
2021-08-14 11:08:49 +01:00
Wayne Stambaugh d36fbb864f KiCad2Step code cleaning. 2021-07-29 07:10:58 -04:00
Wayne Stambaugh 05a5a2416a IDF code housekeeping. 2021-07-28 07:14:27 -04:00
Wayne Stambaugh 369d813a32 Pass std::string by reference instead of on the stack where applicable. 2021-07-27 13:30:05 -04:00
Marek Roszko c794a6ce7a Add pdb install option for msvc 2021-07-14 23:42:45 -04:00
jean-pierre charras 702c0d6f72 Step export: shows a report message if a 3D model is not loadable:
- When a vrml model is specified and model substitution is not allowed
- When the model substitution is allowed but the step model is not found
2021-07-08 17:22:33 +02:00
Jeff Young 4025603a1f Formatting. 2021-07-06 21:36:27 +01:00
Jeff Young 2c1da70181 Write all variables to temp config file and have Kicad2Step use that.
Fixes https://gitlab.com/kicad/code/kicad/issues/7670
2021-06-14 16:54:45 +01:00
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00:00
Seth Hillbrand b891b5e1e2 Do not blindly substitute model names
Makes model substitution (VRML->STEP in STEP Export) optional.  This can
prevent nasty surprises where the user doesn't see/can't affect the
outcome

Also, when substituting models, do not maintain scale factor.  So a VRML
model with non-unity scaling will not be export as a STEP file (of the
same name) with non-unity scaling.  This is the first step to address
https://gitlab.com/kicad/code/kicad/-/issues/1781
2021-06-08 16:38:47 -07:00
Marek Roszko ab82b01714 Evict the last bits of wx.h 2021-06-07 20:23:27 -04:00
Marek Roszko 6b1dfca0ba Silence the msvc warning about double to int conversion 2021-06-06 09:45:03 -04:00
Marek Roszko 82e306bec3 Remove wx/wx.h from idf_helpers.h 2021-06-06 09:37:29 -04:00
jean-pierre charras d7616fdca8 Fix a few compil or coverity warnings. 2021-06-01 09:04:37 +02:00
Marcus A. Romer 1632707d9b Replace tabs with spaces 2021-04-05 01:13:39 +00:00
jean-pierre charras 6b1658a098 kicad2step: fix incorrect Bezier curve handling.
Fixes #7930
https://gitlab.com/kicad/code/kicad/issues/7930
2021-03-22 11:08:40 +01:00
jean-pierre charras 4a53917efa wrml exporter: optimize circle to segment approximation. 2021-03-20 18:16:58 +01:00
Karl Palsson 658bc2f4b2 kicad2step: provide a basic default product name
It would be ideal if it would use the s-expr
kicad_pcb.general.title_block.title by default, and then fall back to
something based on the output step file, but even just the output step
file is a far better default than the "open cascade step translator
version..." text it uses at the moment.

Similar improvements using the title_block would be future work.

Signed-off-by: Karl Palsson <karlp@etactica.com>
2021-03-04 17:01:07 +00:00
Seth Hillbrand 1d3159c1cb Add support for PKZIP-based stpZ files
FreeCAD uses gzip-based stpZ files but many programs will compress using
the archive format of PKZIP (e.g. WinZIP).  This handles the archive
format, taking the first file from the archive, which by the standard
should be the STEP file

Fixes https://gitlab.com/kicad/code/kicad/issues/5376
2021-02-27 16:44:54 -08:00
Seth Hillbrand b823c49a95 Handle polygons in step export
Fixes https://gitlab.com/kicad/code/kicad/issues/7707
2021-02-25 09:50:01 -08:00
Wayne Stambaugh 6a39b81647 Fix the last of broken Doxygen comment specifiers. 2021-01-27 17:39:44 -05:00
Dominik Wernberger 07635d2fc7 Minor adjustments 2021-01-12 20:51:31 +00:00
Dominik Wernberger ac94d72d2d Add more const specifiers 2021-01-12 20:51:31 +00:00
jean-pierre charras cdd4953589 STEP export: fix crash when a rectangle is used in a footprint.
Fixes #6958
https://gitlab.com/kicad/code/kicad/issues/6958
2021-01-07 09:24:30 +01:00
Seth Hillbrand d1f782717e Handle rect and bezier in footprint exports
Teach kicad2step about footprint edgecuts that use fp_curve and fp_rect

Fixes https://gitlab.com/kicad/code/kicad/issues/65054
2021-01-03 12:08:12 -08:00
jean-pierre charras 5db75805bd Step exporter: better values for min distance between 2 points to merge them.
- The default value is 0.01 mm (according to comments and similar to the 3D viewer
 settings that uses 0.02 mm)
- The export dialog  has now 3 values 1 micron, 0.01mm (default) and 0.1 mm
The 0.1 micron option is removed: it makes no sense for a mechanical tolerance.
2021-01-03 11:01:03 +01:00
Mikołaj Wielgus a9feb1c2d4 Update PCBMODEL::SetMinDistance to set BRepBuilderAPI precision
Fixes #3818
2021-01-03 08:40:40 +00:00
Seth Hillbrand 8de9cff4e0 Change environmental variables to human-readable
Versions specific variables that may point to objects that change
through versions, allowing multiple KiCad versions to operate correctly
(even on MSW) on the same machine.
2021-01-01 16:20:35 +00:00
Marek Roszko 7565f60a03 Swap wxFileInputStream/wxFileOutputStream for the buffered kind 2020-12-12 18:52:02 -05:00
Wayne Stambaugh dd4298bb94 Coverity fixes: 280374, 313611, 313648, 313649, and 314720. 2020-12-11 13:29:52 -05:00
Dominik Wernberger 99da663e82 Remove unused variables plus some more fixes from CppCheck
Remove unused variables plus a few more fixes from CppCheck

Remove unused variables plus a few more fixes from CppCheck
2020-11-19 02:28:47 +00:00
Werni 0e44f5128c Add const specifiers 2020-11-18 19:50:36 +00:00
Jeff Young a207bd97bb Naming conventions. 2020-11-17 16:05:49 +00:00
Wayne Stambaugh 723b9e6a77 Fix kicad2step sexpr parser to include new footprint token.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6406
2020-11-17 08:49:24 -05:00
Jeff Young 61bca4aaa4 A bit of "module" erradication, nameing conventions, and formatting. 2020-11-14 21:21:54 +00:00
Jeff Young 666c11965a Clean up some more MODULE terms. 2020-11-14 19:56:06 +00:00
Seth Hillbrand 9ed6cdd943 Remove GITHUB plugins
KiCad github downloads are no longer supported

Fixes https://gitlab.com/kicad/code/kicad/issues/6182
2020-10-29 16:45:04 -07:00
jean-pierre charras d4eb7b0f3d Step export: fix Bezier curves export.
Fixes #6054
https://gitlab.com/kicad/code/kicad/issues/6054
2020-10-21 10:18:03 +02:00
Seth Hillbrand 4085757aeb Remove beginning/ending spaces in translations
Adding space padding makes translations more difficult by increasing
string counts
2020-10-20 12:08:04 -07:00
jean-pierre charras 7414a62947 Attempt to support Bezier curves in STEP export: a fix.
The curve is still exported as segment
2020-10-20 18:40:01 +02:00
jean-pierre charras 12b106aba4 Attempt to support Bezier curves in STEP export. First code.
The bezier curves are in this code replaced by a segm between
the 2 ends curves
2020-10-20 16:45:38 +02:00
jean-pierre charras f18fb9fe64 Step exporter: fix a wxWidgets alert.
Fixes #4760
https://gitlab.com/kicad/code/kicad/issues/4760
2020-10-06 21:40:39 +02:00
jean-pierre charras 63471d861d Step exporter: avoid crash when the board to export has not closed outlines. 2020-10-06 16:03:43 +02:00
Ian McInerney b7e7cf9212 Some code cleanup 2020-09-22 12:29:55 +01:00
Ian McInerney c40470ed0b Initialize more variables 2020-09-22 12:29:13 +01:00
Seth Hillbrand de12d40ee6 Remove OGLTest
We don't use this utility nor do we have plans to
2020-09-12 06:46:46 -07:00
Jeff Young 904d186f6d Don't export hidden models to STEP.
Fixes https://gitlab.com/kicad/code/kicad/issues/5451
2020-09-03 22:59:45 +01:00
Seth Hillbrand f1b1e59cf0 Catch error when decompressing
Make sure we catch errors when thrown by zlib

Fixes https://gitlab.com/kicad/code/kicad/issues/5376
2020-08-26 14:19:46 -07:00
Seth Hillbrand d0e43ab9f1 STEP: Export stpz files
Also include .stpz files as alternates to wrl/wrz models
2020-08-25 19:27:44 -07:00
Wayne Stambaugh ede39780e2 Remove all debugging output that cannot be disabled.
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
2020-08-18 10:17:36 -04:00
Seth Hillbrand e3988b446a Adjust pointer duplication logic 2020-08-18 11:11:41 +00:00
Jeff Young 3b9c47a1be Fixes for rectangle segments in STEP plugin. 2020-08-18 11:11:41 +00:00
SUENAGA Hiroki 27d319b2df correct library path in fixup_bandle().
* Fix build failure on MacOS X 10.15.6.
2020-08-06 02:57:46 +00:00
jean-pierre charras 265f28afe1 Fix a minor compil warning and a Coverity warning 2020-07-30 10:40:51 +02:00
Seth Hillbrand 7e3a338518 Move warning flags to proper place
Cleans unitialized warnings in wxApps
2020-07-02 12:17:45 -07:00
Jeff Young aeed8e6e2c Finish implementation of DRAWSEGMENT::C_RECT.
It's currently only supported in the Footprint Editor.  It could be
easily added to the board editor (all the code is there), but the board
editor is a little short on room in the drawing tools toolbar.
2020-06-15 20:51:31 +01:00
Ian McInerney e4b6487fca Overhaul compiler warnings infrastructure
* Track our warnings separate from normal flags
* Remove all warnings from the SWIG code
* Add more GCC warnings
2020-05-06 01:47:20 +01:00
jean-pierre charras fd6c9c7685 kicad2step: fix a bug when the board has no hole.
kicad2step was trying to remove an empty hole list, generating a OCC error.

Fixes #4242
https://gitlab.com/kicad/code/kicad/issues/x4242
2020-04-22 10:43:28 +02:00
jean-pierre charras 25d7c0cae2 Opencascade: fix min version: OCE=0.18, OCC=6.9.0
Fix also a few minor Coverity warnings.
2020-04-16 10:22:20 +02:00
Simon Richter 8dcbd1e6d2 Tag kicad2step as using WIN32 API
wxWidgets for Windows uses the WIN32 subsystem, not CONSOLE.
2020-04-15 21:13:24 +02:00
jean-pierre charras 5143f87678 Kicad2step: Many fixes in oce_utils.
- Better code and messages.
- Speedup calculations when removing cutouts and holes from main board.
- Do not stop step generation when trying to load a 3D modele having issues.
2020-04-15 11:44:12 +02:00
jean-pierre charras b68bdc22d7 Fix in kicadpcb reader. Update dialog export step
kicad2step: code cleanup, and more activity messages displayed
2020-04-15 10:51:35 +02:00
jean-pierre charras 110b05fe78 kicad2step: convert it from a wxAppConsole to a wxApp, using a wxFrame/wxPanel 2020-04-15 10:51:35 +02:00
Adam Wolf e143ecbf40 For macOS, fix KICAD_BUNDLE_LIBS in ogltest. 2020-04-09 16:23:41 +00:00
Yegor Yefremov 99a28fa3e5 Fix typos in comments. 2020-03-24 16:24:53 +00:00
Adam Wolf ac20428b82 Add macOS KICAD_BUNDLE_LIBS search path for bundle fixup. 2020-02-26 22:10:00 -06:00
jean-pierre charras ad3c4b37ab Fix a few coverity warnings 2020-02-01 15:15:51 +01:00
Ian McInerney 06c979dfaa Convert all CMake paths to absolute instead of relative
It is cleaner and safer to handle the include and source paths
as absolute from the source directory instead of relative to every
path.
2020-01-22 23:27:20 +00:00
Ian McInerney 39b1f0e1ff Replace wxCriticalSection with std::mutex 2020-01-15 23:42:16 +00:00
Seth Hillbrand 7c28c3838a Comment-only changes
Makes class comments conform to coding standards
2020-01-10 16:43:01 -08:00
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
jean-pierre charras a46abcd2dc FILENAME_RESOLVER: fix missing conversion from UTF8 to wide chars.
Fixes #3742
https://gitlab.com/kicad/code/kicad/issues/3742
2020-01-07 13:35:37 +01:00
Ian McInerney 6faa2188ed Silence warnings on MacOS about OpenGL deprecation
Apple has apparently deprecated OpenGL and replaced it with
their Metal API. It still works for now though.
2019-12-28 16:05:03 +00:00
Ian McInerney 116ac9aa75 Move dxflib, tinyspline and nanosvg into a thirdparty library directory
Part of fixing https://gitlab.com/kicad/code/kicad/issues/3637
2019-12-19 17:41:02 +00:00
Seth Hillbrand c6f5df134c Minor speed cleanup
This adjusts iterators to use const reference when only used for
copy.  It also ensures pre-allocation of vectors when size is known
ahead of time.
2019-12-05 14:20:59 -08:00
Seth Hillbrand b5f021ff9f Cleanup: Replace push_back with emplace_back
In cases where we create a new item and immediately push into a
container, the emplace idiom is faster and more efficient.
2019-12-05 13:41:21 -08:00
Seth Hillbrand 4d2e953f42 Cleanup: Replace C-only deprecated headers
This replaces headers deprecated by C++14 with their equivalent
replacement
2019-12-05 11:03:15 -08:00
jean-pierre charras d77ba30a95 Replace __WXDEBUG__ (improperly used) by DEBUG in some #define.
__WXDEBUG__ comes from a build option of wxWidgets,
and is not related to a Debug versus Release Kicad build.
2019-10-14 11:17:38 +02:00
Simon Schubert a0ed40876d kicad2step: scale models
Fixes: lp:1784257
* https://bugs.launchpad.net/kicad/+bug/1784257
2019-08-15 14:29:03 -07:00
Ian McInerney 55261eb223 pcbnew: Fix export of edge.cuts layer to STEP format
Fixes: lp:1820841
* https://bugs.launchpad.net/kicad/+bug/1820841
2019-05-29 19:42:46 -07:00
John Beard 1a9aa2e92d Use old-style boost includes
The Boost::boost style library dependencies don't work
on some CMake versions (couldn't find library -lBoost::boost)

Use ${Boost_INCLUDE_DIRS} in the target_include_dirs() instead.
2019-04-22 01:02:13 +01:00
John Beard 4bd661add7 QA: Add test on GetLayerName function
This adds a test to the recent GetLayerName function, and moves
it to the base.h file for re-use for any code that needs a
layer name.

This test covers the case that caused lp:1824750 [1].

[1]: https://bugs.launchpad.net/kicad/+bug/1824750
2019-04-17 10:52:56 +01:00
John Beard 03214b5dea Sexpr/QA: Split out the sexpr classes into a reusable lib and test
The SEXPR class is a useful general-purpose S-Expression library
class and can (maybe) be used else where. It also should get
test coverage, as even if noone else uses it, it's critical for the
kicad2step exporter.

Also add some test coverage for some kicad2step routines. For now,
they're not useful outside kicad2step, but they are at least a useful
reference for S-Expression parsing.
2019-04-17 10:52:56 +01:00
Simon Richter 03bce55403 List Boost as a dependency for kicad2step
This is not technically correct (the Boost dependency is introduced through
libcommon), but less invasive as it doesn't pull in libcommon on the linker
command line.
2019-04-15 23:42:18 +01:00
John Beard c135158364 Kicad2Step: handle quoted layers
More recent Kicad_pcb files have quoted layer names (i.e.
strings, not symbols). The importer in K2S doesn't handle that,
so it chokes on elements like (layer "Edge.Cuts").

Fixes: lp:1824750
* https://bugs.launchpad.net/kicad/+bug/1824750
2019-04-15 15:00:17 +01:00