Load model from memory

Technical discussions
Post Reply
aarond
Posts: 4
Joined: Mon May 17, 2021 4:23 pm

Load model from memory

Post 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?

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

Re: Load model from memory

Post 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

aarond
Posts: 4
Joined: Mon May 17, 2021 4:23 pm

Re: Load model from memory

Post 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.

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

Re: Load model from memory

Post 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

aarond
Posts: 4
Joined: Mon May 17, 2021 4:23 pm

Re: Load model from memory

Post 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.

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

Re: Load model from memory

Post by nickz »

Hmm. I am sure we got this working.
Checking...

Post Reply