Commit Graph

22 Commits

Author SHA1 Message Date
Kevin Martin
fc08e0a6f0 Add color on DXF import, refactor code
Colors as assigned to imported drawing entities if they are not merged
with other entities.
The code has been refactored to remove much duplication in reading of
attributes.
The code gives brief messages on the Python console about unsupported
DXF festures and also issues some new errors.
There is no support yet for making colors 1-9 and 250-255 contrast with
the creeen background color. Colors are generated by code rather than a
lookup table; this code can eventually modify the colors it generates to
contrast with a specific background color.
2023-12-14 10:15:17 +01:00
Yorik van Havre
3359f6e152 Import: Support DXF text rotation (#11001)
* Import: Support DXF text rotation - fixes #10882

- Reads and supports text rotation in builtin DXF import
- Makes the builtin DXF import produce Draft texts instead of App::Annotations
- Extends the arguments of Draft make_text()

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-11 17:05:31 +02:00
wmayer
4388246c01 Import: fixes #10983: Crash when trying to import a DXF file with Polish letters in the name 2023-10-10 12:58:47 +02:00
pre-commit-ci[bot]
e92ed45df9 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-09-12 13:02:35 -04:00
wmayer
af3a8d4224 Import: Apply clang format 2023-09-10 19:23:47 +02:00
wmayer
9f99285d59 modernize C++: use nullptr 2023-08-05 11:23:12 -06:00
wmayer
2b3d48176c Mods: modernize C++: redundant void arg 2023-08-05 16:50:31 +02:00
Syres916
8bc8209e8b [Import] Dxf Fix regression from https://github.com/FreeCAD/FreeCAD/commit/1cd9feb
See discussion https://forum.freecad.org/viewtopic.php?t=80040&sid=9937b585c8681fe5a2d27f37dcd3f163
2023-08-01 11:04:22 +02:00
Syres916
027a6a912a Merge branch 'master' into patch-80 2023-06-12 14:24:58 +01:00
Kevin Martin
d404dd59ef Handle long text/mtext on DXF import
This had previously been corrected using similar code but merging another
fix lost part of the original change for this issue.
2023-06-11 13:44:08 -04:00
Syres916
63df17f6ee [Import] DXF make codepage case insensitive
See discussion https://forum.freecad.org/viewtopic.php?t=78719

I don't believe https://github.com/FreeCAD/FreeCAD/issues/8704 is fixed even after this change, the example file Encoding-error.dxf which can be opened by Varicad Viewer still opens error free but has nothing in the 3D view.
2023-06-02 11:43:16 +01:00
wmayer
ba9c63a67a Import: fixes #9438: Crash when loading DXF file with a text element 2023-04-29 22:57:07 +02:00
Kevin Martin
9703853ee1 Add GIL locking for Python calls, alter cp mapping
Required GIL locking has been added where Python methods are
called.

The code mapping from codepage names like ansi_nnn to cpnnnn has
been altered a bit to shorten it.
2023-03-29 16:09:35 -04:00
Kevin Martin
4f24127848 Replace "aci" with the lesss cryptic "colorIndex"
The "a" in "aci" refers to a trademark which we want to avoid mentioning
in code. These values are indices into a color table (plus two special
values for BYBLOCK and BYLAYER) so using the term colorIndex seems more
readable.
2023-03-27 09:48:16 -04:00
Kevin Martin
8b36716bf8 Remove reference to a trademarked name 2023-03-27 09:11:52 -04:00
Kevin Martin
375e94dc3a Fix encoding error for import from older DXF files
The C++ importer incorrectly treated the contents of all TEXT and MTEXT
objects as beind encoded as UTF-8, but this is not true for DXF files
before AutoCAD 2007, where the encoding is "plain ASCII" plus some in-band
\U+dddd encoding. This would cause errors if the text contained non-ASCII
characters such as the Degree Sign.

This change causes the correct encoding to be used.
2023-03-27 07:14:07 -04:00
Kevin Martin
ad8483d320 Issue 8968: Correct C++ DXF importer to get all of long MTEXT text
If the MTEXT exceeds 250 characters, the contents are broken up into
several records in the DXF file. The C++ importer has been changed
to collect all these pieces into a single string containing all the text.
2023-03-20 11:48:47 -04:00
luzpaz
fa3841774e Fix various trailing whitespace issues and typos 2023-02-19 10:59:14 -06:00
wmayer
478b50096e Import: [skip ci] fix warning about trailing whitespaces, fix parsing errors 2022-11-25 11:55:51 +01:00
Uwe
f340176f1c [Import] remove unused includes
- also some sorting
2022-11-25 04:34:44 +01:00
Benjamin Alterauge
ecfe912d97 PreCompiled fix
Preventive action to avoid problems with MSVC.
2022-07-16 10:55:24 +02:00
Benjamin Alterauge
fead475d64 Group dxf relevant files in one folder 2022-07-16 10:55:24 +02:00