Seleccionar los padres de un elemento
Addin para API de Navisworks
Descripción
Este código te permitirá cambiar selección de Navisworks a los padres de los elementos seleccionados. Esto puede resultar útil cuando se ejecuta la comparación de modelos y se quiere cambiar la selección de la geometría a otro nivel con más información. El código es un boceto que debe emplearse en combinación con los ejemplos incluidos en el SDK de Navisworks.
#region SelectorTools
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Text;
//Add two new namespaces
using Autodesk.Navisworks.Api;
using Autodesk.Navisworks.Api.Plugins;
namespace ModelicalNavisTools
{
[PluginAttribute("ModelicalNavisTools.ParentSelector", //Plugin name
"MODE", //4 character Developer ID or GUID
ToolTip = "Changes your selection to the parent items",//The tooltip for the item in the ribbon
DisplayName = "Select Parents")] //Display name for the Plugin in the Ribbon
public class SelectParent : AddInPlugin //Derives from AddInPlugin
{
public override int Execute(params string[] parameters)
{
MessageBox.Show(Autodesk.Navisworks.Api.Application.Gui.MainWindow, "Changing selection to parents");
SelectParents();
return 0;
}
public void SelectParents()
{
ModelItemCollection selectionModelItems = new ModelItemCollection();
Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.SelectedItems.CopyTo(
selectionModelItems);
//Clear the current selection
Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.Clear();
//iterate through the ModelItem's in the selection
foreach (ModelItem modelItem in selectionModelItems)
{
//Add parent to selection
Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.Add(modelItem.Parent);
}
}
}
}
#endregion
Plataforma
Navisworks.
Tipo
Navisworks Addin.