Adding objects to a model

Everything DG Kernel: Technical discussions and issues
Post Reply
highrev
Posts: 1
Joined: Tue Jun 18, 2024 9:43 am

Adding objects to a model

Post by highrev »

Hello

I need to load additional object(s) to add to already displayed mode. What is the right way? Do I need to add another control to the form? I am using VB .NET 4.5.
Thanks
Nick
Site Admin
Posts: 20
Joined: Fri Jun 14, 2024 12:35 am

Re: Adding objects to a model

Post by Nick »

Hello

You do not need another control. It is done by creating new model in memory, getting its IModelEx and using IModelEx.Load() like in
Samples\NET\C#\3DBugger\DebuggerForm.cs :
IModel iModel = (IModel)m_iDIObjGenerator.Create(EObjectType.eObjTypeModelGenerator);
IModelEx iModelEx = (IModelEx)iModel;
iModelEx.Load(strPath);
.. copy objects into the main model

The format is detected by the extension of strPath. It can be stl, glm, etc

The C#\DataFlow example also has File>Import Objects menu option, but the sample replaces the current model with new objects. It can be easily modified to only adding objects using the above code.

If you need numerous stl load operations it is better to convert them all in a loop as background operation to .glm. Stl load with all the analysis checks is slow for large files

Nick
Post Reply