[英]Solidworks API AddMenuItem
我正在嘗試為 SOLIDWORKS 編寫插件並熟悉 API。 我首先添加了一個菜單項
public bool ConnectToSW(object ThisSW, int Cookie)
{
this.ThisSW = ThisSW as ISldWorks;
this.Cookie = Cookie;
this.ThisSW.SetAddinCallbackInfo2(0, this, this.Cookie);
SwEventPtr = (SldWorks)this.ThisSW;
this.ThisSW.AddMenuItem5((int)swDocumentTypes_e.swDocPART, this.Cookie, "Item@&File", 0, null, null, "My Menu Item", null);
return true;
}
AddMenuItem5() function 對我也不起作用(可能是一個錯誤)。 您可以使用舊版本,例如 AddMenuItem3()
請注意,菜單項僅在打開零件文檔時可見。 要使其在其他文檔類型中可見,請相應地更改第一個參數。 使用 swDocNone 始終顯示菜單項。
this.ThisSW.AddMenuItem3((int)swDocumentTypes_e.swDocPART, this.Cookie, "Item@&File", -1, "MyMenuCallback", "MyMenuEnableMethod", "My menu item", "");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.