Hi All,
I’m having some trouble loading in some objects with the new implementation. I’ve tried to implement the example usecase but I’m getting an error saying there’s no valid objects and that the request is forbidden:
However it’s a public URL from the example so I’m not sure what’s going on here
Code I’m using below:
import { Viewer, DefaultViewerParams, SpeckleLoader } from "@speckle/viewer";
import { CameraController, SelectionExtension } from "@speckle/viewer";
import React from "react";
class SpeckleReactViewer extends React.Component {
private rootRef = React.createRef<HTMLDivElement>();
componentDidMount() {
this.mainViewer(this.rootRef.current);
}
private async mainViewer(container: HTMLDivElement | null = null) {
/** Configure the viewer params */
const params = DefaultViewerParams;
params.showStats = true;
params.verbose = true;
if (container !== null) {
const viewer = new Viewer(container, DefaultViewerParams);
await viewer.init();
/** Add the stock camera controller extension */
viewer.createExtension(CameraController);
/** Add the selection extension for extra interactivity */
viewer.createExtension(SelectionExtension);
/** Create a loader for the speckle stream */
const loader = new SpeckleLoader(
viewer.getWorldTree(),
"https://latest.speckle.dev/streams/c43ac05d04/objects/d807f3888a400dbd814529fafd8ccac0",
""
);
/** Load the speckle data */
await viewer.loadObject(loader, true);
}
}
public render = (): React.ReactNode => {
return (
<div ref={this.rootRef} style={{ width: "100%", height: "50vh" }} />
);
}
}
export default function App() {
return (
<SpeckleReactViewer />
);
}