Community
Navisworks API
Welcome to Autodesk’s Navisworks API Forums. Share your knowledge, ask questions, and explore popular Navisworks API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NavisWorks Simulate 2011 API and AutoPLANT V8i SS3

2 REPLIES 2
Reply
Message 1 of 3
jorgegarza1209
936 Views, 2 Replies

NavisWorks Simulate 2011 API and AutoPLANT V8i SS3

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:

 

 

Component Cat.png

 

 

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

 

2 REPLIES 2
Message 2 of 3

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

Message 3 of 3
x2dalyon
in reply to: jorgegarza1209

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.

Post to forums  

Rail Community


 

Autodesk Design & Make Report