GetBBox

Introduced

v1.0

Categories

property

Description

Computes the bounding box of a list of objects.

Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference so you need to use the best workaround for your situation:

For scripting languages this command returns an ISIVTCollection which you can use to get the output arguments.

For C# you can use the XSIApplication.ExecuteCommand method to call this command. ExecuteCommand packs the output arguments into a C# System.Object containing an Array of the output arguments (see Calling Commands from C#).

Scripting Syntax

GetBBox( [InputObj], [FineComputation], [LowerBoundX], [LowerBoundY], [LowerBoundZ], [UpperBoundX], [UpperBoundY], [UpperBoundZ] );

Parameters

Parameter Type Description
InputObj String List of objects.

Default Value: Current selection

FineComputation Boolean True to compute the bounding box on the surface, False to compute the bounding box on the control points.

Default Value: FALSE

LowerBoundX Double Returns the lower X coordinate of the bounding box.
LowerBoundY Double Returns the lower Y coordinate of the bounding box.
LowerBoundZ Double Returns the lower Z coordinate of the bounding box.
UpperBoundX Double Returns the upper X coordinate of the bounding box.
UpperBoundY Double Returns the upper Y coordinate of the bounding box.
UpperBoundZ Double Returns the upper Z coordinate of the bounding box.

Examples

1. JScript Example

NewScene( null, false ) ;
var oSphere = ActiveSceneRoot.AddGeometry( "Sphere", "MeshSurface", "MySphere" ) ;
oSphere.PosX = 2 ;
oSphere.PosY = -1 ;
var oTorus = ActiveSceneRoot.AddGeometry( "Torus", "NurbsSurface", "MyTorus" ) ;
oTorus.PosX = 2 ;
oTorus.PosY = 5 ;
var oObjs = new ActiveXObject("XSI.Collection") ;
oObjs.Add( oSphere  ) ;
oObjs.Add( oTorus ) ;
var aRtn = GetBBox( oObjs ) ;
xmin = aRtn.value( "LowerBoundX" );
ymin = aRtn.value( "LowerBoundY" );
zmin = aRtn.value( "LowerBoundZ" );
xmax = aRtn.value( "UpperBoundX" );
ymax = aRtn.value( "UpperBoundY" );
zmax = aRtn.value( "UpperBoundZ" );
LogMessage( "Lower Bound: " + xmin + " / " + ymin + " / " + zmin ) ;
LogMessage( "Upper Bound: " + xmax + " / " + ymax + " / " + zmax ) ;
// Build a Cube that shows the bounding box
var oCube = ActiveSceneRoot.AddPrimitive("Cube") ;
oCube.length = 1 ;
oCube.PosX = ( xmax + xmin ) / 2 ;
oCube.PosY = ( ymax + ymin ) / 2 ;
oCube.PosZ = ( zmax + zmin ) / 2 ;
oCube.sclx = xmax - xmin ;
oCube.scly = ymax - ymin ;
oCube.sclz = zmax - zmin ;

2. VBScript Example

dim xmin, ymin, zmin, xmax, ymax, zmax
dim list
set list = GetValue( "SelectionList" )
GetBBox list, FALSE, xmin, ymin, zmin, xmax, ymax, zmax
LogMessage "Lower Bound: " & xmin & " / " & ymin & " / " & zmin
LogMessage "Upper Bound: " & xmax & " / " & ymax & " / " & zmax

See Also

Geometry.GetBoundingBox Geometry.GetBoundingCapsule Geometry.GetBoundingSphere