Extrude
In DeclaraCAD an extrusion is done using the Prism
declaration as it follows OpenCASCADE's naming conventions. A Prism
must either be given a shape
attribute with the wire or face to extrude or include the part to extrude within the block. The vector
attribute then tells it how much and in which direction to extrude.
Note: If you don't like the
Prism
name, you can use python to rename the import by addingfrom declaracad.occ.api import Prism as Extrude
after the other statement to rename it.
Using Prism
with a face will create a solid.
# Created in DeclaraCAD
from declaracad.occ.api import *
enamldef Assembly(Part):
Prism:
# Extrude in this direction
vector = (0, 0, 5)
Face:
Rectangle:
width = 10
height = 20
rx = 3
Using Prism
on a wire will extrude into a surface, here the bezier curve is extruded twice in different directions to create a solid.
# Created in DeclaraCAD
from declaracad.occ.api import *
enamldef Assembly(Part):
Prism:
transparency = 0.5
vector = (0, 5, 0)
Prism:
vector = (0, 0, 5)
Bezier:
points = [(10, 0), (15, 5), (15, -5), (20, 0)]