cadhub icon indicating copy to clipboard operation
cadhub copied to clipboard

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

Open Irev-Dev opened this issue 3 years ago • 1 comments

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

Irev-Dev avatar Oct 17 '21 00:10 Irev-Dev

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

Irev-Dev avatar Oct 20 '21 07:10 Irev-Dev