diff --git a/app/api/src/docker/README.md b/app/api/src/docker/README.md
index 0e2c04b..f8f5e38 100644
--- a/app/api/src/docker/README.md
+++ b/app/api/src/docker/README.md
@@ -14,6 +14,8 @@ You'll need to have Docker installed
Because of the way the docker containers to be deployed as lambdas on aws are somewhat specialised for the purpose we're using `docker-compose` to spin one up for each function/endpoint. So we've added a aws-emulation layer
+The docker build relies on a git ignored file, the aws-lambda-rie. [Download it](https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/download/v1.0/aws-lambda-rie), then put it into `app/api/src/docker/common/`. alternatively you can put this download into the DockerFiles by reading the instructions at around line 29 of the DockerFiles (`app/api/src/docker/openscad/Dockerfile` & `app/api/src/docker/cadquery/Dockerfile`). However this will mean slower build times as it will need download this 14mb file every build.
+
Then cd into this folder `cd api/src/docker` and:
```bash
@@ -26,8 +28,7 @@ After which we'll also spin up a light express server to act as an emulator to t
yarn install
yarn emulate
```
-You can now add OPENSCAD_BASE_URL="http://localhost:8080" to you .env file and restart your main dev process (`yarn rw dev`)
-comment that line out if you want to go back to using the aws endpoint (and restart the dev process).
+You can now add CAD_LAMBDA_BASE_URL="http://localhost:8080" to you .env file and restart your main dev process (`yarn rw dev`) comment that line out if you want to go back to using the aws endpoint (and restart the dev process).
If you change anything in the `api/src/docker/openscad` directory, you will need to stop the docker process and restart it (will be fairly quick if you're only changing the js)
diff --git a/app/api/src/docker/aws-emulator.js b/app/api/src/docker/aws-emulator.js
index 19f0275..375eed1 100644
--- a/app/api/src/docker/aws-emulator.js
+++ b/app/api/src/docker/aws-emulator.js
@@ -10,9 +10,10 @@ app.use(cors())
const invocationURL = (port) =>
`http://localhost:${port}/2015-03-31/functions/function/invocations`
-app.post('/openscad/preview', async (req, res) => {
+const makeRequest = (route, port) => [route, async (req, res) => {
+ console.log(`making post request to ${port}, ${route}`)
try {
- const { data } = await axios.post(invocationURL(5052), {
+ const { data } = await axios.post(invocationURL(port), {
body: JSON.stringify(req.body),
})
res.status(data.statusCode)
@@ -21,20 +22,11 @@ app.post('/openscad/preview', async (req, res) => {
res.status(500)
res.send()
}
-})
-app.post('/cadquery/stl', async (req, res) => {
- console.log('making post request to 5060')
- try {
- const { data } = await axios.post(invocationURL(5060), {
- body: JSON.stringify(req.body),
- })
- res.status(data.statusCode)
- res.send(data.body)
- } catch (e) {
- res.status(500)
- res.send()
- }
-})
+}]
+
+app.post(...makeRequest('/openscad/preview', 5052))
+app.post(...makeRequest('/openscad/stl', 5053))
+app.post(...makeRequest('/cadquery/stl', 5060))
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
diff --git a/app/api/src/docker/cadquery/Dockerfile b/app/api/src/docker/cadquery/Dockerfile
index 4e91f91..861c222 100644
--- a/app/api/src/docker/cadquery/Dockerfile
+++ b/app/api/src/docker/cadquery/Dockerfile
@@ -37,7 +37,7 @@ RUN npm install
# Get the distribution copy of cq-cli
RUN apt-get install -y libglew2.1
-RUN wget https://github.com/CadQuery/cq-cli/releases/download/v2.2-beta.1/cq-cli-Linux-x86_64.zip
+RUN wget https://github.com/CadQuery/cq-cli/releases/download/v2.2-beta.2/cq-cli-Linux-x86_64.zip
# Comment the entry above out and uncomment the one below to revert to the stable release
# RUN wget https://github.com/CadQuery/cq-cli/releases/download/v2.1.0/cq-cli-Linux-x86_64.zip
RUN unzip cq-cli-Linux-x86_64.zip
diff --git a/app/api/src/docker/cadquery/runCQ.js b/app/api/src/docker/cadquery/runCQ.js
index ef989cc..3f1fda2 100644
--- a/app/api/src/docker/cadquery/runCQ.js
+++ b/app/api/src/docker/cadquery/runCQ.js
@@ -1,10 +1,12 @@
const { makeFile, runCommand } = require('../common/utils')
const { nanoid } = require('nanoid')
-module.exports.runCQ = async ({ file, settings = {} } = {}) => {
+module.exports.runCQ = async ({ file, settings: {
+ deflection = 0.3
+} = {} } = {}) => {
const tempFile = await makeFile(file, '.py', nanoid)
const fullPath = `/tmp/${tempFile}/output.stl`
- const command = `cq-cli/cq-cli --codec stl --infile /tmp/${tempFile}/main.py --outfile ${fullPath}`
+ const command = `cq-cli/cq-cli --codec stl --infile /tmp/${tempFile}/main.py --outfile ${fullPath} --outputopts "deflection:${deflection};angularDeflection:${deflection};"`
console.log('command', command)
try {
diff --git a/app/api/src/services/parts/parts.js b/app/api/src/services/parts/parts.js
index 87a8d6e..e636055 100644
--- a/app/api/src/services/parts/parts.js
+++ b/app/api/src/services/parts/parts.js
@@ -77,13 +77,17 @@ export const updatePart = async ({ id, input }) => {
}
const originalPart = await db.part.findUnique({ where: { id } })
const imageToDestroy =
- originalPart.mainImage !== input.mainImage && input.mainImage && originalPart.mainImage
+ originalPart.mainImage !== input.mainImage &&
+ input.mainImage &&
+ originalPart.mainImage
const update = await db.part.update({
data: foreignKeyReplacement(input),
where: { id },
})
if (imageToDestroy) {
- console.log(`image destroyed, publicId: ${imageToDestroy}, partId: ${id}, replacing image is ${input.mainImage}`)
+ console.log(
+ `image destroyed, publicId: ${imageToDestroy}, partId: ${id}, replacing image is ${input.mainImage}`
+ )
// destroy after the db has been updated
destroyImage({ publicId: imageToDestroy })
}
diff --git a/app/web/src/components/Footer/Footer.js b/app/web/src/components/Footer/Footer.js
index 8699c95..58e96b6 100644
--- a/app/web/src/components/Footer/Footer.js
+++ b/app/web/src/components/Footer/Footer.js
@@ -14,6 +14,12 @@ const Footer = () => {
>
Road Map
+
+ Blog
+
Code of Conduct
diff --git a/app/web/src/components/IdeViewer/IdeViewer.js b/app/web/src/components/IdeViewer/IdeViewer.js
index b9b3c47..8ce86b4 100644
--- a/app/web/src/components/IdeViewer/IdeViewer.js
+++ b/app/web/src/components/IdeViewer/IdeViewer.js
@@ -10,6 +10,11 @@ import {
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
import { Vector3 } from 'three'
import { requestRender } from 'src/helpers/hooks/useIdeState'
+import texture from './dullFrontLitMetal.png'
+import { TextureLoader } from 'three/src/loaders/TextureLoader'
+
+const loader = new TextureLoader
+const colorMap = loader.load(texture)
extend({ OrbitControls })
@@ -22,7 +27,7 @@ function Asset({ geometry: incomingGeo }) {
return (
-
+
)
}
@@ -193,8 +198,10 @@ const IdeViewer = ({ Loading }) => {
})
}}
/>
-
-
+
+
+
+
{state.objectData?.type === 'png' && (
<>
diff --git a/app/web/src/components/IdeViewer/dullFrontLitMetal.png b/app/web/src/components/IdeViewer/dullFrontLitMetal.png
new file mode 100644
index 0000000..268dda1
Binary files /dev/null and b/app/web/src/components/IdeViewer/dullFrontLitMetal.png differ
diff --git a/app/web/src/components/PartProfile/PartProfile.js b/app/web/src/components/PartProfile/PartProfile.js
index 4159333..1a4602b 100644
--- a/app/web/src/components/PartProfile/PartProfile.js
+++ b/app/web/src/components/PartProfile/PartProfile.js
@@ -27,7 +27,8 @@ const PartProfile = ({
const [isInvalid, setIsInvalid] = useState(false)
const { currentUser } = useAuth()
const editorRef = useRef(null)
- const canEdit = currentUser?.sub === userPart.id || currentUser?.roles.includes('admin')
+ const canEdit =
+ currentUser?.sub === userPart.id || currentUser?.roles.includes('admin')
const isImageEditable = !isEditable && canEdit // image is editable when not in profile edit mode in order to separate them as it's too hard too to upload an image to cloudinary temporarily until the use saves (and maybe have to clean up) for the time being
const part = userPart?.Part
const emotes = countEmotes(part?.Reaction)
diff --git a/app/web/src/helpers/cadPackages/cadQueryController.js b/app/web/src/helpers/cadPackages/cadQueryController.js
index 950d5d6..c5a16e0 100644
--- a/app/web/src/helpers/cadPackages/cadQueryController.js
+++ b/app/web/src/helpers/cadPackages/cadQueryController.js
@@ -8,7 +8,9 @@ import {
export const render = async ({ code }) => {
const body = JSON.stringify({
- settings: {},
+ settings: {
+ deflection: 0.2
+ },
file: code,
})
try {