Commit Graph

46 Commits

Author SHA1 Message Date
Marek Roszko b18e441a88 Free memory in dxf import sooner on bad_alloc 2022-04-02 09:57:30 -04:00
Marek Roszko 9f8c0a8185 Catch memory exhaustion trying to import large DXFs
See https://gitlab.com/kicad/code/kicad/-/issues/11308
2022-04-01 23:15:06 -04:00
Jeff Young 34a9a165c9 More wide-string declarations. 2022-02-05 22:26:31 +00:00
Jeff Young c8a50d9b50 Remove unit-less angles from VECTOR2I/D APIs. 2022-01-20 23:58:20 +00:00
Jeff Young 86cb57f4a7 Cherry-pick TEXT_ATTRIBUTES and EDA_ANGLE from rockola/kicad-strokefont 2021-12-28 22:15:20 +00:00
Seth Hillbrand 1160bd94b0 Scale vertex lineweights in DXF import
DXF lineweights are always in 100th of mm, so scale the set weights on
import

Fixes https://gitlab.com/kicad/code/kicad/issues/9854
2021-12-07 16:23:44 -08:00
Tomasz Wlostowski bba742b804 pcbnew: support vertex line start/end width to correctly import certain DXF files 2021-10-25 17:39:09 +02:00
Tomasz Wlostowski df47c1c4e9 pcbnew: use doubles to pass line widths in the DXF importer as they are expressed in DXF's units and can case severe rounding errors when passed as ints 2021-10-25 17:36:04 +02:00
Marek Roszko daca9d21f2 Add dxf point import
Fix #9149
2021-09-12 19:38:52 -04:00
Marek Roszko b924c85f80 Start recording the precision of dxf imports 2021-06-27 00:38:19 -04:00
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00:00
Marek Roszko 39a0bc6252 Remove erroneous block check in dxf import added during previous improvements 2021-04-28 18:48:59 -04:00
Marek Roszko e409b04538 More gracefully handle tinyspline not liking a spline definition
Partial fix for #6634
2021-03-24 00:37:01 -04:00
Marek Roszko 8f21034254 Fix invalid windows macro
Missing one underscore at the end
2021-01-31 16:15:50 -05:00
Marek Roszko 828ecb76aa Remove polyline 3d check added by previous fixes
Fix #7030
2021-01-09 18:56:35 -05:00
Marek Roszko 9322b3a4e1 Use the C++ isnan function 2020-11-29 11:30:45 -05:00
Marek Roszko 5e117bfaa5 Don't allow nan values for dxf text alignment points to creep in
Literally the only place dxflib decides to default to NaN....
2020-11-28 20:13:42 -05:00
Marek Roszko cc7264c0b9 Subtract off the block's base point coordinate from the insert translation 2020-11-28 20:13:42 -05:00
Marek Roszko cac0d93dfd Implement DXF INSERT scale
This has a chance of being wrong due to how the dimensions are stored in these intermediate objects
2020-11-28 20:13:42 -05:00
Marek Roszko 5607420339 Fix polylines being skipped in DXF blocks 2020-11-25 00:06:02 -05:00
Marek Roszko 272ec53e03 Make DXF import slightly prettier by copying text style width factor
It's impossible to replicate the original cad font style but replicating width factors at least
gives you something closer.
2020-11-24 07:15:49 -05:00
Marek Roszko 45598f2933 Add handling of DXF arbitrary axis/extrusions
This fixes some DXFs imports where unforunately CAD tools like SolidWorks
randomly decide to mirror circle definitions across the "z" axis (resulting in x or y axis flips in 2d)
Most likely live projection from 3D to 2D drawings introduces this.
However this is DXF specification to describe it so obtusely with vectors for a 2d drawing.
2020-11-23 21:24:38 -05:00
Marek Roszko 44f4d41bba Fix member variable name 2020-11-23 21:24:38 -05:00
Marek Roszko 32ec8fa928 Implement correct placement of DXF block contained entities
DXF blocks are virtual groups of items.
The insert entity is what actually places all the block contents at a given coordinate.
This should fix importing drawings from professional CAD tools like SolidWorks that will have a good bit of blocks.
2020-11-23 10:10:35 -05:00
Marek Roszko bf59b422bc Record blocks being received during the import 2020-11-23 10:07:30 -05:00
Marek Roszko f5e9a2a6da Use "microns" as the name to be consistent with DXF specification 2020-11-22 15:44:57 -05:00
Marek Roszko 39fe89096e Allow specifying the DXF file units on import
There is no guarantee DXF contains $INSUNIT to specify the units of the file as its optional.
This allows the user to specify the expected units via dropdown.
SolidWorks can definitely generate such unit lacking files as an example
2020-11-22 15:39:37 -05:00
Marek Roszko f130970469 Handle lineweight in dxf import more properly
lineweights can be set to inherit from the layer or block.
2020-11-21 09:22:11 -05:00
Marek Roszko d59053b775 Fix dxf import making all circles filled
Filled objects in dxf is actually not handled at all, they are implemented as "hatched" objects
2020-11-19 21:00:53 -05:00
Jeff Young d094f86b1a Finish module cleanup (except for xpms). 2020-11-14 22:00:12 +00:00
Jeff Young 84dd5108ba Remove some "class_" prefixes from files. 2020-11-13 15:16:23 +00:00
Jeff Young 37906511f5 Class renaming.
DRAWSEGMENT  -> PCB_SHAPE
EDGE_MODULE  -> FP_SHAPE
TEXTE_PCB    -> PCB_TEXT
TEXTE_MODULE -> FP_TEXT
2020-10-05 11:55:33 +01:00
jean-pierre charras d28fea5502 Dxf import: fix a bug that disable import of data inside blocks
Provide also a minimal debug info when enabled in code (and only in debug version)
2020-04-19 13:41:54 +02:00
jean-pierre charras 8f3e8cf893 Dxf importer: fix issue when importing some "degenerated" splines.
Sometimes a dxf curve is a "degenerated" bezier curve having only 3 points.
(a control point is at same location as a end point)
This commit fix incorrect import of these curves.
2020-02-03 10:39:29 +01: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 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 df3fabfa21 pcbnew: Fix DXF Import with blocks
BLOCK elements in DXF are re-usable bits that are useful when editing
the file but should not be shown when importing the model.  This skips
all references except those that exist in the default "*Model_Space".
This block is required in each DXF file and cannot be renamed.

Fixes: lp:1790821
* https://bugs.launchpad.net/kicad/+bug/1790821
2019-10-23 11:28:26 -07:00
Wayne Stambaugh 120ab06db4 Pcbnew: fix DXF import line width bug.
There is a circular dependency between the GRAPHICS_IMPORTER object and
the GRAPHICS_IMPORT_PLUGIN object which makes sharing the settings in
the GRAPHICS_IMPORTER unwieldy.  This fix is a ugly hack that resolves
the issue.  The underlying issue will require some major refactoring.

Fixes lp:1821234

https://bugs.launchpad.net/kicad/+bug/1821234
2019-04-03 11:29:17 -04:00
jean-pierre charras 70c2380fc2 Minor fixes in code: remove dead code. 2019-01-24 18:23:57 +01:00
jean-pierre charras b0ab53ac26 Dxf importer: fix some issues, especially the rotation angle of texts. 2019-01-22 19:59:43 +01:00
jean-pierre charras c56d6ad2dd Fix issues in DXF import and GFX import dialog
Fixes: lp:1812840
https://bugs.launchpad.net/kicad/+bug/1812840
2019-01-22 18:01:04 +01:00
jean-pierre charras 5b3202d8f3 dxf and svg import: accept unicode filenames
Fixes: lp:1805613
https://bugs.launchpad.net/kicad/+bug/1805613
2018-12-07 10:07:43 +01:00
jean-pierre charras 3623980611 DXF importer: fix incorrect line thickness of imported texts. 2018-12-04 20:01:47 +01:00
jean-pierre charras cc0aa8b928 Gfx import: fix many issues, and add many enhancements.
* Do not compile dxf old files.
* import gfx, gal mode: make absolute placement working.
* Import gfx in legacy canvas: use it and make interactive placement working
* Take imported line width in account. Ensure DXF line thickness is OK.
* handling empty files in legacy mode.
2018-12-03 15:25:44 +01:00
jean-pierre charras 430c61822d Import svg import code from experimental trunk: convert dxf importer 2018-12-03 13:42:23 +01:00
jean-pierre charras 74a9d5401a Import svg import code from experimental trunk: start point 2018-12-03 13:42:22 +01:00