feat(freecad): add FreeCAD 1.0.2 backward compatibility#167
feat(freecad): add FreeCAD 1.0.2 backward compatibility#167Moonwolf711 wants to merge 2 commits intoHKUDS:mainfrom
Conversation
Add version detection (utils/compat.py) that auto-detects installed FreeCAD version and gates 15 FreeCAD-1.1-only features behind require_version() checks. On 1.0.x, those commands raise clear errors directing the user to upgrade. All core functionality (Part, Sketcher, PartDesign, booleans, materials, export, etc.) works on 1.0.2+. Gated features: LocalCoordinateSystem, datum attachment modes, Whitworth/NPT threads, tapered holes, toggle-freeze, G84/G74 tapping, box_beam/elliptical beam sections, tie constraints, result purging, constraint suppression, external geometry reference mode, intersection external, external from face, edge-selective 2D fillet, area mode annotations. All 64 existing tests pass. Co-Authored-By: claude-flow <ruv@ruv.net>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe4806ac42
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| from cli_anything.freecad.utils.freecad_backend import get_version | ||
|
|
||
| raw = get_version() # e.g. "1.0.2" or "1.1.0" | ||
| nums = tuple(int(x) for x in re.findall(r"\d+", raw)[:3]) |
There was a problem hiding this comment.
Pad parsed version tuples before comparing minimums
Version parsing currently keeps whatever component count is present (re.findall(... )[:3]), so inputs like "1.1" become (1, 1) and then compare as less than (1, 1, 0). That makes require_version(V1_1, ...) reject supported 1.1 installs and blocks every gated 1.1 feature in those environments. Normalize parsed versions to a fixed length (e.g., right-pad with zeros to 3 components) before storing/comparing.
Useful? React with 👍 / 👎.
| except Exception: | ||
| # FreeCAD not installed — default to permissive (1.1) so pure- | ||
| # state operations still work. Real backend calls will fail | ||
| # later with a clear "FreeCAD not found" message. | ||
| _cached_version = (0, 0, 0) |
There was a problem hiding this comment.
Do not cache unknown version on transient probe failures
The broad except Exception path stores (0, 0, 0) in _cached_version, and subsequent calls return that cached value without retrying; require_version then permanently allows all gated features for the process. If get_version() fails once due a transient/backend error, compatibility checks stay disabled even when version detection would succeed later, which defeats the upgrade guardrails on 1.0.x installations.
Useful? React with 👍 / 👎.
…eation Add 11 parametric model templates (box, cylinder, tube, plate_with_holes, bracket_l, gear_spur, enclosure_box, threaded_bolt, washer, standoff, knob) with 5 CLI commands: - generate templates / template-info — browse available templates - generate from-template — create models with parameter overrides - generate suggest — match text descriptions to templates - generate parse-dims — extract dimensions from natural language Workflow: describe model → suggest template → generate → export STEP/STL. All 64 existing tests pass + all 11 generators verified. Co-Authored-By: claude-flow <ruv@ruv.net>
|
Thanks! Did you test on both AutoCAD 1.0.2 and 1.1+? |
|
Thanks for adding 1.0.2 compatibility. Before merge, please align the version metadata: registry/docs say Also, since this PR is specifically about 1.0.2 vs 1.1 behavior, please add a mocked version-detection test and include real-tool verification notes for both versions if possible. |
Summary
utils/compat.pywith version detection andrequire_version()gatingGated Features (require FreeCAD >= 1.1)
local_coordinate_system, datum attachment modes/refs, Whitworth threads (BSW/BSF/BSP/NPT), tapered holes,toggle_freezereferencemode,intersection_external,add_external_from_faceTest plan
test_core.py)🤖 Generated with claude-flow