My First Plug In - Revit 2015

My First Plug In - Revit 2015

Anonymous
Not applicable
443 Views
1 Reply
Message 1 of 2

My First Plug In - Revit 2015

Anonymous
Not applicable

Hi all,

Im new to the API area of Revit.

I have simply copied what was written in the lesson 1 steps however there are multiple errors coming up and simply isnt a successful build.

This is what is written in the Class 1

 

using System;

using System.Collections.Generic;

using System.Linq;

Element elem = pickedRef.Element;

Element elem = doc.GetElement(pickedRef);

using Autodesk.Revit.DB.Architecture;

using Autodesk.Revit.UI;

using Autodesk.Revit.UI.Selection;

using Autodesk.Revit.ApplicationServices;

using Autodesk.Revit.Attributes;

[TransactionAttribute(TransactionMode.Manual)]

[RegenerationAttribute(RegenerationOption.Manual)]

public class Lab1PlaceGroup : IExternalCommand

{

public Result Execute(

ExternalCommandData commandData,

ref string message,

ElementSet elements)

{

//Get application and document objects

UIApplication uiApp = commandData.Application;

Document doc = uiApp.ActiveUIDocument.Document;

//Define a Reference object to accept the pick result.

Reference pickedRef = null;

//Pick a group

Selection sel = uiApp.ActiveUIDocument.Selection;

pickedRef = sel.PickObject(ObjectType.Element, "Please select a group");

Element elem = pickedRef.Element;

Group group = elem as Group;

//Pick a point

XYZ point = sel.PickPoint("Please pick a point to place group");

//Place the group

Transaction trans = new Transaction(doc);

trans.Start("Lab");

doc.Create.PlaceGroup(point, group.GroupType);

trans.Commit();

return Result.Succeeded;

}

}

 

 

Then when I request to build this attached image pops up. What does it mean? How do I fix it?

Any help is really appreciated!

 

Thank you

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

augusto.goncalves
Alumni
Alumni
You're missing a few steps on the tutorial:

Add references to RevitAPI.dll and RevitAPIUI.dll
Set debug settings (start external application)

Please review it.
Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes