Irev-Dev / Irev-Dev/cadhub

Sync OpenSCAD and three.js camera to allow of zoom to fit

Open
#564 1 comment 0 reactions 1 assignee Claimed by @Irev-Dev View on GitHub
hacktoberfest react three.js
Dominant language
TypeScript
Stars
384
Forks
58
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/Irev-Dev/cadhub/blob/main/CONTRIBUTING.md) to get setup, and of course ask for help here or in the [dev-help discord channel](https://discord.gg/Vgmky37UtD).

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.