Programming
This section describes properties and methods that are available for the eBrowser ActiveX component.
Properties
ptyModelFileName (string)
Name (URL) of EBM file. Can be http: or file: URL or a relative name.
ptyStyleSheet (string)
Style sheet.
ptyAutoInit (bool)
Should the model be loaded when eBrowser starts. Default is true.
ptyStartupPosition (string)
The position id of the object that will be located automatically when eBrowser starts. If this property is not set, the model's initial camera position is used.
ptyMaterialCount (long)
Return the count of materials.
ptyModelCount (long)
Return the count of locally cached models.
ptyPipelineCount (long)
Return the count of pipelines.
ptyPositionCount (long)
Return the count of positions.
ptySetCount (long)
Return the count of custom sets of the model.
ptySelectionColor (long)
Return/set current selection material index.
ptyStepSize (long)
Set the moving speed.
ptySlopeSize (long)
Set the turning speed.
ptyViewObjectDetails (bool)
Enable/disable showing the object details window. Default is true.
ptySingleStep (bool)
If enabled, moving is not continuous and the actual movement happens while releasing the left mouse button. Default is false.
ptyFixedStep (bool)
If enabled, moving in/out is prohibited. This has no effect if 'ptySingleStep' is enabled. Default is false.
ptyRotateCamera (bool) – DEPRECATED
This property is no longer supported.
ptyCheckForModelUpdate (bool)
Enable/disable the check for model updates. Default is false.
ptyAutoRefresh (bool)
If enabled, eBrowser will redraw the canvas if another window overlaps the drawing area. Default is true.
ptyKeyboardEvents (bool) – DEPRECATED
This property is no longer supported.
ptyTransparencyDepth (long)
Controls the transparency percentage of objects. The value must be between 0 (=totally opaque) and 100 (=most transparent). Default is 50.
ptyIncludeMarkupsInImages (bool)
Enable/disable inclusion of markup drawings into snapshot images. With this option you can prevent markup drawings from getting drawn on top of images that are saved. Option preserves its state even after closing eBrowser, so it must be explicitly set if you want to get similar results every time.
ptyIsModelDataLoaded ()
Contains information about whether the model tree has already been loaded. Use this property to check whether subsequent calls through the eBrowser ActiveX interface would be blocked.
ptyStartupPositionType (long)
The two lowest bits of this property are interpreted as follows:
Set the bits to 0, if you want to look for an object with a position id that matches ptyStartupPosition exactly (default).
Set the bits to 1, if you want to look for an object group (system, pipeline, etc.) that matches ptyStartupPosition exactly.
Set the bits to 2, if you want to first search for an object and then if no object was found to look for an object group.
If the 3rd bit of this property is true, the sidebar is hidden on startup.
ptyLicenseServer (string)
Set the license server that you want to use when opening this model. Useful for avoiding the need to manually set the server for every user in a big organization.
ptyCurrentHierarchy
This property can be both read and written, and it is of type BSTR. If the variable is read, it returns the name of the currently active hierarchy; if it is set, eBrowser tries to activate the hierarchy that has the given name. If the name is not found, an error is reported. The given name must match the hierarchy name exactly.
ptyVersionString
Looks up eBrowser version information. The property is read-only, and it returns product version in the form major.minor.maintenance.build.

<HTML>
<HEAD>
<TITLE>Show eBrowser version at start-up</TITLE>
<SCRIPT LANGUAGE="VBScript">
' This is the important part; here we check and print the version:
sub showVersion()
dim vers
vers = eBrowser.ptyVersionString
MsgBox """" & vers & """"
end sub
</SCRIPT>
</HEAD>
<BODY onload="showVersion()">
<OBJECT ID="eBrowser"
CLASSID="CLSID:6D4CB502-3310-11D5-944D-0050DA35F517">
<PARAM NAME="ptyModelFileName" VALUE="The plant.ebm">
</OBJECT>
</BODY>
</HTML>
Methods
mthInitializeAndDraw
Loads the model specified in the ptyModelFileName property. This method is needed only if ptyAutoInit is set to false or a new model is to be loaded.
mthLocateByPosition(string position, long locate_type)
Locates the object that has the specified position id. The lowest bit of the locate_type parameter has been disabled and all searching is now done case insensitively. Set the 3rd bit of locate_type to prevent sidebar from becoming visible.
mthLocateById (string object_id, int reservedforfutureuse)
Deprecated.
mthSetObjectVisibility(string tag, int visibility, int)
Sets object's visibility. 'visibility' 0 means hide, and 1 means show. The 'tag' string will be used to find the object.
mthSetSetColor(string file_name_of_the_set, int color_id)
Applies new material for a set of objects. 'color_id is the index of material in list.
Not supported if more than one model has been loaded to eBrowser.
mthSetSetVisibility(string file_name_of_the_set, int visibility)
Sets visibility for objects in a set.
Not supported if more than one model has been loaded to eBrowser.
mthEnumSets(VARIANT *array_of_sets, long count_of_sets)
Returns an array of strings containing the names of sets. The 'array_of_sets' must have room equal to property 'ptySetCount' to receive the list.
mthEnumPositions(VARIANT *array_of_positions, long count_of_positions)
Returns an array of strings containing the names of positions. The 'array_of_positions' must have room equal to property 'ptyPositionCount' to receive the list.
mthEnumMaterials(VARIANT *array_of_materials, long count_of_materials)
Returns a array of strings containing the names of the materials. The 'array_of_materials' must have room equal to property 'ptyMaterialCount' to receive the list.
mthEnumPipelines(VARIANT *array_of_pipelines, long count_of_pipelines)
Returns an array of strings containing the names of pipelines. The 'array_of_pipelines' must have room equal to property 'ptyPipelineCount' to receive the list.
mthEnumModelCache(VARIANT *array_of_model_names, long count_of_model_names)
Deprecated.
mthSetBackColor(long red, long green, long blue)
Set background color (RGB).
mthEnableModel(VARIANT_BOOL enable_disable)
Show or hide current model.
mthSetScene(VARIANT scene)
Sets the scene location. Scene can either be the index of scenes in the drop-down menu or the name of the scene.
mthSaveToBmp(string file_name, long width, long height)
Save snapshot image into bitmap file.
mthSaveImage(string file_name, string output_file_type, long width, long height, long quality)
Save snapshot image to file. Output file type can be 'bmp', 'jpeg', 'gif', 'png' or 'tiff'. If width, height or both are -1, then use original values for these. Default value for quality percent is 100. Smaller quality means smaller and rougher output file especially with JPEG files.
mthSaveToClpb(long width, long height)
Save snapshot image into clipboard.
mthVievObjectData(string object_id)
Deprecated.
mthSetCameraLocation(long x, long y, long z, long rotation, long slope_angle, long refresh_screen)
Sets the absolute coordinate values for the camera's location.
mthGetCameraLocation(VARIANT *x, VARIANT *y, VARIANT *z, VARIANT *rotation, VARIANT *slope_angle)
Returns absolute coordinates of the camera's location.
mthSetBackGradientColor(int *color1, int *color2)
Set RGB colors to mix the background gradient color. The color arrays consists of three members representing the values of red, green, and blue.
mthAddScene(string scene)
Adds a new scene at current location.
mthDeleteScene(string scene)
Deletes a given scene name.
mthSetObjectColor(string tag, int color, int)
Set object's material. 'color' is the index from the material table for colors. If -1 is passed as the color, the object's original color is used. The 'tag' string will be used to find the value for the object.
mthEnableObjectEvents(string menu_items, string requested_data_format)
Add commands to the context menu that pops up when an object is right-clicked. When such a command is selected, eBrowser triggers an event. The menu items are separated with a semicolon ';' the list must also end with ';'. The 'requested_data_format' can be 'xml', 'pos' or 'tag:?— '. If the 'requested_data_format' is 'tag:?' the wild chars '???' can be used to define what the 'tag' name that is used to retrieve data would be.
In Visual Basic, the event procedure is:
Private Sub eBrowser1_evtRequestObject(ByVal MenuNr As Long, ByVal RequestData As String) End Sub
MenuNr is the index of the command (in MenuItems) and RequestData is the value of the specified tag. Note that on HTML pages you can use the event in script code that is run by the web browser.
evtObjectSelected
This event is fired when a user selects an object by right-clicking it in eBrowser. Returns always objectId-1 and the object tag. If the object tag is not found, the event returns an empty string.
Note: On HTML pages you can use the event in script code that is run by the web browser.
Private Sub eBrowser1_evtObjectSelected(ByVal objectId As Long , ByVal positionId As String) End Sub
mthSetObjectTransparency(string tag, VARIANT_BOOL on_off, int)
Set object as transparent/opaque. The 'tag' string will be used to find the object.
mthCreateAnimationSetByPositionIds(int scene_id, VARIANT *set_id, VARIANT positions)
Deprecated.
mthRemoveAnimationSet(int scene_id, int set)
Deprecated.
mthRotateAnimationSet(int scene_id, int set_id, float angle, float xa, float ya, float za, BOOL redraw)
Deprecated.
mthTranslateAnimationSet(int scene_id, int set_id, float tx, float ty, float tz, BOOL redraw)
Deprecated.
mthSetSetTransparency(string setfile, VARIANT_BOOL on_off (default: 1))
Turns given set of objects into transparent or restores them to opaque. Set file should contain object ids as decimal number, one per row. Not supported if more than one model has been loaded to eBrowser.
mthShowSidebar(bool show)
Show or hide the sidebar.
mthIsModelDataLoaded(VARIANT *isLoaded)
Deprecated, use property ptyIsModelDataLoaded instead.
mthExitExamineMode()
Exits examine mode programmatically. The method mthLocateByPositionId nowadays uses examine mode to locate objects. In order to exit examine mode after the locating, call this method.
mthGetObjectsData(string positionId)
Returns all XML data related to a given object in object’s Data string.
mthLoadModel(BSTR filename)
Loads another model to eBrowser. Filename is full path to the file.
To load two or more models, load the first one with ptyModelFileName
and mthInitializeAndDraw
, and load subsequent models with mthLoadModel
.
Note: The model file given to mthLoadModel must exist and be a valid eBrowser model before the interface is called.
mthSaveModel(BSTR filename)
Saves currently loaded models into a new EBM file. Filename is full path to the file.
Note: The model file passed to mthSaveModel must not exist before calling the interface.
mthGetHierarchies()
This returns the hierarchies in use as a reference to a variant array of BSTRs describing the hierarchies.
mthSetExamineOption(BSTR option, BSTR value)
This method sets one of the options in examine mode to desired state. Currently supported options are:
- "dim" - controls dimming all other objects (case insensitive)
- "highlight" - controls highlighting the examined object (case insensitive)
If the (case insensitive) value is "on", the selected option is set, and if it is "off", the option is unset. The method can be called before going to examine (in which case the option is in the selected state the next time the user goes to examine mode) or while user is in examine mode.

<HTML>
<HEAD>
<TITLE>S&O interfaces example</TITLE>
<SCRIPT LANGUAGE="VBScript">
sub checkModelLoaded()
if eBrowser.ptyIsModelDataLoaded=FALSE then
SetTimeOut "checkModelLoaded()", 100
else
' dim hierarchies
hierarchies = eBrowser.mthGetHierarchies
for i=LBound(hierarchies) to UBound(hierarchies)
MsgBox "Hierarchy number " & i & " is " & hierarchies(i)
Next
eBrowser.ptyCurrentHierarchy = hierarchies(1)
MsgBox "Currently selected hierarchy is " & eBrowser.ptyCurrentHierarchy
end if
end sub
sub setExamineOption(examineOption, optionState)
eBrowser.mthSetExamineOption examineOption, optionState
end sub
</SCRIPT>
</HEAD>
<BODY onload="checkModelLoaded">
<OBJECT ID="eBrowser"
CLASSID="CLSID:6D4CB502-3310-11D5-944D-0050DA35F517" HEIGHT=90% WIDTH=100% >
<PARAM NAME="ptyModelFileName" VALUE="The plant.ebm">
</OBJECT>
<FORM name="myform">
<INPUT type="button" value="Dim" onclick='setExamineOption "dim", "on"'>
<INPUT type="button" value="Undim" onclick='setExamineOption "dim", "off"'>
<INPUT type="button" value="Highlight" onclick='setExamineOption "highlight", "on"'>
<INPUT type="button" value="Unhighlight" onclick='setExamineOption "highlight", "off"'>
</FORM>
</BODY>
</HTML>
A HTML+JavaScript/JScript usage example:
<HTML>
<HEAD>
<TITLE>S&O interfaces example (javascript)</TITLE>
<SCRIPT LANGUAGE="Javascript">
function checkModelLoaded(){
if(eBrowser.ptyIsModelDataLoaded != true){ // can be undefined, false or true, so we test for true
setTimeout("checkModelLoaded()", 100);
} else {
var VBHierarchies = new VBArray(eBrowser.mthGetHierarchies());
var hierarchies = VBHierarchies.toArray();
for(i=0; i < hierarchies.length; i++)
alert("Hierarchy number " + i + " is " + hierarchies[i]);
eBrowser.ptyCurrentHierarchy = hierarchies[1];
alert("Currently selected hierarchy is " + document.eBrowser.ptyCurrentHierarchy);
}
}
function setExamineOption(examineOption, optionState){
eBrowser.mthSetExamineOption(examineOption, optionState);
}
</SCRIPT>
</HEAD>
<BODY onload="checkModelLoaded()">
<OBJECT ID="eBrowser"
CLASSID="CLSID:6D4CB502-3310-11D5-944D-0050DA35F517" HEIGHT=90% WIDTH=100% >
<PARAM NAME="ptyModelFileName" VALUE="The plant.ebm">
</OBJECT>
<FORM name="myform">
<INPUT type="button" value="Dim" onclick='setExamineOption("dim", "on");'>
<INPUT type="button" value="Undim" onclick='setExamineOption("dim", "off");'>
<INPUT type="button" value="Highlight" onclick='setExamineOption("highlight", "on");'>
<INPUT type="button" value="Unhighlight" onclick='setExamineOption("highlight", "off");'>
</FORM>
</BODY>
</HTML>