簡體   English   中英

Solidworks API AddMenuItem

[英]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;
}

我已經成功注冊了包含上述代碼段的程序。 已注冊的加載項列表

但是,當我打開File菜單時,沒有Item項。 我究竟做錯了什么? 文件中沒有項目

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM