* BIM: Implement smart base removal for Walls
Previously, removing the Base object from an Arch Wall would cause the
wall to reset its position to the document origin and could lead to
unintended geometric changes for complex walls.
This commit introduces a "smart debasing" mechanism integrated into the
Component Task Panel's "Remove" button:
- For walls based on a single straight line, the operation now preserves
the wall's global position and parametric `Length`, making it an
independent object.
- For walls with complex bases (multi-segment, curved), a warning dialog
is now presented to the user, explaining the consequences (shape
alteration and position reset) before allowing the operation to
proceed.
This is supported by new API functions `Arch.is_debasable()` and
`Arch.debaseWall()`, which contain the core logic for the feature.
Fixes: https://github.com/FreeCAD/FreeCAD/issues/24453
* BIM: Move wall debasing logic into ArchWall proxy
The logic for handling the removal of a wall's base object was previously
implemented directly within the generic `ComponentTaskPanel` in
`ArchComponent.py`. This created a tight coupling, forcing the generic
component UI to have specific knowledge about the `ArchWall` type.
This commit refactors the implementation to follow a more object-oriented
and polymorphic design:
1. A new overridable method, `handleComponentRemoval(subobject)`, has been
added to the base `ArchComponent` proxy class. Its default implementation
maintains the standard removal behavior.
2. The `_Wall` proxy class in `ArchWall.py` now overrides this method. All
wall-specific debasing logic, including the eligibility check and the
user-facing warning dialog, now resides entirely within this override.
3. The `ComponentTaskPanel.removeElement` method has been simplified. It is
now a generic dispatcher that calls `handleComponentRemoval` on the
proxy of the object being edited, with no specific knowledge of object types.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* BIM: Correct user warning
The operation can indeed be undone.
Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
* [ BIM ]: Refactor Save Preset Stringify
* [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>
* BIM: Update search box text for material search
* BIM: change Material Manager title to title case
* BIM: change Material Manager search placeholder text to sentence case
* BIM: reword reference to tree to avoid confusion with the Tree View
* BIM: Rename button text for creating Multi-Material for consistency
* [ArchStairs] Fix StringerOverlap Base at Angle
Github Issue Discussion
- https://github.com/FreeCAD/FreeCAD/issues/24321#issuecomment-3492459309
"... error when Stringer Overlap is set above certain threshold combined with a non-baseless stair which does not have orthogonal direction - this means that the base line or sketch is rotated to a degree, which is not 0, 90, 180 or 270 degrees."
Further
Fix#24321
* [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>
Fixes#25084.
Instead of a brep file a point list is now used to generate the figure.
Additionally:
Two points have been added to make the head of the figure less 'pointy'.
It would make sense to move the `get_human_figure` function to a different file in the future.
With 1.7m the figure is not very tall BTW.
- The BIM_Project command is removed from the toolbar and relocated to
the Utils menu
- The default when creating a new project has been changed to
non-IFC-native
- The BIM_Project and IFC_MakeProject command menu text have been
reworded to remove ambiguity
* [BimWindow] Fix SymbolPlan position
Fix#24903
* [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>
* [ArchStairs] Fix Structure: when RiserThickness is set & ConnectionDown is not HorizontalCut
Fix#24409
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update src/Mod/BIM/ArchStairs.py - typo correction
Co-authored-by: João Matos <joao@tritao.eu>
* Update ArchStairs.py - typo correction
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: João Matos <joao@tritao.eu>
* [ArchStairs] Fix Wrong Height when toSlabThickness & Landings AtCenter are set
Fix#24408
This fix both Stairs Flight set as Straight and HalfTurnLeft/Right
* [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>
When a profile-based beam had its Base property cleared and the model
was recomputed, the beam would rotate 90 degrees, changing its direction
completely.
Profile objects are always created in the XY plane with Width along X,
height along Y and normal along Z. However, if Base is cleared, fallback
code always used YZ plane orientation for beams. This resulted in a
different orientation during cleaned Base property.
Fix is to check if we are profile-based or not and if yes, use XY plane
orientation, while we don't have this property then just use YZ plane
orientation (preserving traditional horizontal behavior).
* BIM: Implement double-click event for materials group
Add double-click handling for materials group in Tree View.
Fixes: https://github.com/FreeCAD/FreeCAD/issues/24766
* [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>
ArchMaterial's view provider has a setTaskValue helper to set values of widgets inside a task panel. While specific to ArchMaterial, the real place where the helper is called is at BIM_Classification. It appears it's not a general but more like an ad-hoc API for a specific purpose and for a specific object.
In any case, this fix allows widgets that expect a numerical value to have their value set. Before, their value was set as text, unexpectedly.
Before this fix, double-clicking on an ArchMultimaterial object opened its task panel as expected. Unexpectedly, its label was selected and set for edit.
- The tree view's double-click handling expects the view-provider to declare whether it handled the double-click.
- The ViewProvider API's doubleClicked() is documented to return bool (True if handled).
- If a view provider's doubleClicked method returns None/False, the tree falls back to the default Qt behavior (which is beginning inline editing of the item label).
- In ArchMaterial.py the view provider calls self.edit() (or FreeCADGui.ActiveDocument.setEdit(...)) but the method that the tree actually calls (the view provider's doubleClicked) does not return True. Because the method returns None, the tree continues and starts inline label-editing.
In summary: setEdit returning True is fine, but doubleClicked is the method the tree checks; it must return True to suppress the default inline rename.
Python 3 combined the former `urllib`, `urllib2`, `urlparse` Python 2 modules into subpackages of `urllib`. FreeCAD is written in Python 3, thus the `urllib2` import fallback will not work and needs to be removed.
As the title says - upon unclone icon is not being removed, but the
cloned item stops mirroring original item which is correct, so this just
aligns the icon removal logic with the correct behavior.
* BIM: Prevent crash when removing a wall's base component
When a user selected a wall's base object in the Tree View and used the
`Arch_Remove` command, a traceback occurred due to an `AttributeError`.
The `removeComponents` function was incorrectly checking for the `.Base`
attribute on a list of subtractions (`s.Base`) instead of on the parent
host object (`h.Base`).
This commit corrects the reference to check against the parent object,
resolving the crash and allowing the component to be removed.
Fixes: https://github.com/FreeCAD/FreeCAD/issues/24532
Authored-by: furgo16 <148809153+furgo16@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Furgo <148809153+furgo16@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* BIM: Fix Site view provider initialization and constraints
This commit fixes bugs in the `_ViewProviderSite` lifecycle, ensuring
that sun path properties are correctly initialized with valid defaults
and that their constraints are reliably restored when a document is
opened.
Previously, two main problems existed:
1. New Objects: When a new `Site` object was created, its sun path
properties (e.g., `SunDateMonth`) would default to 0, which is an
invalid value. The property editor in the GUI would also lack the
appropriate min/max constraints.
2. Restored Objects: When a document containing a `Site` was opened, the
property constraints were not reapplied. This happened because the
view provider's initialization logic was not being reliably triggered
due to race conditions during the document deserialization process.
These issues are addressed now by a deferred initialization sequence:
- For New Objects: In `_ViewProviderSite.__init__`, constraint and
default value setup is deferred using `QTimer.singleShot(0)`. The
`restoreConstraints` method also now sets sensible defaults (e.g.,
month 6, day 21) when it detects a new object.
- For Restored Objects: The data object's `_Site.onDocumentRestored`
hook is now used as a trigger to start the view provider's
initialization. This is a necessary workaround, as the `ViewProvider`
lacks its own restoration hook. This method now ensures the view
provider's properties are present and then schedules
`restoreConstraints` to run via `QTimer`.
* BIM: add ArchSite GUI tests and fixtures
- Additionally clean up and document the CMakeLists.txt file for better
maintainability and readability
* BIM: Enable GUI tests on CI
- The line to enable the BIM workbench has been commented out, as
previously it occasioned a timeout error on CI
- The BIM GUI tests have been uncommented out to enable them
* [ArchStairs] Fix Blondel Ratio and Winders
Fix#24065Fix#24051
1. Blondel Ratio is not calculated, this if fixed now. Blondel Ratio property is changed to Length following wiki's descripition.
2. Winders is not implemented as commented in wiki. The property is not added at the moment until it is implemented.
* [ArchStairs] Fix Blondel Ratio and Winders - Remove old Property
For existing Stairs object, remove old property which is Float and add new propety which is Length.