Skip to main content
OCCT category icon with a stylized logo representation

Calculating Volume and Surface Area

OCCT provides built-in functions to calculate geometric properties of solid shapes, including volume and surface area. This tutorial demonstrates how to:

  • Create a parametric cone solid
  • Calculate the volume of the solid using getSolidVolume
  • Calculate the surface area using getSolidSurfaceArea
  • Format and display the results with proper units
  • Use pin labels for visual annotation

The example shows a practical workflow for measuring and displaying geometric properties, which is essential for engineering calculations, material estimates, and design validation.

Volume and surface area of a solid
Bitbybit Platform

Volume and surface area of a solid in Rete

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"cone": {
"id": "cone",
"name": "bitbybit.occt.shapes.solid.createCone",
"customName": "cone",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius1": 2,
"radius2": 1,
"height": 2,
"angle": 360,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {
"height": {
"connections": [
{
"node": "numberSlider",
"output": "result",
"data": {}
}
]
}
},
"position": [
316,
429
]
},
"getSolidVolume": {
"id": "getSolidVolume",
"name": "bitbybit.occt.shapes.solid.getSolidVolume",
"customName": "get solid volume",
"async": true,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"shape": {
"connections": [
{
"node": "cone",
"output": "result",
"data": {}
}
]
}
},
"position": [
777,
228
]
},
"pinWithLabel": {
"id": "pinWithLabel",
"name": "bitbybit.occt.dimensions.pinWithLabel",
"customName": "pin with label",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"startPoint": [
0,
0,
0
],
"endPoint": [
0,
5,
2
],
"direction": [
0,
0,
1
],
"offsetFromStart": 0,
"label": "Pin",
"labelOffset": 0.3,
"labelSize": 0.3,
"endType": "none",
"arrowSize": 0.3,
"arrowAngle": 30,
"arrowsFlipped": false,
"labelRotation": 0,
"labelFlipHorizontal": false,
"labelFlipVertical": false
},
"inputs": {
"startPoint": {
"connections": [
{
"node": "pointXyz",
"output": "result",
"data": {}
}
]
},
"endPoint": {
"connections": [
{
"node": "pointXyz2",
"output": "result",
"data": {}
}
]
},
"direction": {
"connections": [
{
"node": "vectorXyz",
"output": "result",
"data": {}
}
]
},
"label": {
"connections": [
{
"node": "format",
"output": "result",
"data": {}
}
]
}
},
"position": [
3856,
-1016
]
},
"toString": {
"id": "toString",
"name": "bitbybit.text.toString",
"customName": "to string",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"item": {
"connections": [
{
"node": "roundToDecimals",
"output": "result",
"data": {}
}
]
}
},
"position": [
1536,
224
]
},
"roundToDecimals": {
"id": "roundToDecimals",
"name": "bitbybit.math.roundToDecimals",
"customName": "round to decimals",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"number": 1.123456,
"decimalPlaces": 2
},
"inputs": {
"number": {
"connections": [
{
"node": "getSolidVolume",
"output": "result",
"data": {}
}
]
}
},
"position": [
1163,
227
]
},
"pointXyz": {
"id": "pointXyz",
"name": "bitbybit.point.pointXYZ",
"customName": "point xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 0,
"y": 0,
"z": 0
},
"inputs": {
"y": {
"connections": [
{
"node": "numberSlider",
"output": "result",
"data": {}
}
]
}
},
"position": [
320,
-824
]
},
"numberSlider": {
"id": "numberSlider",
"name": "bitbybit.math.numberSlider",
"customName": "number slider",
"async": false,
"drawable": false,
"data": {
"options": {},
"number": 5
},
"inputs": {},
"position": [
-471,
55
]
},
"pointXyz2": {
"id": "pointXyz2",
"name": "bitbybit.point.pointXYZ",
"customName": "point xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 1,
"y": 0,
"z": 0
},
"inputs": {
"y": {
"connections": [
{
"node": "add",
"output": "result",
"data": {}
}
]
}
},
"position": [
875,
-615
]
},
"add": {
"id": "add",
"name": "bitbybit.math.add",
"customName": "add",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"first": 1,
"second": 3
},
"inputs": {
"first": {
"connections": [
{
"node": "numberSlider",
"output": "result",
"data": {}
}
]
}
},
"position": [
312,
-446
]
},
"vectorXyz": {
"id": "vectorXyz",
"name": "bitbybit.vector.vectorXYZ",
"customName": "vector xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 1,
"y": 0,
"z": 0
},
"inputs": {},
"position": [
3015,
-731
]
},
"format": {
"id": "format",
"name": "bitbybit.text.format",
"customName": "format",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"text": "Volume {0} m3",
"values": [
"World"
]
},
"inputs": {
"values": {
"connections": [
{
"node": "createList",
"output": "list",
"data": {}
}
]
}
},
"position": [
2319,
183
]
},
"createList": {
"id": "createList",
"name": "bitbybit.lists.createList",
"customName": "create list",
"async": false,
"drawable": false,
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "toString",
"output": "result",
"data": {}
}
]
}
},
"position": [
1905,
259
]
},
"getSolidSurfaceArea": {
"id": "getSolidSurfaceArea",
"name": "bitbybit.occt.shapes.solid.getSolidSurfaceArea",
"customName": "get solid surface area",
"async": true,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"shape": {
"connections": [
{
"node": "cone",
"output": "result",
"data": {}
}
]
}
},
"position": [
781,
561
]
},
"roundToDecimals2": {
"id": "roundToDecimals2",
"name": "bitbybit.math.roundToDecimals",
"customName": "round to decimals",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"number": 1.123456,
"decimalPlaces": 2
},
"inputs": {
"number": {
"connections": [
{
"node": "getSolidSurfaceArea",
"output": "result",
"data": {}
}
]
}
},
"position": [
1156,
560
]
},
"toString2": {
"id": "toString2",
"name": "bitbybit.text.toString",
"customName": "to string",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"item": {
"connections": [
{
"node": "roundToDecimals2",
"output": "result",
"data": {}
}
]
}
},
"position": [
1537,
558
]
},
"createList2": {
"id": "createList2",
"name": "bitbybit.lists.createList",
"customName": "create list",
"async": false,
"drawable": false,
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "toString2",
"output": "result",
"data": {}
}
]
}
},
"position": [
1906,
592
]
},
"format2": {
"id": "format2",
"name": "bitbybit.text.format",
"customName": "format",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"text": "Area {0} m2",
"values": [
"World"
]
},
"inputs": {
"values": {
"connections": [
{
"node": "createList2",
"output": "list",
"data": {}
}
]
}
},
"position": [
2320,
513
]
},
"pinWithLabel2": {
"id": "pinWithLabel2",
"name": "bitbybit.occt.dimensions.pinWithLabel",
"customName": "pin with label",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"startPoint": [
0,
0,
0
],
"endPoint": [
0,
5,
2
],
"direction": [
0,
0,
1
],
"offsetFromStart": 0,
"label": "Pin",
"labelOffset": 0.3,
"labelSize": 0.3,
"endType": "none",
"arrowSize": 0.3,
"arrowAngle": 30,
"arrowsFlipped": false,
"labelRotation": 0,
"labelFlipHorizontal": false,
"labelFlipVertical": false
},
"inputs": {
"startPoint": {
"connections": [
{
"node": "pointXyz",
"output": "result",
"data": {}
}
]
},
"endPoint": {
"connections": [
{
"node": "pointXyz3",
"output": "result",
"data": {}
}
]
},
"label": {
"connections": [
{
"node": "format2",
"output": "result",
"data": {}
}
]
},
"direction": {
"connections": [
{
"node": "vectorXyz",
"output": "result",
"data": {}
}
]
}
},
"position": [
3856,
-299
]
},
"pointXyz3": {
"id": "pointXyz3",
"name": "bitbybit.point.pointXYZ",
"customName": "point xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 1,
"y": 0,
"z": 0
},
"inputs": {
"y": {
"connections": [
{
"node": "add2",
"output": "result",
"data": {}
}
]
}
},
"position": [
874,
-265
]
},
"add2": {
"id": "add2",
"name": "bitbybit.math.add",
"customName": "add",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"first": 1,
"second": 4
},
"inputs": {
"first": {
"connections": [
{
"node": "numberSlider",
"output": "result",
"data": {}
}
]
}
},
"position": [
307,
-134
]
}
},
"modules": {}
}