You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.6 KiB
53 lines
1.6 KiB
import cadquery as cq
|
|
from cqmore import Workplane
|
|
from cqmore.curve import archimedeanSpiral, circle
|
|
from cqmore.polygon import regularPolygon, star
|
|
from random import randint, choice
|
|
import functools as fnc
|
|
import itertools as it
|
|
|
|
picture_height = 178.3
|
|
length = picture_height+5
|
|
picture_length = 4.2
|
|
width = picture_length + 10
|
|
picture_width = 127
|
|
height = picture_width + 10
|
|
|
|
triangle_size = 25
|
|
triangle_width = width+15
|
|
|
|
|
|
def makeTriangle(self, width, height, x_offset=0, y_offset=0):
|
|
return (self.moveTo(x_offset-(width), y_offset).makePolygon(
|
|
[
|
|
(width, height, 0), (width*2, 0, 0), (width*2, width*2, 0),
|
|
]
|
|
))
|
|
|
|
def add_triangle(plane, width, height, offset):
|
|
return plane.triangle(width, height, y_offset=offset)
|
|
|
|
Workplane.triangle = makeTriangle
|
|
|
|
result = Workplane("front").box(length, width, height)
|
|
|
|
result = result.workplane().box(length-20, width, height-15, True, "cut")
|
|
|
|
result = result.workplane().box(length-2, picture_length, picture_width+2, True, "cut")
|
|
|
|
result = result.faces("<X[4]").workplane(0, True).rect(width, height).cutBlind(1)
|
|
|
|
result = (result.faces("<X[0]")
|
|
.workplane()
|
|
.rect(width, height)
|
|
.extrude(triangle_size*0.5)
|
|
.faces("<Z[4]")
|
|
.workplane()
|
|
.triangle(triangle_size , triangle_size, 0, -(triangle_size))
|
|
.extrude(triangle_width)
|
|
.faces("<Z[1]")
|
|
.workplane()
|
|
.triangle(triangle_size,triangle_size, 0, -(triangle_size))
|
|
.extrude(triangle_width))
|
|
|
|
cq.exporters.export(result, "/home/deck/cad_files/small_frame.step")
|
|
|