In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "how to create a plug-in panel in Revit". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Creating the panel is different from the usual code in that the interface is different. We need to use the external interface IExternalApplication, while the interface of the template that we have been using before is IExternalCommand. The differences are as follows:
1. The usual interface.
two。 The interface to be used by the panel
Revit uses addin files to identify and load external plug-ins that implement IExternalApplication. IExternalApplication provides two overloaded OnShutdown and OnStartup to achieve Revit off and on load functions.
Because I'm going to code:
Using System.Data
Using System.Windows
Using System.Windows.Media.Imaging
Using Autodesk.Revit
Using Autodesk.Revit.UI
Using Autodesk.Revit.UI.Selection
Using Autodesk.Revit.DB
Using Autodesk.Revit.DB.Architecture
Using Autodesk.Revit.DB.Mechanical
Using Autodesk.Revit.DB.Plumbing
Using Autodesk.Revit.DB.Electrical
Using Autodesk.Revit.ApplicationServices
Using System.Data.SqlClient
Using Autodesk.Revit.Creation
Using Autodesk.Revit.DB.Structure
Using Autodesk.Revit.Attributes
Namespace zpx123
{
[Autodesk.Revit.Attributes.Transaction (Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration (Autodesk.Revit.Attributes.RegenerationOption.Manual)]
[Autodesk.Revit.Attributes.Journaling (Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]
Class ribbon: IExternalApplication
{
Static string AddInPath = typeof (ribbon). Assembly.Location;// automatically looks for dll files
Public Result OnShutdown (UIControlledApplication application) / / close Revit
{
Return Result.Succeeded
}
Public Result OnStartup (UIControlledApplication application) / / start Revit
{
Application.CreateRibbonTab ("Shuai Debu Yaobu Yao Dexiang tool")
RibbonPanel panel = application.CreateRibbonPanel ("Shuai Debu Yaobu Yao Dexiang tool", "search tool"); / / add a new panel
/ / add a button to the panel (the button executes the content in the zpx123.Classzpx class)
PushButtonData Recher = new PushButtonData ("looking for devices", "looking for electrical devices", AddInPath, "zpx123.Classzpx")
/ / Button prompt
Recher.ToolTip = "enter name and height automatically select the same type of component"
/ / load pictures
Recher.LargeImage = new BitmapImage (new Uri (AddInPath.Replace ("zpx123.dll", "shiyan.png")
Panel.AddItem (Recher)
Return Result.Succeeded
}
}
}
Please use the yellow part as a template!
So how to debug our code? the answer is no. We need to make an addin file here. Let me tell you a quick way to make addin.
1. Or choose an external tool
two。 Click to switch to Applications
3. Find dll file to load
4. Click save
5. Select the second .addin file (if you can't get a picture here, you won't)
6. There will be addin files in the save directory
7. Use notepad to delete everything related to command and keep only the contents in the picture.
8. Save the addin file and place it in the folder in the path shown below
Open revit to try the effect!
There will be a panel name on the menu bar
two。 There will be the following buttons and pictures
3. Mouse over button prompt
This is the end of "how to create a plug-in panel for Revit". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.