To access/modify properties of a TextField (or TextArea) whose instance name is mytext:
Property (Type) |
Getter/Setter |
Example |
value (String) |
Getter |
var strValue = DataModel.GetValue("mytext"); |
Setter |
DataModel.SetValue("mytext", "ABC"); |
|
|
||
enable (boolean) |
Getter |
var bEnabled = DataModel.GetEnable("mytext"); |
Setter |
DataModel.SetEnable("mytext", true); |
|
|
||
visible (boolean) |
Getter |
var bVisible = DataModel.GetVisible("mytext"); |
Setter |
DataModel.SetVisible("mytext", true); |
To access/modify properties of a Button whose instance name is mybutton:
Property (Type) |
Getter/Setter |
Example |
text (String) |
Getter |
var strText = DataModel.GetProperty("mybutton", "text"); |
Setter |
var strText = "Import Model"; DataModel.SetProperty("mybutton", "text", strText); |
|
|
||
enable (boolean) |
Getter |
var bEnabled = DataModel.GetEnable("mybutton"); |
Setter |
DataModel.SetEnable("mybutton", true); |
|
|
||
visible (boolean) |
Getter |
var bVisible = DataModel.GetVisible("mybutton"); |
Setter |
DataModel.SetVisible("mybutton", true); |
To access/modify properties of a FileBrowser whose instance name is myfb:
Property (Type) |
Getter/Setter |
Example |
value (String) |
Getter |
var strValue = DataModel.GetValue("myfb"); |
Setter |
var strFIlename = "C:/altair/hw8.0/demos/hm/bumper.hm"; DataModel.SetValue("myfb", strFIlename); |
|
|
||
enable (boolean) |
Getter |
var bEnabled = DataModel.GetEnable("myfb"); |
Setter |
DataModel.SetEnable("myfb", true); |
|
|
||
visible (boolean) |
Getter |
var bVisible = DataModel.GetVisible("myfb"); |
Setter |
DataModel.SetVisible("myfb", true); |
To access/modify properties of a ComboBox whose instance name is mycombo:
Property (Type) |
Getter/Setter |
Example |
value (String) |
Getter |
var strValue = DataModel.GetValue("mycombo"); |
Setter |
DataModel.SetValue("mycombo", strValue); |
|
|
||
entries (Vector) |
Getter |
var vectEntries = DataModel.GetProperty("mycombo", "entries"); for(i=0; i<vectEntries.size(); i++) strEntry = vectEntries.get(i); |
Setter |
var vectEntries = new java.util.Vector(); vectEntries.add("A"); vectEntries.add("B"); vectEntries.add("C"); DataModel.SetProperty("mycombo", "entries", vectEntries); |
|
|
||
enable (boolean) |
Getter |
var bEnabled = DataModel.GetEnable("mycombo"); |
Setter |
DataModel.SetEnable("mycombo", true); |
|
|
|
|
visible (boolean) |
Getter |
var bVisible = DataModel.GetVisible("mycombo"); |
Setter |
DataModel.SetVisible("mycombo", true); |
To access/modify properties of a ListBox whose instance name is mylist:
Property (Type) |
Getter/Setter |
Example |
value (Vector) |
Getter |
var vectSelEntries = DataModel.GetValue("mylist"); var strFirstSelected = vectSelEntries.get(0); |
Setter |
var vectSelections = new java.util.Vector(); vectSelections.add("A"); DataModel.SetValue("mycombo", vectSelections); |
|
|
||
entries (Vector) |
Getter |
var vectEntries = DataModel.GetProperty("mylist", "entries"); for(i=0; i<vectEntries.size(); i++) strEntry = vectEntries.get(i); |
Setter |
var vectEntries = new java.util.Vector(); vectEntries.add("A"); vectEntries.add("B"); vectEntries.add("C"); DataModel.SetProperty("mylist", "entries", vectEntries); |
|
|
||
enable (boolean) |
Getter |
var bEnabled = DataModel.GetEnable("mylist"); |
Setter |
DataModel.SetEnable("mylist", true); |
|
|
||
visible (boolean) |
Getter |
var bVisible = DataModel.GetVisible("mylist"); |
Setter |
DataModel.SetVisible("mylist", true); |
To access/modify properties of a RadioButton whose instance name is myradio:
Property (Type) |
Getter/Setter |
Example |
value (String) |
Getter |
var strSelected = DataModel.GetValue("myradio"); |
Setter |
var strSelected = "Nastran" DataModel.SetValue("mytext", strSelected); |
|
|
||
enable (boolean) |
Getter |
var bEnabled = DataModel.GetEnable("myradio"); |
Setter |
DataModel.SetEnable("myradio", true); |
|
|
||
visible (boolean) |
Getter |
var bVisible = DataModel.GetVisible("myradio"); |
Setter |
DataModel.SetVisible("myradio", true); |
To access/modify properties of a CheckBox whose instance name is mycheckbox:
Property (Type) |
Getter/Setter |
Example |
value (boolean) |
Getter |
var bSelected = DataModel.GetValue("mycheckbox"); |
Setter |
DataModel.SetValue("mycheckbox", true); |
|
|
||
enable (boolean) |
Getter |
var bEnabled = DataModel.GetEnable("mycheckbox"); |
Setter |
DataModel.SetEnable("mycheckbox", true); |
|
|
||
visible (boolean) |
Getter |
var bVisible = DataModel.GetVisible("mycheckbox"); |
Setter |
DataModel.SetVisible("mycheckbox", true); |
To access/modify properties of a Label whose instance name is mylabel:
Property (Type) |
Getter/Setter |
Example |
value (String) |
Getter |
var strText = DataModel.GetValue("mylabel"); |
Setter |
var strText = "Import HM File: "; DataModel.SetValue("mylabel", strText); |
|
|
||
visible (boolean) |
Getter |
var bVisible = DataModel.GetVisible("mylabel"); |
Setter |
DataModel.SetVisible("mylabel", true); |
To send any message (command/query) to HyperWorks:
|
Example |
Prepare Message |
var command = "*readfile " + filename; |
Send Message |
var retVal = HypeWorks.SendMessage(command); |
Example 1: To get the selected file from the file browser (myfb) and set it on the text field (mytext), the following callback script will be written on the myfb’s OnClicked:
var filename = DataModel.GetValue("myfb");
DataModel.SetValue("mytext", filename);
Example 2: To get the HyperMesh filename from the text field (mytext) and send the command to HyperMesh to read the HyperMesh file, the following callback script will be written on the Apply button’s OnClicked:
var filename = DataModel.GetValue("mytext");
var command = "*readfile " + filename;
HyperWorks.SendMessage(command);