Commit Graph

3739 Commits

Author SHA1 Message Date
Kacper Donat
239173bcf2 Draft: Add example tool hints 2025-05-21 17:42:45 +02:00
Roy-043
a7f0feddc0 Draft: avoid redundant constraints in make_sketch.py (improved)
See #21398 and #21396.
2025-05-21 11:56:11 +02:00
Benjamin Nauck
02e1bbe1ae Merge pull request #21042 from furgo16/add-taskpanel-walloffset
BIM: add Offset input to wall creation task panel
2025-05-19 17:45:46 +02:00
Roy-043
61e349ef54 Draft: use different color for WPProxy to avoid BIM dependency
Fixes #21390.
2025-05-17 14:30:48 +02:00
Roy-043
9d79d1aab9 Draft: avoid redundant constraints in make_sketch.py (#21398)
Forum topic:
https://forum.freecad.org/viewtopic.php?t=97072

The MissingVerticalHorizontal functions from the Sketcher WB do not behave as expected. See #21396.

A check for redundant contraints is required if   `makeMissingVerticalHorizontal()` is used. The argument for the function should be `True`. For consistency the same was done for makeMissingPointOnPointCoincident().
2025-05-16 19:12:32 +02:00
Roy-043
5a7b73e560 Draft: params.py: do not report missing UI files (#21370)
See #21331.
2025-05-16 15:27:33 +02:00
Chris Hennes
f2e78e53e9 UI: Remove qPixmapFromMimeSource pixmap function
This function dates back to Qt3, and was removed in Qt4. Modern Qt no
longer uses this ui file entry, and in some circumstances the uic
complains about its presence.
2025-05-15 00:56:30 +02:00
tetektoza
7d57569eb4 Draft: Finish command if user deselected Chained Mode
As the title says - currently, if user deselects Chained Mode, they
can't exit it without using ESC key for example, as the old behavior
of ContinueMode is kept under it.

So, this patch finishes the command if user has deselected it, at
the same time finishing previous chain.
2025-05-13 11:39:01 +02:00
Furgo
576b5ffb41 Draft: add more context to select plane command message 2025-05-12 21:27:30 +02:00
Roy-043
b451193a49 Draft: aux.fake_function should not overwrite functions
The `aux.fake_function` is used in the Draft unit tests as a substitute for functions that, in most cases, do not yet exist. But in test_modification.py it would overwrite Draft.extrude leading to issues with BIM unit tests.

See:
https://github.com/FreeCAD/FreeCAD/pull/21134#issuecomment-2869178563
2025-05-12 10:45:45 -05:00
Furgo
87768e4c79 Merge branch 'main' into add-taskpanel-walloffset 2025-05-12 05:08:04 +02:00
tetektoza
ff1602ef6b Draft: Introduce new dynamic polygon tracker for Polygon tool (#21045)
As the title says - currently we just have a simple circle, so I thought
with some basic adjustments it's possible to add a cool tracker that
will possibly guide user better on what they are placing on the
viewport.
2025-05-08 14:30:31 +02:00
bofdahof
998f4e4d45 Console: rename PascalCase named methods to camelCase 2025-05-06 17:50:21 +02:00
Roy-043
2e02c6a944 Draft: ShapeString: use an actual font file as default, allow TTC files
* To help novice users supply an actual font file from the OS as the default for ShapeStringFontFile.
* The Draft code blocked the use of TTC font files. `Part.makeWireString()` can however handle them (although only the first font in the file can be used).

Additonally:
In a previous PR the bottom spacer was removed from the task panel. This PR brings it back as it is required in some cases. Without it  the "..." button of the file selector can become huge.
2025-05-05 18:15:47 +02:00
Roy-043
ffd99499fb Draft: fix dim unit override for Building US unit system
Fixes #21092.
2025-05-05 18:01:36 +02:00
tetektoza
7f6b3dcf70 Draft: Preserve direction vector upon Continue Mode for Dimension (#20974)
So, currently, if we use Vertical/Horizontal Dimension which is
constrained in one direction vector, upon `Continue`, the direction
vector is not being preserved.

The cause of that is that everytime we recall the command in Continue
Mode, we also call base class' `Activated` method, which in turn calls
`finish()` if we have already initialized an active Draft command. This
doesn't happen during first usage of the command, because this variable
is not yet populated, but upon second (and next) runs it is. In turn,
this causes to call `finish()`, and clean up the direction vector. So,
in essence, we are specifying the vector and cleaning it every
"Continue" run.

So, as a solution, just move the direction vector as an argument to
populate super class with it, and do that after super class' `Activated()`
call, so it won't get cleaned up in `finish()`.

Co-authored-by: Yorik van Havre <yorik@uncreated.net>
2025-05-05 17:58:54 +02:00
Roy-043
57da6ac140 BIM: close task panels on doc close
Fixes #17952.

This PR is a continuation of #20719.

It mainly involves adding `self.doc`. This new attribute is then also used in the rest of the modified classes. In some cases code was slightly reordered for consistency.

The `_finish_command_on_doc_close` function has been modifief to also handle `Gui.Snapper.ui.escape` and the code in gui_arcs.py has been updated accordingly.

Additionally:
Removed the `done` and `spacedone` variables in BimWall.py by tweaking the code.
2025-05-05 17:52:37 +02:00
Furgo
288a04deba BIM: add Offset input to wall creation task panel 2025-05-05 12:31:03 +02:00
Roy-043
56d75c2c06 Draft: store 3 ShapeString parameters and remove font from prefs (#21054)
* Draft: store 3 ShapeString parameters and remove font from prefs

With this PR 3 ShapeString parameters are stored:
* ShapeStringFontFile: this replaces the old FontFile parameter.
* ShapeStringHeight
* ShapeStringText

The ShapeStringFontFile is just the last selected font file and not exposed in the Preferences editor.

Additionally:
* Changed the label of the text input box from "String" to "Text".
* Changed the label of the point reset button to sentence case.

* Remove faulty docstring
2025-04-29 07:13:17 -05:00
Roy-043
ea6a30efba Draft: Add Global mode to ShapeString task panel
This PR adds the Global mode option to the ShapeString task panel.

Additionally:
* Rounding of coordinates caused by reading values from the task panel is avoided.
* Improved task panel layout: Height input above String input.
* Some code reformatting.
2025-04-28 17:57:41 +02:00
Luz Paz
4619ab1bff Misc: Fix various typos
Found via codespell
2025-04-27 19:32:19 -05:00
aprospero
5f8eac49f3 importSVG - Path generation Overhaul (#20749)
* add precision Parameter for importSVG to preferences

* rewrite svgpath import

reorganize the existing svg interpretation code snippets by dividing the responsibilities for data provision and actual shape generation.
That bears the opportunity to optimize the resulting construction data regarding consistency and precision.

* create cuts from inner paths

organize paths in a tree structure where completely contained paths are children of their sorrounding paths

In a second step the even depth paths are cut with their respective (uneven depth) children.

* move svg path import logic into its own module

* Restructure how the import result is controlled by preferences.

* reintroduce alternative transform function

Using transformGeometry() on shapes results in degenerations like lines mutating to bsplines of 1st order. For non-orthogonal Transformations this can't be avoided. But for orthogonal transformations (the majority) we can apply those transformations without degeneration.

The necessary function including fallback to transformGeometry() is already in the code but was disabled due to a regression.

See: https://tracker.freecad.org/view.php?id=2062

Associated commits: f045df1e 2509e59b d4f3cb72

I reactivate the code since the degeneration of paths seems a bigger issue to me than misformed svg files producing incorrect measurements. Degenrated paths are often the culprit for later arising 3D-calculation errors.

* avoid path degeneration by keeping scale transformations uniform

* repair style application on shapes

the style should be based on the configured svgstyle mode in the svgimport preferences.

* improve logging of face generation.

* refactor: rename _precision_step to _tolerance

naming according to example set in draft utils.

* fix: indentation

* spelling
2025-04-25 16:44:03 +02:00
Roy-043
262f8d49fe Draft: Change 'Chain Mode' GUI text to sentence case 2025-04-24 10:10:18 +02:00
Roy-043
ed4dfba2a7 Draft: adjust formatting of params.py 2025-04-23 17:03:07 +02:00
Florian Foinant-Willig
19c125e898 Draft: Prevent user to remove core properties 2025-04-22 23:52:17 +02:00
Florian Foinant-Willig
065a8a2226 Core: Part::PartFeature should be Part::Feature 2025-04-21 10:51:15 -05:00
Roy-043
6082a0844c Draft: close task panels on doc close
Related: #17952.

This PR introduces a document observer to close task panels on doc close.

For now it is for the Draft Workbench only. The BIM Workbench will be dealt with in a future PR.

The basic code is simple, but to make things works some additional things were addressed:
* gui_base.py: the GuiCommandBase class was enhanced to handle App.activeDraftCommand, self.doc, self.view and self.planetracker. Strictly speaking only the first 2 are required for this PR.
* gui_base.py: self.command_name was changed to self.featureName for compatibility with gui_base_original.py. Not required for this PR.
* gui_arcs.py, gui_circulararray.py, gui_polararray.py and gui_orthoarray.py: updated in relation to the GuiCommandBase class.
* gui_arcs.py Arc_3Points: The command now has a ui property and shows a plane tracker. Only the first is required for this PR.
* gui_shapestrings.py: This command had two ui attributes: self.ui and self.task. This was problematic. To fix this the base class of the command was changed from gui_base_original.Creator to gui_base.GuiCommandBase. As a result the getStrings method is no longer available meaning that the useSupport parameter is ignored when creating a ShapeString. But since that mechanism does not work properly anyway, I feel that this is acceptable. Should many user complain the functionality can of course be reintroduced.
2025-04-20 22:53:52 -05:00
tetektoza
2a983b587d Draft/BIM: Change Continue behavior and caching among commands (#20748)
* Draft: Cache ContinueMode setting for every tool separately

Currently ContinueMode is done to be held globally, so this patch
changes this to cache it inside `user.cfg` for every cmd separately.

* Draft: Add Chained Mode option for Dimension

Added new option under Dimension, although this is simply porting the
existing logic of "Continue" under "Chained Mode", whereas allowing
existing "Continue" mode to retrigger the command instead of placing
Dimensions in a chain.
2025-04-18 17:56:21 +02:00
Roy-043
9dffe0d9b4 Draft: Simplify working plane view observer callback
The old callback contained unnecessary checks that prevented the working plane from working correctly if the Tray was missing.
2025-04-14 11:01:48 -05:00
aprospero
4c7fb9625b Draft: parametrize Draft vector utils precision (#20199)
* parametrize draft vector utils precision

* fix: a single function didn't get the complete latest update.

* compatibility: reintroduce DraftVecUtils.precision() as deprecated.
2025-04-07 23:12:02 +00:00
xtemp09
893e4a2ff1 Make some context menu actions translatable (#20401)
* Make some context menu actions translatable

* [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>
2025-04-07 08:43:04 -05:00
Luz Paz
30ce3023fa Draft: fix source typo
Corrected source variable name so it wouldn't show up in codespell check
2025-04-05 22:59:33 -05:00
luzpaz
7a12d2f96f Fix various typos (#20651)
* Fix various typos
Found via `codespell -q 3 -L aci,addmin,ake,aline,alle,alledges,alocation,als,ang,anid,anormal,anull,aply,apoints,ba,beginn,behaviour,bloaded,bottome,brushin,bu,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childrens,childs,colour,colours,commen,connexion,currenty,documentin,dof,doubleclick,dum,eiter,elemente,ende,feld,finde,findf,findn,fle,freez,graphin,groupe,hist,iff,incrementin,indexin,indicies,initialisation,initialise,initialised,initialises,initialisiert,inout,ist,itsel,kilometre,leadin,localy,lod,mantatory,matc,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oce,oder,ontop,orgin,orginx,orginy,ot,pard,parm,parms,pres,programm,que,rady,recurrance,renderin,re-use,re-used,re-using,rin,ro,rougly,sectionin,seperator,sergent,serie,shs,sinc,siz,som,stpo,strack,substraction,te,technic,thist,thru,tread,tru,ue,uint,unter,uupper,uptodate,vas,vertexes,vew,wallthickness,whitespaces -S "./.git,*.po,*.ts,*.pdf,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml,./src/Base/StackWalker.cpp,./build/doc/SourceDoc,./tools/build/WindowsInstaller/lang,./src/Mod/TechDraw/Templates/locale"`

* [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>
2025-04-05 22:58:20 -05:00
Roy-043
440dfa8203 Merge pull request #20634 from Roy-043/Draft-make-Draft_SelectPlane-recognize-the-new-Part_DatumPlane-object
Draft: make Draft_SelectPlane recognize the new Part_DatumPlane object
2025-04-05 10:46:09 +02:00
Roy-043
9ada83aebd Merge pull request #20574 from luzpaz/typo-source-draft
Draft: fix source typo in draftobjects/patharray.py
2025-04-04 14:42:30 +02:00
Roy-043
83db2c260c Draft: make Draft_SelectPlane recognize the new Part_DatumPlane object
Forum topic:
https://forum.freecad.org/viewtopic.php?t=96058
2025-04-04 14:26:28 +02:00
Roy-043
2e45e8d6e1 Merge pull request #20395 from paullee0/DraftFaces_05_Bind_Improve-Fuse_and_Warning
[Draft-Faces] Bind: Improve fuse and warning
2025-04-01 16:16:43 +02:00
Roy-043
62a64e0613 Merge pull request #20529 from Roy-043/Draft-fix-alignment-of-dim-arrows
Draft: fix alignment of dim arrows
2025-04-01 16:13:01 +02:00
Luz Paz
b9d03abc7b Draft: fix source typo in draftobjects/patharray.py 2025-04-01 10:05:08 -04:00
Kevin Martin
0986dadb2f Correct non-gui DXF C++ importer to not generate pending python exceptions (#20328)
* Add a test case for DXF import

* Test gui flag rather than look for import error to make gui decision

The new code is cleaner and faster and avoids any exception stuff

* Properly avoid trying to use Layer's View object in non-GUI

The code was trying to avoid this but had a Python None object rather than a null C++ pointer and so tried setting a property on None. This left an unhandled exception state which acted as a booby trap that caused the later failure of some unrelated code.

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

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

* De-lint, remove wong "unsupported" message
Hidden layers have been supported for a while but still generated an import note about this being unsupported.

* [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>
2025-03-31 11:20:37 -05:00
Roy-043
1c588e6614 Draft: fix alignment of dim arrows
Forum post (issue 3):
https://forum.freecad.org/viewtopic.php?t=95898#p819131

The `invert` value of dim arrows should always be `False` for the 1st and `True` for the 2nd. It should not depend on their X coords.
2025-03-30 21:20:26 +02:00
Roy-043
f5d98e6e5d Draft: fix Dim Auto Flip Tex angle checks
When checking angles Dim Auto Flip Text did not consider that angles can be almost -180 degrees and should then be treated the same as 180 degree angles.
2025-03-30 14:01:10 +02:00
Paul Lee
b05c02b6f1 [Draft-Faces] Bind: Improve fuse and warning - Further Fix
Github Discussion:
- Fix problem Roy-043 pointed out https://github.com/FreeCAD/FreeCAD/pull/20395#pullrequestreview-2726624360

FC Forum:
- https://forum.freecad.org/viewtopic.php?p=819121#p819121
2025-03-30 10:29:36 +08:00
Roy-043
4ac8f0b141 Draft: fix status bar widgets display timing issue
Fixes #17044.
2025-03-28 06:09:54 +01:00
Roy-043
354cc84935 Draft: add font name dropdown to preferences (#20400)
Fixes #20330.
2025-03-27 13:11:47 +01:00
Roy-043
0c9c23dc18 Draft: remove obsolete param functions
See #20198

These functions are no longer used in the Draft WB or in the BIM WB.

There is a small risk that 3rd party code relies on them and breaks, but that can be addressed when such is reported as a problem.
2025-03-26 15:52:40 +01:00
Roy-043
5ba1c2c9b4 Typo in docstrings 2025-03-24 20:58:31 +01:00
Roy-043
f7a7d4ed61 Draft: Update checked state of grid button when switching the grid
The checked state of the grid button was not updated when the grid was only displayed during Draft commands.
2025-03-24 20:53:39 +01:00
aprospero
7dab93abac get rid of get/set_param doublette in Draft utils
we have the same functionality already in params from draftutils
2025-03-24 11:48:42 -05:00
Roy-043
718ac63365 Merge pull request #20355 from Roy-043/Draft-move-statusbar-widget-delays-to-init_draft_statusbar.py
Draft: move statusbar hide delay to init_draft_statusbar.py
2025-03-23 10:19:53 +01:00