cadquery
cadquery copied to clipboard
Could the Free Function API and the Workplane API with the same function names be designed to have consistent parameter interfaces as much as possible?
Could the Free Function API and the Workplane API with the same function names be designed to have consistent parameter interfaces as much as possible? Here is a table of inconsistencies between the Free Function API and the Workplane API with the same function names:
| Items | Free Function API | CadQuery Workplane API |
|---|---|---|
| rect | def rect(w: float, h: float) -> Shape: | def rect(
) -> T: |
| circle | def circle(r: float) -> Shape: | def circle(self: T, radius: float, forConstruction: bool = False) -> T: |
| ellipse | def ellipse(r1: float, r2: float) -> Shape: | def ellipse(
) -> T: |
| box | def box(w: float, l: float, h: float) -> Shape: | def box(
) -> T: |
| cylinder | def cylinder(d: float, h: float) -> Shape: | def cylinder(
) -> T: |
| sphere | def sphere(d: float) -> Shape: | def sphere(
) -> T: |
Fair request, there is also cq.Sketch to match. For clarity: are you referring to parameter order and semantics (e.g. radius vs diameter) or names too?
All of them, I think:
- the parameters order;
- the semantics, by radius and diameter, I think radius is preferred.
- the parameter name, for example, "width" is preferred to "w" for width.
We do not need to think about the parameters' thing when we write code. It is a natural thing for the parameters.
Is it possible to keep the centered parameter for box, cylinder and sphere free functions? This is also related to consistency with the the same name methods in Workplane class.
For now the design is to not have those and keep the api simple. In the future let's see.