Page 1 of 1

Adding objects to a model

Posted: Tue Jun 18, 2024 9:46 am
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

Re: Adding objects to a model

Posted: Tue Jun 18, 2024 9:47 am
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