Hexagon Holes On Face
Hexagonal patterns are found throughout nature - from honeycomb structures to crystal formations. The subdivideToHexagonHoles function brings this efficiency to your designs, creating optimal packing patterns with superior strength-to-weight ratios. This function is ideal for biomimetic designs, structural panels, and advanced filtration systems where hexagonal geometry provides maximum efficiency.
- Rete
- Blockly
- TypeScript
{
"id": "rete-v2-json",
"nodes": {
"5426441c41e8f5cf": {
"id": "5426441c41e8f5cf",
"name": "bitbybit.occt.shapes.face.createRectangleFace",
"customName": "rectangle face",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"width": 20,
"length": 14,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {},
"position": [
345.2983055114746,
314.52503173302796
]
},
"6cabc11ad209ab15": {
"id": "6cabc11ad209ab15",
"name": "bitbybit.occt.operations.extrude",
"customName": "extrude",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"direction": [
0,
1,
0
]
},
"inputs": {
"shape": {
"connections": [
{
"node": "1371efdcc602ecab",
"output": "result",
"data": {}
}
]
}
},
"position": [
1526.870162325427,
316.83038734970324
]
},
"1371efdcc602ecab": {
"id": "1371efdcc602ecab",
"name": "bitbybit.lists.getItem",
"customName": "get item",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"index": 0,
"clone": true
},
"inputs": {
"list": {
"connections": [
{
"node": "81861028eefcb119",
"output": "result",
"data": {}
}
]
}
},
"position": [
1158.6260102344884,
318.1207836219716
]
},
"550f3b6b8b2aa505": {
"id": "550f3b6b8b2aa505",
"name": "bitbybit.json.parse",
"customName": "parse",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"text": "[0.9]"
},
"inputs": {},
"position": [
350.8630642517603,
710.2281472271986
]
},
"81861028eefcb119": {
"id": "81861028eefcb119",
"name": "bitbybit.occt.shapes.face.subdivideToHexagonHoles",
"customName": "subdivide to hexagon holes",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"nrHexagonsU": 10,
"nrHexagonsV": 10,
"flatU": false,
"holesToFaces": false,
"offsetFromBorderU": 0.01,
"offsetFromBorderV": 0.01
},
"inputs": {
"shape": {
"connections": [
{
"node": "5426441c41e8f5cf",
"output": "result",
"data": {}
}
]
},
"scalePatternU": {
"connections": [
{
"node": "550f3b6b8b2aa505",
"output": "result",
"data": {}
}
]
},
"scalePatternV": {
"connections": [
{
"node": "550f3b6b8b2aa505",
"output": "result",
"data": {}
}
]
}
},
"position": [
781.6836832631826,
317.85078716306583
]
}
}
}
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="Ldvr:Za]@6t%YtYC(fZb">recFace</variable><variable id="[RsUo.DvUrH~{%iBh25D]">faces</variable></variables><block type="variables_set" id="#1~0gby0xZk8BO,0au)F" x="-166" y="-194"><field name="VAR" id="Ldvr:Za]@6t%YtYC(fZb">recFace</field><value name="VALUE"><block type="bitbybit.occt.shapes.face.createRectangleFace" id="!CO=J-c2+^0!Ox{z}V;5"><value name="Width"><block type="math_number" id="Vqs!Pi/zzVA5e1*lI[[9"><field name="NUM">20</field></block></value><value name="Length"><block type="math_number" id="6knDm(2V*qrR|Mo^60Bc"><field name="NUM">14</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ" id="FyX3}}prU6rpGBLQ=WPy"><value name="X"><block type="math_number" id="~H@ceir4M7[DA~MvLDBP"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number" id="B!MlWD2h$pO%{@^:Mh(?"><field name="NUM">0</field></block></value><value name="Z"><block type="math_number" id="G@JSlI}e{wV1c}56A5m}"><field name="NUM">0</field></block></value></block></value><value name="Direction"><block type="bitbybit.vector.vectorXYZ" id="W;x/E^G1dC2[lb}o|^#P"><value name="X"><block type="math_number" id="of+NQsRv__X;NS.4BMsA"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number" id="Rp5E9W2-LsY8~hI$4T%h"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number" id="jmOx3r:l+B-^4RE[[py!"><field name="NUM">0</field></block></value></block></value></block></value><next><block type="variables_set" id="7*Dk6WG}@Y{?+KX#Wxn^"><field name="VAR" id="[RsUo.DvUrH~{%iBh25D]">faces</field><value name="VALUE"><block type="base_time_await_return" id="vjom`14/B5SYKuy|@cw_"><value name="Promise"><block type="bitbybit.occt.shapes.face.subdivideToHexagonHoles" id="dr/T6dz~Lzt~Qd_0E=km"><value name="Shape"><block type="variables_get" id="pq-VMi[cY0$}OceV^cQq"><field name="VAR" id="Ldvr:Za]@6t%YtYC(fZb">recFace</field></block></value><value name="NrHexagonsU"><block type="math_number" id="Gxk:(zAF=jKWG5Fm:Lq/"><field name="NUM">10</field></block></value><value name="NrHexagonsV"><block type="math_number" id="@~RkT9BVYLu~6^PDXP@g"><field name="NUM">10</field></block></value><value name="ScalePatternU"><block type="bitbybit.json.parse" id="{_5^AzQFL$^Ok7/3Nz6T"><value name="Text"><block type="text" id="OVM=1TcL(/mmP,j2mSI^"><field name="TEXT">[0.9]</field></block></value></block></value><value name="ScalePatternV"><block type="bitbybit.json.parse" id="_Se=aS*hq5Jd.LqTrrj7"><value name="Text"><block type="text" id="S.vHkTz=$=-l`=ce+w%z"><field name="TEXT">[0.9]</field></block></value></block></value><value name="FlatU"><block type="logic_boolean" id="flatUBoolean"><field name="BOOL">FALSE</field></block></value><value name="HolesToFaces"><block type="logic_boolean" id="vWy]^U.7YhT$lswl9%l;"><field name="BOOL">FALSE</field></block></value><value name="OffsetFromBorderU"><block type="math_number" id="}qpPiTh8M3GwUtRI6wA}"><field name="NUM">0.01</field></block></value><value name="OffsetFromBorderV"><block type="math_number" id="M]`=VH%S{PH4[lXspvLb"><field name="NUM">0.01</field></block></value></block></value></block></value><next><block type="bitbybit.draw.drawAnyAsyncNoReturn" id="!!?5^fe7i-g^xtw{ATr8"><value name="Entity"><block type="bitbybit.occt.operations.extrude" id="fty*6;3RO/+nM[xu3NNC"><value name="Shape"><block type="lists_getIndex" id="[lg1DA5UnpQV@@d$yLRf"><mutation statement="false" at="false"></mutation><field name="MODE">GET</field><field name="WHERE">FIRST</field><value name="VALUE"><block type="variables_get" id="HVzV,F)c[d%.wXLB8a~Q"><field name="VAR" id="[RsUo.DvUrH~{%iBh25D]">faces</field></block></value></block></value><value name="Direction"><block type="bitbybit.vector.vectorXYZ" id="HP=F/oRd$JU.}YM/ia-]"><value name="X"><block type="math_number" id="26/,~=7uu9b.%x=b)~#c"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number" id="Q;w%YnF2d#eXe:G,t0Zo"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number" id="o.cgs^H|o4an=xAKqO19"><field name="NUM">0</field></block></value></block></value></block></value></block></next></block></next></block></xml>
// Import required DTOs for face creation, subdivision, and extrusion
const { RectangleDto, FaceSubdivideToHexagonHolesDto, ExtrudeDto } = Bit.Inputs.OCCT;
// Import type definitions for type safety
type TopoDSFacePointer = Bit.Inputs.OCCT.TopoDSFacePointer;
type TopoDSWirePointer = Bit.Inputs.OCCT.TopoDSWirePointer;
// Get access to OCCT modules for face operations
const { face } = bitbybit.occt.shapes;
const { operations } = bitbybit.occt;
const { lists } = bitbybit;
// Define the main function to create hexagon holes on a face
const start = async () => {
// Create a rectangular face as the base shape
const faceOptions = new RectangleDto();
faceOptions.width = 20;
faceOptions.length = 14;
faceOptions.center = [0, 0, 0];
faceOptions.direction = [0, 1, 0];
const rectangleFace = await face.createRectangleFace(faceOptions);
// Define scale patterns for U and V directions
// For hexagons, uniform scaling often works best due to natural packing
const scalePatternU = [0.9]; // Uniform hexagon size in U direction
const scalePatternV = [0.9]; // Uniform hexagon size in V direction
// Subdivide the face into hexagonal holes
const subdivideOptions = new FaceSubdivideToHexagonHolesDto<TopoDSFacePointer>();
subdivideOptions.shape = rectangleFace;
subdivideOptions.nrHexagonsU = 10; // Number of hexagon divisions in U direction
subdivideOptions.nrHexagonsV = 10; // Number of hexagon divisions in V direction
subdivideOptions.flatU = false; // Pointy-top orientation (false) vs flat-top (true)
subdivideOptions.holesToFaces = false; // Return wires instead of faces
subdivideOptions.offsetFromBorderU = 0.01; // Small border offset in U direction
subdivideOptions.offsetFromBorderV = 0.01; // Small border offset in V direction
subdivideOptions.scalePatternU = scalePatternU;
subdivideOptions.scalePatternV = scalePatternV;
const holes = await face.subdivideToHexagonHoles(subdivideOptions);
// Get the first hole (the outer boundary with hexagonal holes)
const firstHole = lists.getItem({ list: holes, index: 0, clone: true });
// Extrude the face with holes to create a 3D honeycomb structure
const extrudeOptions = new ExtrudeDto<TopoDSWirePointer>();
extrudeOptions.shape = firstHole;
extrudeOptions.direction = [0, 1, 0];
const extrudedSolid = await operations.extrude(extrudeOptions);
// Draw the resulting 3D solid with hexagonal holes
bitbybit.draw.drawAnyAsync({
entity: extrudedSolid
});
}
// Execute the function
start();
Understanding Hexagonal Hole Subdivision
The subdivideToHexagonHoles function creates honeycomb-like patterns by intelligently arranging hexagonal holes in an optimal packing configuration. Unlike rectangular grids, hexagonal patterns provide the most efficient use of space while maintaining structural integrity - a principle observed throughout nature from beehives to crystal structures.
This approach is particularly valuable for applications requiring:
- Maximum strength-to-weight ratio
- Optimal material efficiency
- Natural aesthetic appeal
- Superior structural properties
- Biomimetic design principles
Key Parameters and Hexagonal Properties
Grid Division Controls
nrHexagonsU and nrHexagonsV: These parameters control the number of hexagonal divisions in each direction. The function automatically handles the complex geometry of hexagonal packing, including the offset pattern that creates the characteristic honeycomb structure.
offsetFromBorderU and offsetFromBorderV: Due to the efficient packing of hexagons, smaller offset values (0.01-0.05) typically work well, as hexagons naturally create more uniform edge spacing than rectangular patterns.
Hexagonal Orientation Control
flatU: This unique parameter controls hexagon orientation:
false: Creates "pointy-top" hexagons (⬢) - optimal for structural applicationstrue: Creates "flat-top" hexagons (⬣) - often preferred for visual applications
The orientation affects both aesthetics and structural properties, with pointy-top configurations typically providing better load distribution.
Scale Pattern Optimization
For hexagonal patterns, scale patterns work differently than rectangular grids:
- Uniform scaling:
[1.0]or[0.9]often produces the most visually pleasing results - Gentle variations:
[0.9, 0.95, 0.9]create subtle size variations without disrupting the natural flow - Gradient effects:
[1.0, 0.8, 0.6, 0.8, 1.0]can create interesting radial or linear transitions
Design Considerations and Applications
Hexagonal patterns offer unique advantages through their natural efficiency. You can create organic flow patterns using gentle scale variations like [0.95, 0.9, 0.85, 0.9, 0.95] or breathing effects with [0.7, 0.85, 1.0, 0.85, 0.7]. The six-sided geometry naturally distributes loads more evenly than rectangular patterns while providing maximum area coverage with minimum material usage.
These patterns excel in aerospace applications for lightweight structural panels, architectural facades that combine aesthetics with efficiency, and biomedical devices that mimic natural cellular structures. The flatU parameter controls orientation - use false for pointy-top hexagons in structural applications or true for flat-top configurations when visual appeal is the priority.
Start with uniform scaling patterns to understand the basic behavior, then experiment with gentle variations. The mathematical perfection of hexagonal geometry means even simple patterns often produce sophisticated results that balance natural beauty with superior functional performance.



