What could be wrong with the Import method on the oSets object here?

I tried executing this code but the Import method on the oSets object is being flagged as an error.

using System;
using Autodesk.Navisworks.Api;
using Autodesk.Navisworks.Api.DocumentParts;
using NavisworksSearchSetImporter;

namespace NavisworksSearchSetImporter
{
    public class SearchSetImporter
    {
        public void ImportSearchSet(string filePath)
        {
            // Open the Navisworks document
            Document oDoc = Autodesk.Navisworks.Api.Application.ActiveDocument;

            // Load the search set from the file
            DocumentSelectionSets oSets = oDoc.SelectionSets;
            oSets.Import(filePath);

            Console.WriteLine("Search set imported successfully.");
        }
    }
}

class Program
{
    static void Main(string[] args)
    {
        SearchSetImporter importer = new SearchSetImporter();
        string filePath = @"C:\Users\olagb\Desktop\Coding\YourSearchSetFile.xml";
        importer.ImportSearchSet(filePath);
    }
}

The Import method on the oSets object doesn't seem to be recongnized and is been flagged as an error, despite importing the right required references.

Upvotes: 0

Views: 17

Answers (0)

Related Questions