Commit Graph

44648 Commits

Author SHA1 Message Date
chris
3476562dd7 fem: attempt to resolve issue #19798 2025-12-14 12:15:35 -06:00
Yash Suthar
8413922e52 Core: fix "Save Image" giving dark area as compare to viewport
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
2025-12-14 14:49:58 +01:00
Kacper Donat
bf697ca710 Gui: Use largest possible marker if needed
This is a quick and dirty fix for https://github.com/FreeCAD/FreeCAD/issues/22010

Basically if we want to use a bigger marker size than available, we use the biggest one
available. This is not a good way to fix the issue - we should ensure that the marker
size that the user requests is actually available - this, however, requires more
significant changes to the code.
2025-12-13 16:23:59 -06:00
xtemp09
df6d148a85 [GUI] Rename Cancel ‘Close’ in Add Property dialog 2025-12-13 15:19:41 +01:00
Furgo
d55d8d1dac BIM: Report command MVP (#24078)
* BIM: BIM Report MVP

* BIM: add Arch.selectObjects() API call and tests

* BIM: adopted ArchSchedule spreadsheet update and linking patterns

* BIM: SELECT with dynamic headers and dynamic data population

* BIM: fix deletion, dependencies, and serialization issues

* BIM: transition from individual query to multiple-query statements

* BIM: Mostly fix serialization issues

* BIM: Report editor UI/UX improvements

- Make edits directly on table (Description field only, for now)
- Sync table edits with query editor (Description field only, for now)
- Fix Property group name for spreadsheet object
- Add tooltips for all task panel widgets
- Put Description input and label on the same row
- Edit statement is now a static title
- Open report editor upon creation
- Remove overview table's redundant edit button
- Put report query options in a box
- Open spreadsheet after accepting report changes

* BIM: Aggregarion and grouping - implement GROUP BY with COUNT(*)

* BIM: Aggregation and grouping - implement SUM, MIN, MAX functions

* BIM: Aggregation and grouping - implement validation

* BIM: add reporting presets support

* BIM: align description and query preset inputs vertically

* BIM: write units on their own spreadsheet cell

* BIM: update test suite to new SQL engine behaviour

* BIM: fix various bugs: return values should not be stringized, non-grouped query with mixed extractors, handle nested properties

* BIM: expand Report test suite, fix property count vs count all bug

* BIM: add report engine SQL's IN clause support

* BIM: enable running Report presets tests from the build directory

* BIM: make spreadsheet more useful for analysis, units on headers

* BIM: update BIM Report icons

* BIM: Add key option columns to report overview table

* BIM: add syntax highlighting support to report query editor

* BIM: Add lark build dependency for SQL parser generator

* BIM: Install the generated parser

* BIM: implement TYPE() function

* BIM: simplify function registry, make it OOP

* BIM: add CHILDREN function

* BIM: improve SQL engine error descriptions

* BIM: Implement ORDER BY clause

* BIM: Implement column aliasing (AS...)

* BIM: improve error reporting to pinpoint exact token names

* BIM: implement CONCAT, LOWER, UPPER functions. Improve exception handling

* BIM: refactor to improve initialization readability and maintenance

* BIM: Improve query editor syntax highlighting

* BIM: Address CodeQL warnings

* BIM: Enable scalar functions in WHERE clause and refactor transformer

- Enable the use of scalar functions (e.g., `LOWER`, `TYPE`) in `WHERE` clause comparisons.
- Refactor the Lark transformer to correctly handle `NUMBER`, `NULL`, and `ASTERISK` terminals using dedicated methods.
- Refactor error handling to raise a custom `BimSqlSyntaxError` exception instead of returning values on failure.
- Improve syntax error messages to be more specific and user-friendly by inspecting the failing token.
- Fix regressions in `AggregateFunction` and `TypeFunction` handling that were introduced during the refactoring.
- Update the test suite to assert for specific exceptions, aligning with the new error handling API.

* BIM: Implement arithmetic operations in SELECT clause

- Update grammar with `expr`, `term`, and `factor` rules to support operator precedence.
- Introduce `ArithmeticOperation` class to represent calculations as a recursive tree.
- Add transformer methods to build the calculation tree from the grammar rules.
- Implement recursive evaluation that correctly normalizes `Quantity` and `float` types before calculation.

* BIM: Add CONVERT() function for unit conversions

- Implement a new ConvertFunction class to handle unit conversions in the SELECT clause.
- Leverage the core Quantity.getValueAs() FreeCAD API method to perform the conversion logic.
- Add a unit test to verify both successful conversions and graceful failure on incompatible units.

* BIM: add self-documenting supported SQL syntax helper

* BIM: document internal and external API functions

* BIM: Finalize and rename public ArchSql API, update all consumers

- Rename public API functions for clarity and consistency
  (run_query_for_objects -> select, get_sql_keywords -> getSqlKeywords,
  etc.).
- Establish Arch.py as the official API facade by exposing all public
  SQL functions and exceptions via a safe wildcard import from ArchSql,
  governed by __all__.
- Refactor all consumers (ArchReport.py, bimtests/TestArchReport.py) to
  use the new function names and access the API exclusively through the
  Arch facade (e.g., Arch.select).
- Finalize the error handling architecture:
  - Arch.select now logs and re-raises exceptions for consumers to
    handle.
  - Arch.count remains "safe," catching exceptions and returning an
    error tuple for the UI.
- Refactor the test suite to correctly assert the behavior of the new
  "unsafe" (select) and "safe" (count) APIs, including verifying
  specific exception messages.

* BIM: add results preview on demand on the query editor

* BIM: add documentation quick reference button

* BIM: Handle query errors gracefully in Report preview UI

Refactor the SQL engine's error handling to improve the Report preview
UI. Invalid queries from the "Preview Results" button no longer print
tracebacks to the console. Instead, errors are now caught and displayed
contextually within the preview table, providing clear feedback without
console noise.

- `ArchSql.select()` no longer logs errors to the console; it now only
  raises a specific exception on failure, delegating handling to the
  caller.
- The `ReportTaskPanel`'s preview button handler now wraps its call to
  `Arch.select()` in a `try...except` block.
- Caught exceptions are formatted and displayed in the preview table
  widget.
- Add new unit test

* BIM: consolidate internal API into a more semantically and functionally meaningful function

* BIM: Implement two-phase execution for SQL engine performance

Refactors the ArchSql engine to improve performance and internal API
semantics. The `Arch.count()` function, used for UI validation, now
executes faster by avoiding unnecessary data extraction.

This is achieved by splitting query execution into two phases. The first
phase performs fast filtering and grouping (`FROM`/`WHERE`/`GROUP BY`).
The second, slower phase processes the `SELECT` columns. The
`Arch.count()` function now only runs the first phase, while
`Arch.select()` runs both.

- Introduces `_run_query(query_string, mode)` as the mode-driven
  internal entry point for the SQL engine
- The `SelectStatement` class is refactored with new internal methods:
  `_get_grouped_data()` (Phase 1) and `_process_select_columns()`
  (Phase 2).
- `Arch.count()` now uses a fast path that includes a "sample execution"
  on a single object to correctly validate the full query without
  performance loss.
- The internal `execute()` method of `SelectStatement` is now a
  coordinator for the two-phase process.

* BIM: Implement autocompletion in Report SQL editor

Introduces an autocompletion feature for the SQL query editor in the BIM
Report task panel. The completer suggests SQL keywords, functions, and
property names to improve query writing speed and accuracy.

- Adds a custom `SqlQueryEditor` subclass that manages all
  autocompletion logic within its `keyPressEvent`.
- The completion model is populated with static SQL keywords and
  functions, plus all unique top-level property names dynamically
  scanned from every object in the document.
- A blocklist is used to filter out common non-queryable properties
  (e.g., `Visibility`, `Proxy`) from the suggestions.
- The editor manually calculates the completer popup's width based on
  content (`sizeHintForColumn`) to resolve a Qt rendering issue and
  ensure suggestions are always visible.
- The first suggestion is now pre-selected, allowing a single `Tab`
  press to accept the completion.

* BIM: remove unused import

* BIM: support SQL comments in queries

* BIM: support non-ASCII characters in queries

* BIM: Allow ORDER BY to accept a comma-separated list of columns for multi-level sorting.

* BIM: fix two-way overview/editor sync

* BIM: refactor to simplify editor modification events

* BIM: add tooltips to overview table

* BIM: add tooltips to query editor, enrich syntax data with signature and snippets

* BIM: implement PARENT function

* BIM: Enable property access on SQL function results

Previously, the SQL engine could only access properties directly from
the main object in a given row. This made it impossible to query
attributes of objects returned by functions, such as getting the name of
a parent with PARENT(*). This commit evolves the SQL grammar to handle
chained member access (.) with correct operator precedence. The parser's
transformer and execution logic were updated to recursively resolve
these chains, enabling more intuitive queries like SELECT
PARENT(*).Label and standard nested property access like Shape.Volume.

* BIM: refactor function registration, internationalize API metadata

* BIM: remove outdated Report alias

* BIM: refactor selectObjects to use latest API, move implementation to ArchSql

* BIM: improve friendly token names for error reporting

* BIM: implement chained functions e.g. PARENT(*).PARENT(*)

* BIM: add further tests for property access, fix bug with non-literal AS clause argument

* BIM: Implement full expression support for GROUP BY

The SQL engine's GROUP BY clause was previously limited to simple
property names, failing on queries that used functions (e.g., `GROUP BY
TYPE(*)`). This has been fixed by allowing the SQL transformer and
validator to correctly process function expressions.

The `SelectStatement.validate()` method now uses a canonical signature
to compare SELECT columns against GROUP BY expressions, ensuring
correctness for both simple properties and complex functions.

New regression tests have also been added to validate `GROUP BY`
functionality with chained functions (PPA) and multiple columns.

* BIM: Make arithmetic engine robust against missing properties

Previously, a query containing an arithmetic expression in the `WHERE`
clause would cause a fatal error if it processed an object that was
missing one of the properties used in the calculation.

This has been fixed by making the `ArithmeticOperation` class NULL-safe.
The engine now correctly handles `None` values returned by property
lookups, propagating them through the calculation as per standard SQL
behavior.

As a result, the engine no longer crashes on such queries. It now
gracefully evaluates all objects, simply filtering out those for which
the arithmetic expression cannot be resolved to a valid number. This
significantly improves the robustness of the query engine.

* BIM: Finalize ORDER BY logic and fix query regressions

- The `ORDER BY` clause is now governed by a single, predictable rule:
  it can only refer to column names or aliases that exist in the final
  `SELECT` list. The engine's transformer and execution logic have been
  updated to enforce and correctly implement this, fixing several test
  failures related to sorting by aliases and expressions.
- Updated test suite to align with the new engine rules. Add new
  dedicated unit tests that explicitly document the supported (aliased
  expression) and unsupported (raw expression) syntax for the `ORDER BY`
  clause.

* BIM: Implement backend for pipelined report execution

Adds the backend architecture for multi-step, pipelined queries. The
core SQL engine can now execute a statement against the results of a
previous one, enabling complex sequential filtering.

- The internal `_run_query` function was refactored to be
  pipeline-aware, allowing it to operate on a pre-filtered list of
  source objects.
- A new `execute_pipeline` orchestrator was added to manage the data
  flow between statements, controlled by a new `is_pipelined` flag in
  the `ReportStatement` data model.
- The public API was extended with `selectObjectsFromPipeline` for
  scripting, and `count()` was enhanced to support contextual validation
  for the UI.

Pipelines phase 2

Pipelines phase 3

* BIM: refactor to avoid circular imports

* BIM: Address key CodeQl check errors/notes

* BIM: Refactor Task Panel UI/UX with explicit editing workflow

Refactor the report editor UI to improve usability and prevent data
loss. Editing a statement is now an explicit action, triggered by a new
"Edit Selected" button. This prevents accidental changes and enables a
new transactional workflow with "Save" and "Discard" buttons for each
edit session. A checkbox for "Apply & Next" has been added to streamline
editing multiple statements.

The results preview feature has been redesigned into a self-contained,
closable pane controlled by a "Show Preview" toggle. This pane includes
its own contextual "Refresh" button, reducing UI clutter. All action
button groups have been consistently right-aligned to improve layout and
workflow.

* BIM: Integrate pipeline execution and stabilize UI workflow

Completes the implementation of the pipelined statements feature by
integrating the new backend orchestrator with the ArchReport object. It
also includes a series of critical bug fixes that were discovered during
end-to-end testing, resulting in a more stable user experience.

The primary feature integration consists of refactoring the
_ArchReport.execute method. It now uses the ArchSql.execute_pipeline
generator, enabling the report to correctly process multi-step pipelines
and honor the user-configured data flow.

Severalbugs and regressions were fixed:

- Backend: A major flaw was fixed where FROM-clause functions (like
  CHILDREN) were not pipeline-aware. The engine's GROUP BY validator was
  also corrected to enforce its original, safer design of not supporting
  aliases.
- UI Workflow: A feedback loop that caused the editor cursor to reset
  was resolved. The transactional logic for the Save, Discard, and "Save
  & Add New" actions was corrected to prevent data loss and ensure
  predictable behavior. The Add and Duplicate actions no longer auto-open
  the editor, creating a more consistent workflow.
- UI State: Fixed regressions related to the explicit editing model,
  including incorrect statement loading (Edit Selected) and state
  management when a report is reloaded from a file.

* BIM: add presets manager

* BIM: Fix 'still touched after recompute' bug in some of the tests

* BIM: cleanup tests, fixed presets tests to new presets locations

* BIM: Move test model to its own module for reusability

* BIM: Move GUI tests to their own module

- Disable two of the tests: they pass, but cause a segmentation fault on
  teardown. They need to be investigated before enabling them on CI.

* BIM: fix bug in interpreting CONVERT string from GROUP BY

* BIM: Migrate signal connections from lambdas to Qt slots

Refactors all signal connections in the `ReportTaskPanel` to use the
`@QtCore.Slot()` decorator instead of lambda wrappers.

- Resolves CodeQL warning "Unnecessary lambda".
- Adheres to PySide/Qt best practices for signal/slot handling.
- Improves code clarity by using explicit, named methods for
  connections.
- Prevents potential runtime `TypeError` exceptions by correctly
  managing slot signatures for signals that emit arguments (e.g.,
  `clicked(bool)`).
- Introduces simple slot wrappers where necessary to cleanly separate UI
  event handling from core logic.

* BIM: Address CodeQl warnings

* BIM: Add CHILDREN_RECURSIVE(subquery, max_depth) SQL function to find all descendants of an object set.

- Create internal _get_bim_type and _is_bim_group helpers to remove all Draft module dependencies from the SQL engine.
- Implement a new _traverse_architectural_hierarchy function using a deque-based BFS algorithm to prevent infinite loops.
- The CHILDREN and CHILDREN_RECURSIVE functions now use the new traversal engine.
- The traversal engine now transparently navigates generic groups but excludes them from the results.
- Correct ParentFunction logic to validate containment by checking the parent's .Group list instead of the child's .InList.
- Add unit tests for recursive traversal, depth limiting, and transparent group handling.
- Update test_group_by_multiple_mixed_columns to match the corrected behavior of the TYPE(*) function.

* BIM: Add __repr__ and __str__ for the ArchReport proxy

* BIM: Align report quantity headers with internal units

- Change default `Quantity` headers to use the property's internal unit
  (e.g., `mm`) instead of the user's global preferred unit (e.g., `m`).
- Fixes inconsistency where the header unit (e.g., `m²`) did not match
  the raw data's unit (e.g., `mm²`), making the default behavior
  predictable.
- Implement by parsing `str(Quantity)` as a workaround for the C++
  `Unit::getString()` method not being exposed to the Python API.
- Add a unit test that temporarily changes the global schema to verify
  the fix is independent of user preferences.

* BIM: remove dual import ArchSql and from ArchSql import

* BIM: Fix IfcRole => IfcType

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

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

* CI: add Lark as a build dependency

* BIM: Replace QRegExp with QRegularExpression for regex patterns

QRegExp is no longer available in PySide6. Make the code compatible with
both PySide2/Qt5 and PySide6/Qt6.

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

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

* CI: move lark dependency to pixi's requirements.host

* BIM: Correct numeric comparisons in SQL WHERE clause

Refactor the `BooleanComparison.evaluate` method to handle numeric and
string-based comparisons separately. Previously, all comparisons were
being performed on string-converted values, causing numerically
incorrect results for `Quantity` objects formatted with "smart" units
(e.g., `"10.0 m"` was incorrectly evaluated as less than `"8000"`).

- The `evaluate` method now normalizes `Quantity` objects to their raw
  `.Value` first.
- If both operands are numeric, a direct numerical comparison is
  performed for all operators (`=`, `!=`, `>`, `<`, `>=`, `<=`).
- String-based comparisons (for `like`, or as a fallback for other
  types) are handled in a separate path.
- Add unit test to lock down this behavior.

* BIM: autocompleter improvements

- Add a trailing space when autocompleting the keywords that need it
- Autocomplete multi-word keywords as a unit

* BIM: Improve live validation user experience

- Do not throw syntax error when in the middle of autocompleting a
  keyword
- Introduce typing state and show incomplete query status

* BIM: change double-click action to edit in statements overview

Also allow quick editing the statement description with F2

* BIM: Improve user strings for consistency

* BIM: show count of returned objects in statements table

* BIM: disable preview on invalid queries

* BIM: define slot so that tests can run headless

* BIM: Update unit test to adapt to new behaviour

* [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-12-13 13:02:13 +00:00
sliptonic
442a36bea6 Merge pull request #25285 from tarman3/profile_restore
CAM: Profile - clean areaOpOnDocumentRestored()
2025-12-12 12:59:55 -06:00
sliptonic
293038762c Merge pull request #25960 from Connor9220/FixBoundaryDressup
CAM: Refactor stock used as boundary to be distinct from regular stock
2025-12-12 12:39:16 -06:00
sliptonic
7a0b613561 Merge pull request #25218 from tarman3/geom_tol
CAM: Path.Geom.cmdsForEdge() - add tolerance
2025-12-12 12:29:04 -06:00
sliptonic
0135bba534 Merge pull request #24297 from tarman3/simplecopy
CAM: SimpleCopy - Allow multiple selection
2025-12-12 12:23:35 -06:00
sliptonic
b5185a0a22 Merge pull request #25827 from tarman3/pathcommands_looperror
CAM: PathCommands - Remove pop message about loop error
2025-12-12 12:19:38 -06:00
sliptonic
72bc4ef1bd Merge pull request #25938 from Connor9220/AddAnnotationsToCommand
CAM: Add annotations support to Command constructor and Python bindings
2025-12-12 12:17:09 -06:00
sliptonic
c495890491 Merge pull request #25786 from Connor9220/FixLinuxCNCPostprocesor
CAM: Add rigid Tapping back to legacy LinuxCNC postprocessor
2025-12-12 11:44:36 -06:00
sliptonic
45386cdcb7 Merge pull request #25783 from Connor9220/AddUnitsPerToolbit
CAM: Add Units (Metric/Imperial) property to ToolBit
2025-12-12 10:46:42 -06:00
sliptonic
96d1084484 Merge pull request #25850 from petterreinholdtsen/cam-fanuc-post-fixes
CAM: Get Fanuc post processor working and implement several improvements
2025-12-12 10:41:51 -06:00
sliptonic
78102d294d Merge pull request #26008 from tarman3/editor_setText
CAM: CodeEditor - stub for setText()
2025-12-12 10:34:17 -06:00
luzpaz
5c0ff4bd8a Fix typos
Fixes various documentation/source-comment typos
2025-12-12 13:59:38 +01:00
PaddleStroke
893a9d19b6 Core: move getPlacementProperty to be more accessible (#26088)
* Core: move getPlacementProperty to be more accessible

* Update DocumentObject.h

* Update DocumentObject.cpp

* Update ViewProviderDragger.h

* Update ViewProviderDragger.cpp

* Update DocumentObject.h

* Update DocumentObject.cpp

* Update ViewProviderLink.cpp

* Update DocumentObject.h

* Update DocumentObject.cpp

* Update DocumentObject.h
2025-12-12 11:59:03 +00:00
PaddleStroke
9625a71d8d Assembly: joint task: fix delete impossible of non-valid refs 2025-12-11 19:04:27 -06:00
Chris Hennes
bb25a4efbc Merge pull request #26089 from Roy-043/Draft-fix-lag-when-snapping-to-face-intersections
Draft: fix lag when snapping to face intersections
2025-12-11 19:01:22 -06:00
Alfredo Monclus
f92c8e126c PardDesign: fix hole task thread combos not translating 2025-12-11 18:56:10 -06:00
Kacper Donat
c10f5d74d3 PartDesign: Recompute preview after forced recompute
This fixes some cases where Preview was stale and not recomputed after
changes done via code.
2025-12-11 18:55:10 -06:00
Roy-043
4b379c8e51 Draft: fix lag when snapping to face intersections
Fixes #25924.

The `snapToIntersection` function has been changed to an if-elif structure, and in case of face-edge intersection snap, only two sublements are checked. This ensures a reasonable speed, even if objects have many edges and faces. The change does mean you have to move the mouse over the correct face for it to be processed. But since face-edge intersection snap is new anyway, this is acceptable I think.
2025-12-11 17:32:44 +01:00
Roy-043
e1d77cc771 Remove maxSnapFaces parameter from params.py
Removed 'maxSnapFaces' parameter from settings.
2025-12-11 17:22:30 +01:00
timpieces
de2f8a58a3 Add proper tooltips for Material properties #24434 (#25509) 2025-12-11 14:56:26 +00:00
Petter Reinholdtsen
9c78ced00c CAM: Made Fanuc post processor compatible with FreeCAD 1.1.
Use setPlainText() if available, otherwise use setText().
Workaround for a regression from #23862.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
8386f1394e CAM: Adjusted Fanuc post processor to move Z to tool change position before M6
A "G28 G91 Z0" is needed according to testing and page 195 (6-1-2 Procedure for ATC operation) in
<URL: https://www.milco.bg/source/Technical%20Service/Documentation%20Dahlih/MCV%20510_1250B%20Operation%20and%20maintenance%20manual%20V2_2.pdf >
to get the spindle into the correct position for a tool change.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
e6c95dbb91 CAM: Added test of Fanuc post processor
Used TestMach3Mach4LegacyPost.py as the starting point with input from
other test scripts too.

The test demonstrate a fix for #25723, as the Fanuc post processor has not been not updated to the latest changes in
the Path module.

This is related to #24676, where thread tapping was added to LinuxCNC, but the equivalent code in the Fanuc
postprocessor were not adjusted to cope, and #25677 where it was observed that the Fanuc postprocessor was
broken in versions 0.20 and 1.0.

Added MockTool class to provide ShapeName to fanuc_post.py, used to
convert drill cycles to threading cycles if the tool has shapeid "tap".
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
38c3eebd7a CAM: Made Fanuc post processor compatible with FreeCAD 1.0.
Several methods introduced 2025-05-04 are preferred, but the methods
available in version 1.0 are used as fallback sources
for active status and coolent enabled.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
34a5301862 CAM: Switched Fanuc post processor to end program with M30, not M2.
The difference according to the documentation is that M30 will rewind
the paper tape while M2 will not.  The effect on a CNC from 1994 is
that M30 turn on the indicator light marking that the program has
completed, while M2 do not, and the light is wanted to know when
the machine is done.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
8b500ca9a3 CAM: Adjusted Fanuc post processor to use M05 consistently everywhere. 2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
4c18ac6c54 CAM: Provide correct and more relevant header from Fanuc post processor
Fanuc only understand upper case letters, no point in providing the
file name in lower case letters.  The provided file name is always "-",
so drop it completely. The first comment is presented in the Fanuc user
interface, it should get more relevant content.

Dropped useless semicolon.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
e4862572ae CAM: Avoid Z overtravel error on Fanuc tool changes
Enabling tool height compensation will cause the axis to move up
the length of the tool, which will cause a Z overtravel error when
the tool change take place close to the top of the machine.  To
counter this move, ask the machine to move its commanded position
down the length of the tool height, which in effect causes no upward
movement after the tool change.  The #4120 variable contain the
current tool number, and #2000 - #20XX contain the tool heights.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
bcb569977d CAM: Avoid adding trailing space to all M6 lines.
The Fanuc post processor add a trailing space to all M6 lines.
This make it problematic to write test for the generated output,
when compiled with the automatic policy enforcer on github
removing trialing space from the expected output.  Avoid the
problem by removing the trailing space from the generated
output.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
3c5f39c0ca CAM: Corrected Fanuc post processor M3 handling
The thread tapping implementation in the Fanuc post processor change
behaviour of M3, G81 and G82 when the tool ShapeID matches "tap".
but the code not not expect that the parse() method will be
called with two different classes as arguments.

Rewrite the M3 handling to handle ToolController arguments
instead of crashing with an AttributeError.

Issues:

Fixes #14016
Fixes #25723
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
06fe4b37ba CAM: Switch Fanuc post processor default for M6T0 to disable by default. 2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
87185c8135 CAM: Made empty spindle at the end optional in Fanuc CAM post processing script
Some Fanuc machines do not understand the 'M6 T0' instructions in the
preamble.  Move it out of the preamble and controlled by a new
command line argument --no-end-spindle-empty for the machines
where running to cause a "Tool Number Alarm" and the program to crash
as tool zero is not a valid tool.

Fixes: #25677
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
0cdf9abc4b CAM: Adjusted Fanuc post processing script to always start with a percent
The percent signal to the machine that a program follows, and is not
part of the header but a required part when uploading programs into
the machine.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
ef794c31bd CAM: Adjusted Fanuc post processing script to not inherit behaviour between calls
Reset line number when using --line-numbers.  Restore all default values when a
command line argument is not used.

This helps the test scripts ensure that the arguments passed during one test is the only
one taking effect during this test.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
533e957f80 CAM: Print "Show editor" status boolean as string, not integer
This get rid of a Python style warning and make the output easier
to understand.
2025-12-11 00:57:20 +01:00
PaddleStroke
7a8135d863 Core: Add getPlacementOf replacing previous getGlobalPlacement logic. (#26059)
* Core: Add getPlacementOf replacing previous getGlobalPlacement logic.

* Update src/App/DocumentObject.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Update DocumentObject.cpp

* Fix error when called from python with targetObj == None

---------

Co-authored-by: Kacper Donat <kadet1090@gmail.com>
2025-12-10 22:47:20 +01:00
Billy Huddleston
5085a286bd CAM: Add Units (Metric/Imperial) property to ToolBit
This PR allows each Toolbit to have its own Units property (Metric/Imperial) for better unit management.

Short Summary:
- Adds a Units property (Metric/Imperial) to ToolBit objects for better unit management.
- Ensures ToolBit schema is set and restored properly in the editor and utilities.
- Updates formatting and property handling to respect the selected units.
- Improves the ToolBit editor widget to refresh and sync schema/UI when units change.
- Uses FreeCAD.Units.setSchema and getSchema to switch between unit schemas.

NOTE: Toolbit dimensions are read from JSON in their native units  (as specified by the Units property),
converted to metric for all internal calculations, and displayed in the UI using the
toolbit's selected units. This ensures both accurate internal computation and user-friendly
display, while storing the correct units in the JSON. This can cause some rounding differences
when switching units. Example: 2 mm becomes 0.0787 inches. If you save that as imperial and then
switch back to metric, it will show 1.9999 mm

src/Mod/CAM/Path/Tool/toolbit/models/base.py:
- Add Units property to ToolBit and ensure it's set and synced with toolbit shape parameters.
- Update property creation and value formatting to use Units.

src/Mod/CAM/Path/Tool/toolbit/ui/editor.py:
- Use setToolBitSchema to set schema based on toolbit units.
- Add logic to refresh property editor widget when units change.
- Restore original schema on close.
- Improve docstrings and signal handling.

src/Mod/CAM/Path/Tool/toolbit/util.py:
- Add setToolBitSchema function for robust schema switching.
- Update format_value to use schema and units.
- Add docstrings and clarify formatting logic.

src/Mod/CAM/Path/Tool/library/ui/browser.py:
- Restore original schema after editing toolbit.

src/Mod/CAM/Path/Tool/library/ui/editor.py:
- Ensure correct schema is set for new toolbits.
2025-12-10 14:57:33 -05:00
Kacper Donat
c12ca7b3ba Stylesheets: Fix toolbar button size change 2025-12-10 20:15:34 +01:00
Yash Suthar
aed9b770f3 Link: Fixed Scale property behaviour when the object is moved
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
2025-12-10 20:13:56 +01:00
Chris Hennes
67948d60a2 PD: Add deprecation warning if Midplane is set 2025-12-10 12:42:13 +01:00
sliptonic
5ad6a1ba58 Merge pull request #26038 from jffmichi/cam_viewprovider_accidental_change
CAM: revert accidental icon name change from #25440
2025-12-09 07:53:17 -06:00
jffmichi
8058f824e2 CAM: revert accidental icon name change from #25440 2025-12-09 05:53:05 +01:00
freecad-gh-actions-translation-bot
f7483a08b4 Update translations from Crowdin 2025-12-08 22:31:48 -06:00
Max Wilfinger
ff36528155 Update stale issue and PR settings in workflow 2025-12-08 11:34:50 -06:00
PaddleStroke
3608c9f8c4 Part: TopoShape make getElementTypeAndIndex more robust (#25913)
* Part: TopoShape make getElementTypeAndIndex more robust
* Part: Add unit tests for new regex

---------

Co-authored-by: Chris Hennes <chennes@gmail.com>
2025-12-08 11:24:13 -06:00
Chris Hennes
6f511f7911 Merge pull request #25903 from WandererFan/CosVertexCrashInScript
TechDraw: Prevent crash on adding cosmetic feature before geometry created
2025-12-08 11:22:21 -06:00