Accessing takeoff data through the Navisworks API

Accessing takeoff data through the Navisworks API

Anonymous
Not applicable
1,618 Views
4 Replies
Message 1 of 5

Accessing takeoff data through the Navisworks API

Anonymous
Not applicable

Hello!

 

I'm trying to access takeoff data through the Navisworks API, but so far I have had no luck. I tried using the pieces of code that are in the Navisworks .NET API documentation, but those bring me nowhere closer to the result.

 

I have tried quering the takeoff variables, but that results in column names not the values of the variables itself:

DocumentTakeoff docTakeoff = Autodesk.Navisworks.Api.Application.MainDocument.GetTakeoff();

List<TakeoffVariableDefinition> takeoffVariableDefinitions = docTakeoff.Objects.Variables.ToList();

 

In addition to that, I have also tried quering data (i.e object values in objects table) through SQL-like sentences, which also gives no result:

List<String> values = new List<String>();

cmd.CommandText = "select object_value from tk_object";
using (NavisWorksDataReader dataReader = cmd.ExecuteReader())
{
    if (dataReader.Read())
    {
        values.Add(dataReader.NextResult().ToString())
    }

    return values;
}

 

Lastly I have also tried finding the variable (i.e model length) by name and getting it's value:

DocumentTakeoff docTakeoff = Autodesk.Navisworks.Api.Application.MainDocument.GetTakeoff();
TakeoffVariableCollection variableCollection = docTakeoff.Objects.SelectInputVariables(objectId);

Int32 lengthIndex = variableCollection.Find("ModelLength");
String value = null;

if (lengthIndex != -1)
{
    TakeoffVariable lengthVariable = variableCollection.GetItem(lengthIndex);
    value = lengthVariable.Value.ToString();
}

return value;

 

Could anyone explain what am I doing wrong or give me directions how to move on. Also it would be great to know, what are the tables in Navisworks API and what data do they correspond to. In the end, it should be possible to reach the quantification data (i.e. object, width, height, count), through a C# plugin.

 

 

Dan

0 Likes
1,619 Views
4 Replies
Replies (4)
Message 2 of 5

OR_AND_NO
Advocate
Advocate

Have you solved this problem?

Now I try to do the same 😞

0 Likes
Message 3 of 5

OR_AND_NO
Advocate
Advocate

Take a look on Takeoff API Plugin code example. There you would see how it works.

0 Likes
Message 4 of 5

jnoordzij
Advocate
Advocate

Hi. I am also working on some Takeoff API things. Unfortunately a lot of forum topics remain unanswered. Could you share with us if you have found a solution? 

 

( I did take a look at the Takeoff API example but did not get much wiser from  it. )

0 Likes
Message 5 of 5

Anonymous
Not applicable

any news on this matter?

0 Likes