Skip to content

Instantly share code, notes, and snippets.

@jdegenstein
jdegenstein / discord_code_snippet
Created November 27, 2023 20:22
to format multiline python in discord ...
to format multi-line python code in discord, type: \```py```py
def codegoeshere():
print("foobar")
```\```
@jdegenstein
jdegenstein / build123d-OCP.code-snippets
Last active November 14, 2024 21:14
VSCode Snippet for build123d + OCP CAD Viewer modeling / speed running
{
// build123d CodeCAD speedmodeling snippet by Jern
//
// This was specifically designed for use with TooTallToby's modeling challenges, but applicable for
// all CodeCAD modeling, but customize as desired for your own needs. This provides:
// 1. A file template that reduces the time necessary to "just start coding/modeling"
// 2. Shortcuts like "?ebds + TAB" that creates a BuildSketch + extrude block
//
// recommended to bind "Snippets: Fill file with Snippet" to e.g. CTRL + ALT + N
// recommended to bind "Jupyter: Restart Kernel" to e.g. CTRL + ALT + /
@jdegenstein
jdegenstein / soma_cube_assembly_cq.py
Last active July 19, 2022 17:58
CadQuery assembly of a Soma Cube Puzzle using constraints
import cadquery as cq
from random import randrange as rrr
from random import seed
#Soma set consists of 7 separate pieces
# 4 pieces can be x-y plane only, other 3 require x-y-z
#keep the same pseudo random colors later:
seed(5)#keep colors run-to-run
#(3,4,5,77,777,51221,512796321 are good seeds)
@jdegenstein
jdegenstein / cq_occ_fuse_hash_testing.py
Last active July 2, 2022 02:50
CadQuery OCC FUSE Hash Testing with Output of New Faces
import cadquery as cq
from random import randrange as rrr
from random import seed
seed(10) #set seed for consistent colors
from OCP.BRepPrimAPI import (
BRepPrimAPI_MakePrism,
)
from OCP.BRepAlgoAPI import (
BRepAlgoAPI_Common,
@jdegenstein
jdegenstein / cq_occ_hash_woutput.py
Last active July 2, 2022 02:48
CadQuery OCC CUT Hash Testing with Output of New Faces
#CadQuery OCC Hash Testing with Output of New Faces
#cq_occ_hash_woutput.py
import cadquery as cq
from random import randrange as rrr
from random import seed
seed(10) #set seed for consistent colors
from OCP.BRepPrimAPI import (
BRepPrimAPI_MakePrism,
)
@jdegenstein
jdegenstein / cq_occ_hash_testing.py
Created June 30, 2022 20:17
CadQuery OCC Hash Testing
import cadquery as cq
from OCP.BRepPrimAPI import (
BRepPrimAPI_MakePrism,
)
from OCP.BRepAlgoAPI import (
BRepAlgoAPI_Common,
BRepAlgoAPI_Fuse,
BRepAlgoAPI_Cut,
BRepAlgoAPI_BooleanOperation,
@jdegenstein
jdegenstein / CQ_clock.py
Last active June 29, 2022 15:06
CadQuery Clock
import cadquery as cq
from cadquery import Location, Vector
from math import degrees, sin, cos, radians, pi
od = 100
dotr = 2
rim = 4
dot_offs = 10
ov_th = 5
dot_ang = 360/12