Message 1 of 4
Error loading .dll file into revit
Not applicable
08-31-2017
10:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi people. Having a bit of trouble loading my dll file into Revit.
I am getting the following error message:
I know for certain it has something to do with how I am structuring my IExternalCommand and My IExternalApplication. I have a main class that talks to the extensions classes (to execute the various commands) which I have used IExternalCommand as follows.
using System.Linq;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace DoorTag
{
[TransactionAttribute(TransactionMode.Manual)]
[RegenerationAttribute(RegenerationOption.Manual)]
public class MoveDoors : IExternalCommand
{
// implement the command
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
//Get application and document objects
UIApplication uiApp = commandData.Application;
Document doc = uiApp.ActiveUIDocument.Document;
// get the active document in revit
var activeDoc = commandData.Application.ActiveUIDocument.Document;
var activeView = commandData.Application.ActiveUIDocument.ActiveGraphicalView;
// create a new filtered collection of door tags and their ids
var tagCollector = new FilteredElementCollector(activeDoc, activeView.Id);
// Find the doors whos tags needs to be moved ---'tagsToMove'
var tagsToMove = tagCollector.
OfCategory(BuiltInCategory.OST_DoorTags).
OfClass(typeof(IndependentTag)).
OfType<IndependentTag>().
// calling an external method that will test if the door is a valid door type.
Where(tag => tag.IsAttachedToValidDoor(true));
foreach (var tag in tagsToMove)
{
tag.MoveToCorrectPosition();
}
return Result.Succeeded;
}
}
}
and I have used a App class to made a small icon for my new addin.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System.Windows.Media.Imaging;
namespace DoorTag
{
class App : IExternalApplication
{
// define a method that will create our tab and button
static void AddRibbonPanel(UIControlledApplication application)
{
// Create a custom ribbon tab
String tabName = "PTW";
application.CreateRibbonTab(tabName);
// Add a new ribbon panel
RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Tools");
// Get dll assembly path
string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
// create push button for doortag command
PushButtonData b1Data = new PushButtonData(
"cmdDoorTag",
"Fix Door" + System.Environment.NewLine + " Tags ",
thisAssemblyPath,
"DoorTag.MoveDoorTags");
PushButton pb1 = ribbonPanel.AddItem(b1Data) as PushButton;
pb1.ToolTip = "Move all the door tags in your open project to their correct position within the door leaf";
BitmapImage pb1Image = new BitmapImage(new Uri("pack://application:,,,/DoorTagProject/component/Resources/DoorTagIcon.png"));
pb1.LargeImage = pb1Image;
}
public Result OnShutdown(UIControlledApplication application)
{
// do nothing
return Result.Succeeded;
}
public Result OnStartup(UIControlledApplication application)
{
// call our method that will load up our toolbar
AddRibbonPanel(application);
return Result.Succeeded;
}
}
}My manifest is as follows
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>
C:\test\DOOR_TAGS\DoorTagProject\DoorTagProject\bin\Release\DoorTagProject.dll
</Assembly>
<ClientId>9a3e9d19-9303-4f2d-8a64-4db4d7eef795</ClientId>
<FullClassName>DoorTag.App</FullClassName>
<Text>DoorTag</Text>
<VendorId>PTW</VendorId>
<VisibilityMode>AlwaysVisible</VisibilityMode>
</AddIn>
</RevitAddIns>Does anyone know what I am doing wrong?