Hi
try this code:
this code simply do the following:
1- graps all Cad Instances in your Project
2- create a new ListViewItem and assign an item text "Visible to user" the name of the instance.
3- give the item name the Id of the element so we can use it as a reference later.
4- now if you checked any element it will give a text message to showing the id name.
5- last statment is how you can get the element from you projecty from the ID.
I hope that helps.
public Frm_Importins()
{
InitializeComponent();
listView1.CheckBoxes = true;
FilteredElementCollector filcol = new FilteredElementCollector(m_doc).OfClass(typeof(ImportInstance));
foreach (ImportInstance imps in filcol)
{
ListViewItem listit = new ListViewItem(imps.get_Parameter(BuiltInParameter.IMPORT_SYMBOL_NAME).AsString());
listit.Name = imps.Id.ToString();
listView1.Items.Add(listit);
}
}
private void listView1_ItemChecked(object sender, ItemCheckedEventArgs e)
{
if (e.Item.Checked)
{
MessageBox.Show("You selected Element of ID " + e.Item.Name);
//get a handle of Revit Element
Element ele = m_doc.GetElement(new ElementId(int.Parse(e.Item.Name)));
}
}


Moustafa Khalil