Community
I have write a simple addin for Revit2017 using C++/CLR, Here is the code:
The .h file ClassLibrary3.h:
#pragma once using namespace System; using namespace System::Windows::Forms; using namespace System::Collections; using namespace Autodesk::Revit; using namespace Autodesk::Revit::DB; using namespace Autodesk::Revit::UI; namespace ClassLibrary3 { [Autodesk::Revit::Attributes::Transaction(Autodesk::Revit::Attributes::TransactionMode::Manual)] public ref class Class1 : IExternalCommand { public: virtual Result Execute(ExternalCommandData ^ commandData, String ^% message, ElementSet ^ elements) sealed; }; }
The .cpp file is:
#include "stdafx.h" #include "ClassLibrary3.h" namespace ClassLibrary3 { Result Class1::Execute(ExternalCommandData ^ commandData, String ^% message, ElementSet ^ elements) { MessageBox::Show("executed"); return Result::Succeeded; } }
The ClassLibrary3.addin:
<?xml version="1.0" encoding="utf-8"?> <RevitAddIns> <AddIn Type="Command"> <Assembly>D:\temp\ClassLibrary3\Debug\ClassLibrary3.dll</Assembly> <ClientId>183C607F-4873-4A6D-BE89-0E0357A05F8C</ClientId> <FullClassName>ClassLibrary3.Class1</FullClassName> <Text>ClassLibrary3</Text> <Description>ClassLibrary3</Description> <VisibilityMode>AlwaysVisible</VisibilityMode> <VendorId>BIMTECH</VendorId> <VendorDescription>BIMTECH</VendorDescription> </AddIn> </RevitAddIns>
The addin is loaded successfully by Revit 2017 and appeared in the External Tools menu.
My problem is that Revit did not respond when I chose to execute the addin command in the menu, why?
It looks like the Class1 :: Execute function is not executed at all
Solved! Go to Solution.
Can't find what you're looking for? Ask the community or share your knowledge.