dymokomi/luced-3d
Source of release 0.11.8
0.11.8 / src / tool_untrim.luc
## Untrim (Alias's): the last trim of a face undone, or every one (a face
## with none goes back to its natural surface; surface_ops.luc). The node
## keeps its face by name; an Edit CAD step untrims each face picked.
from tool_record import Tool, ToolEntry, Pick, Invocation
from geometry_data import GeometryData
from parameter_rows import Parameter, menu
from edit_types import face_level, patch_level
import pick_kinds
import edit_cad_surfaces
import surface_ops
import cad_cook
pub func entry() -> ToolEntry:
return ToolEntry(edit_cad_surfaces.untrim_verb, edit_cad_surfaces.untrim_verb, "untrim-surface", "Surfaces", [cad_cook.context], [cad_cook.edit_kind], made)
func made() -> Tool:
return entry().tool("Modify", "Surface Edit", "Undo a face's last trim, or every one", [Pick("Face", [face_level, patch_level], kind = pick_kinds.face, slot = 0, doc = "The face, kept by its name.")],
rows(), cook, waits = waits)
func waits(values: list[float], texts: list[str], wired: bool) -> str:
return "Pick the face" if texts[0].trim() == "" else ""
func cook(call: Invocation, data: GeometryData, tag: str) -> GeometryData!:
let all = call.number(edit_cad_surfaces.all_slot) != 0.0
if call.node:
let waiting = waits(call.numbers, call.texts, false)
if waiting != "":
return data.passed(waiting)
return surface_ops.untrim(data, call.text(0).trim(), all)
var result = data
for face in edit_cad_surfaces.step_faces(call, data):
result = surface_ops.untrim(result, face, all)
return result
func rows() -> list[Parameter]:
return [menu("Stages", edit_cad_surfaces.all_slot, "Last|All", 0.0, "Alias's Untrim Stages: undo the last trim, or every one (a face with none goes back to its natural surface).")]