How do you reference a specific object in Moi3D scripting?
All  1-10  11-13

Previous
Next
 From:  Elang
12042.11 
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

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
12042.12 In reply to 12042.11 
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();
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Elang
12042.13 In reply to 12042.12 
Understood... Thank you very much, Michael!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-10  11-13