CadQuery MVP integration #281

Merged
Irev-Dev merged 15 commits from kurt/274 into main 2021-04-27 11:53:52 +02:00
2 changed files with 10 additions and 6 deletions
Showing only changes of commit 320e8e4fb8 - Show all commits

View File

@@ -50,7 +50,7 @@ const IdeToolbarNew = ({ cadPackage }) => {
}
return (
<IdeContext.Provider value={{ state, thunkDispatch: thunkDispatch }}>
<IdeContext.Provider value={{ state, thunkDispatch }}>
<div className="h-full flex flex-col">
<nav className="flex">
<button

View File

@@ -14,19 +14,19 @@ import { requestRender } from 'src/helpers/hooks/useIdeState'
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
extend({ OrbitControls })
function Asset({ url }) {
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
function Asset({ stlData }) {
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
const [loadedGeometry, setLoadedGeometry] = useState()
const mesh = useRef()
const ref = useUpdate((geometry) => {
geometry.attributes = loadedGeometry.attributes
})
useEffect(() => {
if (url) {
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
const decoded = atob(url)
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
if (stlData) {
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
const decoded = atob(stlData)
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
const loader = new STLLoader()
setLoadedGeometry(loader.parse(decoded))
}
}, [url])
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
}, [stlData])
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
if (!loadedGeometry) return null
return (
<mesh ref={mesh} scale={[1, 1, 1]}>
@@ -228,7 +228,11 @@ const IdeViewer = () => {
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
</>
)}
{state.ideType === 'cadQuery' && (
<Asset url={state.objectData?.data} />
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
<Asset
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
stlData={
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
state.objectData?.type === 'stl' && state.objectData?.data
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
}
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
/>
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
)}
</Canvas>
</div>
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.
Irev-Dev commented 2021-04-26 10:20:10 +02:00 (Migrated from github.com)
Review

This is where the stl is loaded in for CadQuery.

This is where the stl is loaded in for CadQuery.