Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
masuidrive committed Oct 24, 2023
0 parents commit f801225
Show file tree
Hide file tree
Showing 10 changed files with 527 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"hostRequirements": {
"memory": "8gb"
},
"customizations": {
"vscode": {
"extensions": [
"bierner.markdown-preview-github-styles",
"mutantdino.resourcemonitor",
"esbenp.prettier-vscode"
]
}
},

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "18"
}
},
"remoteEnv": {
// https://code.visualstudio.com/remote/advancedcontainers/environment-variables
// "PATH": "${containerEnv:PATH}:/some/other/path",
// "MY_REMOTE_VARIABLE2": "${localEnv:SOME_LOCAL_VAR}"
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [4000, 8080, 9099]
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "./setup.sh"
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
3 changes: 3 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

npm install -g prettier
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
node_modules
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files.associations": {
"*.jscad": "javascript"
},
"editor.wordWrap": "on"
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# keycaps-jscad
1 change: 1 addition & 0 deletions chocv1_08u/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.stl
35 changes: 35 additions & 0 deletions chocv1_08u/basic.jscad
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const jscadModeling = require('@jscad/modeling')
// const stem = require("./chocv1_stem.js")

function main(parameters) {
let { scale, size } = parameters;
const { colorize } = jscadModeling.colors
const { cube, cuboid, line, sphere, star } = jscadModeling.primitives
const { intersect, subtract } = jscadModeling.booleans

const logo = [
colorize([1.0, 0.4, 1.0], subtract(
cube({ size }),
sphere({ radius: 200 })
)),
colorize([1.0, 1.0, 0], intersect(
sphere({ radius: 130 }),
cube({ size: 210 })
))
]

const transpCube = colorize([1, 0, 0, 0.75], cuboid({ size: [100 * scale, 100, 210 + (200 * scale)] }))
const star2D = star({ vertices: 8, innerRadius: 150, outerRadius: 200 })
const line2D = colorize([1.0, 0, 0], line([[220, 220], [-220, 220], [-220, -220], [220, -220], [220, 220]]))

return [transpCube, line2D, star2D, ...logo]
}

function getParameterDefinitions() {
return [
{ name: 'size', caption: 'size of outer box:', type: 'float', initial: 300 },
{ name: 'scale', caption: 'Scale of inner box:', type: 'slider', initial: 1, min: 0, max: 5 },
];
}

module.exports = { main, getParameterDefinitions }
23 changes: 23 additions & 0 deletions chocv1_08u/chocv1_stem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const jscadModeling = require('@jscad/modeling')

const { cube, cuboid, cylinder, cylinderElliptic, ellipsoid, geodesicSphere, roundedCuboid, roundedCylinder, sphere, torus } = jscadModeling.primitives

const createPrimitives = () => {
return [
cube(),
cuboid({ size: [1, 2, 3] }),
roundedCuboid({ size: [2, 3, 2], roundRadius: 0.4, segments: 32 }),
roundedCuboid({ size: [1, 2, 3], roundRadius: 0.4, segments: 16 }),
sphere({ radius: 2, segments: 16 }),
geodesicSphere({ radius: 1.5, segments: 16 }),
ellipsoid({ radius: [2, 1, 1.5], segments: 64, axes: [[1, 1, 0], [0, -1, 1], [-1, 0, 1]] }),
cylinder({ radius: 1, height: 5 }),
roundedCylinder({ radius: 1, height: 8, roundRadius: 0.8 }),
cylinderElliptic({ height: 8, startRadius: [1, 2], startAngle: 0, endRadius: [1, 2], endAngle: (Math.PI / 8), segments: 32 }),
cylinder({ start: [0, 0, 0], end: [3, 3, 10], radius: 1 }),
torus({ innerRadius: 1, outerRadius: 1.2 }),
torus({ innerRadius: 1, outerRadius: 1.5, innerSegments: 4, outerSegments: 6, innerRotation: 0 })
]
}

module.exports = createPrimitives
Loading

0 comments on commit f801225

Please sign in to comment.