21 lines
609 B
Python
21 lines
609 B
Python
from build123d import Align, Plane, Pos, Rectangle, extrude
|
|
|
|
|
|
def validate(context, target, params):
|
|
errors = []
|
|
if target is None:
|
|
errors.append("NO_TARGET: rib 需要一个实体作为输入")
|
|
return errors
|
|
|
|
|
|
def run(context, target, params):
|
|
bbox = target.bounding_box()
|
|
base_z = bbox.max.Z
|
|
|
|
rib_sketch = Plane.XY.offset(base_z) * (
|
|
Pos(params["x_offset"], params["y_offset"], 0)
|
|
* Rectangle(params["length"], params["thickness"], align=(Align.MIN, Align.MIN))
|
|
)
|
|
rib_solid = extrude(rib_sketch, amount=params["height"])
|
|
return target + rib_solid
|