Customized Command Definition Examples
Example: Replacing a Part of the URL Using Property Substitutions
This customized command is labeled Button Label, has a tooltip, etc. In addition, when this command is activated, it checks the currently selected part for a specified property (Source_file_name). If it does not find it, the button is not enabled. If it finds it, it replaces the substring in the 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>
Example: Replacing a Part of the URL when Multiple Parts are Selected
In this example, when the user selects two parts, Creo View fetches the values of the Featrue_Id property of both parts, returned from getSelectedPartProperty. It then replaces two substrings of the URL with these values.
<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>