Hide Table of Contents
DeleteFaces4 Method (IBody2)

Obsolete. Superseded by IBody2::DeleteFaces5.

.NET Syntax

Visual Basic (Declaration) 
Function DeleteFaces4( _
   ByVal FaceList As Object, _
   ByVal Option As Integer, _
   ByVal DoLocalCheck As Boolean, _
   ByRef BodyList As Object, _
   ByRef LocalCheckResult As Boolean _
) As Boolean
Visual Basic (Usage) 
Dim instance As IBody2
Dim FaceList As Object
Dim Option As Integer
Dim DoLocalCheck As Boolean
Dim BodyList As Object
Dim LocalCheckResult As Boolean
Dim value As Boolean
 
value = instance.DeleteFaces4(FaceList, Option, DoLocalCheck, BodyList, LocalCheckResult)
C# 
bool DeleteFaces4( 
   object FaceList,
   int Option,
   bool DoLocalCheck,
   out object BodyList,
   out bool LocalCheckResult
)
C++/CLI 
bool DeleteFaces4( 
&   Object^ FaceList,
&   int Option,
&   bool DoLocalCheck,
&   [Out] Object^ BodyList,
&   [Out] bool LocalCheckResult
) 

Parameters

FaceList

Array containing the faces for deletion

Option

Additional control (see Remarks)

DoLocalCheck

True checks the bodies during the operation and sets the return value to indicate whether or not the resultant body is valid, false does not

BodyList
Array of temporary bodies
LocalCheckResult

True if body is valid, false if not; to obtain this value, you must pass True for the DoLocalCheck argument

Return Value

True if set of faces are deleted, false if not

Example

Unmanaged C++ COM:

template <class T,int type> class SafeArray

{

public:

      SafeArray(VARIANT *input):

        m_input(input),

        m_access(false),

        m_bCreate(false),

        m_pSafeArray(NULL),

        m_arrayData(NULL),

        m_result(S_OK)

      {

            if(m_input != NULL)

            {

                  if (V_ISARRAY(m_input))

                  {

                        m_pSafeArray =  V_ARRAY (m_input);

                        m_result     =  SafeArrayAccessData ( m_pSafeArray, (void HUGEP**)&m_arrayData);

                        m_access = m_result == S_OK ;

                  }

                  else

                     m_access = true;

            }

            else

            {

                  ASSERT(FALSE);

                  m_input = &m_target;

            }

      }

      SafeArray(const VARIANT &input) :

        m_access(true),

        m_bCreate(false),

        m_pSafeArray(NULL),

        m_arrayData(NULL),

        m_result(S_OK)

      {

            m_input = (VARIANT *) &input;

            if (V_ISARRAY(m_input))

            {

                  m_pSafeArray =  V_ARRAY (m_input);

                  m_result     =  SafeArrayAccessData ( m_pSafeArray, (void HUGEP**)&m_arrayData);

                  m_access = m_result == S_OK ;

            }

            else

               m_access = true;

      }

      SafeArray(unsigned int size,unsigned int dims = 1):

        m_input(&m_target),

        m_access(false),

        m_bCreate(true),

        m_pSafeArray(NULL),

        m_arrayData(NULL),

        m_result(S_OK)

      {

            ASSERT(size >= 0);

            if(size > 0)

            {

                  m_rgsabound[0].lLbound        = 0;

                  m_rgsabound[0].cElements      = (int) size;

                  m_pSafeArray =  SafeArrayCreate(type, (int)dims, m_rgsabound);

                  V_VT(m_input) = VT_ARRAY | type;

                  m_result = SafeArrayAccessData( m_pSafeArray, (void HUGEP**)&m_arrayData);

                  m_access = m_result == S_OK ;

                  if(!m_access)

                     V_VT(m_input) = VT_EMPTY;

            }

            else

            {

                  V_VT(m_input) = VT_EMPTY;

                  m_access = true;

            }

      }

       inline HRESULT status(){return m_result;}

       inline int getSize(int index = 0) {return (m_access&&m_pSafeArray)?m_pSafeArray->rgsabound[index].cElements:0;}

      ~SafeArray(){UnaccessData();}

      operator T* ()                {ASSERT(m_access);return m_arrayData;}

      operator VARIANT ()           {ASSERT(m_access);UnaccessData(); return *m_input;}

      T & operator[](int i)   {ASSERT(m_access&&m_arrayData);return m_arrayData[i];}

      SAFEARRAY* getSafeArrayData()  {return m_pSafeArray;}

      //Operator SAFEARRAY*() {return m_pSafeArray;}

private:

      void UnaccessData(){

            if(m_access){

                  m_result = SafeArrayUnaccessData( m_pSafeArray );

                  if(m_bCreate && m_result == S_OK)

                        V_ARRAY(m_input) = m_pSafeArray;

                  m_access = false;

            }

      }

      bool              m_bCreate;

      bool              m_access;

      VARIANT           *m_input;

      VARIANT           m_target;

      T                 *m_arrayData ; 

      SAFEARRAY         *m_pSafeArray;

      SAFEARRAYBOUND  m_rgsabound[1];    

      HRESULT                 m_result;

};

template <typename T> inline T GetSpecificInterface(IUnknown* pUnk, const IID& iid, T &specificInterface)

{

      specificInterface = NULL;

      if (NULL != pUnk)

      {

            HRESULT res = pUnk->QueryInterface(iid, (LPVOID*)&specificInterface);

            if (specificInterface)

                  specificInterface->Release();

      }

      return specificInterface;

}

typedef SafeArray<VARIANT_BOOL, VT_BOOL>        SafeBooleanArray;

typedef SafeArray<double,       VT_R8>          SafeDoubleArray ;

typedef SafeArray<long,         VT_I4>          SafeLongArray ;

typedef SafeArray<BYTE,         VT_I1>          SafeByteArray ;

typedef SafeArray<BYTE,         VT_UI1>         SafeUByteArray ;

typedef SafeArray<BSTR,         VT_BSTR>        SafeBSTRArray ;

typedef SafeArray<LPDISPATCH,   VT_DISPATCH>    SafeDISPATCHArray;

typedef SafeArray<LPVARIANT,    VT_VARIANT>     SafeVARIANTArray;

////////////////////////////////////Snippet follows

            VARIANT_BOOL            retVal;

            IBody2                  *TestBody2;

            VARIANT                 bodies;

            SafeDISPATCHArray faces(nfaces);  // Allocate safe array of LPDISPATCH items

            for ( i = 0; i < nfaces; i++ )

                  GetSpecificInterface( gfacelist[i], IID_IDispatch, faces[i]) ; // Add to array

            GetSpecificInterface( TestBody, IID_IBody2, TestBody2) ; // Convert LPBODY to LPBODY2

            res = TestBody2->DeleteFaces4(faces,delfas_option, doLocalCheck, &bodies, &localCheckResult,&retVal);

            SafeDISPATCHArray vBodies(bodies);  // Access the VARIANT array

            int numBodies = vBodies.getSize();

              LPSLDWORKS pSolidWorks = UserApp->m_pSolidWorks ;

             DumpSolid(pSolidWorks,numBodies, vBodies);   // Use VARIANT array as simple array

            for(i=0; i < numBodies; i++)

            {

                  LPBODY pBody = NULL;

                  GetSpecificInterface( vBodies[i], IID_IBody, pBody) ;

                  pBody->Release();

            }

Remarks

All of the specified faces, which must belong to this temporary body, are deleted from IBody2. If the resulting body does not have a complete boundary, then SolidWorks treats any holes as wounds and heals them as specified by the option argument. The option argument takes the following values:

Value

Loops on the faces to delete are...

0

Dependent on each other and should be healed at the same time. If extending faces does not yield a solution, then SolidWorks tries to shrink the faces.

1

Independent and should be healed separately. This option also grows the parent faces around the hole to cover it.

2

Independent and should be healed separately. This option also finds a surface in which all edges of a hole lie and attaches this to a face covering the hole (SolidWorks creates a new face to cover the hole).

For example, consider a cube with a through hole made up of four faces (a square hole). To delete these four faces, specify option 0 because the loop on the first face to be deleted is dependent on the loop of the second face to be deleted. Likewise, the loop on the second face to be deleted is dependent on the third face to be deleted, and so on.

Now consider the same cube with a through hole, except this through hole is a simple cylinder (one face). To delete the cylindrical face, specify option 1 to heal the loops independently. This is necessary because the cylindrical face actually has two loops (one at either end of the cylinder) that need to be healed separately.

It is possible to generate invalid geometry when you use this method because checking is disabled. Call IBody2::Check3 to verify that the body is a valid solid after using this method.

 

See Also

Availability

SolidWorks 2009 FCS, Revision Number 17.0


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   DeleteFaces4 Method (IBody2)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2012 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.