You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Learn how to create basic wire primitives composed out of multiple edges
tags
code
occt
rete
blockly
typescript
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import BitByBitRenderCanvas from '@site/src/components/BitByBitRenderCanvas';
Introduction to OCCT Wire Basic Primitives
Wires are one-dimensional geometric entities that represent connected sequences of edges forming open or closed curves. OCCT provides several primitive wire types that serve as building blocks for more complex 2D and 3D modeling operations. These wire primitives are commonly used to create profiles for extrusion, sweeping, and other advanced geometric operations.
This example demonstrates the creation of the most common primitive wire types:
Circle Wire: A circular wire with specified radius and center
Square Wire: A square-shaped wire with specified size and center
NGon Wire: A regular polygon wire with specified number of corners
Parallelogram Wire: A parallelogram-shaped wire with width, height, and angle
Rectangle Wire: A rectangular wire with specified width and length
Ellipse Wire: An elliptical wire with major and minor radii
circleWiresquareWirengonWireparallelogramWirerectangleWireellipseWirecircleWire3000010squareWire3500010ngonWire-60001062parallelogramWire-1100010TRUE3230rectangleWire26900010ellipseWire120001014circleWiresquareWirengonWireparallelogramWirerectangleWireellipseWire","version":"0.20.7","type":"blockly"}}
title="Creating basic wire primitives"
/>
{\n // Create a circle wire\n const circleOptions = new CircleDto();\n circleOptions.radius = 3;\n circleOptions.center = [0, 0, 0] as Point3;\n circleOptions.direction = [0, 1, 0] as Vector3;\n\n const circleWire = await wire.createCircleWire(circleOptions);\n\n // Create a square wire at a different position\n const squareOptions = new SquareDto();\n squareOptions.size = 3;\n squareOptions.center = [5, 0, 0] as Point3;\n squareOptions.direction = [0, 1, 0] as Vector3;\n\n const squareWire = await wire.createSquareWire(squareOptions);\n\n // Create an NGon wire (hexagon)\n const ngonOptions = new NGonWireDto();\n ngonOptions.center = [-6, 0, 0] as Point3;\n ngonOptions.direction = [0, 1, 0] as Vector3;\n ngonOptions.nrCorners = 6;\n ngonOptions.radius = 2;\n\n const ngonWire = await wire.createNGonWire(ngonOptions);\n\n // Create a parallelogram wire\n const parallelogramOptions = new ParallelogramDto();\n parallelogramOptions.center = [-11, 0, 0] as Point3;\n parallelogramOptions.direction = [0, 1, 0] as Vector3;\n parallelogramOptions.aroundCenter = true;\n parallelogramOptions.width = 3;\n parallelogramOptions.height = 2;\n parallelogramOptions.angle = 30;\n\n const parallelogramWire = await wire.createParallelogramWire(parallelogramOptions);\n\n // Create a rectangle wire\n const rectangleOptions = new RectangleDto();\n rectangleOptions.width = 2;\n rectangleOptions.length = 6;\n rectangleOptions.center = [9, 0, 0] as Point3;\n rectangleOptions.direction = [0, 1, 0] as Vector3;\n\n const rectangleWire = await wire.createRectangleWire(rectangleOptions);\n\n // Create an ellipse wire\n const ellipseOptions = new EllipseDto();\n ellipseOptions.center = [12, 0, 0] as Point3;\n ellipseOptions.direction = [0, 1, 0] as Vector3;\n ellipseOptions.radiusMinor = 1;\n ellipseOptions.radiusMajor = 4;\n\n const ellipseWire = await wire.createEllipseWire(ellipseOptions);\n\n // Draw all the created wires\n bitbybit.draw.drawAnyAsync({ entity: circleWire });\n bitbybit.draw.drawAnyAsync({ entity: squareWire });\n bitbybit.draw.drawAnyAsync({ entity: ngonWire });\n bitbybit.draw.drawAnyAsync({ entity: parallelogramWire });\n bitbybit.draw.drawAnyAsync({ entity: rectangleWire });\n bitbybit.draw.drawAnyAsync({ entity: ellipseWire });\n}\n\n// Execute the function\nstart();","version":"0.20.7","type":"typescript"}}
title="Creating basic wire primitives"
/>
These primitive wires serve as the foundation for more complex 2D and 3D modeling operations. They can be used to create faces through surface generation, extruded into solids, used as profiles for sweeping operations, or combined and modified to create sophisticated wireframe geometries for engineering and design applications.