Camera Position to specific ShapeDiverDisplayGeometry

Hi everyone,

I want to represent an engraving of a personalized message in a furniture configurator using the ShapeDiverTextInput, to generate a 3D text that will be displayed on a cover, simulating the engraving of the message. I used that feature through the API and it works OK.

But I have this question: Is there be any method to be able to zoom with the camera to that specific point where the message is located? I understand that with api.scene.camera.updateAsync (position, target) I can specify my new camera Moving Camera to a Certain Position so that it fully Shows a Specified Geometry: but my problem is that I don’t know in which specific position my personalized message will be, since it responds to different positions regarding where is located the parametric furniture. It would be great to be able to zoom the BoundingBox of a specific ShapeDiverDisplayGeometry, and not the entire result.

Thanks!

Regards,

Hi @josegomezrivera95, you can get the final position of your engraving from Grasshopper by using the ShapeDiverDataOutput component. Just input the resulting point into the data output and then you will be able to access the data with the function api.scene.getData().

Hope it helps.

Thanks @edsahergom

It’s a great solution. I will try it.

Thank you!

Hey @josegomezrivera95,

just one quick remark to be sure you are aware of this: When implementing your solution for zooming to the extents of a specified geometry (thanks again!), I realized that the camera does not already need to be positioned on a geometry to zoom to its extents.
For example:

api.scene.camera.updateAsync({
position:{x:0,y:0,z:1000}, //top view
target:{x:0,y:0,z:0}
},
{duration: 0 }
).then(function () {
//zoom you camera in the object you want to see with a 0 duration
api.scene.camera.zoomAsync([scenePath], { duration: 0 })
});

This function will zoom to the extents of the geometry “scenePath”, even if it does not lie at x:0, y:0. That means you only need to know from which orientation you want to view at the engraving and not precisely where it is located. For example, you would use position:{x:0,y:0,z:1}, target:{x:0,y:0,z:0} for a top view, position:{x:1,y:1,z:1}, target:{x:0,y:0,z:0} for a perspective and so on…

David