GetBoundingBox Method (ISketchManager)

GetBoundingBox Method (ISketchManager) | Send Feedback
See Also

X1[out]
  x coordinate of a corner of the bounding box

Y1[out]
  y coordinate of a corner of the bounding box

Z1[out]
  z coordinate of a corner of the bounding box

X2[out]
  x coordinate of the opposite diagonal corner of the bounding box

Y2[out]
  y coordinate of the opposite diagonal corner of the bounding box

Z2[out]
  z coordinate of the opposite diagonal corner of the bounding box

Gets the bounding box enclosing the sketch entity.

# Syntax

Visual Basic |
--- | ---
    Sub GetBoundingBox( _
       ByRef X1 As System.Double, _
       ByRef Y1 As System.Double, _
       ByRef Z1 As System.Double, _
       ByRef X2 As System.Double, _
       ByRef Y2 As System.Double, _
       ByRef Z2 As System.Double _
    )

C# |
--- | ---
    void GetBoundingBox(
       out System.double X1,
       out System.double Y1,
       out System.double Z1,
       out System.double X2,
       out System.double Y2,
       out System.double Z2
    )

JavaScript |
--- | ---
    GetBoundingBox(
    ) : {
       X1 : Number,
       Y1 : Number,
       Z1 : Number,
       X2 : Number,
       Y2 : Number,
       Z2 : Number
    }

COM native C++ |
--- | ---
    HRESULT GetBoundingBox(
       DOUBLE* X1,
       DOUBLE* Y1,
       DOUBLE* Z1,
       DOUBLE* X2,
       DOUBLE* Y2,
       DOUBLE* Z2
    )

C++ |
--- | ---
    DSRESULT GetBoundingBox(
       double* X1,
       double* Y1,
       double* Z1,
       double* X2,
       double* Y2,
       double* Z2
    )

#### Parameters

X1[out]
  x coordinate of a corner of the bounding box
Y1[out]
  y coordinate of a corner of the bounding box
Z1[out]
  z coordinate of a corner of the bounding box
X2[out]
  x coordinate of the opposite diagonal corner of the bounding box
Y2[out]
  y coordinate of the opposite diagonal corner of the bounding box
Z2[out] or Return Value
  z coordinate of the opposite diagonal corner of the bounding box

# Example

This code snippet shows how to get the Sheets, their names, and the bounding box coordinates.

#### COM native C++

void CAddinDumpManager::DumpSheets( CStdioFile& fileOutput, LPCWSTR tabStr, IDocumentPtr dsDoc )
{
CString strPrint;
_variant_t pVariantArray = dsDoc->GetSheets();
if( V_VT( &pVariantArray ) != VT_EMPTY )
{
ISheetPtr *sheets = NULL;
int count = 0;
TypeConverter::convertVariantArrayToPtrArray<ISheetPtr, ISheet>( pVariantArray, sheets, count );

strPrint.Format( L"Sheets: (%d):\r\n", count );
fileOutput.WriteString( strPrint );

if( sheets && count > 0 )
{
//Iterate through Block instances
for( int i = 0; i < count; ++i )
{
//Get Sheet name
bstr_t SheetName= sheets[i]->GetName();

strPrint.Format( L"Name: %s\r\n", SheetName.operator const wchar_t*() );
fileOutput.WriteString( strPrint );
//Get ISketchManager object
ISketchManagerPtr dsSketchManagerSheet( sheets[i]->GetSketchManager() );
if( dsSketchManagerSheet != NULL )
{
//Get Sheet bounding box
double x1, y1, z1, x2, y2, z2;
dsSketchManagerSheet->GetBoundingBox( &x1, &y1, &z1, &x2, &y2, &z2 );

strPrint.Format( L"Bounding box: %.4f %.4f %.4f %.4f\r\n", x1, y1, x2, y2 );
fileOutput.WriteString( strPrint );
}
else
fileOutput.WriteString( L"ERROR GetSketchManager\r\n" );
}
delete[] sheets;
}
}
else
fileOutput.WriteString( L"ERROR GetSheets\r\n" );
}

# See Also

####

ISketchManager Interface
ISketchManager Members

# Availability

DraftSight V1R1