RFVertex.EnumDepthAdjacentFaces



Your Ad Here

Description

Collectes entity's ID of adjacent faces up to the specified maximum count in an RFEntityID array by searching for the specified depth and retrieves the actual number of adjacent faces.

Syntax

Function RFVertex.EnumDepthAdjacentFaces(depth As Long, maxFaceCount As Long, pFaceIDs As RFEntityID, pFaceCount As Long) As RFErrorCode

The EnumDepthAdjacentFaces syntax has these parts:

Part Description
depth [INLong Required. Depth of the adjacent face searching.
maxFaceCount [INLong Required. The array size of pFaceIDs. (Maximum number of faces expected.)
pFaceIDs [OUTRFEntityID Required. The first element of an RFEntityID array to store entity ID's of adjacent faces.
pFaceCount [OUTLong Required. The actual number of adjacent faces stored in pFaceIDs.

Remarks

Sample

Dim rfErr As RapidForm.RFErrorCode
Dim vtObj As RapidForm.RFVertex

    ' Assign the RFVertex interface object.
    Set vtObj = RapidForm.Vertex
    
    ' Pick a vertex.
    Dim pickedID As RFEntityID
    rfErr = RapidForm.SelectTools.PickEntity(RF_PICK_VERTEX, 1, pickedID)
    
    ' If an error happens, exit the subroutine.
    If rfErr <> RF_SUCCESS Then
        MsgBox RapidForm.Application.GetErrorMessage(rfErr)
        Exit Sub
    End If
    
    rfErr = vtObj.SetID(pickedID)
    
    ' Collect N-depth adjacent faces
    Dim nDepth As Long
    Dim nMaxFcs As Long
    Dim pDepthAdjFcs() As RFEntityID
    Dim nDepthAdjFcs As Long
    
    nDepth = 2
    nMaxFcs = 100
    
    ' Allocate the memory space of the pAdjFcs array as the amount of nMaxFcs
    ReDim pDepthAdjFcs(nMaxFcs)
    rfErr = vtObj.EnumDepthAdjacentFaces(nDepth, nMaxFcs, pDepthAdjFcs(0), nDepthAdjFcs)
    
    ' If the actual number of N-depth adjacent faces is larger than the expected nMaxFcs, recollect the faces again.
    If nDepthAdjFcs > nMaxFcs Then
        nMaxFcs = nDepthAdjFcs
        Erase pDepthAdjFcs
        
        ReDim pDepthAdjFcs(nMaxFcs)
        rfErr = vtObj.EnumDepthAdjacentFaces(nDepth, nMaxFcs, pDepthAdjFcs(0), nDepthAdjFcs)
    End If

   ' Finally release the allocated memory space for the pAdjFcs array when it is no longer necessary.
    Erase pDepthAdjFcs

Return to Rapidform Index


Your Ad Here