Change length of a mesh via parameter

Hi all,

i have (maybe) a stupid but for me important question.

imagine a cuboid, which has a predefined length, a height and a depth shown in a browser window. below there is a html form with some input fields for length, height and depth and a button “change”.
if i now change one of these text fields for example length from 1m to 3m and click a button “change” it should adjust my mesh instantly to a cuboid with 3m length.

showing the cuboid in a browser, give it some nice textures, change the camera is super easy thanks to your 3d engine :slight_smile:
my problem is passing these predefined “parameters” like length to the model/mesh and rerender(?)…

i don’t want to create the mesh by my own directly with babylonjs - i know this would work. but these models i want to work later on are much more complex so i need someone who can create these with for example fusion 360 autodesk a CAD program and i just want to import them in order to show them in the browser.

in these CAD programs there is a possibility to create a parametric construction. which means it’s a mesh with parameters for e.g. length, and so on.
a friend of mine now created such a 3d model (this cuboid) with these editable parameters for me and gave me the model in different formats 3mf, f3d, fbx, obj, sat, skp, smt, stl and usdz.

my questions are: if i import such a model with babylon, is there a way to adjust these predefined parameters? does anybody has experience with this?
do you know how to create such models in a CAD or Blender in order to do stuff like this in babylonjs?

thank you very much!

Hello and welcome!

The simplest thing is to scale on relevant axis.
Example - GLB cube, scaled 2 times on X axis:

GLTF/GLB format is also very convenient for the web.

1 Like

Hi labris and thank you for the fast reply!
your proposal sounds ledig and will work for simple objects like my cube.
but when it comes to more complex models i don’t know if scaling is still working.

is there maybe another way? for me the best way would be to access these in CAD predefined parameters directly.

thanks a lot!

Believe me, scaling will always work as scaling :slight_smile:
Even the most complex CAD model would have only 3 axis in 3D space.
Probably you may give it a try with your models?

1 Like

Do you talk about parametric modelling?
I am not sure if there are transfer file formats for that and cross engines/plattforms.

yes i think it’s the correct term parametric modelling.
maybe to give you a better impression of what i am thinking of, here is an example:

but also thanks labris for your reply, i gonna give it a try! i just want to talk to experts in the beginning so i have an orientation, what and how it could work, before i go deeper…

There is a lot of examples of different 3D configurators in Demo section of this forum, here is one of the latest ones - Architectural 3D app. Country house configurator

As for file formats, some of CAD tools support GLB export, one may also use .obj or even .stl (which has no textures though) to use with Babylon. Personally for me, when I worked with CAD models, most convenient pipeline was export to FBX and then import to C4D (or Blender if you prefer) for optimizations and texturing, then export to GLB.

Here is just one of numerous links how to optimize CAD models for rendering - 6 tips to optimize your CAD model for rendering - Meshmatic

1 Like