dymokomi/luced-3d
Source of release 0.11.8
0.11.8 / src / tool_solid_cylinder.luc
## Solid Cylinder: luce-cad's analytic solid (CadSolids), its faces named for
## the node. A node of a CAD network.
from luce_cad.cad_geometry import CadGeometry
from luce_cad.solids import CadSolids
from luce_cad.modeling import CadModeling
from tool_record import Tool, ToolEntry, Pick, Invocation
from geometry_data import GeometryData
from parameter_rows import Parameter, number
import cad_cook
pub func entry() -> ToolEntry:
return ToolEntry("Solid Cylinder", "Solid Cylinder", "cylinder", "Create", [cad_cook.context], [], made)
func made() -> Tool:
let none_picked: list[Pick] = []
let rows: list[Parameter] = [number("Radius", 0, 10.0, 0.001, 100000.0, 0.5, "The base's radius.", soft = 50.0), number("Height", 1, 20.0, 0.001, 100000.0, 0.5, "Along +Y, centered on the origin.", soft = 100.0)]
return entry().tool("Create", "Solids", "A cylinder along +Y, centered on the origin", none_picked, rows, cook)
func cook(call: Invocation, data: GeometryData, tag: str) -> GeometryData!:
let v = call.numbers
return GeometryData(geometry = CadGeometry.of_model(CadModeling.tagged(CadSolids.cylinder(v[0], v[1], tolerances = call.tolerances), tag)))