feat(api): add pythonscad implementation - #2
Conversation
Add support for the pythonscad API implementation, including its module registration, dependency requirements, and unit tests.
| return PsCone(l, r1=rad, r2=rad, sides=sides, direction="Z", api=self) | ||
|
|
||
| def cylinder_x(self, l: float, rad: float) -> Shape: | ||
| return PsRod(l, rad, None, self.rotZtoX, self) |
There was a problem hiding this comment.
CRITICAL: self.rotZtoX is undefined — PsShapeAPI does not define this attribute, unlike TMShapeAPI where rotZtoX is a class-level rotation matrix. This will raise AttributeError when cylinder_x is called.
| return PsRod(l, rad, None, self.rotZtoX, self) | |
| return PsRod(l, rad, None, None, self) |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| return PsRod(l, rad, None, self.rotZtoX, self) | ||
|
|
||
| def cylinder_y(self, l: float, rad: float) -> Shape: | ||
| return PsRod(l, rad, None, self.rotZtoY, self) |
There was a problem hiding this comment.
CRITICAL: self.rotZtoY is undefined — PsShapeAPI does not define this attribute, unlike TMShapeAPI where rotZtoY is a class-level rotation matrix. This will raise AttributeError when cylinder_y is called.
| return PsRod(l, rad, None, self.rotZtoY, self) | |
| return PsRod(l, rad, None, None, self) |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| if hasattr(shape.solid, 'to_scad'): | ||
| scad_content = shape.solid.to_scad() | ||
| elif hasattr(shape.solid, '__str__'): | ||
| scad_content = str(shape.solid) |
There was a problem hiding this comment.
WARNING: str(shape.solid) will write the literal string "None" to the SCAD file if shape.solid is None, producing invalid output without any error.
| scad_content = str(shape.solid) | |
| scad_content = str(shape.solid) if shape.solid is not None else "// Empty solid" |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| try: | ||
| return self._scad_func_eval(num) | ||
| except: | ||
| assert f"# WARNING: {num} is not numeric" |
There was a problem hiding this comment.
WARNING: assert f"# WARNING: {num} is not numeric" always passes because a non-empty string is truthy. This silently swallows type errors instead of raising an exception.
| assert f"# WARNING: {num} is not numeric" | |
| assert False, f"# WARNING: {num} is not numeric" |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
|
|
||
| class PsRod(PShape): | ||
| def __init__( | ||
| self, l: float, rad: float, sides, rotMat: NDArray, api: PsShapeAPI |
There was a problem hiding this comment.
WARNING: NDArray is not imported in this file. Even though from __future__ import annotations defers evaluation, NDArray is undefined and will cause NameError in runtime introspection contexts.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
Previous Review Summaries (5 snapshots, latest commit d6e81c5)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit d6e81c5)Status: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Previous review (commit 95a815d)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (1 file)
Fix these issues in Kilo Cloud Previous review (commit 8977f20)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (1 file)
Fix these issues in Kilo Cloud Previous review (commit 49b187e)Status: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
Previous review (commit 2d92842)Status: 5 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
Files Reviewed (5 files)
Reviewed by step-3.7-flash · Input: 52.1K · Output: 5.9K · Cached: 251.4K |
Replaces the `PsRod` class with `PsCone` in `cylinder_x`, `cylinder_y`, and `cylinder_z` methods to simplify cylinder generation and remove unused rotation logic.
Move PsBall, PsBox, and PsCone classes out of the PShape class scope to the module level.
| if __name__ == "__main__": | ||
| run_api_test("pythonscad") | ||
|
|
||
| if __name__ == "__main__": |
There was a problem hiding this comment.
WARNING: Duplicate if __name__ == "__main__": block
The refactoring that moved nested classes to top-level accidentally duplicated the __main__ block at lines 678 and 681. Python only executes the first one, making lines 681-682 dead code.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Add support for the pythonscad API implementation, including its module registration, dependency requirements, and unit tests.
This implementation:
The backend uses pythonscad's native API with a trimesh/mandril fallback for reliable geometric queries.