Toggle section box in Python

Hi, is there a way to automate the camera position and create a section box with python? I want to create section breaks automatically (the right is the initial 3d model, but I’d love to display the section when it loads)
Thank you so much! → i feel i am missing something :sweat_smile:

1 Like

By automate, do you mean animate the camera or simply control the first camera position on load?

Animation isn’t possible but the latter definitely is. You can pass a camera object as a query parameter to the embedded viewer.

Camera: c=[-7.05094,-7.00764,6.46436,0.69299,-0.02689,2.05062,0,1]
Likewise sections: "sectionBox":[0.05,-3.41,-0.44,6.44,3.35,4.54]}

These are all coordinate positions you can experiment to find in the speckle.xyz frontend, as you amend you’ll decode what is needed for your 3d data

1 Like

i will try this weekend, thank you so much!

modifying indirect lighting works the same way?

Unfortunately not - lighting parameters are not encoded in the url as of yet. We’ll keep it in mind and add them - one way or another.

Meta discussion (for when we will pick this up): we’re really putting a lot of viewer stuff in the url, and we’re probably need to do something about it:

  • either move to saving these either after a # so they don’t get sent to the server/proxy and break url length constraints,
  • OR create a different way of saving views (ie, like storing the metadata in a comment, but without the comment - a sort of “saved view” table).
2 Likes

@jan-casas To echo this, saving views with a comment in advance has become my preferred way to interact with the embedded viewer programmatically. This is suited to situations where both you know specific views you want to show or cycle through and then pass commentSlideshow=true in your embed parameters

2 Likes

yep I was saving the camera coordinates to a dictionary and selecting based on a dropdown
thank you!

To give an example to @jonathon’s meaning:

And the code: (you can get it via the share menu on your model, and customise all the options in there):

<iframe src="https://latest.speckle.dev/embed?stream=92b620fb17&commit=527d4bdbf4&transparent=true&autoload=true&hidecontrols=true&noscroll=true&hidesidebar=true&hideselectioninfo=true&commentslideshow=true" width="800" height="400" frameborder="0"></iframe>
2 Likes

maybe an option in settings to customize the default values (indirect lighting) on stream?, in my case plan/section views are too dark

We’ll note this feature request :heartbeat:

2 Likes