Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
I am new to the Navisworks API. I am trying to search the modelItems based on an AutoPLANT database value from the piping table. I have made my connection with Data tools and my database values are being displayed. When i am wrting the code I do not get a valid property catagory for AutoPLANT components.Below is a copy of the code and snap shot:
s.SearchConditions.Add(
SearchCondition.HasCategoryByName(PropertyCategoryNames.Geometry));
private void searchGeometry_Click(object sender, EventArgs e) { #region searchGeometry //Create a new search Search s = new Search(); //set the selection to everything s.Selection.SelectAll(); //Add a search condition s.SearchConditions.Add(SearchCondition.HasCategoryByName(PropertyCategoryNames.Geometry)); //get the resulting collection by applying this search ModelItemCollection searchResults = s.FindAll(Autodesk.Navisworks.Api.Application.ActiveDocument, false); //Select the items in the model that are contained in the collection Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.CopyFrom(searchResults); #endregion
Hi,
I have not a model of AutoPlant, but if the objects do have the property category whose name is ‘Geometry’, the API should work. Have you tried if with display name? i.e.
s.SearchConditions.Add(SearchCondition.HasCategoryByDisplayName(“xxxxx”));
Note: display name is language dependent. you can check it in GUI and test with API.
Regards,
Xiaodong Liang
Developer Technical Services
I find the component ID (comp_id) like this:
foreach (ModelItem mi in oModels)
{
string curr_Comp_Id = "";
nameValue = mi.PropertyCategories.FindPropertyByName("LcOpDwgComponentAttrib", "LcOaSceneBaseUserName").Value.ToString();
comp_id = nameValue.Substring(nameValue.LastIndexOf(":") + 1);
//get comp_id info, then add info to navisworks element.
Can't find what you're looking for? Ask the community or share your knowledge.