Commit Graph

424 Commits

Author SHA1 Message Date
Max Wilfinger
8ff5a1f688 Fix source string typos mentioned on Crowdin (#15261) 2024-07-08 17:18:31 -05:00
wmayer
06b464a9b0 Import: Simplify handling of Resource_FormatType
The type Resource_FormatType already exists since 2015. So, its usage doesn't require pre-processor macros everywhere.
2024-06-21 12:00:38 -05:00
wmayer
d49303a5dc Import: Move options handling to ImportGui.importOptions
Currently a modal dialog is used directly in ImportGui.open()/ImportGui.insert() that makes it impossible to use the functions in a
script because they will be blocked
2024-06-21 12:00:38 -05:00
wmayer
127f935711 Fix several compiler warnings
* -Wmaybe-uninitialized
* -Wunused-parameter
* -Wunused-variable
* -Wnonnull
* -Wstringop-truncation
* -Wstringop-overflow
2024-06-19 21:14:23 -05:00
Kuzemko Alexsandr
173733750b Select code page during STEP Import (#14416)
* [STEP Import]
Added the ability to select the encoding of the source file when importing.
Requires OCCT version 7.8.0 and higher

* fix compile error for OCCT < 7.8.0

* Also hide label "CodePage" for OCCT < 7.8.0

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

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

* Fix error

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

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

* Fix error on Ubuntu 20-04

* Fix error on Ubuntu 20-04

---------

Co-authored-by: Kuzma30 <kuzemkoa@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-17 10:47:28 -05:00
wmayer
f4f694e793 Test: make test for STEP import independent of user settings
If the option 'Enable STEP compound merge' is active the test would fail
2024-06-12 20:19:49 +02:00
David Carter
5feb963f9d Material: Appearance Updates 2
Improves the use of the ShapeAppearance property for the Part workbench.

    removes DiffuseColor property
        adds Python compatibility using custom attributes
        transitions DiffuseColor to ShapeAppearance on open
    Improved UI elements for setting object appearance, and appearance per face
    Lays the foundation for future texture support
2024-06-01 19:57:16 -05:00
wmayer
560cab6f31 clang/gcc: Add build option FREECAD_WARN_ERROR to force to make warnings into errors 2024-05-29 13:37:07 +02:00
wmayer
3f2e6d8257 Import: Replace normal message with log message when loading a STEP file 2024-05-23 00:49:10 +02:00
mosfet80+
cc96fcae66 [mod] removed unused variable
removed unused variable
2024-05-21 13:01:34 +02:00
mosfet80
dcc1c3c9e4 mod: clean ImportOCAF.cpp
clean  ImportOCAF.cpp
2024-05-20 11:44:08 -05:00
Roy-043
d1791815b8 Import: C++ DXF importer wrongly scaled polyline bulges
Fixes #13600.
2024-04-29 16:12:17 +02:00
wmayer
f84224bb43 Mod: Show regressions in shape colouring
This PR demonstrates the known regressions of the recently merged material branch:
* Changing the transparency after setting color per face will reset them
* The result of boolean operations or compound doesn't inherit the colour of its input objects
* If colour is set per face to a boolean operaton object then saving and restoring the file causes weird rendering behaviour
  because material binding is set to PER_PART but only a single colour is defined
* If a shape inside a part container has set colour per face then saving and restoring as STEP file causes weird rendering
behaviour for the same reason
* Shape binder or datum objects don't show the correct default shape colour
2024-04-09 22:13:42 +02:00
David Carter
ba20441935 Material: Material appearance
Uses new material system for appearance

Each feature object now has a property called ShapeMaterial that
describes its physical properties. If it has a shape, it has a
material.

The ShapeColor attribute is replaced by a ShapeAppearance attribute.
This is a material list that describes all appearance properties, not
just diffuse color. As a list in can be used for all elements of a
shape, such as edges and faces.

A new widget is provided to allow the user to select materials in a
consistent fashion. It can also launch the material editor with its
more advanced capabilities.
2024-04-04 07:39:58 -05:00
pre-commit-ci[bot]
15d7980173 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-03-31 10:47:32 +02:00
ppphp
8863b9ac4c fix: c++20 deprecate [=] 2024-03-31 10:47:32 +02:00
wmayer
dc8e5bb924 Fix build failure for MinGW
MinGW needs to know about the COIN_DLL export macro
2024-03-11 16:02:48 +01:00
wmayer
64a91968a3 MSVC: fix compiler warnings 2024-02-25 00:12:34 +01:00
wmayer
e6bbc7f049 Part: use of ShapeMapHasher for code simplification 2024-02-12 12:02:17 -06:00
Kevin Martin
62469d23cf Handle all combos of "group into blocks" "use DXF colors" "use layers"
Fixes #11873 this was the primary goal of these changes

Fixes (partially) #11874 the parts of a polyline are combined as a
compound object (shape) but it would be preferable for them to be made
into a wire (if possible)

Fixes #11872 Objects in a block definition are now kept separately
until the block is inserted, in which case the inserted objects are
subject to all the other options regarding combining.

Fixes (partially, review required) #11871 Text and dimensions are now
kept as part of the block definition and are placed in the drawing when
the block is inserted but this code has not been extensively tested.

Affects #11875, custom types are not made, but the labels now reflect
the object types rather than all being "Shapennn"

This leaves the importer options handling in a bit of a mess that needs
cleanup eventually, but this can be a new issue.
This includes some importer flags that have no corresponding options
(e.g. import frozen layers), some flags not yet implemented, some
flags not yet even declared in the code because their implementation
is further off (import hatch outlines), and some suggested future
options (import SOLIDs as faces)

Centralize the calculation of the OCS for entities as they're read
from the DXF. Most of the entities don't use this yet, but some of
them roll their own crude Normal Vector handling. Because the new
code takes priority over the old for reading the normal vector, such
code will always see (0, 0, 1) as the extrusion direction.
2024-02-06 12:50:30 +01:00
Chris Hennes
63a6592f03 Merge pull request #12064 from bdieterm/fixPlaneTransparency
Gui: add explicit transparency specification
2024-01-23 21:33:20 -06:00
WandererFan
e72efde5eb [Import]fix linkage warning on linux/gcc (#12071)
* [Import]fix linkage warning on linux/gcc


https://stackoverflow.com/questions/41167119/how-to-fix-a-wsubobject-linkage-warning

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-22 14:37:33 -03:00
bdieterm
abfe38e0e7 Gui: add explicit transparency specification 2024-01-21 17:41:31 +01:00
wandererfan
0e53aafa86 [Import]fix rounding errors in dxf export 2024-01-17 11:33:50 -05:00
bgbsww
bd1fc0fc03 Add support for OCCT 7.8.0 (#11909) 2024-01-09 19:47:25 -06:00
pre-commit-ci[bot]
b1ee268d98 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-01-09 20:07:57 -05:00
wandererfan
e3d42e82a6 [Import]Flatten sketch before dxf export. 2024-01-09 20:07:57 -05:00
Kevin Martin
c2fb684ff7 Streamline scaling for DXF import
Eliminate m_measurement_inch to clean up logic for priority of MEASUREMENT and INSUNITS.
Save the actual scaling factor rather than the scaling enum so a switch statement is not executed for each call to mm()
Add to CDxfRead the work to handle dxfScaling option, ImpExpDxfRead just has to set it up now.
Get the scaling factor from a lookup table rather than a switch statement
Display a message explaining what the scaling factor is and where it comes from
Remove large amount of Lint.
2024-01-08 18:01:21 +01:00
luzpaz
9c8a3f27f9 Fix typos 2023-12-22 13:35:23 +00:00
pre-commit-ci[bot]
bd2c77f797 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-12-14 15:47:56 +01:00
Yorik van Havre
2c4c9ac520 Fix DXF importer wrongly prioritizes the MEASUREMENT variable 2023-12-14 15:47:56 +01:00
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
Kevin Martin
37e6c19a4b Add hooks so Gui classes can be seen by DXF importer 2023-12-14 10:15:17 +01:00
André Caldas
89dbab9b0e Avoids using getNameInDocument() to test if DocumentObject is attached to a Document.
This patch substitutes by isAttachedToDocument() (almost) everywhere where
getNameInDocument() is used for this purpose.

The very few places not touched by this patch demand a (just a little) less trivial change.
When we change the returning type of getNameInDocument() to std::string,
those places will be easily found, because they shall generate a compiler error
(converting std::string to bool).

Rationale:
The fact that getNameInDocument() return nullptr to indicate
that the object is not attached to a document is responsible for lots of bugs
where the developer does not check for "nullptr".

The idea is to eliminate all those uses of getNameInDocument() and, in the near future,
make getNameInDocument() return always a valid std::string.
2023-12-11 17:37:58 +01:00
wmayer
207fb09b68 MSYS: fix build failure with MinGW & gcc 2023-11-28 16:16:34 +01:00
pre-commit-ci[bot]
0dc15c940d [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-11-20 18:25:29 +01:00
Kevin Martin
00c94b8351 Use PyObject_CallObject rather than interpreting generated code
Rather than generating Python code and interpreting it, which, in C++, is fraught with issues of creating the correct syntax for a str token when the text contains certain special characters like double-quote and backslash, the modified code makes call(s) to PyObject_CallObject which takes the C++ string and makes the appropriate conversion itself. The steps in building the Position passed to make_text are also done using c++ objects until the final Python Placement object is needed.
2023-11-20 18:25:29 +01:00
Florian Foinant-Willig
464ffa7e73 Import: modernize type checking 2023-10-23 18:08:53 +02:00
Victor Predko
e1206a3fac File formats: Uppercase file types when importing a file. (#10977)
* Added uppercase extensions for supported formats

In the file App\Application.cpp

* Added file types in upper case

* Adds uppercase file types to the file import filter.

Fixes #10879

* Added filter for *.fcmacro *.fcscript
2023-10-16 14:40:46 -03: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
e9cbdd208c Import: fix -Wunused-private-field 2023-10-11 15:12:42 +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
wmayer
dc771fca63 Import: Extend OCAF browser 2023-10-03 15:55:22 +02:00
wmayer
b2be356609 Import: Support of colors of the glTF format 2023-10-03 15:42:30 +02:00
wmayer
39d8f90cba Imoprt: move ExportOCAF2 to own source files
and move global functions to Tools class
2023-10-03 08:13:27 +02:00
Chris Hennes
8595b07b76 Merge pull request #10844 from ppphp/remove_redundant_definition
[cmake] some definitions do not matter now
2023-10-02 14:20:49 -05:00
wmayer
5a49ba8e20 Import: improve new STEP/IGES/glTF export function to support colors per face in headless mode
Fixes #10861
2023-10-02 17:10:34 +02:00
wmayer
2d4bcbba34 Import: fix legacy STEP/IGES/glTF export function to support colors per face
See issue #10861
2023-10-02 17:10:34 +02:00
wmayer
02df23ce95 Import: move OCAFBrowser to its own source files 2023-10-01 22:23:57 +02:00
wmayer
6d7b6b52c2 Import: rename ImportOCAFExt to ImportOCAFGui and move to own source files 2023-10-01 22:23:57 +02:00