| sidebar_position | 3 | |
|---|---|---|
| title | Edge Primitives | |
| sidebar_label | Edge Primitives | |
| description | Master the fundamentals of edge creation in OCCT - from simple lines and circles to complex arcs and ellipses. Learn multiple methods to create precise geometric boundaries for your 3D models. | |
| tags |
|
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import BitByBitRenderCanvas from '@site/src/components/BitByBitRenderCanvas';
Edge primitives are the fundamental building blocks for creating geometric boundaries in 3D modeling. In OCCT (Open CASCADE Technology), edges define the boundaries between faces and form the skeleton of complex 3D shapes. This tutorial covers the essential edge types you'll use in most modeling scenarios.
In this tutorial, you'll discover how to create:
- Linear edges - straight lines between two points
- Circular arcs - curved segments using various definition methods
- Complete circles - closed circular boundaries
- Elliptical edges - oval-shaped curves with dual radii
Each example is provided in three formats: Rete (visual node-based), Blockly (block-based), and TypeScript (code-based), so you can learn using your preferred approach.
Understanding edge primitives is crucial because:
- They form the boundaries of all 3D shapes
- They enable precise geometric control in your models
- They provide multiple creation methods for different design scenarios
- They serve as the foundation for more complex geometric operations
Let's start with the most basic edge primitive - the line edge.
startPointendPointstartPoint-500endPoint500startPointendPointstartPointendPoint","version":"0.20.7","type":"blockly"}} title="Creating primitive solids" /> {\n // Create start and end points\n const startPoint: Point3 = [-5, 0, 0];\n const endPoint: Point3 = [5, 0, 0];\n\n // Create a line between the points\n const lineOptions = new LineDto();\n lineOptions.start = startPoint;\n lineOptions.end = endPoint;\n\n const line = await bitbybit.occt.shapes.edge.line(lineOptions);\n\n // Draw the line and points\n bitbybit.draw.drawAnyAsync({ entity: line });\n bitbybit.draw.drawAnyAsync({ entity: startPoint });\n bitbybit.draw.drawAnyAsync({ entity: endPoint });\n}\n\n// Execute the function\nstart();","version":"0.20.7","type":"typescript"}} title="Creating primitive solids" />
This example demonstrates how to create a simple straight line edge in 3D space. A line edge is the most basic type of edge primitive, defined by two points: a start point and an end point.
What's happening:
- We define two points:
startPointat[-5, 0, 0]andendPointat[5, 0, 0] - These points create a horizontal line along the X-axis, 10 units long
- The
LineDtoobject packages our start and end points for the OCCT line creation function - The result is a straight edge that can be used in more complex geometries or displayed on its own
Key concepts:
- Start and End Points: Every line needs exactly two points to define its position and direction
- 3D Coordinates: Points are specified as
[x, y, z]coordinates in 3D space - Edge vs Line: An edge is a geometric boundary that can be part of a face or solid, while a line is the mathematical definition
This example shows how to create an arc edge that passes through three specific points. This is one of the most intuitive ways to define an arc since you can directly control three points that the arc must pass through.
What's happening:
- We define three points:
startPointat[-5, 0, 0],midPointat[0, 6, 0], andendPointat[5, 0, 0] - The arc starts at the first point, curves through the middle point, and ends at the third point
- OCCT automatically calculates the circular arc that best fits these three points
- The middle point determines how much the arc curves - higher Y values create more pronounced curves
Key concepts:
- Three-Point Definition: The arc is uniquely defined by exactly three non-collinear points
- Curve Direction: The order of points matters - the arc flows from start to middle to end
- Geometric Constraint: The three points cannot be in a straight line (collinear) as this wouldn't define a unique arc
This example demonstrates creating an arc using two endpoints and a tangent vector that controls the arc's curvature at the start point. This method gives you precise control over both the arc's endpoints and its initial direction.
What's happening:
- We define two endpoints:
startPointat[-5, 0, 0]andendPointat[5, 0, 0] - We create a tangent vector by subtracting two points: from
startPointtovecEndPtat[-2, 3, 0] - This tangent vector controls how the arc curves away from the start point
- The arc begins at the start point, follows the tangent direction initially, then curves to reach the end point
Key concepts:
- Tangent Vector: Defines the direction the arc travels when leaving the start point
- Vector Calculation: We calculate the tangent by finding the direction from one point to another
- Curvature Control: The tangent vector's direction and magnitude influence how sharply the arc curves
- Helper Visualization: The example draws additional lines to show the tangent direction and reference points
This example shows how to create an arc by extracting a portion of an existing circle edge between two specified points. This method is useful when you want to create an arc that follows a specific circular path.
What's happening:
- First, we create a complete circle edge with radius 5, centered at the origin
- We define two points:
startPointat[8, 0, 0]andendPointat[8, 0, 8] - The system finds where these points would intersect the circle (projected onto the circle if needed)
- An arc is created along the circle's circumference between these two intersection points
- Helper lines are drawn to visualize the relationship between the center and the arc endpoints
Key concepts:
- Base Circle: The arc follows the exact curvature of the parent circle
- Point Projection: Points are projected onto the circle to find valid start/end positions
- Arc Direction: The
senseparameter controls whether the arc goes clockwise or counterclockwise - Geometric Relationship: The resulting arc maintains the same radius and center as the original circle
This example demonstrates creating an arc by specifying a base circle and two angular positions. This method provides precise control over the arc's span using angle measurements.
What's happening:
- We start with a circle edge (radius 5, centered at origin)
- Two angles are specified:
alphaAngle1at 45° andalphaAngle2at 270° - The arc is created between these two angular positions on the circle
- The result is a portion of the circle spanning from 45° to 270° (a 225° arc)
Key concepts:
- Angular Definition: Angles are measured in degrees from a reference direction (typically the positive X-axis)
- Arc Span: The difference between the two angles determines how much of the circle becomes the arc
- Direction Control: The
senseparameter determines if the arc goes from angle1 to angle2 or the other way - Precise Control: This method is ideal when you know exactly what angular portion of a circle you need
This example shows how to create an arc starting from a specific point on a circle and extending through a specified angular distance. This method combines point-based positioning with angular measurement.
What's happening:
- We create a base circle (radius 5, centered at origin)
- A starting point is defined at
[8, 0, 8]which gets projected onto the circle - An angle of 360° is specified, creating a complete circular arc (full circle)
- The arc begins at the projected point location and sweeps through the specified angle
- Helper elements show the center point, the reference point, and connecting lines
Key concepts:
- Point Projection: The specified point is projected onto the circle to find the actual start position
- Angular Sweep: The angle determines how far around the circle the arc extends
- Complete Circle: A 360° angle creates a full circular arc, essentially recreating the original circle
- Starting Position: Unlike other methods, this gives you control over exactly where on the circle the arc begins
This example demonstrates creating a complete circular edge, which is one of the most fundamental curved primitives in 3D modeling. A circle edge represents a perfect circular boundary that can be used as a standalone geometry or as part of more complex shapes.
What's happening:
- We define a circle with radius 5 units, centered at the origin
[0, 0, 0] - The direction vector
[0, 1, 0]specifies that the circle lies in a plane perpendicular to the Y-axis (horizontal plane) - The
CircleDtoobject packages all the circle parameters for the OCCT creation function - The result is a complete circular edge that forms a closed loop
Key concepts:
- Radius: Determines the size of the circle (distance from center to edge)
- Center Point: The position in 3D space where the circle is located
- Direction Vector: Defines the orientation of the plane containing the circle
- Closed Curve: A circle is a closed curve, meaning it has no start or end points
This example demonstrates creating an elliptical edge, which is an oval-shaped curve that extends the concept of a circle to have two different radii. Ellipses are commonly used in technical drawings and 3D modeling for creating elongated circular shapes.
What's happening:
- We define an ellipse centered at the origin
[0, 0, 0] - The direction vector
[0, 1, 0]specifies the orientation plane (horizontal, like the circle) - Two radii are specified:
radiusMinor= 3 (shorter radius) andradiusMajor= 10 (longer radius) - The result is an oval shape that is 20 units wide and 6 units tall
- The
EllipseDtoobject packages all parameters for the OCCT creation function
Key concepts:
- Major Radius: The longer radius that defines the ellipse's widest dimension
- Minor Radius: The shorter radius that defines the ellipse's narrower dimension
- Aspect Ratio: The relationship between major and minor radii determines how "stretched" the ellipse appears
- Closed Curve: Like a circle, an ellipse is a closed curve with no endpoints
- Geometric Relationship: When major and minor radii are equal, the ellipse becomes a perfect circle