Luce packages
LuceLuce BaseLuciaOS

dymokomi/luced-3d

Source of release 0.11.9

0.11.9 / src / tool_check.luc

## Check (Alias's continuity check, curvature combs and deviation map): the
## input passes through and the viewport draws what was measured over it,
## each checked edge green, yellow or red with its label, combs and quills,
## the deviation from the second input as a tint (cad_check.luc). A node of
## a CAD network; it keeps its edges by reference.
from luce_cad.model import CadModel
from tool_record import Tool, ToolEntry, Pick, Invocation
from geometry_data import GeometryData
from edit_types import edge_level
import pick_kinds
import cad_check
import cad_cook

pub func entry() -> ToolEntry:
    return ToolEntry(cad_check.kind_name, cad_check.kind_name, "surface-analysis", "Inspect", [cad_cook.context], [], made)

func made() -> Tool:
    return entry().tool("Modify", "Inspect", "Draw edges' continuity, curvature combs and the deviation from a reference over the body", picks(), cad_check.fields(), cook, inputs = 2)

func picks() -> list[Pick]:
    return [Pick("Edges", [edge_level], kind = pick_kinds.edges, slot = 0, needed = optional, summary = cad_check.edges_summary, clear = "All edges",
                 doc = "The edges checked, remembered by the faces they lie between. None picked: every edge between two faces.")]

func optional(values: list[float], texts: list[str], wired: bool) -> bool:
    return false

func cook(call: Invocation, data: GeometryData, tag: str) -> GeometryData!:
    var reference: CadModel? = none
    if let other = call.second:
        if other.has_cad():
            reference = cad_cook.body_of(other, "second")
    var body: CadModel? = none
    if data.has_cad():
        body = cad_cook.body_of(data, "first")
    return cad_check.evaluate(call.numbers, call.text(0), data, body, reference)