Show messages: All
1-7
8-13
From: Elang
Hi Michael,
Thank you very much for taking the time to write such a detailed explanation. It makes much more sense to me now.
I think I understand the distinction between using `update()/commit()` for interactive commands and using `calculate()` for programmatically generating geometry. I also understand why obtaining and keeping the object reference is the preferred approach.
I would like to spend some time studying these concepts and experimenting with both approaches before asking any further questions. I'm sure I'll learn much more by trying them myself first.
Earlier you asked what I was actually trying to accomplish. My long-term goal is to build procedural scripts that generate many objects and perform a sequence of operations on them. Rather than creating just one or two objects, a script may eventually generate dozens of intermediate and final objects before reaching the final result.
Once I have explored these concepts a bit more, I'll come back with a more concrete example of that workflow. I think it will make my questions much clearer.
Thank you again for your patience and for sharing your knowledge. I really appreciate your guidance, and I'll be back on the forum soon after I've had some time to experiment.
Best regards,
- Elang
From: Elang
Hi Michael,
I've attached a script that I've been working on as part of an R&D project at the company where I work. We have three MoI3D V4 licenses, all of which are used by our design and engineering team.
The goal of this script is to automate the creation of production box designs for our souvenir products. The idea is simple: the user enters the overall bounding box dimensions of a souvenir, and the script automatically generates the corresponding box design.
If you have some time, I'd really appreciate it if you could take a look and share your comments. Also, if you notice that I'm still approaching things with the wrong paradigm (as you pointed out in one of my previous posts) please don't hesitate to correct me. I'd much rather learn the proper way than continue building on a flawed approach.
My hope is that this tool will reduce the engineering time required for each box design by around 10–20 minutes, making the workflow more efficient for our team.
Thank you very much for your continued support and for all the knowledge you've shared with the MoI community over the years. It is genuinely appreciated.
Best regards,
- Elang
Attachments:
-AutoBox02.htm
-AutoBox02.js
Image Attachments:
2026-07-23_155110.jpg
2026-07-23_155543.jpg
From: Michael Gibson
Hi Elang,
re:
> If you have some time, I'd really appreciate it if you could take a look and share your
> comments. Also, if you notice that I'm still approaching things with the wrong paradigm
> (as you pointed out in one of my previous posts) please don't hesitate to correct me.
> I'd much rather learn the proper way than continue building on a flawed approach.
It looks good to me! Some minor things in the .htm file:
The <link rel="stylesheet" href="moi://ui/moi.css" type="text/css"> can be removed, it isn't needed anymore starting with MoI version 3. Same with xmlns:moi in the <html>.
In the <head> you can put in a <style> with some style rules and then all the individual inline style="" and align="" attributes can be removed, see attached.
- Michael
Attachments:
-AutoBox02_styles.htm
From: Elang
Hi Michael,
Thank you very much for pointing out the `.htm` documentation. I'll definitely take a look at it later.
For now, I think I may have found a bug related to the bounding box dimensions.
I wrote this simple script to retrieve the bounding box of the selected object(s). However, when I displayed the values using `moi.ui.alert()`, the reported dimensions did not match the X/Y/Z size shown in the Object Info panel.
Here is the script:
code:
function excercise_06()
{
var rnd = moi.geometryDatabase.getSelectedObjects();
var bbox = rnd.getBoundingBox();
moi.ui.alert(
'X Length : ' + bbox.xLength +
'Y Length : ' + bbox.yLength +
'Z Length : ' + bbox.zLength
);
}
excercise_06();
In the screenshot below, you can see that the X dimension reported by `bbox.xLength` differs from the X Size shown in the Object Info panel.
Am I misunderstanding what `getBoundingBox()` returns, or could this be a bug? I've attached the 'problematic' 3dm file.
Thank you very much in advance for your attention.
- Elang
Attachments:
Plaque.3dm
Image Attachments:
2026-07-24_110041.jpg
From: Michael Gibson
Hi Elang, since getting a precise minimal bounding box can be a time consuming calculation there are various types of approximations.
The one in the object info panel is based off of the display mesh. If you click on it to open the "Edit size" menu it will do a more accurate solver based calculation in the menu.
The one used by ObjectList.getBoundingBox() is quick to calculate and uses the bounds of surface control points. It can be larger than the accurate bounding box.
Do this if you want a "tight" bounding box:
code:
function excercise_06()
{
var rnd = moi.geometryDatabase.getSelectedObjects();
var bbox = rnd.getHighAccuracyBoundingBox();
moi.ui.alert(
'X Length : ' + moi.ui.formatCoordinate(bbox.xLength) +
' Y Length : ' + moi.ui.formatCoordinate(bbox.yLength) +
' Z Length : ' + moi.ui.formatCoordinate(bbox.zLength)
);
}
excercise_06();
From: Elang
Understood... Thank you very much, Michael!
Show messages: All
1-7
8-13