From 77d67ab7a353e6d826b5d2ec59b289578ffc2203 Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 10 Apr 2024 00:33:57 -0500 Subject: [PATCH] fix: Pass configuration when getting part size --- npm/src/geometry.ts | 4 ---- npm/src/onshape.ts | 15 +++++++++++---- package.json | 2 +- web/components/SettingsTab.vue | 1 - web/composables/useBoardLayoutsQuery.ts | 1 - 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/npm/src/geometry.ts b/npm/src/geometry.ts index 5fddf08..bd8bb1f 100644 --- a/npm/src/geometry.ts +++ b/npm/src/geometry.ts @@ -142,10 +142,6 @@ export class BoardLayouter { readonly config: Config, ) { const padding = -new Distance(config.extraSpace).m; - console.log('PADDING', padding, { - a: stock, - b: stock.pad({ right: padding, top: padding }), - }); this.paddedStock = stock.pad({ right: padding, top: padding }); } diff --git a/npm/src/onshape.ts b/npm/src/onshape.ts index 1cfca69..905603b 100644 --- a/npm/src/onshape.ts +++ b/npm/src/onshape.ts @@ -60,6 +60,7 @@ export function defineOnshapeLoader(config?: OnshapeApiConfig): OnshapeLoader { itemSource.wvmId, itemSource.elementId, itemSource.partId, + itemSource.configuration, ); const material = headerIdToValue[materialHeaderId] as any; return { @@ -142,10 +143,14 @@ function defineOnshapeApi(config?: OnshapeApiConfig) { wvmid: string, eid: string, partid: string, - ) => - fetch( - `/parts/d/${did}/${wvm}/${wvmid}/e/${eid}/partid/${partid}/boundingboxes`, - ), + configuration: string | undefined, + ) => { + let url = `/parts/d/${did}/${wvm}/${wvmid}/e/${eid}/partid/${partid}/boundingboxes`; + if (configuration) { + url += `?configuration=${encodeURIComponent(configuration)}`; + } + return fetch(url); + }, }; } @@ -181,6 +186,8 @@ namespace Onshape { partId: string; wvmType: string; wvmId: string; + configuration: string; + fullConfiguration?: string; }; headerIdToValue: Record; }>; diff --git a/package.json b/package.json index 0191ea0..0eb37ed 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "web" ], "scripts": { - "dev": "bun --cwd web dev", + "dev": "bun run build && bun --cwd web dev", "build": "bun --cwd npm build", "check": "bun --cwd npm check && bun --cwd web check", "prepare": "simple-git-hooks" diff --git a/web/components/SettingsTab.vue b/web/components/SettingsTab.vue index afd99b1..053ebdc 100644 --- a/web/components/SettingsTab.vue +++ b/web/components/SettingsTab.vue @@ -11,7 +11,6 @@ const extraSpace = useExtraSpaceSetting(); watch(distanceUnit, (newUnit, oldUnit) => { if (!newUnit || !oldUnit) return; - console.log(newUnit, oldUnit); const convertValue = (value: Ref) => { const dist = new Distance(value.value + oldUnit); value.value = dist[newUnit]; diff --git a/web/composables/useBoardLayoutsQuery.ts b/web/composables/useBoardLayoutsQuery.ts index 64809e9..9972b6d 100644 --- a/web/composables/useBoardLayoutsQuery.ts +++ b/web/composables/useBoardLayoutsQuery.ts @@ -17,7 +17,6 @@ export default function () { const parts = partsQuery.data.value; if (parts == null) return undefined; - console.log(toRaw(config.value)); return generateBoardLayouts(parts, stock.value, config.value); });