cadhub
cadhub copied to clipboard
Sync OpenSCAD and three.js camera to allow of zoom to fit
We can use a feature of OpenSCAD --viewall
to make sure the parts is not cut off on first load, but when we use the feature we need to sync up the camera position in OpenSCAD to our three.js camera so that later renders still work.
All of this information is already provided to you, you just need to sync if the cameras with the info that comes back from openSCAD.
This video has a more thorough explanation as well as some tips on which files need to be changed.
https://user-images.githubusercontent.com/29681384/137605255-3a331dd0-dfcf-4c53-84ca-68b8cb67aea9.mp4
You should work off the kurt/openscad-view-all
branch (and it might help to see the diff for this branch, but not necessary https://github.com/Irev-Dev/cadhub/commit/38ab79a80bcd07a6a7ceefff1d17018d44a0dd24)
After you have seeded your db going to http://localhost:8910/u/local-user-1/demo-project1/ide will show you the hinge from video.
Files of interest are:
-
app/web/src/helpers/cadPackages/openScad/openScadController.ts
-
app/web/src/helpers/hooks/useIdeState.ts
-
app/web/src/components/IdeViewer/IdeViewer.tsx
Follow the instructions in CONTRIBUTING.md to get setup, and of course ask for help here or in the dev-help discord channel.
If you'd like to contribute the CadHub but this issue is taken or you'd prefer something else, have a look at #535 to see if there's something else you would like
I'm going to make a start on this one.