Commit Graph

31763 Commits

Author SHA1 Message Date
Yorik van Havre
04d5da5519 Merge pull request #9649 from yorikvanhavre/arch-ifc-rectange
Arch: Fixed wrong IFC export of rectangles
2023-05-30 15:13:11 +02:00
Yorik van Havre
0179c9e693 Merge pull request #9643 from yorikvanhavre/yorikvanhavre-arch-html-tooltips
Arch: Removed html from tooltips (try 2)
2023-05-30 15:12:52 +02:00
Yorik van Havre
88c45c7be3 Merge pull request #9631 from yorikvanhavre/arch-command-texts
Arch: removed 'object' from command tooltips
2023-05-30 15:12:01 +02:00
Roy-043
ad0c41a60e Draft: get_svg: loose edges in obj with faces also received a fill (#9695) 2023-05-30 08:13:47 +02:00
Roy-043
4a90f6e386 Arch: Fix ArchReference (broken after #9316) (#9685) 2023-05-28 15:26:16 +02:00
wandererfan
ab188f6e0b [TD]fix Svg export of template fields 2023-05-28 09:24:14 -04:00
Abdullah Tahiri
5a2c48b593 Sketcher: new toPythonCommand sketcher Python method
====================================================

This commit leverages PythonConverter to produce the Python commands necessary to replicate
a sketch.

The output is a tuple comprising line by line the python commands.

Limitations: Only internal geometry is replicated. No external links.

Usage:
ActiveSketch.toPythonCommands()

Example output:
('geoList = []', 'geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(0.000000, 0.000000, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 65.000000), 3.926991, 8.639380))', 'geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(-70.304056, -14.307964, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 65.000000), 1.186945, 1.992409))', 'ActiveSketch.addGeometry(geoList,False)', 'del geoList', 'constrGeoList = []', 'constrGeoList.append(Part.LineSegment(App.Vector(-45.961941,45.961941,0.000000),App.Vector(0.000000,0.000000,0.000000)))', 'constrGeoList.append(Part.LineSegment(App.Vector(0.000000,0.000000,0.000000),App.Vector(-45.961941,-45.961941,0.000000)))', 'ActiveSketch.addGeometry(constrGeoList,True)', 'del constrGeoList', 'geoList = []', 'geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(-70.304056, 14.307964, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 65.000000), 4.290776, 5.096240))', 'geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(-50.000000, 0.000000, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 65.000000), 2.376910, 3.906275))', 'ActiveSketch.addGeometry(geoList,False)', 'del geoList', 'constraintList = []', "constraintList.append(Sketcher.Constraint('Coincident', 0, 3, -1, 1))", "constraintList.append(Sketcher.Constraint('Coincident', 1, 1, 0, 2))", "constraintList.append(Sketcher.Constraint('Coincident', 2, 1, 0, 2))", "constraintList.append(Sketcher.Constraint('Coincident', 2, 2, 0, 3))", "constraintList.append(Sketcher.Constraint('Coincident', 3, 1, 0, 3))", "constraintList.append(Sketcher.Constraint('Coincident', 3, 2, 0, 1))", "constraintList.append(Sketcher.Constraint('Symmetric', 0, 1, 0, 2, -1))", "constraintList.append(Sketcher.Constraint('Coincident', 4, 2, 0, 1))", "constraintList.append(Sketcher.Constraint('Symmetric', 1, 3, 4, 3, -1))", "constraintList.append(Sketcher.Constraint('Symmetric', 4, 1, 1, 2, -1))", "constraintList.append(Sketcher.Constraint('Coincident', 5, 1, 1, 2))", "constraintList.append(Sketcher.Constraint('Coincident', 5, 2, 4, 1))", "constraintList.append(Sketcher.Constraint('DistanceY', 4, 1, 1, 2, 90.000000))", "constraintList.append(Sketcher.Constraint('Radius', 5, 65.000000))", "constraintList.append(Sketcher.Constraint('DistanceX', 5, 3, 0, 3, 50.000000))", "constraintList.append(Sketcher.Constraint('Equal', 5, 4))", "constraintList.append(Sketcher.Constraint('Equal', 4, 0))", "constraintList.append(Sketcher.Constraint('Perpendicular', 2, 3))", 'ActiveSketch.addConstraint(constraintList)', 'del constraintList', '')

A list directly copiable into the console of a new sketch can be obtained, for example:

for i in ActiveSketch.toPythonCommands():
    print(i)

Example output:
geoList = []
geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(0.000000, 0.000000, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 65.000000), 3.926991, 8.639380))
geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(-70.304056, -14.307964, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 65.000000), 1.186945, 1.992409))
ActiveSketch.addGeometry(geoList,False)
del geoList
constrGeoList = []
constrGeoList.append(Part.LineSegment(App.Vector(-45.961941,45.961941,0.000000),App.Vector(0.000000,0.000000,0.000000)))
constrGeoList.append(Part.LineSegment(App.Vector(0.000000,0.000000,0.000000),App.Vector(-45.961941,-45.961941,0.000000)))
ActiveSketch.addGeometry(constrGeoList,True)
del constrGeoList
geoList = []
geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(-70.304056, 14.307964, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 65.000000), 4.290776, 5.096240))
geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(-50.000000, 0.000000, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 65.000000), 2.376910, 3.906275))
ActiveSketch.addGeometry(geoList,False)
del geoList
constraintList = []
constraintList.append(Sketcher.Constraint('Coincident', 0, 3, -1, 1))
constraintList.append(Sketcher.Constraint('Coincident', 1, 1, 0, 2))
constraintList.append(Sketcher.Constraint('Coincident', 2, 1, 0, 2))
constraintList.append(Sketcher.Constraint('Coincident', 2, 2, 0, 3))
constraintList.append(Sketcher.Constraint('Coincident', 3, 1, 0, 3))
constraintList.append(Sketcher.Constraint('Coincident', 3, 2, 0, 1))
constraintList.append(Sketcher.Constraint('Symmetric', 0, 1, 0, 2, -1))
constraintList.append(Sketcher.Constraint('Coincident', 4, 2, 0, 1))
constraintList.append(Sketcher.Constraint('Symmetric', 1, 3, 4, 3, -1))
constraintList.append(Sketcher.Constraint('Symmetric', 4, 1, 1, 2, -1))
constraintList.append(Sketcher.Constraint('Coincident', 5, 1, 1, 2))
constraintList.append(Sketcher.Constraint('Coincident', 5, 2, 4, 1))
constraintList.append(Sketcher.Constraint('DistanceY', 4, 1, 1, 2, 90.000000))
constraintList.append(Sketcher.Constraint('Radius', 5, 65.000000))
constraintList.append(Sketcher.Constraint('DistanceX', 5, 3, 0, 3, 50.000000))
constraintList.append(Sketcher.Constraint('Equal', 5, 4))
constraintList.append(Sketcher.Constraint('Equal', 4, 0))
constraintList.append(Sketcher.Constraint('Perpendicular', 2, 3))
ActiveSketch.addConstraint(constraintList)
del constraintList
2023-05-28 14:59:31 +02:00
Abdullah Tahiri
62bda37579 Sketcher: PythonConverter not respecting creation order
=======================================================

The original coding grouped normal and construction geometries together regardless of the actual order.

If construction geometries where interleaved with normal geometries, all normal would be grouped into a single
list and all construction into another.

This causes a problem that indices referenced in constraints may not match.

This commit fixes this behaviour. While still creating as much geometries together as a list, as many lists as
necessary are created to keep the order of creation.
2023-05-28 14:59:31 +02:00
Abdullah Tahiri
1d61ed187c Sketcher: Fix bug angle via point visualisation
===============================================

Issue description:
https://forum.freecad.org/viewtopic.php?f=3&t=70325
https://github.com/FreeCAD/FreeCAD/issues/7520

The general algorithm to calculate normals miserably fails when
the curve is a line segment and the point through which the normal
to a curve is to be drawn is colinear with the line segment.

The solution is to provide specific code for this corner case.

fixes #7520
2023-05-28 06:45:50 +02:00
Chris Hennes
21223c8227 Sketcher: 'B-spline' consistency 2023-05-27 21:47:25 +02:00
Roy-043
a5c9da55cf Draft: fix getcoords in gui_snapper.py (#9654)
The function did not handle global and relative mode properly
2023-05-26 19:45:31 +02:00
Chris Hennes
a2d457e88f Update translations 2023-05-25 21:32:26 -05:00
Abdullah Tahiri
2637527e3a Sketcher: SketcherTests - format black 2023-05-25 17:08:03 +02:00
Abdullah Tahiri
9271b6d433 Sketcher: /Mod/Sketcher c++ header clang 2023-05-25 17:08:03 +02:00
Abdullah Tahiri
233a337ca5 Sketcher: /Mod/Sketcher python code black formatted 2023-05-25 17:08:03 +02:00
Abdullah Tahiri
ec899d75c6 SketcherGui: apply clang-format 2023-05-25 17:08:03 +02:00
Chris Hennes
fd8b50d23f Merge pull request #9637 from Ondsel-Development/sanitybug
fix label and file size
2023-05-25 07:28:33 -05:00
Roy-043
630afe1e7c Sketcher: fix typo in Refraction constraint menu text 2023-05-25 14:12:06 +02:00
Roy-043
c731955976 Sketcher: Improve grid and snap related GUI texts
- Always use sentence case (as elsewhere in Sketcher)
- 'Toggle grid' instead of 'Activate grid'.
- Some other minor changes.
2023-05-25 14:10:45 +02:00
Abdullah Tahiri
fdd3525424 SketcherGui: Separate user and developer errors
===============================================

Revisiting all console calls:
- Using the Notification Framework when the user needs to be notified
- Turning them into DeveloperError/DeveloperWarnings when messages are intended only for developers
2023-05-25 14:09:06 +02:00
Abdullah Tahiri
cc091b2703 Console: Update loging macros to only send to developers 2023-05-25 14:09:06 +02:00
Chris Hennes
ec8fe448dc Gui: Don't show raw exception to user 2023-05-24 20:57:43 +02:00
Roy-043
6835eaf702 Draft: Draft_CubicBezCurve: set EnableSelection to False, fixes #6452 (#9640)
While the command is active set EnableSelection to False to correctly detect mouse up events.
2023-05-24 20:35:24 +02:00
Yorik van Havre
f68c045ff7 Draft: Fixes continuing dimensions - fixes #9507 (#9632) 2023-05-24 20:34:52 +02:00
Abdullah Tahiri
60d99ca570 Sketcher: Obey non-intrusive preferences for modal pop-ups
==========================================================

This commit turns the remaining blocking pop-ups in which the user can only click "ok"
into non-intrusive notifications, depending on the user preferences in settings.
2023-05-24 18:35:41 +02:00
Abdullah Tahiri
2a3fe4c628 Gui: Notifications Framework - accept more notifier types
=========================================================

Extends notifier types to Gui::Document, App::Document, Gui::ViewProviderDocumentObject.

This allows to pass these objects as notifiers, and the framework gets the right string
from the Label or FullLabel as appropriate.
2023-05-24 18:35:41 +02:00
wandererfan
367a0a7277 [TD]prevent object deletion outside dialog 2023-05-24 10:15:45 -04:00
wandererfan
2737e830b1 [TD]fix fail on object deleted during dialog (#9626) 2023-05-24 10:15:45 -04:00
Yorik van Havre
4a748f4fb3 Arch: Fixed wrong IFC export of rectangles 2023-05-24 10:44:01 +02:00
Jonas Bähr
7356c8d844 Add myself to CONTRIBUTORS 2023-05-23 17:13:56 -04:00
wmayer
12c20003b3 Sketcher: fix crash when creating a parabola or hyperbola or when using Sketcher_Split
Forum: https://forum.freecad.org/viewtopic.php?t=78543
2023-05-23 20:01:41 +02:00
wmayer
812a20b864 MeshPart: Allow to cancel trim by plane 2023-05-23 16:05:49 +02:00
Abdullah Tahiri
d7ec60c2b4 Console: Improve the documentation 2023-05-23 14:24:45 +02:00
Abdullah Tahiri
12a7f3b236 NotificationArea/Preferences: Allow Opt-in for Developer warnings and errors
============================================================================

The old preferences had errors and warnings ON by default and allowed to opt-out.
It was not possible to separate errors/warnings intended for users from those intended for developers.

The new version has developer errors and warnings OFF by default. User intended ones are ON.
It is possible to opt-in for developer errors and warnings from the preferences dialog.

As developer errors and warnings are NOT translated, if opting-in, they won't be localised.

User errors and warnings should be translated. If they are not, it is a bug.
2023-05-23 14:24:45 +02:00
Abdullah Tahiri
0e85b24348 Sketcher: Command constraints error handling adaptation
=======================================================

- Better handling for exceptions originating in Python addConstraint.
- Refactor to reuse code for handling of exceptions
2023-05-23 14:24:45 +02:00
Abdullah Tahiri
2338ae633e Sketcher: Make Command Constraints show the severity of warning for typical user mistakes 2023-05-23 14:24:45 +02:00
Abdullah Tahiri
c2b2b0c1fa Base: Interpreter - Mark Exception reporting and stack as intended for developers 2023-05-23 14:24:45 +02:00
Abdullah Tahiri
cc13da5470 Console: Remove Translated Notification message
===============================================

With the new console extension, the translation state is coded separatedly.

Therefore, it is possible to code a Notification as translated without needing a specific type.

Additionally, any other message, such as Error of Warning can be translated.

It does not make sense to leave this message, if only for reasons of coherence and to simplify
maintainance of code.
2023-05-23 14:24:45 +02:00
Abdullah Tahiri
c973033b6c Gui: Adapt Notifications Framework 2023-05-23 14:24:45 +02:00
Abdullah Tahiri
98f3163a7a App: NotificationArea adaptation to the new messages 2023-05-23 14:24:45 +02:00
Abdullah Tahiri
2bcee570da Console: Extend the Python interface 2023-05-23 14:24:45 +02:00
Abdullah Tahiri
45bf89d977 Console: Convenience dedicated functions 2023-05-23 14:24:45 +02:00
Abdullah Tahiri
a66e00d2a4 Ilogger - Separate behaviour for user exposed and not exposed loggers 2023-05-23 14:24:45 +02:00
Abdullah Tahiri
e3702ac2d8 Console: Extend framework with intended recipient and content type metainformation
==================================================================================

Limitations of the current framework:
- Codes the translated state only for TranslatedNotification as part of the type.
- Does not code the intended recipient (user, developer, ...)

Problems:
- Some errors are intended for developers, some errors may only be intended for users,
if, for example, there is another developer error which already contains all the information.
The current framework may lead to information duplication or to showing to the user developer
information, which is perceived as annoying.
- Logs shall be in English (report view), while every message to the user (UI) shall be translated.
The current framework can only differentiate where to report based on subscription (legacy logs do not
subscribe to notifications), and for notifications, whether it is translated or not depends on the type.
It is not possible to code errors or warnings that are already translated.

Solution:
- To extend the ILogger interface with additional metainformation, indicating the intended recipient
(User, Developer, All), and the content of the message (translated, untranslated, untranslatable). The latter
is useful for dynamic strings that won't find a match in the translation framework.

Bonus:
- This extended version allows to do away with translatednotification, as now any message can be independently
marked as translated or untranslated or untraslatable.
- It is now possible to provide the right icon of severity (error, warning, info), even when it is only user intended
and already translated.
2023-05-23 14:24:45 +02:00
Jonas Bähr
dc07897a29 Sketcher: Add tests for Circle to Line distance constraint
Note that support for secants currently only works for reference
constraints but not for driving ones. If and how this should be done
is still under discussion [1].

[1]: https://github.com/FreeCAD/FreeCAD/pull/9044#issuecomment-1548006842
2023-05-23 14:19:51 +02:00
Yorik van Havre
2f222a1242 Arch: Removed leftovers of leftover html escape chars 2023-05-23 14:10:22 +02:00
Yorik van Havre
f6c003bdbc Arch: Removed leftover html escape chars 2023-05-23 14:00:49 +02:00
Yorik van Havre
3880f47e17 Merge branch 'arch-html-tooltips' of github.com:yorikvanhavre/FreeCAD into yorikvanhavre-arch-html-tooltips 2023-05-23 13:54:36 +02:00
Yorik van Havre
03450a5684 Merge pull request #9586 from yorikvanhavre/arch-ifc-export-fix
Arch: Minor fix to IFC exporter
2023-05-23 13:53:14 +02:00
Yorik van Havre
1ae23db392 Merge pull request #9585 from yorikvanhavre/arch-svg-fill
Arch: Fixed SVG fill
2023-05-23 13:52:33 +02:00