Saving Model

Forum for reporting problems
Post Reply
atrev
Posts: 24
Joined: Tue Jul 30, 2013 9:19 am

Saving Model

Post by atrev »

We are saving meshes we produce using the IModelEx.SaveEx function, but if we accidentally leave a PointArra section in the view, it causes a StackOverflow exception on the SaveEx line and kills the application, even if function is in an error block

we went from

Code: Select all

Dim imdl As KernCADnet.IModelEx = frmMain.AxKernCADMainForm.GetModel
Dim options As KernCADnet.IDataContext = imdl
options.SetVerbose(False)
imdl.SaveEx("merged.stl", options)
to

Code: Select all

Dim origMdl As IModel = CType(frmMain.AxKernCADMainForm.GetModel, IModel)
Dim m_iDIObjGenerator As IDIObjGenerator = CType(frmMain.AxKernCADMainForm.GetView, IDIObjGenerator)
Dim imdl As IModelEx = CType(m_iDIObjGenerator.Create(EObjectType.eObjTypeModelGenerator), IModelEx)
Dim options As KernCADnet.ISTLDataContext = CType(imdl, ISTLDataContext)
Dim iarry2 As IArray2 = imdl
For k As Integer = 0 To origMdl.GetSectionCount - 1
    If origMdl.GetSection(k).GetSectionType = "MeshSection" Then
        iarry2.Add(origMdl.GetSection(k))
    End If
Next
options.SetVerbose(False)
imdl.SaveEx("merged.stl", options)

And this seems to have solved our problem for now, but I thought I'd report anyway.
Thanks

nickz
Site Admin
Posts: 236
Joined: Fri Jul 26, 2013 3:58 am

Re: Saving Model

Post by nickz »

atrev,
I do not see it happening on simple model. There should be something else involved. Would be good to get the model
Nick

Post Reply