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

Open
opened 2021-10-17 02:22:48 +02:00 by Irev-Dev · 1 comment
Irev-Dev commented 2021-10-17 02:22:48 +02:00 (Migrated from github.com)

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 38ab79a80b)

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

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
Irev-Dev commented 2021-10-20 09:15:40 +02:00 (Migrated from github.com)

I'm going to make a start on this one.

I'm going to make a start on this one.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: h3n3/cadhub#564