Hi,
I created a simple add-in that adds hangers (a custom family I created prior to coding the app) along the duct curve. The problem occurs when I run the add-in via my office PC.
Here's some information:
1. Add-in is coded in visual studio (C#) - and everything works fine on my personal PC.
2. After building the add-in, I copied the manifest file (*.addin) and the .DLL file to the %appdata% location on my office PC. When I run Revit it asks me to load the add-in, and the push button appears on the ribbon. So far so good.
3. When I activate the command on the ribbon, it shows me Dialog saying that the required family is missing. I did this on purpose, just to check if the external application can be started. The result is yes, it starts with no problem.
FilteredElementCollector collector = new FilteredElementCollector(doc);
IList<Element> symbols = collector.OfCategory(BuiltInCategory.OST_MechanicalEquipment).WhereElementIsElementType().ToElements();
//Pravim praznu promenljivu tipa Element u koju planiram da smestim familiju "Hanger - SU", koja ce mi trebati za dalju obradu
Element hangerFamily;
hangerFamily = symbols.Where(elem => elem.Name == "Hanger - SU").FirstOrDefault();
//Kreiram Family Symbol objekat od Elementa - OVO JE INSTANCA od familije koju smo izabrali
FamilySymbol famsym = hangerFamily as FamilySymbol;
//Provera da li je familija pronadjena, ako nije izbacuje gresku, a ako jeste kreci glavni program
if (famsym == null)
{
TaskDialog.Show("Greska", "Familija 'Hanger - SU' nije ucitana. Ubacite familiju u projekat pa pokrenite opet komandu");
}
4. After that, I loaded the required family in the project and clicked the push button again. And here the issue appears, saying "Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index". To me, it just looks like some loop is not iterating properly - But how can it be, when everything works just fine on my personal PC where I coded and tested the app with no issues?
5. I checked the installed .NET frameworks on both PCs, and the version on my personal PC is 4.8.9032.0, while my office PC .NET version is 4.8.3752.0.
Does anyone have any idea what might be causing the issue?
Solved! Go to Solution.