Skip to content

feat(freecad): add FreeCAD 1.0.2 backward compatibility#167

Open
Moonwolf711 wants to merge 2 commits intoHKUDS:mainfrom
Moonwolf711:feat/freecad-102-compat
Open

feat(freecad): add FreeCAD 1.0.2 backward compatibility#167
Moonwolf711 wants to merge 2 commits intoHKUDS:mainfrom
Moonwolf711:feat/freecad-102-compat

Conversation

@Moonwolf711
Copy link
Copy Markdown

Summary

  • Add utils/compat.py with version detection and require_version() gating
  • Gate 15 FreeCAD 1.1-only features behind version checks across 7 core modules (body, cam, fem, sketch, draft, techdraw, document)
  • On FreeCAD 1.0.x, gated commands raise clear errors directing users to upgrade
  • All core functionality (Part primitives, Sketcher, PartDesign pad/pocket/fillet, booleans, materials, export, sessions, measure, mesh, assembly, basic FEM/CAM) works on 1.0.2+
  • Update FREECAD.md, README.md, SKILL.md, registry.json to reflect 1.0.2+ compatibility

Gated Features (require FreeCAD >= 1.1)

Module Feature
body local_coordinate_system, datum attachment modes/refs, Whitworth threads (BSW/BSF/BSP/NPT), tapered holes, toggle_freeze
cam G84/G74 tapping operations
fem box_beam/elliptical beam sections, tie constraints, result purging, constraint suppression
sketch external geometry reference mode, intersection_external, add_external_from_face
draft edge-selective 2D fillet
techdraw area mode annotations

Test plan

  • All 64 existing unit tests pass (test_core.py)
  • Verify version detection against FreeCAD 1.0.2 installation
  • Verify version detection against FreeCAD 1.1 installation
  • Verify gated features produce clear error messages on 1.0.x
  • Verify gated features work normally on 1.1+

🤖 Generated with claude-flow

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>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +37 to +41
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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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>
@yuh-yang
Copy link
Copy Markdown
Collaborator

Thanks! Did you test on both AutoCAD 1.0.2 and 1.1+?

@yuh-yang
Copy link
Copy Markdown
Collaborator

Thanks for adding 1.0.2 compatibility. Before merge, please align the version metadata: registry/docs say 1.2.0, but setup.py and the package __init__ still say 1.0.0.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants