How I can get information from a Navisworks .NWD file using its NET API by IronPython (mainly name of each item in orden to confirm that all parts are already modeled).

I have not experience with C# but with python, so I want to use IronPython.

I know about NavisPythonShell but After some attempts, it didn't work for me. Navisworks crashed as soon as plugin run.

Anyway I got some advances using IronPython. Navisworks opens, load a file and close, but using Autodesk.Navisworks.Api.Application.ActiveDocument, It only got NoneType "object".

import sys, clr
navis_path = r'C:\Program Files\Autodesk\Navisworks Manage 2017'
nw_model = r'C:\Users\myName\Client\navis\nodel.nwd' 
sys.path.append(navis_path)

clr.AddReference('Autodesk.Navisworks.Api')
clr.AddReference('Autodesk.Navisworks.Automation')
clr.AddReference('Autodesk.Navisworks.Controls')

from Autodesk.Navisworks.Api import *
from Autodesk.Navisworks.Api.Automation import *
from Autodesk.Navisworks.Api.Controls import *

nw = NavisworksApplication()
nw.Visible = True
nw.OpenFile(nw_model)

doc = Application.ActiveDocument

Type of doc equal to "NoneType"

0 Answers