Page 1 of 1

Load model from memory

Posted: Mon May 17, 2021 5:13 pm
by aarond
In KernelCAD there was a method to load a model from memory, IModelEx.LoadFromMemory(), is there a way to do this in DG Kernel?

Re: Load model from memory

Posted: Tue May 18, 2021 7:12 am
by nickz
Hi Aaron
Strictly speaking it should be working, despite it was declared deprecated, but I do not remember any recent mentioning of it.
We will take a close look at it shortly to check if it does. Please keep an eye on this thread.
Regards

Re: Load model from memory

Posted: Tue May 18, 2021 5:47 pm
by aarond
Ah, I was using the IModel_DG interface and didn't see the method in there. I didn't think to try casting it to IModelEx. I will play around with that method, thanks.

Re: Load model from memory

Posted: Mon May 31, 2021 5:08 am
by nickz
Hi Aaron
There was a bug. Sorry. It was kind of grey area missed in tests.
Please get today's 5215 update: [url../ProDown.htm]Downloads[/url]

If you intend to load an .mdg, call it like:

Code: Select all

iModelEx.LoadFromMemory(arr, (int)ECADFormat.eCADFormatMDG);
Not with 0 format. 0 is .glm (should work as well).
See an example in Test_IModel_DG.TestLoadFromMemory() of Samples\NET\C#\Tests\InterfaceTests\Test_IModel_DG.cs (Load Samples\NET\C#\Tests\InterfaceTests\InterfaceTests.sln)

We will add this to _DG interface also in the next version

Regards

Re: Load model from memory

Posted: Thu Jun 10, 2021 7:08 pm
by aarond
Thanks Nick, I can verify it is working for the MDG models, however it is not working for GLM models. I plan on moving to MDG going forward but we have a ton of GLM models out in the wild that we will still need to support.

I am using the ECADFormat.eCADFormatGLM when trying to load GLMs but the view is empty and no error is thrown.

Re: Load model from memory

Posted: Sun Jun 13, 2021 11:59 pm
by nickz
Hmm. I am sure we got this working.
Checking...

Re: Load model from memory

Posted: Wed Jun 16, 2021 4:52 am
by nickz
This should be working now after today's 5217 update Download.
See the Test_IModel_DG.TestGlmMemoryPersit() in DGKernel_6_2\Samples\NET\C#\Tests\InterfaceTests\Test_IModel_DG.cs, C#\Tests\InterfaceTests sample project.
Regards