simplecadapi 2.0.0b2__tar.gz → 2.0.0b3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/PKG-INFO +112 -156
  2. simplecadapi-2.0.0b3/README.md +169 -0
  3. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/README.md +6 -1
  4. simplecadapi-2.0.0b3/docs/api/translate_model_json_to_fcstd.md +17 -0
  5. simplecadapi-2.0.0b3/docs/api/translate_model_json_to_freecad_script.md +17 -0
  6. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/README.md +3 -5
  7. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/operation_graph_json_spec.md +19 -20
  8. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/serialization/README.md +1 -2
  9. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/serialization/expressions-and-replay.md +1 -2
  10. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/serialization/features-booleans-transforms.md +3 -6
  11. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/solid.md +34 -0
  12. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/wire.md +1 -1
  13. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/pyproject.toml +1 -1
  14. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/auto_tools/auto_docs_gen.py +8 -2
  15. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/auto_tools/skill_pack.py +4 -1
  16. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/core.py +96 -17
  17. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/freecad_translator.py +11 -10
  18. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/operations.py +93 -62
  19. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/serializer.py +0 -9
  20. simplecadapi-2.0.0b2/README.md +0 -213
  21. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/.gitignore +0 -0
  22. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/LICENSE +0 -0
  23. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/MANIFEST.in +0 -0
  24. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/Const.md +0 -0
  25. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/Expr.md +0 -0
  26. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/ExpressionGraph.md +0 -0
  27. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/GraphSession.md +0 -0
  28. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/SemanticDelta.md +0 -0
  29. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/SemanticRef.md +0 -0
  30. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/SimpleCADError.md +0 -0
  31. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/Sketch.md +0 -0
  32. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/Var.md +0 -0
  33. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/and_.md +0 -0
  34. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/apply_tag.md +0 -0
  35. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/chamfer_rsolid.md +0 -0
  36. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/const_function.md +0 -0
  37. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/cut_rsolidlist.md +0 -0
  38. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/export_graph_json.md +0 -0
  39. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/export_model_json.md +0 -0
  40. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/export_session_json.md +0 -0
  41. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/export_step.md +0 -0
  42. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/export_stl.md +0 -0
  43. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/extrude_rsolid.md +0 -0
  44. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/fillet_rsolid.md +0 -0
  45. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/geo.md +0 -0
  46. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/helical_sweep_rsolid.md +0 -0
  47. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/import_graph_json.md +0 -0
  48. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/import_model_json.md +0 -0
  49. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/import_session_json.md +0 -0
  50. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/intersect_rsolidlist.md +0 -0
  51. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/linear_pattern_rsolidlist.md +0 -0
  52. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/list_tags.md +0 -0
  53. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/loft_rsolid.md +0 -0
  54. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_angle_arc_redge.md +0 -0
  55. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_angle_arc_rwire.md +0 -0
  56. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_box_rsolid.md +0 -0
  57. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_circle_redge.md +0 -0
  58. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_circle_rface.md +0 -0
  59. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_circle_rwire.md +0 -0
  60. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_cone_rsolid.md +0 -0
  61. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_cylinder_rsolid.md +0 -0
  62. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_face_from_wire_rface.md +0 -0
  63. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_helix_redge.md +0 -0
  64. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_helix_rwire.md +0 -0
  65. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_line_redge.md +0 -0
  66. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_n_hole_flange_rsolid.md +0 -0
  67. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_naca_propeller_blade_rsolid.md +0 -0
  68. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_point_rvertex.md +0 -0
  69. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_polyline_rwire.md +0 -0
  70. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_rectangle_rface.md +0 -0
  71. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_rectangle_rwire.md +0 -0
  72. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_segment_redge.md +0 -0
  73. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_segment_rwire.md +0 -0
  74. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_sphere_rsolid.md +0 -0
  75. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_spline_redge.md +0 -0
  76. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_spline_rwire.md +0 -0
  77. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_threaded_rod_rsolid.md +0 -0
  78. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_three_point_arc_redge.md +0 -0
  79. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_three_point_arc_rwire.md +0 -0
  80. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/make_wire_from_edges_rwire.md +0 -0
  81. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/meta.md +0 -0
  82. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/mirror_shape.md +0 -0
  83. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/not_.md +0 -0
  84. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/or_.md +0 -0
  85. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/radial_pattern_rsolidlist.md +0 -0
  86. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/render_screenshot_rpath.md +0 -0
  87. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/replay_graph.md +0 -0
  88. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/replay_model_json.md +0 -0
  89. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/revolve_rsolid.md +0 -0
  90. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/rotate_shape.md +0 -0
  91. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/select.md +0 -0
  92. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/select_edges_by_tag.md +0 -0
  93. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/select_faces_by_tag.md +0 -0
  94. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/shell_rsolid.md +0 -0
  95. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/suspend_graph_recording.md +0 -0
  96. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/sweep_rsolid.md +0 -0
  97. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/tag.md +0 -0
  98. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/translate_shape.md +0 -0
  99. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/union_rsolid.md +0 -0
  100. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/value.md +0 -0
  101. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/api/var_function.md +0 -0
  102. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/architecture/sdk-architecture-review.md +0 -0
  103. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/compound.md +0 -0
  104. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/coordinate_system.md +0 -0
  105. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/declarative_constraints.md +0 -0
  106. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/edge.md +0 -0
  107. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/face.md +0 -0
  108. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/rearchitecture_2_0.md +0 -0
  109. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/rearchitecture_2_0_requirements.md +0 -0
  110. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/serialization/primitives-and-profiles.md +0 -0
  111. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/serialization/scalar-fields.md +0 -0
  112. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/shell.md +0 -0
  113. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/simple_workplane.md +0 -0
  114. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/tagged_mixin.md +0 -0
  115. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/docs/core/vertex.md +0 -0
  116. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/__init__.py +0 -0
  117. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/_vendor_warning_filters.py +0 -0
  118. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/auto_tools/__init__.py +0 -0
  119. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/auto_tools/evolution.py +0 -0
  120. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/auto_tools/make_export.py +0 -0
  121. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/autotag.py +0 -0
  122. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/errors.py +0 -0
  123. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/evolve.py +0 -0
  124. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/expr.py +0 -0
  125. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/frame.py +0 -0
  126. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/graph.py +0 -0
  127. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/kernel/__init__.py +0 -0
  128. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/kernel/ocp_booleans.py +0 -0
  129. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/kernel/ocp_builders.py +0 -0
  130. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/kernel/ocp_cast.py +0 -0
  131. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/kernel/ocp_curves.py +0 -0
  132. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/kernel/ocp_export.py +0 -0
  133. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/kernel/ocp_features.py +0 -0
  134. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/kernel/ocp_mesh.py +0 -0
  135. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/kernel/ocp_properties.py +0 -0
  136. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/kernel/ocp_topology.py +0 -0
  137. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/kernel/ocp_transforms.py +0 -0
  138. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/kernel/spline_fit.py +0 -0
  139. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/py.typed +0 -0
  140. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/ql.py +0 -0
  141. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/sketch.py +0 -0
  142. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/tagging.py +0 -0
  143. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/topology.py +0 -0
  144. {simplecadapi-2.0.0b2 → simplecadapi-2.0.0b3}/src/simplecadapi/tracking.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simplecadapi
3
- Version: 2.0.0b2
3
+ Version: 2.0.0b3
4
4
  Summary: A simplified OCP-native CAD modeling Python API
5
5
  Project-URL: Homepage, https://github.com/NiJingzhe/SimpleCADAPI
6
6
  Project-URL: Repository, https://github.com/NiJingzhe/SimpleCADAPI
@@ -375,192 +375,143 @@ Description-Content-Type: text/markdown
375
375
 
376
376
  # SimpleCADAPI
377
377
 
378
- SimpleCADAPI is an OCP-native imperative CAD modeling Python package. It keeps the 1.x-style functional API while adding v2 graph recording, expression parameters, and replayable model JSON workflows.
378
+ SimpleCADAPI is an OCP-native Python SDK for building CAD models with clear,
379
+ functional operations and replayable model graphs. It wraps OpenCascade geometry
380
+ in a compact public API for creating solids, applying features, tagging semantic
381
+ intent, querying topology, exporting manufacturing files, and translating recorded
382
+ models into FreeCAD workflows.
379
383
 
380
- ## README Scope
384
+ Current beta: `simplecadapi==2.0.0b3`.
381
385
 
382
- This README only covers package-level capabilities, installation methods, publishing/packaging workflows, and Skills usage instructions.
383
- Experimental scripts and temporary modeling examples are not included as formal documentation.
386
+ ## What It Provides
384
387
 
385
- ## Package Installation (Python Package Managers)
388
+ - OCP-native shape types: `Vertex`, `Edge`, `Wire`, `Face`, and `Solid`.
389
+ - Functional modeling operations for primitives, profiles, extrude, revolve,
390
+ loft, sweep, booleans, transforms, patterns, fillets, chamfers, and shells.
391
+ - Replayable modeling with `GraphSession`, `export_model_json(...)`,
392
+ `import_model_json(...)`, and `replay_model_json(...)`.
393
+ - Expression parameters with `var(...)`, arithmetic expressions, and serialized
394
+ expression graphs.
395
+ - QL selectors for geometry grounding, topology queries, and stable feature
396
+ selections.
397
+ - Semantic tags through `apply_tag(shape, tag)` and `list_tags(shape)`.
398
+ - STEP/STL export and FreeCAD translation helpers for script or `.FCStd` output.
386
399
 
387
- Current package name: `simplecadapi` (see `pyproject.toml` for the version).
388
-
389
- ### Method A: Install from package repository with pip
400
+ ## Install
390
401
 
391
402
  ```bash
392
403
  pip install simplecadapi
393
404
  ```
394
405
 
395
- Optional development dependencies:
396
-
397
- ```bash
398
- pip install "simplecadapi[dev]"
399
- ```
400
-
401
- ### Method B: Install with uv
402
-
403
- Install in the current virtual environment:
404
-
405
- ```bash
406
- uv pip install simplecadapi
407
- ```
408
-
409
- Add as a project dependency in `pyproject.toml`:
406
+ With `uv`:
410
407
 
411
408
  ```bash
412
409
  uv add simplecadapi
413
410
  ```
414
411
 
415
- ### Method C: Install from local build artifacts
416
-
417
- Build a local wheel/sdist first if you want to install from local artifacts:
412
+ For local development from this repository:
418
413
 
419
414
  ```bash
420
- uv build
415
+ uv sync --group dev
421
416
  ```
422
417
 
423
- ## Quick Verification of Installation
418
+ ## Quick Start
424
419
 
425
420
  ```python
426
- import simplecadapi as scad
427
-
428
- box = scad.make_box_rsolid(10.0, 20.0, 30.0)
429
- scad.export_stl(box, "example_box.stl")
430
- scad.export_step(box, "example_box.step")
431
- ```
432
-
433
- ## How to Package SDK Skills
421
+ from pathlib import Path
434
422
 
435
- This project provides the `skill-pack` CLI for generating lightweight SDK reference skills: **No built-in SDK source code**, focused on API and architecture descriptions.
436
-
437
- ### 1) Packaging Command
438
-
439
- Execute in the repository root directory:
440
-
441
- ```bash
442
- uv run skill-pack --refresh-docs --archive --skill-name simplecadapi
443
- ```
444
-
445
- Common parameters:
446
-
447
- - `--output-root <dir>`: Output directory (default `./skills`)
448
- - `--package-name <pkg>`: Runtime installation package name (default reads from `project.name`)
449
- - `--package-version <ver>`: Runtime installation version (default reads from `project.version`)
450
- - `--no-clean`: Do not clean existing output directory
451
- - `--archive`: Additionally generate `<skill-name>.tar.gz`
423
+ import simplecadapi as scad
452
424
 
453
- ### 2) Packaging Result Structure
425
+ out = Path("out")
426
+ out.mkdir(exist_ok=True)
454
427
 
455
- After packaging, you will get a directory similar to:
428
+ base = scad.make_box_rsolid(60.0, 36.0, 8.0, bottom_face_center=(0.0, 0.0, 0.0))
429
+ hole = scad.make_cylinder_rsolid(5.0, 14.0, bottom_face_center=(0.0, 0.0, -3.0))
430
+ slot = scad.make_box_rsolid(18.0, 8.0, 14.0, bottom_face_center=(14.0, 0.0, -3.0))
456
431
 
457
- - `skills/simplecadapi/SKILL.md`
458
- - `skills/simplecadapi/references/`
459
- - `skills/simplecadapi/references/docs/api/`
460
- - `skills/simplecadapi/references/docs/core/`
432
+ part = scad.cut_rsolidlist(base, hole, slot)
433
+ boss = scad.make_cylinder_rsolid(8.0, 7.0, bottom_face_center=(-18.0, 0.0, 8.0))
434
+ part = scad.union_rsolid(part, boss)
435
+ part = scad.apply_tag(part, "role.demo.bracket")
461
436
 
462
- ### 3) Read the SDK skill
437
+ print("volume", round(part.get_volume(), 3))
438
+ print("faces", len(part.get_faces()))
439
+ print("tags", scad.list_tags(part))
463
440
 
464
- ```bash
465
- cd skills/simplecadapi
441
+ scad.export_step(part, str(out / "bracket.step"))
442
+ scad.export_stl(part, str(out / "bracket.stl"))
466
443
  ```
467
444
 
468
- Key entry points:
469
-
470
- - `skills/simplecadapi/SKILL.md`
471
- - `skills/simplecadapi/references/SDK_OVERVIEW.md`
472
- - `skills/simplecadapi/references/SDK_SURFACES.md`
473
- - `skills/simplecadapi/references/V2_MODELING_WORKFLOWS.md`
474
- - `skills/simplecadapi/references/SDK_PACKAGE_SUMMARY.md`
475
- - `skills/simplecadapi/references/docs/api/README.md`
476
- - `skills/simplecadapi/references/docs/core/README.md`
445
+ ## Replayable Modeling
477
446
 
478
- ### 4) Preferred v2 replay workflow
447
+ Use `GraphSession` when a model should be inspectable, serializable, replayable,
448
+ or translated into another CAD environment.
479
449
 
480
450
  ```python
481
- from simplecadapi import GraphSession, export_model_json, replay_model_json
482
-
483
- with GraphSession() as session:
484
- ...
485
-
486
- model_json = export_model_json(session)
487
- rebuilt = replay_model_json(model_json)
488
- print(len(rebuilt))
489
- ```
490
-
491
- ## Serialization and Replay Docs
492
-
493
- For detailed operation-by-operation JSON formats and replay behavior, see:
494
-
495
- - [`docs/core/serialization/README.md`](docs/core/serialization/README.md)
496
- - [`docs/core/operation_graph_json_spec.md`](docs/core/operation_graph_json_spec.md)
497
- - [`examples/07_serialization_operation_tree.py`](examples/07_serialization_operation_tree.py)
498
-
499
- ## Auto Tools
500
-
501
- The project includes 4 main CLIs:
502
-
503
- - `auto-docs-gen`: Generate `docs/api/` documentation from the public API source surface
504
- - `make-export`: Update imports/exports in `src/simplecadapi/__init__.py`
505
- - `evolve`: Extract functions from scripts for repository-managed evolve modules
506
- - `skill-pack`: Package thin SDK skill (documentation only)
507
-
508
- Examples:
509
-
510
- ```bash
511
- uv run make-export --dry-run
512
- uv run auto-docs-gen
513
- uv run evolve path/to/your_case.py
514
- uv run skill-pack --refresh-docs --archive
515
- ```
516
-
517
- ## RAGFlow Documentation Sync
518
-
519
- `scripts/sync_ragflow_docs.py` is used to incrementally sync Markdown files under `docs/` to the specified RAGFlow dataset, chunked by H2 headings; the document's `chunk_method` is set to `manual`.
520
-
521
- Prepare the environment:
522
-
523
- ```bash
524
- .venv/bin/python -m pip install ragflow-sdk
525
- ```
526
-
527
- It is recommended to use `.env` (already added to `.gitignore`):
528
-
529
- ```bash
530
- RAGFLOW_API_KEY=your_key_here
531
- RAGFLOW_BASE_URL=http://localhost
532
- RAGFLOW_DATASET_NAME=SimpleCADAPI
451
+ import simplecadapi as scad
452
+ from simplecadapi import ql as Q
453
+
454
+ with scad.GraphSession() as session:
455
+ body = scad.make_box_rsolid(40.0, 24.0, 10.0, bottom_face_center=(0.0, 0.0, 0.0))
456
+ cutter = scad.make_cylinder_rsolid(4.0, 16.0, bottom_face_center=(0.0, 0.0, -3.0))
457
+ drilled = scad.cut_rsolidlist(body, cutter)
458
+
459
+ bottom_circle = (
460
+ Q.edges()
461
+ .where(Q.curve_type("circle"))
462
+ .order_by(Q.center_axis("z"))
463
+ .take(1)
464
+ .exactly(1)
465
+ )
466
+ final = scad.chamfer_rsolid(drilled, bottom_circle, 0.6)
467
+
468
+ model_json = scad.export_model_json(session)
469
+ rebuilt = scad.replay_model_json(model_json)
470
+
471
+ print("recorded_nodes", session.graph.node_count)
472
+ print("replayed_outputs", len(rebuilt))
533
473
  ```
534
474
 
535
- Run the sync:
475
+ ## Modeling Mental Model
476
+
477
+ - Start from design intent: reference axes, critical profiles, and the features
478
+ that produce the final solid.
479
+ - Build from lower-dimensional geometry to higher-dimensional geometry: profile
480
+ wires/faces first, then solid features such as extrude, revolve, loft, and
481
+ sweep.
482
+ - Keep operations functional. Create new values with public functions such as
483
+ `make_rectangle_rface(...)`, `extrude_rsolid(...)`, `cut_rsolidlist(...)`, and
484
+ `fillet_rsolid(...)`.
485
+ - Use tags for semantic intent and selection anchors, for example
486
+ `role.mounting.surface`, `anchor.datum.primary`, or `group.fasteners`.
487
+ - Store numeric and geometric facts in metadata or graph payloads, not in tags.
488
+ - Use QL to ground selections by geometry facts rather than relying on topology
489
+ iteration order.
490
+ - When an indexed topology pick is intentional, pass the index to the plural
491
+ child-geometry getter, such as `get_edges(index)`, `get_faces(index)`,
492
+ `get_wires(index)`, or `get_vertices(index)`, so replayable graph workflows
493
+ preserve the pick as a geo select node.
494
+ - Use model JSON as the interchange boundary for replay, tests, and FreeCAD
495
+ translation.
496
+
497
+ ## FreeCAD Translation
498
+
499
+ Recorded model JSON can be translated into a FreeCAD Python script:
536
500
 
537
- ```bash
538
- set -a && source .env && set +a
539
- .venv/bin/python scripts/sync_ragflow_docs.py --create-dataset
501
+ ```python
502
+ script = scad.translate_model_json_to_freecad_script(model_json)
540
503
  ```
541
504
 
542
- Common parameters:
543
-
544
- - `--dataset-id` / `RAGFLOW_DATASET_ID`: Directly specify the dataset ID (avoid name conflicts)
545
- - `--delete-removed`: Delete documents that have been removed locally
546
- - `--dry-run`: Only preview changes without executing writes
547
- - `--progress-interval N`: Print progress every N documents
548
-
549
- ## Development and Testing
550
-
551
- Local development installation (editable):
505
+ If FreeCAD or FreeCADCmd is available, the same model JSON can be written as an
506
+ `.FCStd` file:
552
507
 
553
- ```bash
554
- uv pip install -e ".[dev]"
508
+ ```python
509
+ scad.translate_model_json_to_fcstd(model_json, "bracket.FCStd")
555
510
  ```
556
511
 
557
- Run unit tests:
512
+ ## Examples
558
513
 
559
- ```bash
560
- uv run python -m unittest test/test_all_features.py
561
- ```
562
-
563
- Run examples:
514
+ Run examples from the source checkout:
564
515
 
565
516
  ```bash
566
517
  uv run python examples/01_basic_modeling.py
@@ -571,18 +522,23 @@ uv run python examples/06_parametric_gear_model.py
571
522
  uv run python examples/07_serialization_operation_tree.py
572
523
  ```
573
524
 
574
- ## Core Design Constraints (Brief)
525
+ ## Documentation
575
526
 
576
- - API functions uniformly use `snake_case` and reflect return types in function names (e.g., `*_rsolid`, `*_rwire`).
577
- - Core types are OCP-native wrappers and are kept as stable as possible; functionality is extended by adding new functions (Open-Closed Principle).
578
- - Support `SimpleWorkplane` context for local coordinate modeling.
579
- - Export interfaces support single entities, multiple entities, and nested list inputs.
527
+ - Public API reference: [`docs/api/`](docs/api/)
528
+ - Core type and modeling notes: [`docs/core/`](docs/core/)
529
+ - Serialization and replay details:
530
+ [`docs/core/serialization/README.md`](docs/core/serialization/README.md)
531
+ - Operation graph JSON spec:
532
+ [`docs/core/operation_graph_json_spec.md`](docs/core/operation_graph_json_spec.md)
580
533
 
581
- ## Documentation Entry Points
534
+ ## Development
582
535
 
583
- - API documentation: `docs/api/`
584
- - Core documentation: `docs/core/`
536
+ ```bash
537
+ uv sync --group dev
538
+ uv run python -m pytest test tests
539
+ python3 -m compileall src/simplecadapi
540
+ ```
585
541
 
586
542
  ## License
587
543
 
588
- MIT, see `LICENSE`.
544
+ MIT, see [`LICENSE`](LICENSE).
@@ -0,0 +1,169 @@
1
+ # SimpleCADAPI
2
+
3
+ SimpleCADAPI is an OCP-native Python SDK for building CAD models with clear,
4
+ functional operations and replayable model graphs. It wraps OpenCascade geometry
5
+ in a compact public API for creating solids, applying features, tagging semantic
6
+ intent, querying topology, exporting manufacturing files, and translating recorded
7
+ models into FreeCAD workflows.
8
+
9
+ Current beta: `simplecadapi==2.0.0b3`.
10
+
11
+ ## What It Provides
12
+
13
+ - OCP-native shape types: `Vertex`, `Edge`, `Wire`, `Face`, and `Solid`.
14
+ - Functional modeling operations for primitives, profiles, extrude, revolve,
15
+ loft, sweep, booleans, transforms, patterns, fillets, chamfers, and shells.
16
+ - Replayable modeling with `GraphSession`, `export_model_json(...)`,
17
+ `import_model_json(...)`, and `replay_model_json(...)`.
18
+ - Expression parameters with `var(...)`, arithmetic expressions, and serialized
19
+ expression graphs.
20
+ - QL selectors for geometry grounding, topology queries, and stable feature
21
+ selections.
22
+ - Semantic tags through `apply_tag(shape, tag)` and `list_tags(shape)`.
23
+ - STEP/STL export and FreeCAD translation helpers for script or `.FCStd` output.
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pip install simplecadapi
29
+ ```
30
+
31
+ With `uv`:
32
+
33
+ ```bash
34
+ uv add simplecadapi
35
+ ```
36
+
37
+ For local development from this repository:
38
+
39
+ ```bash
40
+ uv sync --group dev
41
+ ```
42
+
43
+ ## Quick Start
44
+
45
+ ```python
46
+ from pathlib import Path
47
+
48
+ import simplecadapi as scad
49
+
50
+ out = Path("out")
51
+ out.mkdir(exist_ok=True)
52
+
53
+ base = scad.make_box_rsolid(60.0, 36.0, 8.0, bottom_face_center=(0.0, 0.0, 0.0))
54
+ hole = scad.make_cylinder_rsolid(5.0, 14.0, bottom_face_center=(0.0, 0.0, -3.0))
55
+ slot = scad.make_box_rsolid(18.0, 8.0, 14.0, bottom_face_center=(14.0, 0.0, -3.0))
56
+
57
+ part = scad.cut_rsolidlist(base, hole, slot)
58
+ boss = scad.make_cylinder_rsolid(8.0, 7.0, bottom_face_center=(-18.0, 0.0, 8.0))
59
+ part = scad.union_rsolid(part, boss)
60
+ part = scad.apply_tag(part, "role.demo.bracket")
61
+
62
+ print("volume", round(part.get_volume(), 3))
63
+ print("faces", len(part.get_faces()))
64
+ print("tags", scad.list_tags(part))
65
+
66
+ scad.export_step(part, str(out / "bracket.step"))
67
+ scad.export_stl(part, str(out / "bracket.stl"))
68
+ ```
69
+
70
+ ## Replayable Modeling
71
+
72
+ Use `GraphSession` when a model should be inspectable, serializable, replayable,
73
+ or translated into another CAD environment.
74
+
75
+ ```python
76
+ import simplecadapi as scad
77
+ from simplecadapi import ql as Q
78
+
79
+ with scad.GraphSession() as session:
80
+ body = scad.make_box_rsolid(40.0, 24.0, 10.0, bottom_face_center=(0.0, 0.0, 0.0))
81
+ cutter = scad.make_cylinder_rsolid(4.0, 16.0, bottom_face_center=(0.0, 0.0, -3.0))
82
+ drilled = scad.cut_rsolidlist(body, cutter)
83
+
84
+ bottom_circle = (
85
+ Q.edges()
86
+ .where(Q.curve_type("circle"))
87
+ .order_by(Q.center_axis("z"))
88
+ .take(1)
89
+ .exactly(1)
90
+ )
91
+ final = scad.chamfer_rsolid(drilled, bottom_circle, 0.6)
92
+
93
+ model_json = scad.export_model_json(session)
94
+ rebuilt = scad.replay_model_json(model_json)
95
+
96
+ print("recorded_nodes", session.graph.node_count)
97
+ print("replayed_outputs", len(rebuilt))
98
+ ```
99
+
100
+ ## Modeling Mental Model
101
+
102
+ - Start from design intent: reference axes, critical profiles, and the features
103
+ that produce the final solid.
104
+ - Build from lower-dimensional geometry to higher-dimensional geometry: profile
105
+ wires/faces first, then solid features such as extrude, revolve, loft, and
106
+ sweep.
107
+ - Keep operations functional. Create new values with public functions such as
108
+ `make_rectangle_rface(...)`, `extrude_rsolid(...)`, `cut_rsolidlist(...)`, and
109
+ `fillet_rsolid(...)`.
110
+ - Use tags for semantic intent and selection anchors, for example
111
+ `role.mounting.surface`, `anchor.datum.primary`, or `group.fasteners`.
112
+ - Store numeric and geometric facts in metadata or graph payloads, not in tags.
113
+ - Use QL to ground selections by geometry facts rather than relying on topology
114
+ iteration order.
115
+ - When an indexed topology pick is intentional, pass the index to the plural
116
+ child-geometry getter, such as `get_edges(index)`, `get_faces(index)`,
117
+ `get_wires(index)`, or `get_vertices(index)`, so replayable graph workflows
118
+ preserve the pick as a geo select node.
119
+ - Use model JSON as the interchange boundary for replay, tests, and FreeCAD
120
+ translation.
121
+
122
+ ## FreeCAD Translation
123
+
124
+ Recorded model JSON can be translated into a FreeCAD Python script:
125
+
126
+ ```python
127
+ script = scad.translate_model_json_to_freecad_script(model_json)
128
+ ```
129
+
130
+ If FreeCAD or FreeCADCmd is available, the same model JSON can be written as an
131
+ `.FCStd` file:
132
+
133
+ ```python
134
+ scad.translate_model_json_to_fcstd(model_json, "bracket.FCStd")
135
+ ```
136
+
137
+ ## Examples
138
+
139
+ Run examples from the source checkout:
140
+
141
+ ```bash
142
+ uv run python examples/01_basic_modeling.py
143
+ uv run python examples/02_graph_replay.py
144
+ uv run python examples/03_expressions.py
145
+ uv run python examples/05_loft_sweep_revolve.py
146
+ uv run python examples/06_parametric_gear_model.py
147
+ uv run python examples/07_serialization_operation_tree.py
148
+ ```
149
+
150
+ ## Documentation
151
+
152
+ - Public API reference: [`docs/api/`](docs/api/)
153
+ - Core type and modeling notes: [`docs/core/`](docs/core/)
154
+ - Serialization and replay details:
155
+ [`docs/core/serialization/README.md`](docs/core/serialization/README.md)
156
+ - Operation graph JSON spec:
157
+ [`docs/core/operation_graph_json_spec.md`](docs/core/operation_graph_json_spec.md)
158
+
159
+ ## Development
160
+
161
+ ```bash
162
+ uv sync --group dev
163
+ uv run python -m pytest test tests
164
+ python3 -m compileall src/simplecadapi
165
+ ```
166
+
167
+ ## License
168
+
169
+ MIT, see [`LICENSE`](LICENSE).
@@ -1,6 +1,6 @@
1
1
  # SimpleCAD API Index
2
2
 
3
- This index includes generated docs for the public SimpleCAD API surface, including v2 graph, expression, and model JSON workflows.
3
+ This index includes generated docs for the public SimpleCAD API surface, including geometry operations, graph/model JSON workflows, expressions, QL, and export helpers.
4
4
 
5
5
  ## Import Surfaces
6
6
 
@@ -65,6 +65,11 @@ This index includes generated docs for the public SimpleCAD API surface, includi
65
65
  - [export_step](export_step.md) *(from operations.py)* `top-level`
66
66
  - [export_stl](export_stl.md) *(from operations.py)* `top-level`
67
67
 
68
+ ## FreeCAD Translation
69
+
70
+ - [translate_model_json_to_fcstd](translate_model_json_to_fcstd.md) *(from freecad_translator.py)* `top-level`
71
+ - [translate_model_json_to_freecad_script](translate_model_json_to_freecad_script.md) *(from freecad_translator.py)* `top-level`
72
+
68
73
  ## Modeling Graph and Replay
69
74
 
70
75
  - [GraphSession](GraphSession.md) *(from graph.py)* `top-level`
@@ -0,0 +1,17 @@
1
+ # translate_model_json_to_fcstd
2
+
3
+ ## API Definition
4
+
5
+ ```python
6
+ def translate_model_json_to_fcstd(json_str: str, output_path: str, *, document_name: str = 'SimpleCADModel', freecad_cmd: Optional[str] = None) -> str
7
+ ```
8
+
9
+ *Source: freecad_translator.py*
10
+
11
+ ## Import Surface
12
+
13
+ - top-level: `from simplecadapi import translate_model_json_to_fcstd`
14
+
15
+ ## Description
16
+
17
+ Translate canonical model JSON to `.FCStd` via FreeCADCmd/FreeCAD.
@@ -0,0 +1,17 @@
1
+ # translate_model_json_to_freecad_script
2
+
3
+ ## API Definition
4
+
5
+ ```python
6
+ def translate_model_json_to_freecad_script(json_str: str, document_name: str = 'SimpleCADModel') -> str
7
+ ```
8
+
9
+ *Source: freecad_translator.py*
10
+
11
+ ## Import Surface
12
+
13
+ - top-level: `from simplecadapi import translate_model_json_to_freecad_script`
14
+
15
+ ## Description
16
+
17
+ Translate exported model JSON into a FreeCAD Python script.
@@ -2,7 +2,7 @@
2
2
 
3
3
  This directory documents the core public object model for SimpleCADAPI.
4
4
 
5
- SimpleCADAPI 2.x is OCP-native at runtime: public geometry objects are thin Python wrappers around OpenCascade/OCP shapes exposed through the `.wrapped` attribute. The package keeps the 1.x-style functional modeling API while adding graph recording, expression parameters, and replayable model JSON.
5
+ SimpleCADAPI is OCP-native at runtime: public geometry objects are thin Python wrappers around OpenCascade/OCP shapes exposed through the `.wrapped` attribute. The package provides functional modeling operations, expression parameters, QL selectors, and replayable model JSON.
6
6
 
7
7
  ## Core Classes Overview
8
8
 
@@ -57,8 +57,9 @@ SimpleWorkplane ← local modeling context
57
57
  - **Shape-first API**: users work with `Vertex`, `Edge`, `Wire`, `Face`, and `Solid`, not graph nodes.
58
58
  - **Functional modeling style**: public operations return new geometry values, e.g. `make_box_rsolid(...)`, `cut_rsolidlist(...)`, `fillet_rsolid(...)`.
59
59
  - **OCP-native runtime**: geometry construction, topology traversal, properties, booleans, transforms, and export use OCP/OpenCascade helpers.
60
- - **Replayable v2 workflows**: `GraphSession` can record a canonical low-level operation graph and `export_model_json()` can serialize it for `replay_model_json()`.
60
+ - **Replayable graph workflows**: `GraphSession` can record a canonical low-level operation graph and `export_model_json()` can serialize it for `replay_model_json()`.
61
61
  - **Tags and metadata**: tags are useful for lightweight semantics; structured numeric facts should be stored in metadata such as `metadata["geo"]`.
62
+ - **Indexed topology access**: use plural methods such as `get_edges()` and `get_faces()` for enumeration, and pass an index to the same getter, such as `get_edges(index)` or `get_faces(index)`, for intentional indexed picks that should become graph selection nodes.
62
63
 
63
64
  ## Basic Usage
64
65
 
@@ -98,6 +99,3 @@ print(len(rebuilt))
98
99
  - [User Guide](../../README.md)
99
100
  - [JSON Operation Graph Spec](operation_graph_json_spec.md)
100
101
  - [Serialization and Replay Operation Guides](serialization/)
101
- - [Declarative Constraint Layout Design Draft](declarative_constraints.md)
102
- - [SimpleCADAPI 2.0 Re-architecture Design](rearchitecture_2_0.md)
103
- - [SimpleCADAPI 2.0 Requirements and Acceptance](rearchitecture_2_0_requirements.md)