opensourcebim / bimserver-javascript-api Goto Github PK
View Code? Open in Web Editor NEWBIMserver JavaScript API
License: GNU Lesser General Public License v3.0
BIMserver JavaScript API
License: GNU Lesser General Public License v3.0
Hi,
Is there equivalent for downloadViaWebsocket ?
Our server forbidden web sockets and I'm trying to bypass it by regular ajax call
Thanks
Dror
i can't download "bimserverclient.js" (404 not Found). "bimserverclient.js" is lost. Can you re-upload it?
I have forked the code and converted it to and ES2015 module. In addition to modernising the code, it should help with compatibility with NodeJS (see #7)
https://github.com/bastienmenis/BIMserver-JavaScript-API
@rubendel I am happy to create a pull request but can you review this first? I did not understand how you manage the version numbers, I had to replace '%VERSION%' with a number so that the package.json could be parsed.
I used rollup/babel for bundling as an UMD module. The UMD module has been tested with bimSurfer. The ES2015 module has been tested in an Angular app with Rollup as bundler (it should also work with Webpack)
I've tried to use the Model
but i've notice that if i call the load
method:
const poid = project.oid;
const roid = project.lastRevisionId;
const schema = project.schema;
return new Promise((resolve, reject) => {
client.getModel(poid, roid, schema, true, (loadedModel) => {
console.log("Model loaded!");
resolve(loadedModel)
},'Test');
});
my callback functions doesn't get called and the BIMServer (v1.5.124) logs this error
18:27:19 ERROR [qtp1492822331-42]: Missing parameter: download -> query
and looking at the source the param is missing. What should be the effect of the load
method? To execute a standard pre-load query or it should take the query as a parameter?
BIMserver-JavaScript-API/model.js
Lines 40 to 44 in 584ba60
The use of the window variable is not compatible with use in Node.js, e.g. complains
`/Users/marcgille/git/BIMsurfer/node_modules/bimserverapi/js/bimserverclient.js:20
if (typeof window.BimServerApiWebSocket == "undefined") {
^
ReferenceError: window is not defined
`
I would happy to help tweak the code towards state where it can be loaded into Node.js and also as a (browserified) browser version.
Let me know whether you are interested.
The bimserverclient.js has a bug at line 849,
file.type = schema.contentType;
There is no file variable defined in the scope.
After trying to build the javascript, i only got two files in build:
build/bimserverapi.umd.js
build/bimserverapi.umd.js.map
How do i get the needed build/bimserverapi.js to use for static import?
The combined minified library link on README is also broken.
Hi,
not really an issue here, but I can't get this piece of code returning correctly the toReturn
array, so I'm here to ask for help.
Let's say I want to get all the ifcwalls in a project with a particular ifcwalltype via javascript api.
I would like to know if there is a better way than my solution to archieve this and how can I get the
toReturn array back to the calling method, because now, probably due to timing issues, sometimes is empty, no matter how I return back the data.
var BimServerGetElementsWithType = function(projectid,typeoid) { //project oid, ifcwalltype oid
var toReturn = new Array();
Global.bimServerApi.call("Bimsie1ServiceInterface", "getProjectByPoid", {poid: projectid}, function(project) {
Global.bimServerApi.call("Bimsie1LowLevelInterface", "getDataObjectByOid", {roid: project.lastRevisionId, oid: typeoid},
function(data) {
data.values.forEach(function(value){
if (value.__type == "SListDataValue" && value.fieldName =="ObjectTypeOf") {
value.values.forEach(function(listItem, index) {
if (listItem.__type == "SReferenceDataValue" && listItem.typeName == "IfcRelDefinesByType") {
Global.bimServerApi.call("Bimsie1LowLevelInterface", "getDataObjectByOid", {roid: project.lastRevisionId, oid: listItem.oid},
function(data) {
data.values.forEach(function(value){
if (value.__type == "SListDataValue") {
value.values.forEach(function(listItem, index){
if (listItem.__type == "SReferenceDataValue") {
Global.bimServerApi.call("Bimsie1LowLevelInterface", "getDataObjectByOid", {roid: project.lastRevisionId, oid: listItem.oid},
function(data){
toReturn.push(data); // push all the walls with type "typeoid" into the array.
});
};
});
};
});
});
}
});
}
});
});
});
};
TIA for your time.
I would really like to test the typescript branch with different JS sources.
How to build a bimserver jar plugin out of this API?
Is there a short documentation or wiki pages available?
App is working perfectly fine on desktop, login OK, displaying projects Ok etc...
when I switch to an android device (not tested on IPhone), as soon as i click login button, login successful then websocket disconnects.
The interesting thing is that when i use wifi, everything works correctly on android, EVEN IF the wifi is provided by another mobile phone (portable hotspot).
Any idea on why this is happening and how to debug ?
Thanks !
Hello,
I am having an issue with my installation of the BIMserver. it load ups just fine and allows me to check-in and ifc file. however when i go to view the model nothing appears. and when clicking on the head[1] of the tree i get the following error[2].
[1]
I have the following run configuration with all plugins installed and being loaded successfully.
Hello
I was checking an object on BimView and I saw on my object a fields is set as an inverse but it isn't on buildingsmart-tech.org (cf screenshot)
Maybe it's a mistake ?
This file seems to have some other inconsistencies with the documentation provided by BuildingSmart I can point them out if you wish
best regards
Im trying to connect with my bimserver on my local computer. But is is not working. it says:
scenejs.js:42 GET http://localhost:8082/js/bimserverapi_BimServerApi.js?bust=0.0.23 404 (Not Found)
function connect(server, email, password) {
var serveraddres = "http://localhost:8082";
requirejs.config({
baseUrl: serveraddres + "/js", // address should be the address of your bimserver, including optional port
urlArgs: "bust=" + "0.0.23" // the version you use here will be used for caching
});
requirejs(["bimserverapi_BimServerApi", "bimserverapi_BimServerApiPromise"], function(BimServerApi, BimServerApiPromise) {
if (address.endsWith("/")) {
address = address.substring(0, address.length - 1);
}
if (BimServerApi != null) {
var bimServerApi = new BimServerApi(address, notifier);
bimServerApi.init(function(){// This function gets called on success, you can use bimServerApi now
o.bimServerApi = bimServerApi;
o.bimServerApi.login("email", "password", false, function(){
$(dialog).dialog('close');
o.viewer = new BIMSURFER.Viewer(o.bimServerApi, 'viewport');
resize();
o.viewer.loadScene(function(){
var clickSelect = o.viewer.getControl("BIMSURFER.Control.ClickSelect");
clickSelect.activate();
clickSelect.events.register('select', o.nodeSelected);
clickSelect.events.register('unselect', o.nodeUnselected);
});
showSelectProject();
});
});
} else {
console.log("something went wrong with bimserverapi");
}
}, function (err) {
console.log("can not connect ",err);
});
}
When I install the project by npm install
, I have this error:
npm WARN Invalid version: "%VERSION%"
And I check the package.json, the vesion key has value "%Version%". I don't know which version it should be, so I didn't give a pull request.
Put a limit on the amount of retries and a timeout to prevent the client from retrying forever on a server that's simply switched-off or unreachable
I had several problems with the command "npm run build", to solve them, I had:
Hello,
we have error while loading projects into browser using javascript API.
We have an "Unimplemented version" error.
Looking at the BimServerGeometryLoader.js code looks like :
(line 205)
if (BIMSERVER_VERSION == "1.4") {
if (version != 4 && version != 5 && version != 6) {
console.error("Unimplemented version");
return false;
}
} else {
if (version != 10) {
console.error("Unimplemented version");
return false;
}
}
Unfortunately, I did not found what this "version" is about.
In our case, its value is 11 instead of 10.
We use apache-tomcat-8.5.16, jdk1.8.0_131, and bimserverwar-1.5.85.war.
It use to work fine on one Win2012 server, but on many other PCs (mostly Win7), we have this issue.
We could not figure out where does this come from. Would you please let us know what is it about ?
Regards,
Chris .
Hi,
The link to combined minified library doesn't work. Can you please fix that. Thanks
Hi,
i've noticed that Model.load
doesn't call the callback if called with deep=true
.
i.e.:
const client = new bimserverapi.BimServerClient(SERVER_ADDRESS);
// ...
client.getModel(
poid,
roid,
schema,
true, // deep
loadedModel => {
console.log("Model loaded!");
},
"TestModel"
);
this is due to the missing query
param in the download
call:
BIMserver-JavaScript-API/model.js
Lines 40 to 44 in fbe734c
This is also confirmed by the BIMServer, which logs
12:06:45 ERROR [qtp669700766-34]: Missing parameter: download -> query
when the above code is executed
There is a function called create
in the Model
class. It is not working at the moment because the generateGuid
parameter is missing. I fixed this but I fail to understand what the function is supposed to do.
After calling create()
followed by commit()
, it looks like it does create an object but not the properties. Is this on purpose, or was this functionality never fully implemented?
I had a look at the LowLevelInterface in BIMServer, are the following steps the correct process to create objects?
startTransaction
createObject
addStringAttribute
/ addIntegerAttribute
/ etc.commitTransaction
Hi, I am setting up a complete DEV environment for BIMserver+API+bimvie+BIMsurfer as explained in the great youtube video but on Mac OS.
BIMserver alone is working just fine in my DEV environment, but as soon as I try to add other projects to Eclipse, I am stuck with "Loading BIMviews..." on screen when trying to open bimvie using Safari.
I was stuck during a while before figuring out that this issue does not appear with Chrome on my Mac.
This must to be linked to Module resolution or loading.
Is there a way to fix this so that we can develop using Safari instead of Chrome on my Mac ?
Same issue also appear if I try to connect using Safari (iOS) or Chrome (Android).
Is there a way to fix this so that we can test the DEV environment directly from mobile devices (iOS/Android) ?
I am starting from GIT Labels:
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.