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