must declare a body

must declare a body

Anonymous
Not applicable
407 Views
1 Reply
Message 1 of 2

must declare a body

Anonymous
Not applicable

I am new to programming and i am trying to follow an example in the API Developer Guide (13-9: Labeling a Dimension). I am receiving the following error:

'DimLabel.DimLabel. Execute(Autodesk.Revit.UI.ExternalCommandData, ref string, Autodesk.Revit.DB.ElementSet)' must declare a body because it is not marked abstract, extern, or partial.

Please let me know how to fix this.  The code is attached.

0 Likes
408 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

Basically, no body is defined for your Execute method.  See the commented area below.  Uncomment the curly braces and put the body of the Execute method between them.

 

<snip>

 

        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements);

 

// Body goes here

// {

//       CreateLinearDimension(commandData.Application.ActiveUIDocument.Document);  // Or whatever

// }

 


            public Dimension CreateLinearDimension (Document document)
            {

<snip>

 

0 Likes