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.

Bitbybit Platform

Get volume and surface area from solid

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"bef75e4e7ff3c3b7": {
"id": "bef75e4e7ff3c3b7",
"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": "3451ed6841849bc5",
"output": "result",
"data": {}
}
]
}
},
"position": [
316.4713600560928,
429.3616724479225
]
},
"7983606b99981835": {
"id": "7983606b99981835",
"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": "bef75e4e7ff3c3b7",
"output": "result",
"data": {}
}
]
}
},
"position": [
776.8984375,
228.30078125
]
},
"76186587e6ec91af": {
"id": "76186587e6ec91af",
"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
},
"inputs": {
"startPoint": {
"connections": [
{
"node": "1ece96f4b7f7b2f0",
"output": "result",
"data": {}
}
]
},
"endPoint": {
"connections": [
{
"node": "194d1fdaff71b010",
"output": "result",
"data": {}
}
]
},
"direction": {
"connections": [
{
"node": "51a8898dbf972632",
"output": "result",
"data": {}
}
]
},
"label": {
"connections": [
{
"node": "0efa312769a4d07b",
"output": "result",
"data": {}
}
]
}
},
"position": [
3856.438127809349,
-1015.9733606944596
]
},
"9c4a703b6e556e1a": {
"id": "9c4a703b6e556e1a",
"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": "30dea4d862516011",
"output": "result",
"data": {}
}
]
}
},
"position": [
1536.26953125,
224.28515625
]
},
"30dea4d862516011": {
"id": "30dea4d862516011",
"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": "7983606b99981835",
"output": "result",
"data": {}
}
]
}
},
"position": [
1162.9375,
227.17578125
]
},
"1ece96f4b7f7b2f0": {
"id": "1ece96f4b7f7b2f0",
"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": "3451ed6841849bc5",
"output": "result",
"data": {}
}
]
}
},
"position": [
320.1503492475161,
-823.8345351273548
]
},
"3451ed6841849bc5": {
"id": "3451ed6841849bc5",
"name": "bitbybit.math.numberSlider",
"customName": "number slider",
"data": {
"number": 5
},
"inputs": {},
"position": [
-471.18057504668485,
55.287555693302465
]
},
"194d1fdaff71b010": {
"id": "194d1fdaff71b010",
"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": "9d44a01eb843e2d1",
"output": "result",
"data": {}
}
]
}
},
"position": [
875.337940721461,
-614.8163334681311
]
},
"9d44a01eb843e2d1": {
"id": "9d44a01eb843e2d1",
"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": "3451ed6841849bc5",
"output": "result",
"data": {}
}
]
}
},
"position": [
312.3284556725623,
-445.57119812816956
]
},
"51a8898dbf972632": {
"id": "51a8898dbf972632",
"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": [
3014.8799127241427,
-730.5519639853317
]
},
"0efa312769a4d07b": {
"id": "0efa312769a4d07b",
"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": "599e0c7d46fb3220",
"output": "list",
"data": {}
}
]
}
},
"position": [
2318.784938903148,
183.34330157468807
]
},
"599e0c7d46fb3220": {
"id": "599e0c7d46fb3220",
"name": "bitbybit.lists.createList",
"customName": "create list",
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "9c4a703b6e556e1a",
"output": "result",
"data": {}
}
]
}
},
"position": [
1904.7372263660575,
259.0413088840905
]
},
"cf44076aa095e6be": {
"id": "cf44076aa095e6be",
"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": "bef75e4e7ff3c3b7",
"output": "result",
"data": {}
}
]
}
},
"position": [
781.1595294729707,
561.0577770468958
]
},
"ffa937c14c398763": {
"id": "ffa937c14c398763",
"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": "cf44076aa095e6be",
"output": "result",
"data": {}
}
]
}
},
"position": [
1155.6690292844728,
559.5658471840296
]
},
"67d5a769c297f8ac": {
"id": "67d5a769c297f8ac",
"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": "ffa937c14c398763",
"output": "result",
"data": {}
}
]
}
},
"position": [
1536.7464934260677,
557.6073820788339
]
},
"1c0ab3180b9f1f7c": {
"id": "1c0ab3180b9f1f7c",
"name": "bitbybit.lists.createList",
"customName": "create list",
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "67d5a769c297f8ac",
"output": "result",
"data": {}
}
]
}
},
"position": [
1906.1380856366695,
592.2885091683142
]
},
"07fa1b295ea8f41b": {
"id": "07fa1b295ea8f41b",
"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": "1c0ab3180b9f1f7c",
"output": "list",
"data": {}
}
]
}
},
"position": [
2320.154705372718,
513.2889897780375
]
},
"34136572848d000a": {
"id": "34136572848d000a",
"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
},
"inputs": {
"startPoint": {
"connections": [
{
"node": "1ece96f4b7f7b2f0",
"output": "result",
"data": {}
}
]
},
"endPoint": {
"connections": [
{
"node": "e484b4c9d7d6c427",
"output": "result",
"data": {}
}
]
},
"label": {
"connections": [
{
"node": "07fa1b295ea8f41b",
"output": "result",
"data": {}
}
]
},
"direction": {
"connections": [
{
"node": "51a8898dbf972632",
"output": "result",
"data": {}
}
]
}
},
"position": [
3855.9347930048825,
-299.2942260650964
]
},
"e484b4c9d7d6c427": {
"id": "e484b4c9d7d6c427",
"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": "2b0e56a3f84f7519",
"output": "result",
"data": {}
}
]
}
},
"position": [
873.8268720660141,
-264.68433278373993
]
},
"2b0e56a3f84f7519": {
"id": "2b0e56a3f84f7519",
"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": "3451ed6841849bc5",
"output": "result",
"data": {}
}
]
}
},
"position": [
307.39199038507314,
-134.11228446887458
]
}
}
}