Commit Graph

182 Commits

Author SHA1 Message Date
Jeff Young 69c1171320 Add PDFWriter debug mode (ie: uncompressed output).
Fixes https://gitlab.com/kicad/code/kicad/issues/5593
2020-11-06 10:56:45 +00:00
Marek Roszko e928b2d8fd Split EDA_UNITS out from common. 2020-10-25 00:02:52 -04:00
jean-pierre charras c87faad344 Python compatibility: move DXF_PLOTTER::DXF_UNITS to DXF_UNITS in pcb_plot_params.h
Fixes #6034
https://gitlab.com/kicad/code/kicad/issues/6034
2020-10-21 18:29:53 +02:00
Seth Hillbrand 2a43b88115 Standardize PostScript capitalizaiton 2020-10-20 13:09:13 -07:00
Wayne Stambaugh 8ff51d8899 Eeschema: add schematic sheet page number.
The groundwork has now been laid for per sheet instance data.  Initially
this only supports sheet page numbers but could be expanded to include
other per sheet instance information.

ADDED: Support for user defined schematic page numbers.
2020-10-19 14:05:45 -04:00
Marek Roszko b9f1601418 Rename PLOT_MODE to OUTLINE_MODE 2020-10-15 19:33:18 -04:00
Marek Roszko eb33c33f15 Rename EDA_DRAW_MODE_T to PLOT_MODE 2020-10-15 19:30:07 -04:00
jean-pierre charras 46d115faa7 PS plotter; fix a compil warning, and a potential bug. 2020-10-15 15:24:26 +02:00
Marek Roszko 1538d737e7 Split out FILL_T to its own header to avoid spreading eda_item everywhere 2020-10-14 21:51:23 -04:00
Marek Roszko f59551d6ad Remove painter.h from eda_text.h 2020-10-14 19:18:38 -04:00
Marek Roszko 12d21e34e2 Remove trigo.h from eda_text.h 2020-10-13 23:37:48 -04:00
Marek Roszko b2e9f6987d Split base_struct into eda_item and eda_rect 2020-10-13 21:24:50 -04:00
Marek Roszko 2c86363aa0 Relocate the page_layout includes to a page_layout folder 2020-10-13 20:33:33 -04:00
Jeff Young 1703729269 Require explicit decl of maxError and errorLocations.
This should reduce both performance issues and clearance issues.
2020-10-13 13:49:07 +01:00
jean-pierre charras 380534807b Plotters: better support of filled circles having a thickness set to 0.
Setting a line thickness = 0 for graphic objects (circle, rect, line) is
allowed but creates issues for circles that were plotted a non filled shapes
but having a outline thickness = 0.
2020-10-12 11:30:43 +02:00
jean-pierre charras 34f47b3806 Add support of AP macro for chamfered round rect pads. 2020-10-11 12:53:45 +02:00
jean-pierre charras 213a74cbe6 Gerber, Dialog plot: add option to disable Aperture Macro use.
Some broken Gerber readers cannot handle Aperture Macros without errors
although this feature exists since the beginning of RS274X format.
2020-10-10 16:42:21 +02:00
jean-pierre charras f60954c232 Gerber export: add support for flashed chamfered rect (with no rounded corner) pads 2020-10-09 16:47:34 +02:00
Jeff Young fa32f291bc Escape parens when outputting PDF text.
Fixes https://gitlab.com/kicad/code/kicad/issues/5917
2020-10-08 16:46:22 +01:00
jean-pierre charras 2aa357c872 Gerber export: fix incorrect size or orient of flashed oval and round Rect
shapes when they are not horizontal or vertical.
2020-10-08 14:48:34 +02:00
jean-pierre charras 00fea5006e Gerber plotter: fix a bug in a aperture macro calculation 2020-10-08 13:24:28 +02:00
jean-pierre charras 61f1f7d948 Gerber, aperture macros: use different apertures primitives in macro defs.
To avoid issues with broken Gerber readers use aperture macros with shapes
without rotation when more than one primitive is required.
In many gerber readers, rotation of a set of primitives is broken
(do not follow Gerber requirements)
2020-10-06 11:08:07 +02:00
jean-pierre charras 12ecccd0f3 Gerber output: disable use of aperture macros until some issues are fixed. 2020-10-05 10:54:38 +02:00
jean-pierre charras e76736b7bf Fix a few Coverity warnings 2020-10-03 12:47:41 +02:00
jean-pierre charras 0deeed0ddc add missing file 2020-10-02 10:28:24 +02:00
jean-pierre charras 0cca2a0ad2 Rect, Round Rect, Oval, Trapezoid (rotated) pads now use flashed apertures.
Complex shapes are plot using regions.

The old code is still available, just in case...
2020-10-02 10:19:45 +02:00
jean-pierre charras 8285110c2a more cleanup about removing useless include 2020-10-02 08:58:19 +02:00
jean-pierre charras 6b958ff4e0 Move specialized plotter classes from plotter.h to specific plotter_xx.h
plotter.h contains now only a header common to all plotters.
The code does not actually change, but it allows modifying a specific plotter
without recompiling most of kicad files.
2020-09-27 09:54:39 +02:00
Jeff Young e2bc7557cc Clean up arc/circle polygonization.
1) For a while now we've been using a calculated seg count from a given
maxError, and a correction factor to push the radius out so that all
the error is outside the arc/circle.  However, the second calculation
(which pre-dates the first) is pretty much just the inverse of the first
(and yields nothing more than maxError back). This is particularly
sub-optimal given the cost of trig functions.

2) There are a lot of old optimizations to reduce segcounts in certain
situations, someting that our error-based calculation compensates for
 anyway.  (Smaller radii need fewer segments to meet the maxError
condition.) But perhaps more importantly we now surface maxError in the
UI and we don't really want to call it "Max deviation except when it's
not".

3) We were also clamping the segCount twice: once in the calculation
routine and once in most of it's callers.  Furthermore, the caller
clamping was inconsistent (both in being done and in the clamping
value). We now clamp only in the calculation routine.

4) There's no reason to use the correction factors in the 3Dviewer;
it's just a visualization and whether the polygonization error is
inside or outside the shape isn't really material.

5) The arc-correction-disabling stuff (used for solder mask layer) was
somewhat fragile in that it depended on the caller to turn it back on
afterwards.  It's now only exposed as a RAII object which  automatically
cleans up when it goes out of scope.

6) There were also bugs in a couple of the polygonization routines where
we'd accumulate round-off error in adding up the segments and end up with
an overly long last segment (which of course would voilate the error
max). This was the cause of the linked bug and also some issues with vias
that we had fudged in the past with extra clearance.

Fixes https://gitlab.com/kicad/code/kicad/issues/5567
2020-09-11 11:23:49 +01:00
Marek Roszko de7a1b647c Use a local tmp file for plotting
Fix #5238
2020-08-20 16:23:51 +00:00
Seth Hillbrand b650e4568b Mirror hidden text in SVG plotter
We output a 0 opacity text in the SVG plotter to allow searching.  When
this text is changed to 100 opacity, it can show up on the user screen
and so needs to be mirrored to match the stroke font output

Fixes https://gitlab.com/kicad/code/kicad/issues/5001
2020-07-30 06:17:37 -07:00
jean-pierre charras ed79ef8feb PDF plotter: better handling of non ASCII7 (unicode 16) chars.
Note also the PS plotter handle poorly these non ASCII chars.

Fixes #4957
https://gitlab.com/kicad/code/kicad/issues/4957
2020-07-26 17:59:02 +02:00
Simon Richter c407e96b14 std::min/std::max requires <algorithm> 2020-07-11 15:46:57 +02:00
Wayne Stambaugh 2078e629c5 Eeschema: allow editing of junction properties diameter and color.
Add missing plot and print changes for the new bus entry properties.

ADDED: Junction properties diameter and color can now be edited.

Fixes: https://gitlab.com/kicad/code/kicad/issues/4593
2020-06-24 13:36:17 -04:00
Jon Evans e91b9f6dfb Rip out the unused leftovers of the old color system 2020-06-18 22:32:14 -04:00
jean-pierre charras 1973153368 Gerber plotter: ensure the gerber region for a round rect pad is always closed.
Due to rounding issues, sometimes (especially for rotated pads) the region
(4 segments+4 arcs) was incorrectly closed (1 unit (nanometer) mismatch between
start point and end point.
Although it does not create bad shape, its breaks the round rect pad identification
in CAM tools.
start point and end point are now the same.
2020-06-12 10:22:19 +02:00
Jon Evans c6a6c071cf PDF Plotter: avoid assert if default pen width is zero 2020-05-26 21:17:39 -04:00
Jeff Young c7da63151c Clamp egregiously large numbers when plotting.
This keeps some plot file viewers (such as Acrobat) from choking.

Fixes https://gitlab.com/kicad/code/kicad/issues/4408
2020-05-18 13:38:17 +01:00
Jeff Young f5bbf24047 Cleanup unused code that was masking earlier stroking bug. 2020-05-18 13:38:17 +01:00
Jeff Young 21ae7907f2 Don't stroke text. Stroking is for move/line statements. 2020-05-18 13:38:17 +01:00
Jeff Young d8a74c13b8 Fix a syntax error in the PDF generator.
The /Trapped key needs to be the name False, which is not the same
as the boolean false.  Thanks PDF, that's clear as mud.
2020-05-18 13:38:17 +01:00
Jeff Young c9bf2eaa1d Fix PDF syntax error. 2020-05-13 18:04:08 +01:00
Jeff Young bcea2019d4 Unify support for line width magic cookies.
They were added for the Gerber plotter but once there there's the
expectation by others that they'll work.
2020-05-13 17:56:47 +01:00
Jeff Young 1fb51d29ab Reverse interpretation of triple-tilde.
Fixes https://gitlab.com/kicad/code/kicad/issues/4396
2020-05-11 22:56:09 +01:00
Jeff Young 10614a9ebc Implement changes for Sketch Pads to Fab Layers.
Includes adding Fab Layers to default text & graphic settings.

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

Fixes https://gitlab.com/kicad/code/kicad/issues/2274
2020-05-01 18:49:42 +01:00
Ian McInerney 99dcadf7e6 Introduce new KI_FALLTHROUGH macro
Annotate purposeful fallthroughs in switch statements with the
KI_FALLTHROUGH macro.
2020-04-25 00:44:09 +01:00
jean-pierre charras 18150e5769 SVG plotter: fix some issues: incorrect bitmap size and missing lines in header
Fixes #4256
https://gitlab.com/kicad/code/kicad/issues/4256
2020-04-24 17:19:08 +02:00
Jeff Young 7f742ef934 Fix typo. 2020-04-24 14:46:22 +01:00
jean-pierre charras 7e0a1a16ee SVG plotter: use %f instead of %g to print floats.
Looks like scientific notation is not always accepted by Inkscape.
2020-04-23 07:59:41 +02:00
Seth Hillbrand 819f28daf5 Revert part of 9c8941e04
This accidentally changed gerber plotting behavior, resulting in invalid
aperture sizes

Fixes https://gitlab.com/kicad/code/kicad/issues/4232
2020-04-20 15:42:23 -07:00
Johannes Pfister e5042a46ba Add ability to set SVG plot units and precision
ADDED: Ability to set SVG to metric or imperial units
and made it possible to change the size of a step
2020-04-20 22:02:03 +00:00
Jeff Young 2b6089240a Change super/subscript syntax to ^{foo} and _{foo}. 2020-04-18 21:04:41 +01:00
Ian McInerney b8d2802cfe Add missing cases to silence compiler warnings 2020-04-18 00:47:35 +01:00
Jeff Young 9c8941e040 Remove a bunch of globals. 2020-04-16 17:34:46 +01:00
Jeff Young 6e800bddae Rationalize penWidth processing as first step in removing some globals. 2020-04-13 20:58:13 +01:00
Jeff Young 4990d1e7b2 Variable substitution framework.
This implements editing of variables and moving SCH_FIELDs,
TEXTE_MODULEs, TEXTE_PCB and worksheet items over to the new
framework.
2020-03-30 14:15:59 +01:00
jean-pierre charras 9d2712a824 Fix a few Coverity warnings.
It also fix:

Fixes #4082
https://gitlab.com/kicad/code/kicad/issues/4082
2020-03-29 18:42:24 +02:00
jean-pierre charras de7154e8e9 Gerber plotter: Non horiz or vertical oval pads: better plot output:
These pads were plotted as a segment. This is not the right way.
Pads must be flashed or plotted as regions, not painted.
They are now plotted as Gerber regions round rectangle pads.
These regions are similar to flashed pads.
2020-03-27 10:34:41 +01:00
jean-pierre charras 9cb3333d05 Gerber plotter: plot round rectangle pads using a region with arcs.
Previously, the region was a usual polygon with arc approximated by segment.
Using a region with arcs is a better way because it allows CAM tools to
identify this region as a round-rect pad.

A side effect is a better shape and smaller files, however not really noticeable in fact.
2020-03-20 19:45:05 +01:00
jean-pierre charras 08f0e8d6e8 Pcbnew, Gerber output: always generates Aperture Attributes.
Previously, for historical reasons, they were added only if
Include Netlist Attributes option was on.

But Aperture Attributes have nothing to do with Netlist Attributes, and good
Gerber files must include them.
2020-03-12 16:57:13 +01:00
Jon Evans 643c97a2f4 ADDED: Schematic plotting can use a dedicated color theme
ADDED: PDF, PS, and SVG plots can optionally include the page background color

Fixes #1830
2020-03-06 00:01:02 -05:00
Seth Hillbrand e38ab6c699 Treat 0-length ovals as circles
Some buggy SVG interpreters can't handle 0-length ovals.  In this case,
they are meant to be circles, so we can export as circles in our
plotter.

Fixes https://gitlab.com/kicad/code/kicad/issues/3995
2020-03-04 18:03:20 -06:00
jean-pierre charras 465ffff162 Gerber plots: Add initial G01 command to the header,
to ensure linear interpolation mode.
To avoid issues, an interpolation mode must be set before first D01 command.
2020-02-03 17:55:19 +01:00
Ian McInerney f896043067 Fix comments for switch statement fall throughs
This cleans up all GCC warnings (-Wimplicit-fallthrough=2) about
implicitly falling through switch cases.
2020-01-11 19:16:32 +00:00
Jeff Young 5e5edd03f6 Implement super- and subscript printing and plotting for eeschema. 2020-01-10 22:32:49 +00:00
jean-pierre charras d587bd5bca SVG plotter: fix an issue with mirrored texts.
Mirrored texts have a size < 0.
Of course, the actual value for the plotter is the absolute value.
2020-01-09 18:07:56 +01: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
Mark Roszko 19ceb11ae7 Change more enums over to scoped enums 2019-12-28 00:55:11 +00:00
Mark Roszko 11ff16be4e Switch to scoped enums 2019-12-20 14:11:39 +00:00
jean-pierre charras 24cd80ef3e Gerber plotter: modify G02 and G03 commands.
They are now in a specific block and no longer combined with an other command.
(combining these commands with an other command (D01 or D02) is deprecated)

Fixes #3677 | https://gitlab.com/kicad/code/kicad/issues/3677
2019-12-18 11:35:28 +01:00
Seth Hillbrand c4d853c1e8 SHAPE_LINE_CHAIN: Remove element access
This is the first step to allowing non-segments in the line chain.
External routines cannot be allowed to change the line chain without
going through the internal routines.  To accomplish this, we remove the
Vertex() and Point() access routines and only leave the const versions.
Transformations are given for both points as well as the chain itself.
2019-12-12 13:54:48 +00:00
Seth Hillbrand fa133f3f5c Plot SVG embedded
ADDED: embedded image support for SVG files

Fixes #3643 | https://gitlab.com/kicad/code/kicad/issues/3643
2019-12-08 08:57:33 -08: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
Jeff Young 89ace3b0d0 Apply the overbar fixes from the stroke font to bitmap text.
Fixes: lp:1852037
* https://bugs.launchpad.net/kicad/+bug/1852037
2019-11-18 11:36:30 +00:00
jean-pierre charras 5833392689 FIX: Pcbnew plot BezierCurve: add missing line thickness initialization. 2019-11-09 14:02:41 +01:00
jean-pierre charras 5f3353cad1 Add native Bezier curve plot in SVG plotter. 2019-11-05 14:27:07 +01:00
jean-pierre charras 51ed01d765 GERBER_PLOTTER: small change in code to manage the current selected aperture.
Avoid using an iterator to store this aperture because iterators can be invalided
when modifying a list.
Enhancements in gerber_placefile_writer.
2019-11-04 14:33:10 +01:00
jean-pierre charras 65bf669387 Refinements in gerber placefile writer: allows adding board edge cuts in file.
Use a pad bounding box for footprints having no valid courtyard defined.
Refinement also in Gerber files when plotting oval pads.
2019-11-01 18:12:26 +01:00
jean-pierre charras 8a4ba87fba Gerber output: Fix incorrect zones outline thickness in filled areas.
Fixes: lp:1848929
https://bugs.launchpad.net/kicad/+bug/1848929
2019-10-20 21:15:31 +02:00
jean-pierre charras 846397c692 Fix compil warning 2019-10-19 15:44:40 +02:00
jean-pierre charras f892ebbb49 Fix issues in Gerber attributes 2019-10-19 11:26:29 +02:00
jean-pierre charras b9202e81bc Fix Gerber plot pad oval for pad orientation not n*90 degrees.
Use now a Gerber region that support TO attributes like flashed pads.
2019-10-19 11:26:29 +02:00
jean-pierre charras 47f9c505c5 Gerber plot: better handling of polygonal pad shapes plotting
update GBR_CMP_PNP_METADATA.
2019-10-19 11:26:29 +02:00
jean-pierre charras 4b2d801fec Gerber file export: avoid duplicate corner when creating polygons (regions in Gerber dialect)
Fixes: lp:1847714
https://bugs.launchpad.net/kicad/+bug/1847714
2019-10-11 20:59:23 +02:00
jean-pierre charras ac2373ae16 Gerber plotter: add support of standard aperture regular polygon as flashed shape.
Standard apertures are circle, rect, oblong and polygon (regular polygonal shapes with 3 to 12 vertices)
The support of the standard aperture type polygon was missing in Gerber plotter.
2019-10-02 17:33:06 +02:00
jean-pierre charras a1fe8cfa5a Minor changes: cleanup code and prepare code to add more attributes to Object Attributes (.TO) 2019-09-18 11:48:49 +02:00
jean-pierre charras 64b5e8bee2 Minor fix and enhancement code. 2019-09-15 11:10:53 +02:00
Jeff Young 8dd8740fa3 Performance enhancement for pad drawing.
Fixes: lp:1843065
* https://bugs.launchpad.net/kicad/+bug/1843065
2019-09-09 13:45:06 +01:00
Seth Hillbrand 53989e3bdc SVG: Correct plot fills for arcs/polylines
When plotting in Eeschema, various elements may be filled with either
the foreground or background colors.  The fill mode is rather unique,
requiring un-stroked pie wedges for arcs and both closed and open filled
polylines.

Fixes: lp:1840769
* https://bugs.launchpad.net/kicad/+bug/1840769

(cherry picked from commit 213547f545)
2019-08-20 12:03:56 -07:00
Jeff Young a25368cc6b Improve spelling.
The groundwork here is thanks to kunda1.

Fixes: lp:1831510
* https://bugs.launchpad.net/kicad/+bug/1831510
2019-08-20 19:14:05 +01:00
Simon Schubert 176fe80425 SVG plot: output invisible text in addition to plotting
Fixes: lp:1544918
* https://bugs.launchpad.net/kicad/+bug/1544918
2019-08-15 13:39:38 -07:00
Ian McInerney ff9d899ae0 pcbnew: Clean up warnings with unit handling in the DXF export 2019-07-10 12:21:01 -04:00
Jeff Young 16cf1a4d09 Output text content as a description of the stroked path.
Fixes: lp:1544918
* https://bugs.launchpad.net/kicad/+bug/1544918
2019-06-28 22:18:30 +01:00
Seth Hillbrand 6444cfd345 Greyscale plotting adjustment
When plotting greyscale, we should use luminance preservation for the
image output (blues get washed out otherwise).
2019-06-18 17:12:53 -07:00
Seth Hillbrand 66e8795656 Plotting: Handle mask transparency
This handles images with transparent colors by mapping the transparent
color to white.  This only works when plotted into the background.

(cherry picked from commit b32439a694)
2019-06-17 14:59:38 -07:00
Ian McInerney dc56678289 Make DXF monochrome output only contain Black layer
Fixes: lp:1832359
* https://bugs.launchpad.net/kicad/+bug/1832359
2019-06-13 15:18:30 -07:00
Ian McInerney d5f680ecd2 Allow DXF to be exported in either inches or millimeters
Fixes: lp:1832188
* https://bugs.launchpad.net/kicad/+bug/1832188
2019-06-13 15:18:20 -07:00
jean-pierre charras f135ec47fa Page layout: rework and fix a few issues.
* rename WS_DRAW_ITEM_POLYGON to WS_DRAW_ITEM_POLYPOLYGONS (better name)
* use SHAPE_POLY_SET instead of std::vector(<wxPoint> to manage the set of polygons.
It also remove duplicate code related to HitTest and bounding box.
* fix HitTest and WS_DRAW_ITEM_POLYGON highlight.
2019-06-13 13:23:39 +02:00
Jeff Young d6e9bdf07b Convert remaining legacy drawing code to print code. 2019-05-31 21:54:22 +01:00