.NET Import CAD geometry

Hello,

I am trying to create a plugin to automatically import CAD geometry. I managed to import a CAD file with ISimWorld. Import Method. However it does not let me modify all of the import options (only tessellation quality and feature tree).

I noticed that ImportConfigElement has options for ImportMarkups, ImportMaterials etc. but I don’t know how to do the import using that configuration.

Does anyone have a solution for that?

Hello,

This should do the trick:

// Get settings
var settings = IoC.Get<IApplicationSettingService>();
var importSection = settings.GetSection<IImportSection>();
var importElement = importSection.ImportElement;
// Set settings
importElement.ImportMaterials = false;
// Save settings
settings.RefreshSection(importSection);

// Load cad
IApplication _app = IoC.Get<IApplication>();
Vector3 position = new Vector3();
bool component = false;
Uri location = IoC.Get<IUrlHelper>().LocalPathToUrl(@"C:\Users\user\folder\cad.jt", false); 
_app.LoadLayout(location, position, out component, _app.World);

 

2 Likes