-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend STLLoaderPlugin to handle data directly, not only loaded from file #572
Comments
SolutionIf we already have our STL file in memory (perhaps pre-loaded, or even generated in-client), then we can just pass that loadSTL("./models/stl/binary/spurGear.stl", (stlData) =>{
const model = stlLoader.load({
id: "myModel",
stl: stlData,
smoothNormals: true
});
})
function loadSTL(src, ok, error) {
const request = new XMLHttpRequest();
request.overrideMimeType("application/json");
request.open('GET', src, true);
request.responseType = 'arraybuffer';
request.onreadystatechange = function () {
if (request.readyState === 4) {
if (request.status === 200) {
ok(request.response);
} else if (error) {
error(request.statusText);
}
}
};
request.send(null);
} |
/ping @MaxGeldner - I just released this fix in 1.7.0-alpha.4 See all changes in that pre-release here: https://github.com/xeokit/xeokit-sdk/blob/master/CHANGE_LOG.md Everything under the "1.7.0" heading in that change log is pre-released in 1.7.0-alpha.4. The other issue that (if I understand correctly) is important for our project is #579, which allows us to load STL models with double-precision global coordinates, so they properly render align with double-precision map coordinates without rounding errors. |
@xeolabs Thank you very much :) I hope to integrate the new version before our meeting next monday and get back to you with questions on that appointment, if I have any. Until then have a nice weekend! |
Is this feature critical for your commercial enterprise?
Yes, it is critical for the DBI project (we are in talks over a license agreement atm I think).
Is your feature request related to a problem? Please describe.
I'd like to plug data directly into the STL loader and not go the extra way of having to write my data into a file, to use the STL loaders load() function.
Assuming a part of my code generates a STL string, it would be better to have a method in the STL loader that can handle this STL string directly.
Describe the solution you'd like
At the moment the STL loader uses the parse() function to actually load the STL string, taken from a file via the load() function, into Xeokit.
Solutions would be:
At the moment a call would look something like this:
For example (a call could look like this):
The text was updated successfully, but these errors were encountered: