自訂指令定義範例
範例:使用屬性替代項目取代一部份 URL
此自訂指令標記為 Button Label,有工具提示等。此外,當啟動此指令時,它會檢查目前選取的部份是否有指定的屬性 (Source_file_name)。如果找不到,則不會啟用按紐。如果找到了,則會取代 URL 中的子字串。
<menu
ui="rmb"
view="all"
pane="all"
select="any"
visible="getSelectedCount()==1 && getPropertyExists('Source_file_name')">
<command_name >MyCommand 1</command_name>
<label >Button Label</label>
<tooltip>This is a new command.</tooltip>
<icon>\my\icons\location\icon16x16.png</icon>
<action
target="browser">
http://somewhere.com/content.jsp?partName=<!Source_file_name!>
</action>
</menu>
範例:選取多個部份時取代一部份 URL
在此範例中,當使用者選取兩個部份時,Creo View 會擷取從 Featrue_Id 傳回之兩部份 getSelectedPartProperty 屬性的值。然後會用這些值取代 URL 的兩個子字串。
<menu
ui="rmb"
view="all"
pane="all"
select="any"
visible="getSelectedCount()==2 && getSelectedPartProperty(1,'Feature_Id','featureId1') &&
getSelectedPartProperty(2,'Feature_Id','featureId2')">
<command_name >MyCommand 2</command_name>
<label >Button Label</label>
<action
target="browser">
http://www.somewhere.com/index.jsp?Id1=<!featureId1!>&Id2=<!featureId2!>
</action>
</menu>