JeffYao28
223 Views, 1 Reply

Accessing Splitter.Sizes using API always throws exception

Hi there,

 

My accessing of the Sizes property of splitter object from job item always throws exception:System.NullReferenceException: 'Object reference not set to an instance of an object.'

The C# code snippet using Fabrication API is:

void TestSplitter()
{
string msg;
for (var i1 = 0; i1 < Job.Items.Count; i1++)
{
var item = Job.Items[i1];
for (var i2 = 0; i2 < item.Splitters.Count; i2++)
{
try
{
var splitter = item.Splitters[i2];
if (splitter != null)
{
// The statement below throws System.NullReferenceException: 'Object reference not set to an instance of an object.'
var sizes = splitter.Sizes;
}
}
catch (Exception ex)
{
msg = ex.Message;
}
}
}
}

This error was seen when running the code in CAMduct 2023.

Please find the MAJ Job from the attached zip file so you can open it in CAMduct and check its item splitters, as the attached screen shot shows.

Any idea what is wrong in my coding?

Thanks!

 

Jeff Yao

 

JeffYao28
in reply to: JeffYao28

Autodesk ADN responded that this has been put on their internal tracking list.