bernhard-42 / jupyter-cadquery

An extension to render cadquery objects in JupyterLab via pythreejs
Apache License 2.0
326 stars 45 forks source link

Resize view #43

Closed Jojain closed 3 years ago

Jojain commented 3 years ago

Hello, I've tried to resize the 3D view in your new viewer that you presented here #42 , but I don't know how to do it. I tried to change the size width like that : show(shapes, cad_width = 1000) But it doesn't do anything, I've also tried it with regular jupyter-cadquery and it doesn't do anything either. Am I doing it wrong ?

bernhard-42 commented 3 years ago

@Jojain

But it doesn't do anything

Great catch. Due to the fact that the viewer gets started once at the beginning, resizing as parameters of show doesn't work. I will add command line parameters to jvc in the next version.

I've also tried it with regular jupyter-cadquery and it doesn't do anything either.

Hmmm, that seems broken for the sidecar, too. What would work is in this order:

set_defaults(cad_width=1000, height=800)
set_sidecar("Test")

To get the viewer working I had to do a major refactoring and found/fixed quite some bugs this week. That's why the next version is still not out. But the sizing parameters will definitely be part of it.

Thanks for the tests and the feedback, and btw. the next version also comes with an incremental show_object function where every call will add a new object to the view (similar as in CQ Editor).

Jojain commented 3 years ago

Since voilà didn't worked for now I use the viewer by starting jupyter lab manually and to set the view this works :

from jupyter_cadquery.viewer.server import start_viewer
from jupyter_cadquery.defaults import set_defaults
set_defaults(cad_width=1400, height=800)
start_viewer()

Thanks ! Note that in issue #42 you told me that I could call show(obj1, ob2) but it's actually not possible since the show function you defined in the viewer doesn't accept multiple objects. However packaging every shape in a PartGroup works well and is nice.

PS : That's unrelated and not a big deal but in case you didn't know the jupyter-cadquery view icons don't look good on dark background of darkmode jupyter lab, see below : image

bernhard-42 commented 3 years ago

@Jojain There is a new version available, see https://github.com/bernhard-42/jupyter-cadquery/issues/42#issue-877159979

Notable features / fixes:

I should have added quite some of the stuff from your feedback. Maybe you can give it a try whether it now works better?

If it does, I will soon make a release candidate out it to get out of the "pip install from git" woods ...

bernhard-42 commented 3 years ago

RC1 released ...

bernhard-42 commented 3 years ago

@Jojain Does it work? Can we close this issue?

Jojain commented 3 years ago

I cannot try it before Monday , I will let you know then if it works

Jojain commented 3 years ago

I tried it and it's all good, resizing from command line or overriding the settings with the show function works !