Skip to main content

Rendering 3D Objects in Bitbybit Editors

Draw category icon with a paintbrush

This guide demonstrates how to use the core "Draw" functionalities across Bitbybit's different editor environments: Rete, Blockly, and TypeScript. The objective is to render a 3D object-specifically, a cube with rounded edges-and customize its appearance.

A filleted cube with its own colours​

The script builds a cube, rounds its edges with a fillet, and draws the result with options of its own: blue faces, light red edges, and its vertices drawn as points.

Each editor draws it the same way:

  • Rete: the draw any async component, in the palette's draw category under its draw async heading.
  • Blockly: the draw any async no return block, in the toolbox under draw > draw async. The blocks are nested directly, without variables in between.
  • TypeScript: bitbybit.draw.drawAnyAsync, with a Bit.Inputs.Draw.DrawOcctShapeOptions for the options.
Bitbybit Platform

A filleted cube drawn with its own options in Rete

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"b1bf89dae109c64b": {
"id": "b1bf89dae109c64b",
"name": "bitbybit.occt.shapes.solid.createCube",
"customName": "cube",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"size": 5,
"center": [
0,
0,
0
],
"originOnCenter": true
},
"inputs": {},
"position": [
376.49611866408657,
295.8380861953228
]
},
"511f71201db977e8": {
"id": "511f71201db977e8",
"name": "bitbybit.occt.fillets.filletEdges",
"customName": "fillet edges",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 1
},
"inputs": {
"shape": {
"connections": [
{
"node": "b1bf89dae109c64b",
"output": "result",
"data": {}
}
]
}
},
"position": [
751.1640625,
293.23828125
]
},
"d1567030a8ca9ba2": {
"id": "d1567030a8ca9ba2",
"name": "bitbybit.draw.drawAnyAsync",
"customName": "draw any async",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"entity": {
"connections": [
{
"node": "511f71201db977e8",
"output": "result",
"data": {}
}
]
},
"options": {
"connections": [
{
"node": "8136f5dbe1a1aa7f",
"output": "result",
"data": {}
}
]
}
},
"position": [
1202.458352666743,
483.28792369009324
]
},
"8136f5dbe1a1aa7f": {
"id": "8136f5dbe1a1aa7f",
"name": "bitbybit.draw.optionsOcctShape",
"customName": "options occt shape",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"faceOpacity": 1,
"edgeOpacity": 1,
"edgeColour": "#ffbb00",
"faceColour": "#0008ff",
"vertexColour": "#ff00ff",
"edgeWidth": 2,
"vertexSize": 0.3,
"drawEdges": true,
"drawFaces": true,
"drawVertices": true,
"precision": 0.01,
"drawEdgeIndexes": false,
"edgeIndexHeight": 0.1,
"edgeIndexColour": "#ff00ff",
"drawFaceIndexes": false,
"faceIndexHeight": 0.06,
"faceIndexColour": "#0000ff"
},
"inputs": {},
"position": [
748.3541705405835,
689.9545863118427
]
}
}
}