How to read the custom properties from Navisworks file using API.

How to read the custom properties from Navisworks file using API.

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

How to read the custom properties from Navisworks file using API.

Anonymous
Not applicable

Hi.

 

User is adding additional properties (custom properties) using Navisworks Data Tools. When i am reading the properties from navisworks file using the API's, the API is returning all the properties under "Item", "Material", "Timeliner", "Entity Handle", "Autoplant Component", "Autocad" tabs. But this navisworks file has one more property node called "XYZ"(example, this is user defined name) and this property node has multiple properties user has entered. But the API is not reading these properties. So, the question is how to read Custom or user defined properties from navisworks file?

 

Here is the piece of code to read the properties i have in my project. 

GetValue(oModelItem, null)).GetEnumerator();

while (ePropertyCatIterator.MoveNext())
{
object oPropCatIter = ePropertyCatIterator.Current;
string sCategory = Convert.ToString(oPropCatIter.GetType().GetProperty("DisplayName").GetValue(oPropCatIter, null));


IEnumerator<Object> ePropertyIterator = ((IEnumerable<Object>)oPropCatIter.GetType().GetProperty("Properties").
GetValue(oPropCatIter, null)).GetEnumerator();

      while (ePropertyIterator.MoveNext())
      {
                  object oPropIter = ePropertyIterator.Current;
                  string sValue = Convert.ToString(oPropIter.GetType().GetProperty("Value").GetValue(oPropIter, null));
                   string sName = Convert.ToString(oPropIter.GetType().GetProperty("DisplayName").GetValue(oPropIter,        null));

     }

}

Regards

Sampath

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

Anonymous
Not applicable

@xiaodong.liang  Any help is much appreciated. 

0 Likes
Message 3 of 5

Ganesh79
Explorer
Explorer

Hi Sampath,

you can use the below code.

 

private Boolean IsXYZAttributeExist(ComApi.InwOaPath path)
{
Boolean isExist = false;
InwGUIPropertyNode2 propn = m_state.GetGUIPropertyNode(path, true) as InwGUIPropertyNode2;
foreach (InwGUIAttribute2 guiattrib in propn.GUIAttributes())
{
if (guiattrib.ClassUserName == "XYZ")
{
isExist = true;
break;
}
}
return isExist;
}

 

0 Likes
Message 4 of 5

Anonymous
Not applicable

Hi Ganesh..

 

Thanks for your time to respond my query.

 

I tried it and it does not work and hence posted the query here. The GUIProperties is returning all the categories like "Item", "Material", "Geometry", "Entity Handle", "Autocad" etc, but it is not returning the category which user added using data tools. 

 

Regards

Sampath.

0 Likes
Message 5 of 5

sampath.jeedigam
Enthusiast
Enthusiast

The data comes in via a link to a database (or other odbc source) i.e., LcOdpDBDatabaseReadLink . So we have to read these properties from that category.

 

Any idea?

 

Regards

Sampath.

0 Likes