My first revit plugin help Lesson 1

My first revit plugin help Lesson 1

Nathan.HilsonN67V6
Advocate Advocate
529 Views
5 Replies
Message 1 of 6

My first revit plugin help Lesson 1

Nathan.HilsonN67V6
Advocate
Advocate

Can anybody give quick insight on why this isn't recognizing? Followed all the steps but won't recognize "Execute". 

 

NathanHilsonN67V6_0-1642642818518.png

 

0 Likes
Accepted solutions (1)
530 Views
5 Replies
Replies (5)
Message 2 of 6

Kevin.Lawson.PE
Advocate
Advocate

Hi Nathan, welcome to the Revit API, your life will never be the same. 

 

If you hover over the error and rest the mouse, Intellisense will pop up an error description.

 

KevinLawsonPE_0-1642649277010.png

There's also an "Error List" tab on the bottom pane that will give you more info about the error.  Post those and we can be of more help. 

 

My guess is that you are not returning a value. Make sure all code "paths" return Result.Succeeded or Result.Failed. 

-Kevin Lawson, PE
www.rippleengineeringsoftware.com
Revit heating and cooling load calculations in one click!
0 Likes
Message 3 of 6

Nathan.HilsonN67V6
Advocate
Advocate

Thanks Kevin. I posted the snippets below. 

 

NathanHilsonN67V6_0-1642680401685.png

NathanHilsonN67V6_1-1642680528413.png

 

0 Likes
Message 4 of 6

Kevin.Lawson.PE
Advocate
Advocate
Accepted solution

I was right! "Not all code paths return a value"

 

The class "Execute" is expecting a "Result" to be returned.  You need to have a "return Result.Succeeded" statement at the end of the Execute code.

 

public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
//do whatver the code does
return Result.Succeeded;
}
-Kevin Lawson, PE
www.rippleengineeringsoftware.com
Revit heating and cooling load calculations in one click!
Message 5 of 6

Nathan.HilsonN67V6
Advocate
Advocate

Thanks. You just saved me a ton of time trying to do more research. Everything I found online kept saying I was missing a reference. 

0 Likes
Message 6 of 6

Kevin.Lawson.PE
Advocate
Advocate

That was my first inclination as well, but you would have had a lot more errors if you were missing a reference. 

-Kevin Lawson, PE
www.rippleengineeringsoftware.com
Revit heating and cooling load calculations in one click!
0 Likes