feat: expand product exporters and FEM workflow

This commit is contained in:
NiJingzhe
2026-08-18 01:36:44 +08:00
parent 9d6703a786
commit ba1e06a489
49 changed files with 4363 additions and 382 deletions
+17
View File
@@ -0,0 +1,17 @@
# ProductMJCFExportReport
## Class Definition
```python
class ProductMJCFExportReport(output_path: Path, mapping_path: Path, mesh_directory: Path, root_definition_id: str, mesh_count: int, body_count: int, joint_count: int, equality_count: int, grounded_group_count: int, site_count: int, default_density_count: int, limitations: tuple[str, ...])
```
*Source: exporter/mjcf.py*
## Import Surface
- exporter namespace: `from simplecadapi import exporter` then `exporter.mjcf.ProductMJCFExportReport(...)`
## Description
Observed facts and compiler decisions from one MJCF export.
+17
View File
@@ -0,0 +1,17 @@
# ProductOBJExportReport
## Class Definition
```python
class ProductOBJExportReport(output_path: Path, root_definition_id: str, solid_count: int, definition_count: int, vertex_count: int, triangle_count: int, linear_deflection: float, angular_deflection_degrees: float, relative: bool, tessellation_backend: str = 'opencascade-brep-tessellation')
```
*Source: exporter/obj.py*
## Import Surface
- exporter namespace: `from simplecadapi import exporter` then `exporter.obj.ProductOBJExportReport(...)`
## Description
Evidence from direct BREP tessellation and triangle OBJ export.
+2 -2
View File
@@ -3,7 +3,7 @@
## Class Definition
```python
class ProductSTLExportReport(output_path: Path, root_definition_id: str, solid_count: int, definition_count: int, quadrilateral_count: int, residual_triangle_count: int, stl_triangle_count: int, quad_fraction: float, mesh_size: float, remesh_backend: str = 'gmsh-quad-dominant')
class ProductSTLExportReport(output_path: Path, root_definition_id: str, solid_count: int, definition_count: int, vertex_count: int, triangle_count: int, linear_deflection: float, angular_deflection_degrees: float, relative: bool, tessellation_backend: str = 'opencascade-brep-tessellation')
```
*Source: exporter/stl.py*
@@ -14,4 +14,4 @@ class ProductSTLExportReport(output_path: Path, root_definition_id: str, solid_c
## Description
Evidence from quad-dominant product-surface remeshing and STL export.
Evidence from direct BREP tessellation and binary STL export.
+4
View File
@@ -91,8 +91,12 @@ This index includes generated docs for the public SimpleCAD API surface, includi
## Export
- [ProductMJCFExportReport](ProductMJCFExportReport.md) *(from exporter/mjcf.py)* `exporter namespace`
- [ProductOBJExportReport](ProductOBJExportReport.md) *(from exporter/obj.py)* `exporter namespace`
- [ProductSTEPExportReport](ProductSTEPExportReport.md) *(from exporter/step.py)* `exporter namespace`
- [ProductSTLExportReport](ProductSTLExportReport.md) *(from exporter/stl.py)* `exporter namespace`
- [export_product_package_to_mjcf](export_product_package_to_mjcf.md) *(from exporter/mjcf.py)* `exporter namespace`
- [export_product_package_to_obj](export_product_package_to_obj.md) *(from exporter/obj.py)* `exporter namespace`
- [export_product_package_to_step](export_product_package_to_step.md) *(from exporter/step.py)* `exporter namespace`
- [export_product_package_to_stl](export_product_package_to_stl.md) *(from exporter/stl.py)* `exporter namespace`
@@ -0,0 +1,23 @@
# export_product_package_to_mjcf
## API Definition
```python
def export_product_package_to_mjcf(data: ProductPackageInput, output_path: str | Path, *, mesh_directory: str | Path | None = None, mapping_path: str | Path | None = None, linear_deflection: float = 0.15, default_density_kg_m3: float | None = None) -> ProductMJCFExportReport
```
*Source: exporter/mjcf.py*
## Import Surface
- exporter namespace: `from simplecadapi import exporter` then `exporter.mjcf.export_product_package_to_mjcf(...)`
## Description
Compile a validated `.scadpkg` assembly into an MJCF model.
Fixed constraints and attachments through forwarded nested-assembly
connectors create rigid groups. Revolute/prismatic edges form a
deterministic spanning tree. Gear, belt, and rack-pinion relations become
independent fixed-tendon equalities. Root assembly connectors and geometry
names in the ``interface.*`` namespace become MJCF sites.
+21
View File
@@ -0,0 +1,21 @@
# export_product_package_to_obj
## API Definition
```python
def export_product_package_to_obj(data: ProductPackageInput, output_path: str | Path, *, linear_deflection: float = 0.1, angular_deflection_degrees: float = 20.0, relative: bool = False) -> ProductOBJExportReport
```
*Source: exporter/obj.py*
## Import Surface
- exporter namespace: `from simplecadapi import exporter` then `exporter.obj.export_product_package_to_obj(...)`
## Description
Export one `.scadpkg` directly from evaluated BREP as triangle OBJ.
`linear_deflection` is the maximum chordal deviation in product units.
`angular_deflection_degrees` limits angular deviation on curved surfaces.
No remeshing or topology reconstruction is performed.
+5 -4
View File
@@ -3,7 +3,7 @@
## API Definition
```python
def export_product_package_to_stl(data: ProductPackageInput, output_path: str | Path, *, mesh_size: float = 1.0, recombination_angle_degrees: float = 45.0) -> ProductSTLExportReport
def export_product_package_to_stl(data: ProductPackageInput, output_path: str | Path, *, linear_deflection: float = 0.1, angular_deflection_degrees: float = 20.0, relative: bool = False) -> ProductSTLExportReport
```
*Source: exporter/stl.py*
@@ -14,7 +14,8 @@ def export_product_package_to_stl(data: ProductPackageInput, output_path: str |
## Description
Export one validated `.scadpkg` as a quad-dominant remeshed STL.
Export one `.scadpkg` directly from evaluated BREP as binary STL.
Gmsh recombines each CAD surface into quadrilaterals before its STL writer
splits every quad into two triangles, as required by the STL file format.
`linear_deflection` is the maximum chordal deviation in product units.
`angular_deflection_degrees` limits angular deviation on curved surfaces.
No remeshing or topology reconstruction is performed.