Skip to content

Commit c45d529

Browse files
migrated some new docs
1 parent 0d7a012 commit c45d529

File tree

6 files changed

+90
-4
lines changed

6 files changed

+90
-4
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"label": "Edge",
3+
"position": 2,
4+
"link": {
5+
"type": "generated-index"
6+
}
7+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
sidebar_position: 2
3+
title: "Understanding and Visualizing OCCT Edge Indexing"
4+
sidebar_label: Edge Indexing
5+
description: Learn how to use and visualize edge indexes in OCCT for operations like filleting or chamfering specific edges, and how to adjust their display in Bitbybit.
6+
tags: [occt]
7+
---
8+
import BitByBitRenderCanvas from '@site/src/components/BitByBitRenderCanvas';
9+
10+
# OCCT Edge Indexing: Identifying and Using Specific Edges
11+
12+
<img
13+
src="https://s.bitbybit.dev/assets/icons/white/occt-icon.svg"
14+
alt="OCCT category icon with a stylized logo representation"
15+
width="100"
16+
title="OCCT category icon" />
17+
18+
## Introduction to Edge Indexing
19+
20+
In many CAD modeling scenarios, you'll need to select and operate on specific edges of a shape. For example, when applying a fillet (rounding) or a chamfer to particular edges of a solid or shell, you need a way to tell the system *which* edges to modify. This is where **edge indexing** comes into play.
21+
22+
Each edge on an OCCT shape has an index, which acts like an address or identifier for that specific edge within the context of that particular shape. Operations like filleting or chamfering often accept a list of these edge indexes to target the desired edges.
23+
24+
**Important Note on Indexing Convention:**
25+
Due to some legacy reasons, particularly related to Blockly integration, edge indexes in many Bitbybit OCCT operations start from **1**, not 0 (which is more common in programming). Always be mindful of this 1-based indexing when providing edge indexes.
26+
27+
## How to Know Which Index Applies to Which Edge?
28+
29+
To identify the index of a specific edge on your 3D model, Bitbybit provides a way to visualize these indexes directly in the 3D scene.
30+
31+
* When using a `drawAnyAsync` command (or its equivalent in visual editors) with an OCCT shape as the entity, you can provide specific OCCT drawing options.
32+
* Within these options, there's a setting like **"Draw Edge Indexes"** (or `drawEdgeIndexes` in TypeScript).
33+
* Turning this option on will render the numerical index next to each edge of the shape in the 3D view.
34+
35+
**Caution: Index Instability After Modification**
36+
Keep in mind that if you perform an operation that changes the topology of the shape (like applying a fillet or chamfer), the number of edges on your shape will likely change. Consequently, the **old index values will no longer be valid or may refer to different edges** on the modified shape. You would need to re-visualize the indexes on the new shape if further indexed operations are required.
37+
38+
### Examples: Visualizing Edge Indexes
39+
40+
Below are examples in TypeScript, Blockly, and Rete that demonstrate creating a simple solid box and enabling the drawing of its edge indexes.
41+
42+
**TypeScript Example: Drawing Edge Indexes**
43+
<BitByBitRenderCanvas
44+
requireManualStart={true}
45+
script={{"script":"const start = async () => {\n\n const boxOpt = new Bit.Inputs.OCCT.BoxDto();\n boxOpt.width = 5;\n boxOpt.length = 8;\n boxOpt.height = 10;\n const box = await bitbybit.occt.shapes.solid.createBox(boxOpt);\n\n const drawOpt = new Bit.Inputs.Draw.DrawOcctShapeOptions();\n drawOpt.drawEdgeIndexes = true;\n drawOpt.faceOpacity = 0.3;\n drawOpt.edgeOpacity = 0.3;\n drawOpt.edgeIndexHeight = 0.24\n\n bitbybit.draw.drawAnyAsync({\n entity: box,\n options: drawOpt\n });\n}\n\nstart();\n","version":"0.20.3","type":"typescript"}}
46+
title="Edge Indexing"
47+
/>
48+
49+
**Blockly Example: Drawing Edge Indexes**
50+
<BitByBitRenderCanvas
51+
requireManualStart={true}
52+
script={{"script":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"bitbybit.draw.drawAnyAsyncNoReturn\" id=\"UO^K1-FNciNjT{DsaF2S\" x=\"-1052\" y=\"-1219\"><value name=\"Entity\"><block type=\"bitbybit.occt.shapes.solid.createBox\" id=\"kAPiNsy.MZ9?u8OMw:F{\"><value name=\"Width\"><block type=\"math_number\" id=\"ps%ZB=Lg|=n2+WoN88L;\"><field name=\"NUM\">5</field></block></value><value name=\"Length\"><block type=\"math_number\" id=\"9AIhYC!Bl`qQ=@rx{Hvm\"><field name=\"NUM\">8</field></block></value><value name=\"Height\"><block type=\"math_number\" id=\"VA?PT:1w_do!EcPH3o`H\"><field name=\"NUM\">10</field></block></value><value name=\"Center\"><block type=\"bitbybit.point.pointXYZ\" id=\"*C~h4g-MdUu*}L~6n9W;\"><value name=\"X\"><block type=\"math_number\" id=\"HSM/v}`gGJkJyeK.OYgI\"><field name=\"NUM\">0</field></block></value><value name=\"Y\"><block type=\"math_number\" id=\"Co1x#c;yRR~3n8]irr}O\"><field name=\"NUM\">0</field></block></value><value name=\"Z\"><block type=\"math_number\" id=\"n.I1=AL{C-iE4{hZiuRz\"><field name=\"NUM\">0</field></block></value></block></value></block></value><value name=\"Options\"><block type=\"bitbybit.draw.optionsOcctShape\" id=\"C)_;nd+-yNa2tkQ=f.(j\"><value name=\"FaceOpacity\"><block type=\"math_number\" id=\"WJFo/9(aQI[,F]A0,{nV\"><field name=\"NUM\">0.3</field></block></value><value name=\"EdgeOpacity\"><block type=\"math_number\" id=\"2xaR^pUK:5[w$[i*9iEJ\"><field name=\"NUM\">0.3</field></block></value><value name=\"EdgeColour\"><block type=\"colour_picker\" id=\"1Kbr5PB^wsuJ9`NhR,g(\"><field name=\"COLOUR\">#ffffff</field></block></value><value name=\"FaceColour\"><block type=\"colour_picker\" id=\"OsgqgBob6so1DhNeQTzf\"><field name=\"COLOUR\">#ff0000</field></block></value><value name=\"EdgeWidth\"><block type=\"math_number\" id=\"S[;)nHF3kw,0T6.imOS:\"><field name=\"NUM\">2</field></block></value><value name=\"DrawEdges\"><block type=\"logic_boolean\" id=\"o~*ZYZY;JaHYEi`Cc$Zb\"><field name=\"BOOL\">TRUE</field></block></value><value name=\"DrawFaces\"><block type=\"logic_boolean\" id=\"Sg:lgzZ4(fSu^x%a#Sol\"><field name=\"BOOL\">TRUE</field></block></value><value name=\"Precision\"><block type=\"math_number\" id=\",MwLCD$,blZsB`:NR`m_\"><field name=\"NUM\">0.01</field></block></value><value name=\"DrawEdgeIndexes\"><block type=\"logic_boolean\" id=\"NWp7H~{+?}[IWv/g{Im,\"><field name=\"BOOL\">TRUE</field></block></value><value name=\"EdgeIndexHeight\"><block type=\"math_number\" id=\"F5O^[n@Xq)6N-}71wc:_\"><field name=\"NUM\">0.24</field></block></value><value name=\"EdgeIndexColour\"><block type=\"colour_picker\" id=\"i*VgIX^h~3nr1S.o1-3y\"><field name=\"COLOUR\">#ff00ff</field></block></value><value name=\"DrawFaceIndexes\"><block type=\"logic_boolean\" id=\"|S~9#-TIn?ed*=]V?*1h\"><field name=\"BOOL\">FALSE</field></block></value><value name=\"FaceIndexHeight\"><block type=\"math_number\" id=\"G3,mdV2.$_lJl4,Uh/zF\"><field name=\"NUM\">0.06</field></block></value><value name=\"FaceIndexColour\"><block type=\"colour_picker\" id=\";7fHMr6^$BfeQ3x(9Xy.\"><field name=\"COLOUR\">#0000ff</field></block></value></block></value></block></xml>","version":"0.20.3","type":"blockly"}}
53+
title="Edge Indexing"
54+
/>
55+
56+
**Rete Example: Drawing Edge Indexes**
57+
<BitByBitRenderCanvas
58+
requireManualStart={true}
59+
script={{"script":"{\"id\":\"rete-v2-json\",\"nodes\":{\"88e0333871f34e09\":{\"id\":\"88e0333871f34e09\",\"name\":\"bitbybit.occt.shapes.solid.createBox\",\"customName\":\"box\",\"async\":true,\"drawable\":true,\"data\":{\"genericNodeData\":{\"hide\":true,\"oneOnOne\":false,\"flatten\":0,\"forceExecution\":false},\"width\":5,\"length\":8,\"height\":10,\"center\":[0,0,0],\"originOnCenter\":true},\"inputs\":{},\"position\":[-846.1000022577027,778.8093041611836]},\"76f7f3e52d369e97\":{\"id\":\"76f7f3e52d369e97\",\"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\":\"88e0333871f34e09\",\"output\":\"result\",\"data\":{}}]},\"options\":{\"connections\":[{\"node\":\"7561c973c8b2bfaa\",\"output\":\"result\",\"data\":{}}]}},\"position\":[-431.68995025210455,1062.6003327458436]},\"7561c973c8b2bfaa\":{\"id\":\"7561c973c8b2bfaa\",\"name\":\"bitbybit.draw.optionsOcctShape\",\"customName\":\"options occt shape\",\"async\":false,\"drawable\":false,\"data\":{\"genericNodeData\":{\"hide\":false,\"oneOnOne\":false,\"flatten\":0,\"forceExecution\":false},\"faceOpacity\":0.3,\"edgeOpacity\":0.3,\"edgeColour\":\"#ffffff\",\"faceColour\":\"#ff0000\",\"vertexColour\":\"#ff00ff\",\"edgeWidth\":2,\"vertexSize\":0.03,\"drawEdges\":true,\"drawFaces\":true,\"drawVertices\":false,\"precision\":0.01,\"drawEdgeIndexes\":true,\"edgeIndexHeight\":0.24,\"edgeIndexColour\":\"#ff00ff\",\"drawFaceIndexes\":false,\"faceIndexHeight\":0.06,\"faceIndexColour\":\"#0000ff\"},\"inputs\":{},\"position\":[-903.5179710077027,1229.3171166611837]}}}","version":"0.20.3","type":"rete"}}
60+
title="Edge Indexing"
61+
/>
62+
63+
64+
## Adjusting Edge Index Display
65+
66+
Sometimes, the default display of edge indexes might not be optimal:
67+
68+
* **Indexes Not Visible (Geometry Too Large):** If your geometry is very large, the default text size for indexes might be too small to see. You can adjust the **`edgeIndexHeight`** property in the OCCT drawing options to make the index text larger.
69+
* **Indexes Overlapping (Geometry Too Small or Dense):** Conversely, if your geometry is small or has many edges close together, the index text might appear too large and overlap, making it unreadable. In this case, you can *decrease* the `edgeIndexHeight`.
70+
* **Visibility Through Faces:** To see indexes on edges that might be obscured by faces, it's often helpful to make the faces semi-transparent. You can do this by setting the **`faceOpacity`** property in the drawing options to a value less than 1 (e.g., 0.5). You can also adjust `edgeOpacity` if needed.
71+
72+
By using these visualization tools and understanding how edge indexing works, you can precisely target specific edges for various modeling operations in OCCT within the Bitbybit environment.

docs/learn/code/common/occt/shapes/edge.md renamed to docs/learn/code/common/occt/shapes/edge/edge.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
sidebar_position: 2
2+
sidebar_position: 1
33
title: "Working with Edges in OCCT"
4-
sidebar_label: OCCT Edge
4+
sidebar_label: Intro Edges
55
description: Learn about OCCT edges, how to create linear and curved edges, analyze their properties, use them to construct wires, and deconstruct other shapes into edges in Bitbybit.
66
slug: /editors/categories/occt/edge # Or adjust as needed
77
tags: [occt]

docs/learn/code/common/occt/shapes/shapes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
sidebar_position: 1
33
title: "Understanding OCCT Shape Types and Hierarchy"
4-
sidebar_label: OCCT Shapes
4+
sidebar_label: Intro Shapes
55
description: Explore the different types of shapes in OpenCascade Technology (OCCT) and understand their hierarchical relationship, from vertices to solids and compounds.
66
tags: [occt]
77
---
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"label": "Wire",
3+
"position": 3,
4+
"link": {
5+
"type": "generated-index"
6+
}
7+
}

docs/learn/code/common/occt/shapes/wire.md renamed to docs/learn/code/common/occt/shapes/wire/wire.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
sidebar_position: 3
33
title: "Working with Wires in OCCT"
4-
sidebar_label: OCCT Wire
4+
sidebar_label: Intro Wires
55
description: Learn about OCCT wires, how to create them from edges or points (polylines, splines, Bezier curves), their role in constructing faces, and how faces can have multiple wires (e.g., for holes).
66
tags: [occt]
77
---

0 commit comments

Comments
 (0)