Jin
January 23, 2025, 10:15am
1
Is there any way to put icon + ? in front of custom nodes? They are all set in thunderbolt (modify)
Thank you!
It depends on the type of custom node. For C# it is like this:
{
}
/// <summary>
/// This will run a regular expression on a a string. By default this removes all whitespace and special characters from a string
/// </summary>
/// <param name="stringToReplace">Your target string.</param>
/// <param name="regexString">The regular expression to use.</param>
/// <param name="replacement">What to replace with.</param>
/// <returns name="modifiedString">The finished product</returns>
[NodeCategory("Actions")]
public static string ParseRegularExpression(string stringToReplace, string regexString = @"[^a-zA-Z0-9]", string replacement = "")
{
string modifiedString = Regex.Replace(stringToReplace, @"[^a-zA-Z0-9]", "");
return modifiedString;
}
/// <summary>
/// Converts the input string to a title case.
/// </summary>
/// <param name="str"></param>
If in Python, open the dyf in a text editor with dynamo closed.
Under the Category property, set it to your package name followed by:
.Query
.Action
.Create
For ?, thunderbolt or + respectively, e.g.
Note that in Crumple I abuse an extra layer naming system between the paxkage name and the suffix in some cases to group my nodes together by function in the library and by name.
You can see examples of this in my package:
Crumple > About > Node (query)
{
"Uuid": "8202ba51-b2a8-4f4d-9de2-dff68bf44f39",
"IsCustomNode": true,
"Category": "Crumple.Query",
"Description": "Opens the Aussie BIM Guru YouTube channel.",
"Name": "© About.AussieBIMGuru",
"ElementResolver": {
"ResolutionMap": {
"DSCore.List": {
"Key": "DSCore.List",
"Value": "DSCoreNodes.dll"
}
}
},
"Inputs": [],
"Outputs": [],
"Nodes": [
{
"ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels",
"NodeType": "PythonScriptNode",
This file has been truncated. show original
An example of a nested node/name:
Crumple > Application > Windows > Node (action)
{
"Uuid": "cac9d4f6-2079-450f-998e-7f674949d1f4",
"IsCustomNode": true,
"Category": "Crumple.Application.Actions",
"Description": "Given a filepath or list of filepaths, separate out any backup file paths.",
"Name": "© Windows.FilterBackups",
"ElementResolver": {
"ResolutionMap": {}
},
"Inputs": [],
"Outputs": [],
"Nodes": [
{
"ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels",
"NodeType": "PythonScriptNode",
"Code": "# Made by Gavin Crump\r\n# Free for use\r\n# BIM Guru, www.bimguru.com.au\r\n\r\n# Boilerplate text\r\nimport clr\r\n\r\n# Define list/unwrap list functions\r\ndef tolist(input):\r\n result = input if isinstance(input, list) else [input]\r\n return result\r\n\r\n# Preparing input from dynamo to revit\r\nfilePaths = tolist(IN[0])\r\n\r\n# Return only non-backup\r\ndef isBackup(fp):\r\n\tfp1 = fp.rsplit(\".\", 1)[0]\r\n\tfp2 = fp1.rsplit(\".\",1)[-1]\r\n\ttry:\r\n\t\tint(fp2)\r\n\t\treturn True\r\n\texcept:\r\n\t\treturn False\r\n\r\npathsOut, bkpPaths = [],[]\r\n\r\nfor fp in filePaths:\r\n\tbkp = isBackup(fp)\r\n\tif bkp:\r\n\t\tbkpPaths.append(fp)\r\n\telse:\r\n\t\tpathsOut.append(fp)\r\n\r\n# Preparing output to Dynamo\r\nOUT = pathsOut, bkpPaths",
"Engine": "CPython3",
"VariableInputPorts": true,
"Id": "5a3bbe454af64fca969970915c94abc2",
"Inputs": [
This file has been truncated. show original