Commit Graph

27 Commits

Author SHA1 Message Date
Matthijs Kooijman
be69ec5e00 Draft: Fix mixup of TextAlignment vs Justification for Labels
TextAlignment is the vertical alignment, while Justification is the
horizontal alignment. here, get_text was passed the vertical, while it
expected the horizontal. This caused the alignment of a Label to be
wrong in the resulting SVG (e.g. in a TechDraw draft view).

This seems to have been broken since SVG support for Labels was first
introduced in commit 3391a5ea4b (Initial work, only text (no lines)).
2022-03-22 14:46:50 +01:00
Matthijs Kooijman
fd8475b1c6 Draft: Fix SVG generation for label objects
Label objects would produce invalid SVG XML, because the stroke-linecap
property was added as if it was a style (with : and ;), but it was
inserted in the XML tag directly, rather than inside the style attribute
value. The invalid SVG prevented for example a TechDraw draft view from
rendering when it contained a label.

This was added in commit d8c74c06fd (Draft: Using square endcaps for
lines in SVG output).

This stroke-linecap is supported both as a presentation attribute inside
the style or a XML attribute, so for consistency with the surrounding
attributes, it is made a normal attribute, rather than putting it inside
the style.

See also https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap
2022-03-22 14:38:36 +01:00
Yorik van Havre
dd1b0e0a3d Draft: Fixed error in SVG rendering of LinkedArrays - fixes #6516 2022-03-10 13:34:18 +01:00
marioalexis
3f67ee78f7 Draft: Replace Drawing functions with TechDraw functions 2022-02-20 16:34:29 -03:00
Yorik van Havre
e6b7c0e5f9 Draft: fixed tstroke error in get_svg 2022-01-25 11:16:44 +01:00
Yorik van Havre
568dbcea9e Arch: Fixed display of axis bubbles and texts on DXF export and Techdraw pages 2021-12-16 15:55:58 +01:00
luz paz
4bd77b3b35 Draft: fix doxygen typos 2021-12-07 22:53:54 -06:00
Yorik van Havre
a09ec0b403 Draft: Use BuildingParts as group in Draft SVG projections 2021-08-26 14:54:33 +02:00
Yorik van Havre
72e249a106 Draft: Fixed last commit (stroke endcap -> stroke-linecap) 2021-05-06 18:49:55 +02:00
Yorik van Havre
d8c74c06fd Draft: Using square endcaps for lines in SVG output 2021-05-06 18:38:32 +02:00
Chris Hennes
fe7e45a7de [DRAFT] Catch only Exception, not BaseException 2021-02-11 11:52:45 +01:00
Benjamin Nauck
d32631cc54 [Draft] Add better error message in get_svg for direction
An AttributeError is raised when `direction=Vector(0,0,0)` and obj is
an Arch::Space on line: bead9bb938/src/Mod/Draft/draftfunctions/svg.py (L799)

This patch checks if early on if the direction vector and raises a
ValueError with a description of what has gone wrong.

A caveat with this solution is that this new behaviour might break old
code which depends on that invalid directions can be used.
2021-01-31 20:24:59 +01:00
Yorik van Havre
e672aa26b4 Draft: Small layer improvements
- Added 'Print Line Color' property
- Added 'Add new layer' context menu action to layers group
2020-12-15 16:43:33 +01:00
Yorik van Havre
c4d42a1f74 Draft: Fixed bug in SVG projection fill 2020-11-19 13:53:44 +01:00
Yorik van Havre
9a3fcfd8ca Arch: fixed placement of Space label on TD pages 2020-10-26 10:35:40 +01:00
vocx-fc
39744ce987 Draft: split svg.get_svg into subfunctions (2)
Define a subfunction to process Draft "Dimension" (v0.18)
or "LinearDimension" (v0.19) objects.
2020-10-19 13:23:04 +02:00
vocx-fc
8187cbee19 Draft: split svg.get_svg into subfunctions
Define a subfunction to process `Part.Shape` objects.
2020-10-19 13:23:04 +02:00
vocx-fc
f136ee844d Draft: move svg subfunctions to svgshapes.py module 2020-10-19 13:23:04 +02:00
vocx-fc
ebc50e03ed Draft: move svg subfunctions to svgtext.py module 2020-10-19 13:23:04 +02:00
vocx-fc
6379d802b1 Draft: split svg.get_path function for paths that are BSplines
If it's not a circle nor ellipse nor straight line
convert the curve to BSpline. Move into a subfunction.

Improve a few varible names to be more verbose, like `vertex`
and `edge`.
2020-09-21 14:25:03 +02:00
vocx-fc
f2d10669e5 Draft: svg, move test so the code is less indented
The angle between the curve and plane is tested for being coplanar,
0 or 180 degrees. The negative test is done earlier so that the
return is done earlier, and the rest of the code is not indented.
2020-09-21 14:25:03 +02:00
vocx-fc
8e69b05e9d Draft: split svg.get_path into smaller readable functions
Split the SVG string for circular and elliptical paths.
2020-09-21 14:25:03 +02:00
vocx-fc
2f48f1caba Draft: split svg.get_text into smaller readable functions
Split the code for SVG string that will be displayed
for TechDraw pages; also split the header for other cases.
2020-09-21 14:25:03 +02:00
vocx-fc
0739ffa58e Draft: clean up SVG processing code, add comments
For the try-except blocks we should trap a specific `Exception`,
not just any type. It seems string handling was an issue
with Python 2, so the string needed UTF8 decoding.

When the software no longer supports Python 2, these
blocks can be removed.
2020-09-21 14:25:03 +02:00
vocx-fc
5cf799dd85 Draft: rename svg parameter to fillspaces (lowercase) 2020-09-09 12:53:54 +02:00
vocx-fc
b835e5f29d Draft: replace FreeCAD with App for consistency 2020-09-09 12:53:54 +02:00
vocx-fc
7627d0b81a Draft: move getSVG to draftfunctions submodule
Small fixes where the `get_svg` function is used, for example,
in the (obsolete) `DrawingView` class and `Arch_SectionPlane`.

Also update the unit tests accordingly.
2020-09-09 12:53:54 +02:00