Script: Christmas Tree Pattern

Christmas Tree Pattern picture
Type
Rete logo indicatorrete
Author
matas
Date Created
Jan 1, 2024, 5:32:19 PM
Last Edit Date
Jan 6, 2024, 2:25:03 PM

Project Information

In this project we demonstrate several new features, such filtering of points on the face and creating faces by combining multiple wires. We first create hexagonal point grid, removing all the points that are not on the face of the heart. Remaining points are used as origins for Christmas tree wires. Then face is created and extruded.

View Full Project

Script Code

{
  "id": "rete-v2-json",
  "nodes": {
    "98653435a3d9eadc": {
      "id": "98653435a3d9eadc",
      "name": "bitbybit.point.hexGrid",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        },
        "nrHexagonsY": 21,
        "nrHexagonsX": 21,
        "radiusHexagon": 0.5,
        "orientOnCenter": true,
        "pointsOnGround": false
      },
      "inputs": {},
      "position": [
        686.3769600353521,
        -8.909702194727926
      ]
    },
    "8691dcc0bb8edaf6": {
      "id": "8691dcc0bb8edaf6",
      "name": "bitbybit.occt.shapes.wire.createHeartWire",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        },
        "rotation": 90,
        "sizeApprox": 10
      },
      "inputs": {
        "direction": {
          "connections": [
            {
              "node": "17742aaa1466c1e4",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        876.0046467129553,
        725.2474462925619
      ]
    },
    "17742aaa1466c1e4": {
      "id": "17742aaa1466c1e4",
      "name": "bitbybit.vector.vectorXYZ",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        },
        "x": 0,
        "y": 0,
        "z": 1
      },
      "inputs": {},
      "position": [
        378.515625,
        830.0625
      ]
    },
    "0bd1147e48711776": {
      "id": "0bd1147e48711776",
      "name": "bitbybit.occt.shapes.face.createFaceFromWire",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        },
        "planar": true
      },
      "inputs": {
        "shape": {
          "connections": [
            {
              "node": "8691dcc0bb8edaf6",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        1130.9928389364384,
        391.5582701828273
      ]
    },
    "c2b99605d624690e": {
      "id": "c2b99605d624690e",
      "name": "bitbybit.occt.shapes.face.filterFacePoints",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        },
        "tolerance": 0.01,
        "useBndBox": false,
        "gapTolerance": 0.05,
        "keepIn": true,
        "keepOn": true,
        "keepOut": false,
        "keepUnknown": false
      },
      "inputs": {
        "points": {
          "connections": [
            {
              "node": "98653435a3d9eadc",
              "output": "result",
              "data": {}
            }
          ]
        },
        "shape": {
          "connections": [
            {
              "node": "0bd1147e48711776",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        1668.9486265562034,
        216.2180174077213
      ]
    },
    "c535f2d20f562e33": {
      "id": "c535f2d20f562e33",
      "name": "bitbybit.occt.shapes.wire.createChristmasTreeWire",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        },
        "height": 6,
        "innerDist": 1.5,
        "outerDist": 3,
        "nrSkirts": 5,
        "trunkHeight": 1,
        "trunkWidth": 1,
        "half": false,
        "rotation": 0
      },
      "inputs": {},
      "position": [
        2579.085998968027,
        175.53445615454876
      ]
    },
    "87a3a86a3e53bdcc": {
      "id": "87a3a86a3e53bdcc",
      "name": "bitbybit.lists.flatten",
      "data": {
        "nrLevels": 1
      },
      "inputs": {
        "list": {
          "connections": [
            {
              "node": "c2b99605d624690e",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        2190.3289482391233,
        508.1203180737045
      ]
    },
    "cecd45866d60a8d8": {
      "id": "cecd45866d60a8d8",
      "name": "bitbybit.occt.transforms.scale",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        },
        "factor": 0.11
      },
      "inputs": {
        "shape": {
          "connections": [
            {
              "node": "c535f2d20f562e33",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        3175.613721251641,
        283.754618454874
      ]
    },
    "6ffe21d0bd48498f": {
      "id": "6ffe21d0bd48498f",
      "name": "bitbybit.occt.shapes.wire.reversedWire",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        }
      },
      "inputs": {
        "shape": {
          "connections": [
            {
              "node": "cecd45866d60a8d8",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        3497.118335787151,
        372.8469052676732
      ]
    },
    "a5fe7b0648479063": {
      "id": "a5fe7b0648479063",
      "name": "bitbybit.occt.transforms.translate",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        }
      },
      "inputs": {
        "shape": {
          "connections": [
            {
              "node": "6ffe21d0bd48498f",
              "output": "result",
              "data": {}
            }
          ]
        },
        "translation": {
          "connections": [
            {
              "node": "87a3a86a3e53bdcc",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        3871.7292226584486,
        538.1059935147547
      ]
    },
    "d9c0020cb0d8272c": {
      "id": "d9c0020cb0d8272c",
      "name": "bitbybit.occt.shapes.wire.createHeartWire",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        },
        "rotation": 90,
        "sizeApprox": 13
      },
      "inputs": {
        "direction": {
          "connections": [
            {
              "node": "17742aaa1466c1e4",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        858.915554049208,
        1167.3416114297706
      ]
    },
    "b67f77ea658aa75a": {
      "id": "b67f77ea658aa75a",
      "name": "bitbybit.occt.shapes.face.createFaceFromWires",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        },
        "planar": false
      },
      "inputs": {
        "shapes": {
          "connections": [
            {
              "node": "1b0a82b2b22b0093",
              "output": "list",
              "data": {}
            }
          ]
        }
      },
      "position": [
        5253.087142881022,
        692.75199880101
      ]
    },
    "0c703c0ebfd9f631": {
      "id": "0c703c0ebfd9f631",
      "name": "bitbybit.lists.createList",
      "data": {},
      "inputs": {
        "listElements": {
          "connections": [
            {
              "node": "cb2fe38dcd848900",
              "output": "result",
              "data": {}
            },
            {
              "node": "a5fe7b0648479063",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        4235.291145972629,
        928.9997241916554
      ]
    },
    "e4161fa3e9d82d32": {
      "id": "e4161fa3e9d82d32",
      "name": "bitbybit.lists.flatten",
      "data": {
        "nrLevels": 1
      },
      "inputs": {
        "list": {
          "connections": [
            {
              "node": "0c703c0ebfd9f631",
              "output": "list",
              "data": {}
            }
          ]
        }
      },
      "position": [
        4516.287984027663,
        697.8349028469199
      ]
    },
    "1b0a82b2b22b0093": {
      "id": "1b0a82b2b22b0093",
      "name": "bitbybit.lists.createList",
      "data": {},
      "inputs": {
        "listElements": {
          "connections": [
            {
              "node": "e4161fa3e9d82d32",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        4868.041584143968,
        708.376955402615
      ]
    },
    "3182cf27519b2a02": {
      "id": "3182cf27519b2a02",
      "name": "bitbybit.occt.operations.extrude",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        }
      },
      "inputs": {
        "shape": {
          "connections": [
            {
              "node": "b67f77ea658aa75a",
              "output": "result",
              "data": {}
            }
          ]
        },
        "direction": {
          "connections": [
            {
              "node": "5d24dd7651a43671",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        5803.741845368216,
        805.6799665392979
      ]
    },
    "5d24dd7651a43671": {
      "id": "5d24dd7651a43671",
      "name": "bitbybit.vector.vectorXYZ",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        },
        "x": 0,
        "y": 0,
        "z": 0.2
      },
      "inputs": {},
      "position": [
        5448.307233762323,
        1016.0923700270475
      ]
    },
    "5d560635d40a5f3c": {
      "id": "5d560635d40a5f3c",
      "name": "bitbybit.babylon.scene.enableSkybox",
      "data": {
        "genericNodeData": {
          "hide": false,
          "oneOnOne": false,
          "flatten": 0
        },
        "skybox": "city",
        "size": 1000,
        "blur": 0.4,
        "environmentIntensity": 0.7
      },
      "inputs": {},
      "position": [
        212.55510124312104,
        1712.5857754209082
      ]
    },
    "58bbeb5bde0615e9": {
      "id": "58bbeb5bde0615e9",
      "name": "bitbybit.draw.drawAnyAsync",
      "data": {
        "genericNodeData": {
          "hide": false,
          "oneOnOne": false,
          "flatten": 0
        }
      },
      "inputs": {
        "entity": {
          "connections": [
            {
              "node": "3182cf27519b2a02",
              "output": "result",
              "data": {}
            }
          ]
        },
        "options": {
          "connections": [
            {
              "node": "c9ff9c28ac937f2c",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        6552.987824721928,
        1253.1490570158908
      ]
    },
    "fdbb939a8e3985c4": {
      "id": "fdbb939a8e3985c4",
      "name": "bitbybit.babylon.scene.drawDirectionalLight",
      "data": {
        "genericNodeData": {
          "hide": false,
          "oneOnOne": false,
          "flatten": 0
        },
        "intensity": 2,
        "diffuse": "#ffffff",
        "specular": "#ffffff",
        "shadowGeneratorMapSize": 1024,
        "enableShadows": true,
        "shadowDarkness": 0
      },
      "inputs": {},
      "position": [
        181.85100408961245,
        2094.691022839723
      ]
    },
    "cb2fe38dcd848900": {
      "id": "cb2fe38dcd848900",
      "name": "bitbybit.occt.transforms.translate",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        }
      },
      "inputs": {
        "translation": {
          "connections": [
            {
              "node": "5c4eacde8e863b39",
              "output": "result",
              "data": {}
            }
          ]
        },
        "shape": {
          "connections": [
            {
              "node": "d9c0020cb0d8272c",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        1993.811876191125,
        1642.692012459621
      ]
    },
    "5c4eacde8e863b39": {
      "id": "5c4eacde8e863b39",
      "name": "bitbybit.vector.vectorXYZ",
      "data": {
        "genericNodeData": {
          "hide": true,
          "oneOnOne": false,
          "flatten": 0
        },
        "x": 0,
        "y": 0.3,
        "z": 0
      },
      "inputs": {},
      "position": [
        1531.2837018519328,
        1850.1223160779825
      ]
    },
    "c9ff9c28ac937f2c": {
      "id": "c9ff9c28ac937f2c",
      "name": "bitbybit.draw.optionsOcctShapeMaterial",
      "data": {
        "genericNodeData": {
          "hide": false,
          "oneOnOne": false,
          "flatten": 0
        },
        "precision": 0.01,
        "drawEdges": true,
        "edgeColour": "#000000",
        "edgeWidth": 1
      },
      "inputs": {
        "faceMaterial": {
          "connections": [
            {
              "node": "44c822fa470e3947",
              "output": "result",
              "data": {}
            }
          ]
        }
      },
      "position": [
        5910.5869933724925,
        1664.3016468042565
      ]
    },
    "44c822fa470e3947": {
      "id": "44c822fa470e3947",
      "name": "bitbybit.babylon.material.pbrMetallicRoughness.create",
      "data": {
        "genericNodeData": {
          "hide": false,
          "oneOnOne": false,
          "flatten": 0
        },
        "name": "Custom Material",
        "baseColor": "#69ff66",
        "metallic": 0.8,
        "roughness": 0.2,
        "alpha": 1,
        "backFaceCulling": false,
        "zOffset": 2
      },
      "inputs": {},
      "position": [
        5450.711653863521,
        1686.7961333268859
      ]
    }
  }
}