Workbench的歸屬問題及其它
問題來源:CATIA CAA 如何在CATIA開始菜單中創建新的模塊選項?
Encyclopedia里,進入User Interface,Technical Articles,Application Overview這一章。如圖,Start菜單里的這些都是屬於Workbench的。我們可以看到Workbench其實是Workshop的一部分,一個Workshop下可以集成多個Workbench。
再看一下In short部分Each document type is associated with a workshop which includes commands arranged in menus and toolbars which are added to the common menus and to the standard toolbar.
在我的理解上,這句話的意思是,一個文件類型對應一個workshop。
那對不對呢?下面還有一段What happens at run-time? The first time a document of the type you designed is created, opened or double-clicked, the application, by means of the CATApplicationFrame class instance, asks for the documents workshop using the GetWorkshop(Name) method of the CATIUIActivate interface implemented by the UI-activable object of your document. GetWorkshop returns the workshop name, here Tools. Then the application queries a pointer to the workshop factory interface, and requests this factory to create an instance of the workshop class. This class implements the CATIWorkshop interface which provides the methods GetWorkshop to create and return an instance of the workshop, GetCommands to instantiate the workshops command headers, and GetInterface to return the interface derived from CATIWorkshopConfiguration and exposed by the workshop to allow for workbenches. Once these methods have been called and the appropriate objects created and returned to the CATApplicationFrame class instance, your document is loaded and displayed in its window, and the workshop youve designed for it is available. Then, for any created, opened or double-clicked document of the same type, the same workshop object is used (GetWorkshop is not called again). Nevertheless, a new set of command headers is created and associated with the document to keep the workshops status for the document. The workshop status is the availability or unavailability of each command depending on the document contents.
打開文檔的時候,會通過GetWorkshop來獲得Workshop的名稱,然後通過Workshop的factory來創建Workshop。
那麼,我們能不能創建一個自己的workshop呢?我覺得應該是可以的。在CAADoc里有這兩個edu其中http://CAABskUserInterface.edu中有CAABskWorkshop相關文件
從文件來看應該是一個自定義Workshop的例子。可惜我電腦上V5的百科全書搜索功能有問題,無法在百科全書里搜到哪個章節有詳細的解釋,如果誰能搜到也請告訴一下如何在百科全書中打開相關文章,謝謝。總之,這個問題我覺得大概是這樣,通過模仿上述edu中的代碼來創建Workshopfactory之類的對象,實現一些類似Getworkshop的方法,這樣就有了完整的factory,通過Workshopfactory創建Workshop來集成Workbench。打開文件的時候,CATIA會根據對應的文件類型調用Workshop,而Workshop來調用其所允許使用的Workbench。
推薦閱讀: