dymokomi/luced-3d
Source of release 0.11.8
0.11.8 / src / tool_solid_cone.luc
## Solid Cone: 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 Cone", "Solid Cone", "cone", "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),
number("Top radius", 2, 0.0, 0.0, 100000.0, 0.5, "0 is a pointed cone; otherwise a frustum.", soft = 50.0)]
return entry().tool("Create", "Solids", "A cone or frustum 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.cone(v[0], v[1], v[2], tolerances = call.tolerances), tag)))