Script XMLHttpRequest

Script XMLHttpRequest

hhd
Explorer Explorer
1,108 Views
5 Replies
Message 1 of 6

Script XMLHttpRequest

hhd
Explorer
Explorer

I am studying a script that utilizes information using openapi. In the InfraWorks Scripts window

 

var xh = new XMLHttpRequest();

 

When I run, an error appears.

 

Error: ReferenceError: Can`t find variable: XMLHttpRequest

 

Is there any way to use XMLHttpRequest in InfraWorks?

0 Likes
1,109 Views
5 Replies
Replies (5)
Message 2 of 6

Karsten.Saenger
Autodesk Support
Autodesk Support

Hi @hhd ,

 

to my knowledge InfraWorks only supports JavaScript, see https://knowledge.autodesk.com/article/Autodesk-InfraWorks-JavaScript-API-Documentation.

Regards,

Karsten.

 

 



Karsten Saenger
0 Likes
Message 3 of 6

roskirko
Collaborator
Collaborator

The only way I know of bringing up a web browser page is through a tooltip.

This script will bring up Google Maps at a particular latitude and longitude (embedded in the source data) for bus stop locations.

The key line to bring up Google Maps is in the one for str1. The tooltip is embedded into the City Furniture model used to represent the bus stop. 

 

Process(SOURCE, CITY_FURNITURE) {
CITY_FURNITURE.EXTERNAL_ID = SOURCE["FeatId"];
CITY_FURNITURE.MODEL_SCALE_X = 25;
CITY_FURNITURE.MODEL_SCALE_Y = 25;
CITY_FURNITURE.MODEL_SCALE_Z = 25;
CITY_FURNITURE.NAME = SOURCE["Bus_Route"];
CITY_FURNITURE.RULE_STYLE = "3D Model/City Furniture/Bus Stop";
var str1 = "<a href='https://www.google.ca/maps/@"
var str2 = SOURCE["Latitude"] var str3 = ","
var str4 = SOURCE["Longitude"]
var str5 = ",50m/data=!3m1!1e3'>Bus Stop in Google Map</a>" var
res = str1.concat(str2, str3, str4, str5);
CITY_FURNITURE.TOOLTIP = res
return true;
}

Geographic Information Systems
Fanshawe College
0 Likes
Message 4 of 6

hhd
Explorer
Explorer

The script you informed seems to be a script related to Data Source.

 

I try to run it in the Script window that comes out by pressing Ctrl + 2.

 

Thanks for any help though.

0 Likes
Message 5 of 6

ramesh_sridharan
Autodesk
Autodesk

@hhd Here is a quick video to show how to use scripts for tooltips

Regards,

Ramesh S
Product Manager - Infrastructure Solutions

[email protected]



Ramesh Sridharan
Product Manager
0 Likes
Message 6 of 6

roskirko
Collaborator
Collaborator

Put the following into the Tooltip property HTML section for any object (right click on the object and select Properties) in your model to show how to call up Google Maps, for instance, from the tooltip:

 

<a href='https://www.google.ca/maps/' >Google Maps</a>

 

Make sure to click the Update button to update the properties. Once the property is updated, hover over the object, wait for the tooltip to show and select the link. Google Maps will appear in your default browser.

 

Programmatically, XMLHttpRequest is not supported (yet) in Infraworks).

Geographic Information Systems
Fanshawe College
0 Likes