一、背景
小夥伴們在基於.net做CAD開發時,使用.bundle打包文件時,如果需要打開CAD時,插件的某個命令,比如下面的FirstDo在CAD啓動後,就能執行(例如初始化RibbonUI的顯示)。
[CommandMethod("FirstDo")]
public void FirstDoAdd()
{
//....
}
二、解決思路
對.bundle中的PackageContents.xml 文件進行配置即可
在裏面加入這行代碼:
<Command Local="FirstDo" Global="AddRibbon" StartupCommand="FirstDo"/>
<?xml version="1.0" encoding="utf-8" ?>
<ApplicationPackage SchemaVersion="1.0" AppVersion="1.0"
ProductCode="{02933C01-125D-48EF-B576-08C3AEF6A23K}"
Name="xxx插件"
>
<CompanyDetails
Name="xxx有限公司"
Email="[email protected]"
/>
<RuntimeRequirements OS="Win32|Win64" Platform="AutoCAD*"/>
<Components>
<ComponentEntry ModuleName="./Contents/xxx.dll" >
<Commands>
<Command Local="FirstDo" Global="AddRibbon" StartupCommand="FirstDo"/>
</Commands>
</ComponentEntry>
</Components>
</ApplicationPackage>
三、注意事項
1.我是黑夜の騎士,歡迎大家關注我的博客,筆者將持續輸出BIM相關軟件開發以及編程乾貨;
2.歡迎加入BIM行業開發交流1羣,獲取更多開發資料 羣號:711844216