Problem with IMeshTopol.AddSimplex()

Forum for reporting problems
Ibi
Posts: 17
Joined: Mon Jul 29, 2013 12:44 am

Problem with IMeshTopol.AddSimplex()

Postby Ibi » Thu Dec 07, 2017 8:48 pm

Hi
I have an application, which used to work with v4.4. It does not work with 5.1

Here is a code extract:

Code: Select all

Dim generator As KernCADnet.DIObjGenerator = New KernCADnet.DIObjGenerator
        Dim iMeshObject As ISection = generator.Create(EObjectType.eObjTypeMeshSection)
        Dim i As Integer
 
        Dim iMeshTopol As IMeshTopol = iMeshObject
 
        For i = 0 To totalNodes - 1
            iMeshTopol.AddVertex()
        Next
 
        Dim iMesh As IMesh = iMeshObject
        Dim IVertexIterator As IIterator = iMesh.GetVertexIterator
        Dim iMeshMods As IMeshMods = iMeshObject
        Dim posVtx(1000), posVertex As Integer
 
        posVertex = IVertexIterator.GetHeadPosition
        posVtx(0) = posVertex
        iMeshMods.SetVertexCoord(posVertex, points(0, 1), points(0, 2), points(0, 3))
        ' vertex 0 is set now continue with 1,2,3 etc.
        For i = 1 To totalNodes - 1
            IVertexIterator.GetNext(posVertex)
            posVtx(i) = posVertex
            iMeshMods.SetVertexCoord(posVertex, points(i, 1), points(i, 2), points(i, 3))
        Next i
        For i = 1 To totalElements
            iMeshTopol.AddSimplex(posVtx(triangleNodes(i, 1)), posVtx(triangleNodes(i, 2)), posVtx(triangleNodes(i, 3)), 85.0)
            Next

It actually crashes on the iMeshTopol.AddSimplex(..) line. Instead of 85 it used to be 0.0, after reading your help document I changed it to 85 but it made no difference.

I hint would be appreciated
Thank you
Ibi

Prashant Kande
Posts: 13
Joined: Mon Apr 04, 2016 4:55 am

Re: Problem with IMeshTopol.AddSimplex()

Postby Prashant Kande » Fri Dec 08, 2017 3:06 am

Hi Ibi
We just have posted an update 4686 of 5.1: http://dynoinsight.com/ProDown.htm
We have added error reporting inside IMeshTolop.AddSimplex()

Most likely there is some bug in your code which requests an invalid simplex

If you catch the exception and check for error like:

Code: Select all

 Private Sub AddSimplex(iMeshTopol As IMeshTopol, vert0 As Integer, vert1 As Integer, vert2 As Integer, creaseAngle As Double)
          Try
              iMeshTopol.AddSimplex(vert0, vert1, vert2, creaseAngle)
          Catch ex As Exception
              'Check what was the problem
              Dim iErrror As IError_KC = m_iModel
              Dim n As Integer = iErrror.GetCount()
              Dim i
              For i = 0 To n Step 1
                  Dim strErr As String = iErrror.GetErrorEx(i)
              Next i
          End Try

      End Sub

The strError would give you answer (there is a good chance) about the problem

The above snipped is from Morph.vb installed sample


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest