NEAREST_MATERIAL
Excel Usage
=NEAREST_MATERIAL(name, complete)
name(str, required): Search keywordscomplete(bool, optional, default: false): If True, returns only hits with all three properties available. Default False.
Returns (str): Valid material ID for lookup functions.
Examples
Example 1: Search for stainless steel
Inputs:
| name |
|---|
| stainless steel |
Excel formula:
=NEAREST_MATERIAL("stainless steel")
Expected output:
"Error: maximum recursion depth exceeded"
Example 2: Search for fiber
Inputs:
| name |
|---|
| fiber |
Excel formula:
=NEAREST_MATERIAL("fiber")
Expected output:
"Error: maximum recursion depth exceeded"
Example 3: Search for material with all properties
Inputs:
| name | complete |
|---|---|
| fiber | true |
Excel formula:
=NEAREST_MATERIAL("fiber", TRUE)
Expected output:
"Error: maximum recursion depth exceeded"
Example 4: Search for cork
Inputs:
| name |
|---|
| cork |
Excel formula:
=NEAREST_MATERIAL("cork")
Expected output:
"Error: maximum recursion depth exceeded"
Python Code
from ht.insulation import nearest_material
def nearest_material(name, complete=False):
"""
Find the nearest material ID hit for a search term.
See: https://ht.readthedocs.io/en/latest/ht.insulation.html#ht.insulation.nearest_material
This example function is provided as-is without any representation of accuracy.
Args:
name (str): Search keywords
complete (bool, optional): If True, returns only hits with all three properties available. Default False. Default is False.
Returns:
str: Valid material ID for lookup functions.
"""
try:
return str(nearest_material(name=name, complete=complete))
except Exception as e:
return f"Error: {str(e)}"