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

Addin doesn't work on another PC

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
filip_tacic
295 Views, 2 Replies

Addin doesn't work on another PC

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?

 

 

Labels (8)
2 REPLIES 2
Message 2 of 3
mhannonQ65N2
in reply to: filip_tacic

It sounds like the error is in part of the code you didn't share, since it is finding the family symbol. Also, are you testing it on the same project and with the same input?

Message 3 of 3
filip_tacic
in reply to: filip_tacic

Hi Mhannon,

 

Thank you for your answer! I double-checked both projects and they were fine, but it turned out that the hanger family on my local PC had an extra reference plane (which I used inside the add-in code), and the hanger family in my office was a previous version of the same family (without the ref plane).

 

Now, everything works perfectly!

 

PS. In the first post, I've attached the complete VS solution with all the classes and codes.

 

Thanks once again, you really helped me out!

Filip

 

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community